updates
[silc.git] / lib / silcclient / command.c
index 1d21505886126dcc6b51d273d21620ac6d928812..4dd9a23e8bda4b9bc6f6e771406a31e6e51ab1bd 100644 (file)
@@ -283,7 +283,7 @@ SILC_CLIENT_CMD_FUNC(nick)
     goto out;
   }
 
-  if (!strncmp(conn->nickname, cmd->argv[1], cmd->argv_lens[1]))
+  if (!strcmp(conn->nickname, cmd->argv[1]))
     goto out;
 
   /* Show current nickname */
@@ -928,6 +928,7 @@ SILC_CLIENT_CMD_FUNC(cumode)
   SilcClientCommandContext cmd = (SilcClientCommandContext)context;
   SilcClientConnection conn = cmd->conn;
   SilcChannelEntry channel;
+  SilcChannelUser chu;
   SilcClientEntry client_entry;
   SilcBuffer buffer, clidp, chidp;
   unsigned char *name, *cp, modebuf[4];
@@ -986,11 +987,12 @@ SILC_CLIENT_CMD_FUNC(cumode)
     return;
   }
   
-  for (i = 0; i < channel->clients_count; i++)
-    if (channel->clients[i].client == client_entry) {
-      mode = channel->clients[i].mode;
+  while ((chu = silc_list_get(channel->clients)) != SILC_LIST_END) {
+    if (chu->client == client_entry) {
+      chu->mode = mode;
       break;
     }
+  }
 
   /* Are we adding or removing mode */
   if (cmd->argv[2][0] == '-')
@@ -1179,10 +1181,22 @@ SILC_CLIENT_CMD_FUNC(names)
     goto out;
   }
 
-  if (cmd->argv[1][0] == '*')
+  if (cmd->argv[1][0] == '*') {
+    if (!conn->current_channel) {
+      cmd->client->ops->say(cmd->client, conn, "You are not on any channel");
+      COMMAND_ERROR;
+      goto out;
+    }
     name = conn->current_channel->channel_name;
-  else
+  } else {
     name = cmd->argv[1];
+  }
+
+  if (!conn->current_channel) {
+    cmd->client->ops->say(cmd->client, conn, "You are not on that channel");
+    COMMAND_ERROR;
+    goto out;
+  }
 
   /* Get the Channel ID of the channel */
   if (!silc_idcache_find_by_data_one(conn->channel_cache, name, &id_cache)) {