Fixed WATCH command reply handling.
[silc.git] / apps / silcd / command_reply.c
index 6d427ca9e626ebb36cc782d148dc6a12790c8fe7..6a4713d6a07c3ca239766f95ecf990a5ecbcf3d3 100644 (file)
@@ -52,6 +52,7 @@ SilcServerCommandReply silc_command_reply_list[] =
   SILC_SERVER_CMD_REPLY(users, USERS),
   SILC_SERVER_CMD_REPLY(getkey, GETKEY),
   SILC_SERVER_CMD_REPLY(list, LIST),
+  SILC_SERVER_CMD_REPLY(watch, WATCH),
 
   { NULL, 0 },
 };
@@ -292,6 +293,7 @@ silc_server_command_reply_whois_save(SilcServerCommandReplyContext cmd)
   if (tmp) {
     silc_free(client->attrs);
     client->attrs = silc_memdup(tmp, len);
+    client->attrs_len = len;
   }
 
   return TRUE;
@@ -311,8 +313,11 @@ silc_server_command_reply_whois_save_client(SilcServerCommandReplyContext cmd)
   if (tmp && client) {
     silc_free(client->attrs);
     client->attrs = silc_memdup(tmp, len);
+    client->attrs_len = len;
   }
 
+  client->data.status &= ~SILC_IDLIST_STATUS_RESOLVING;
+
   return TRUE;
 }
 
@@ -961,6 +966,7 @@ SILC_SERVER_CMD_REPLY_FUNC(join)
       silc_free(id);
       goto out;
     }
+    hmac = NULL;
     server->stat.my_channels++;
     server->stat.channels++;
   } else {
@@ -987,9 +993,9 @@ SILC_SERVER_CMD_REPLY_FUNC(join)
     founder_key = NULL;
   }
 
-  if (entry->hmac_name && hmac) {
+  if (entry->hmac_name && (hmac || (!hmac && entry->hmac))) {
     silc_free(entry->hmac_name);
-    entry->hmac_name = strdup(silc_hmac_get_name(hmac));
+    entry->hmac_name = strdup(silc_hmac_get_name(hmac ? hmac : entry->hmac));
   }
 
   /* Get the ban list */
@@ -1043,6 +1049,8 @@ SILC_SERVER_CMD_REPLY_FUNC(join)
  out:
   SILC_SERVER_PENDING_EXEC(cmd, SILC_COMMAND_JOIN);
  err:
+  if (hmac)
+    silc_hmac_free(hmac);
   silc_free(client_id);
   silc_server_command_reply_free(cmd);
 
@@ -1068,7 +1076,7 @@ SILC_SERVER_CMD_REPLY_FUNC(stats)
 
   /* Get statistics structure */
   tmp = silc_argument_get_arg_type(cmd->args, 3, &tmp_len);
-  if (server->server_type == SILC_SERVER && tmp) {
+  if (server->server_type != SILC_ROUTER && tmp) {
     silc_buffer_set(&buf, tmp, tmp_len);
     silc_buffer_unformat(&buf,
                         SILC_STR_UI_INT(NULL),