updates.
[silc.git] / apps / irssi / src / silc / core / silc-servers.c
index f9f5854f20f26d002658adeba1c513fc947f534d..9fdfd4a55bf22a24351000b2ec2aa7b69c33a9f7 100644 (file)
@@ -80,7 +80,8 @@ static void silc_send_msg_clients(SilcClient client,
   char *nickname = NULL;
 
   if (!clients_count) {
-    printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Unknown nick: %s", rec->nick);
+    printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, 
+             "%s: There is no such client", rec->nick);
   } else {
     if (clients_count > 1) {
       silc_parse_userfqdn(rec->nick, &nickname, NULL);
@@ -91,8 +92,8 @@ static void silc_send_msg_clients(SilcClient client,
                                              nickname, rec->nick, 
                                              &clients_count);
       if (!clients) {
-       printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, "Unknown nick: %s", 
-                 rec->nick);
+       printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, 
+                 "%s: There is no such client", rec->nick);
        silc_free(nickname);
        goto out;
       }
@@ -101,6 +102,16 @@ static void silc_send_msg_clients(SilcClient client,
 
     target = clients[0];
 
+    /* Still check for exact math for nickname, this compares the
+       real (formatted) nickname and the nick (maybe formatted) that
+       use gave. This is to assure that `nick' does not match 
+       `nick@host'. */
+    if (strcasecmp(rec->nick, clients[0]->nickname)) {
+      printtext(NULL, NULL, MSGLEVEL_CLIENTERROR, 
+               "%s: There is no such client", rec->nick);
+      goto out;
+    }
+
     /* Send the private message */
     silc_client_send_private_message(client, conn, target, 0,
                                     rec->msg, strlen(rec->msg),
@@ -312,6 +323,7 @@ char *silc_server_get_channels(SILC_SERVER_REC *server)
 /* SYNTAX: FILE RECEIVE [<nickname>] */
 /* SYNTAX: FILE CLOSE [<nickname>] */
 /* SYNTAX: FILE */
+/* SYNTAX: JOIN <channel> [<passphrase>] [-cipher <cipher>] [-hmac <hmac>] [-founder <-pubkey|passwd>] */
 
 void silc_command_exec(SILC_SERVER_REC *server,
                       const char *command, const char *args)
@@ -320,18 +332,18 @@ void silc_command_exec(SILC_SERVER_REC *server,
   unsigned char **argv;
   uint32 *argv_lens, *argv_types;
   char *data, *tmpcmd;
-  SilcClientCommand *cmd;
+  SilcClientCommand cmd;
   SilcClientCommandContext ctx;
 
   g_return_if_fail(server != NULL);
 
   tmpcmd = g_strdup(command); 
   g_strup(tmpcmd);
-  cmd = silc_client_command_find(tmpcmd);
+  cmd = silc_client_command_find(silc_client, tmpcmd);
   g_free(tmpcmd);
   if (cmd == NULL)
     return;
-
+  
   /* Now parse all arguments */
   data = g_strconcat(command, " ", args, NULL);
   silc_parse_command_line(data, &argv, &argv_lens,
@@ -350,7 +362,7 @@ void silc_command_exec(SILC_SERVER_REC *server,
   ctx->argv_types = argv_types;
   
   /* Execute command */
-  (*cmd->cb)(ctx, NULL);
+  silc_client_command_call(cmd, ctx);
 }
 
 /* Generic command function to call any SILC command directly. */