updates.
[silc.git] / apps / silcd / command_reply.c
index d9fbe6a8e603c85027c532c6714fffd6673b0540..dee4e0bef9bcd7a1838c08a96a06445caec96082 100644 (file)
@@ -895,8 +895,8 @@ SILC_SERVER_CMD_REPLY_FUNC(join)
     /* The entry exists. */
 
     /* If ID has changed, then update it to the cache too. */
-    if (!SILC_ID_CHANNEL_COMPARE(channel->id, id))
-      silc_idlist_replace_channel_id(server->local_list, channel->id, id);
+    if (!SILC_ID_CHANNEL_COMPARE(entry->id, id))
+      silc_idlist_replace_channel_id(server->local_list, entry->id, id);
 
     entry->disabled = FALSE;
 
@@ -917,26 +917,21 @@ SILC_SERVER_CMD_REPLY_FUNC(join)
   /* Get the ban list */
   tmp = silc_argument_get_arg_type(cmd->args, 8, &len);
   if (tmp) {
-    if (entry->ban_list)
-      silc_free(entry->ban_list);
-    entry->ban_list = silc_calloc(len, sizeof(*entry->ban_list));
-    memcpy(entry->ban_list, tmp, len);
+    silc_free(entry->ban_list);
+    entry->ban_list = silc_memdup(tmp, len);
   }
 
   /* Get the invite list */
   tmp = silc_argument_get_arg_type(cmd->args, 9, &len);
   if (tmp) {
-    if (entry->invite_list)
-      silc_free(entry->invite_list);
-    entry->invite_list = silc_calloc(len, sizeof(*entry->invite_list));
-    memcpy(entry->invite_list, tmp, len);
+    silc_free(entry->invite_list);
+    entry->invite_list = silc_memdup(tmp, len);
   }
 
   /* Get the topic */
   tmp = silc_argument_get_arg_type(cmd->args, 10, &len);
   if (tmp) {
-    if (entry->topic)
-      silc_free(entry->topic);
+    silc_free(entry->topic);
     entry->topic = strdup(tmp);
   }
 
@@ -1204,6 +1199,8 @@ SILC_SERVER_CMD_REPLY_FUNC(list)
       cache->expire = time(NULL) + 60;
   }
 
+  channel->user_count = usercount;
+
   if (topic) {
     silc_free(channel->topic);
     channel->topic = strdup(topic);