updates
[crypto.git] / apps / silcd / command.c
index 25df5eddead10cca6f40826c906f0d7fe4b7efe0..aeecb572eaa4f552a072f1c6f41affb25a348017 100644 (file)
@@ -777,7 +777,7 @@ silc_server_command_whois_send_reply(SilcServerCommandContext cmd,
     }
       
     strncat(uh, entry->username, strlen(entry->username));
-    if (!strchr(entry->username, '@')) {
+    if (!strchr(entry->username, '@') && entry->connection) {
       strncat(uh, "@", 1);
       hsock = (SilcSocketConnection)entry->connection;
       len = strlen(hsock->hostname);
@@ -1835,7 +1835,7 @@ silc_server_command_identify_send_reply(SilcServerCommandContext cmd,
                                                      3, nh, strlen(nh));
       } else {
        strncat(uh, entry->username, strlen(entry->username));
-       if (!strchr(entry->username, '@')) {
+       if (!strchr(entry->username, '@') && entry->connection) {
          strncat(uh, "@", 1);
          hsock = (SilcSocketConnection)entry->connection;
          len = strlen(hsock->hostname);
@@ -2085,8 +2085,9 @@ SILC_SERVER_CMD_FUNC(nick)
  send_reply:
   /* Send the new Client ID as reply command back to client */
   packet = silc_command_reply_payload_encode_va(SILC_COMMAND_NICK, 
-                                               SILC_STATUS_OK, 0, ident, 1, 
-                                               2, nidp->data, nidp->len);
+                                               SILC_STATUS_OK, 0, ident, 2,
+                                               2, nidp->data, nidp->len,
+                                               3, nick, strlen(nick));
   silc_server_packet_send(cmd->server, cmd->sock, SILC_PACKET_COMMAND_REPLY,
                          0, packet->data, packet->len, FALSE);
 
@@ -2540,18 +2541,20 @@ SILC_SERVER_CMD_FUNC(invite)
     strncat(channel->invite_list, invite, len);
     strncat(channel->invite_list, ",", 1);
 
-    /* Send notify to the client that is invited to the channel */
-    idp = silc_id_payload_encode(channel_id, SILC_ID_CHANNEL);
-    idp2 = silc_id_payload_encode(sender->id, SILC_ID_CLIENT);
-    silc_server_send_notify_dest(server, dest_sock, FALSE, dest_id, 
-                                SILC_ID_CLIENT,
-                                SILC_NOTIFY_TYPE_INVITE, 3, 
-                                idp->data, idp->len, 
-                                channel->channel_name, 
-                                strlen(channel->channel_name),
-                                idp2->data, idp2->len);
-    silc_buffer_free(idp);
-    silc_buffer_free(idp2);
+    if (!(dest->mode & SILC_UMODE_BLOCK_INVITE)) {
+      /* Send notify to the client that is invited to the channel */
+      idp = silc_id_payload_encode(channel_id, SILC_ID_CHANNEL);
+      idp2 = silc_id_payload_encode(sender->id, SILC_ID_CLIENT);
+      silc_server_send_notify_dest(server, dest_sock, FALSE, dest_id, 
+                                  SILC_ID_CLIENT,
+                                  SILC_NOTIFY_TYPE_INVITE, 3, 
+                                  idp->data, idp->len, 
+                                  channel->channel_name, 
+                                  strlen(channel->channel_name),
+                                  idp2->data, idp2->len);
+      silc_buffer_free(idp);
+      silc_buffer_free(idp2);
+    }
   }
 
   /* Add the client to the invite list of the channel */