- /* Send notify to the primary router */
- silc_server_send_notify_invite(
- server, SILC_PRIMARY_ROUTE(server),
- SILC_BROADCAST(server), channel, sender->id,
- silc_argument_get_arg_type(cmd->args, 3, NULL),
- list);
+ /* The notify is sent to local servers (not clients), and to network. */
+ if (atype && tmp && len2) {
+ silc_buffer_set(&alist, tmp, len2);
+
+ /* Send to local servers if we are router */
+ if (server->server_type == SILC_ROUTER) {
+ SilcBuffer idp, idp2;
+ idp = silc_id_payload_encode(channel_id, SILC_ID_CHANNEL);
+ idp2 = silc_id_payload_encode(sender->id, SILC_ID_CLIENT);
+ silc_server_send_notify_to_channel(server, NULL, channel, FALSE, FALSE,
+ SILC_NOTIFY_TYPE_INVITE, 5,
+ idp->data, idp->len,
+ channel->channel_name,
+ strlen(channel->channel_name),
+ idp2->data, idp2->len,
+ atype, 1,
+ tmp ? alist.data : NULL,
+ tmp ? alist.len : 0);
+ silc_buffer_free(idp);
+ silc_buffer_free(idp2);
+ }
+
+ /* Send to network */
+ silc_server_send_notify_invite(server, SILC_PRIMARY_ROUTE(server),
+ SILC_BROADCAST(server), channel,
+ sender->id, atype,
+ tmp ? &alist : NULL);
+ }
+
+ /* Send invite list back only if the list was modified, or no arguments
+ was given. */
+ type = 0;
+ argc = silc_argument_get_arg_num(cmd->args);
+ if (argc == 1)
+ type = 1;
+ if (silc_argument_get_arg_type(cmd->args, 3, &len))
+ type = 1;