updates.
[silc.git] / apps / irssi / src / silc / core / silc-channels.c
index 82d6d08020b5dfc40417820aacc2e81611aaddde..c823e0a5e1699c87ca15ef31fbcaf3030a942152 100644 (file)
@@ -468,6 +468,14 @@ static void event_kill(SILC_SERVER_REC *server, va_list va)
                       MSGLEVEL_CRAP, SILCTXT_CHANNEL_KILLED_YOU, 
                       tmp ? tmp : "");
   } else {
+    GSList *nicks, *tmpn;
+    nicks = nicklist_get_same_unique(SERVER(server), client_entry);
+    for (tmpn = nicks; tmpn != NULL; tmpn = tmpn->next->next) {
+      CHANNEL_REC *channel = tmpn->data;
+      NICK_REC *nickrec = tmpn->next->data;
+      nicklist_remove(channel, nickrec);
+    }
+
     printformat_module("fe-common/silc", server, NULL,
                       MSGLEVEL_CRAP, SILCTXT_CHANNEL_KILLED, 
                       client_entry->nickname,
@@ -680,6 +688,7 @@ static void command_away(const char *data, SILC_SERVER_REC *server,
 
 typedef struct {
   int type;                    /* 1 = msg, 2 = channel */
+  bool responder;
   SILC_SERVER_REC *server;
 } *KeyInternal;
 
@@ -709,7 +718,7 @@ static void keyagr_completion(SilcClient client,
       /* Set the private key for this client */
       silc_client_del_private_message_key(client, conn, client_entry);
       silc_client_add_private_message_key_ske(client, conn, client_entry,
-                                             NULL, key);
+                                             NULL, key, i->responder);
       printformat_module("fe-common/silc", i->server, NULL, MSGLEVEL_NOTICES,
                         SILCTXT_KEY_AGREEMENT_PRIVMSG, 
                         client_entry->nickname);
@@ -791,7 +800,8 @@ static void command_key(const char *data, SILC_SERVER_REC *server,
   g_free(tmp);
 
   if (argc < 4) {
-    silc_say(silc_client, conn, "Usage: /KEY msg|channel <nickname|channel> "
+    silc_say(silc_client, conn, SILC_CLIENT_MESSAGE_INFO,
+            "Usage: /KEY msg|channel <nickname|channel> "
             "set|unset|agreement|negotiate [<arguments>]");
     return;
   }
@@ -803,7 +813,8 @@ static void command_key(const char *data, SILC_SERVER_REC *server,
     type = 2;
 
   if (type == 0) {
-    silc_say(silc_client, conn, "Usage: /KEY msg|channel <nickname|channel> "
+    silc_say(silc_client, conn, SILC_CLIENT_MESSAGE_INFO,
+            "Usage: /KEY msg|channel <nickname|channel> "
             "set|unset|agreement|negotiate [<arguments>]");
     return;
   }
@@ -881,13 +892,13 @@ static void command_key(const char *data, SILC_SERVER_REC *server,
                                              argv[5], argv[4],
                                              argv_lens[4],
                                              (argv[4][0] == '*' ?
-                                              TRUE : FALSE));
+                                              TRUE : FALSE), FALSE);
        else
          silc_client_add_private_message_key(silc_client, conn, client_entry,
                                              NULL, argv[4],
                                              argv_lens[4],
                                              (argv[4][0] == '*' ?
-                                              TRUE : FALSE));
+                                              TRUE : FALSE), FALSE);
 
        /* Send the key to the remote client so that it starts using it
           too. */
@@ -1009,7 +1020,7 @@ static void command_key(const char *data, SILC_SERVER_REC *server,
          else
            strcat(buf, "*generated*");
 
-         silc_say(silc_client, conn, "%s", buf);
+         silc_say(silc_client, conn, SILC_CLIENT_MESSAGE_INFO, "%s", buf);
        }
       } else {
        printformat_module("fe-common/silc", server, NULL, MSGLEVEL_CRAP,
@@ -1040,7 +1051,7 @@ static void command_key(const char *data, SILC_SERVER_REC *server,
          else
            strcat(buf, "*generated*");
 
-         silc_say(silc_client, conn, "%s", buf);
+         silc_say(silc_client, conn, SILC_CLIENT_MESSAGE_INFO, "%s", buf);
        }
       }
 
@@ -1080,7 +1091,7 @@ static void command_key(const char *data, SILC_SERVER_REC *server,
        
        strcat(buf, "<hidden>");
 
-       silc_say(silc_client, conn, "%s", buf);
+       silc_say(silc_client, conn, SILC_CLIENT_MESSAGE_INFO, "%s", buf);
       }
       
       silc_client_free_channel_private_keys(keys, keys_count);
@@ -1119,7 +1130,8 @@ static void command_key(const char *data, SILC_SERVER_REC *server,
   }
 
   if (command == 0) {
-    silc_say(silc_client, conn, "Usage: /KEY msg|channel <nickname|channel> "
+    silc_say(silc_client, conn, SILC_CLIENT_MESSAGE_INFO,
+            "Usage: /KEY msg|channel <nickname|channel> "
             "set|unset|agreement|negotiate [<arguments>]");
     goto out;
   }
@@ -1127,14 +1139,18 @@ static void command_key(const char *data, SILC_SERVER_REC *server,
   if (command == 4 && client_entry) {
     printformat_module("fe-common/silc", server, NULL, MSGLEVEL_NOTICES,
                       SILCTXT_KEY_AGREEMENT, argv[2]);
+    internal->responder = TRUE;
     silc_client_send_key_agreement(silc_client, conn, client_entry, hostname, 
                                   port, 120, keyagr_completion, internal);
+    if (!hostname)
+      silc_free(internal);
     goto out;
   }
 
   if (command == 5 && client_entry && hostname) {
     printformat_module("fe-common/silc", server, NULL, MSGLEVEL_NOTICES,
                       SILCTXT_KEY_AGREEMENT_NEGOTIATE, argv[2]);
+    internal->responder = FALSE;
     silc_client_perform_key_agreement(silc_client, conn, client_entry, 
                                      hostname, port, keyagr_completion, 
                                      internal);