Added support for detecting founder public key changing with
authorPekka Riikonen <priikone@silcnet.org>
Tue, 13 Nov 2007 16:39:02 +0000 (16:39 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Tue, 13 Nov 2007 16:39:02 +0000 (16:39 +0000)
CMODE command.

apps/irssi/CHANGES
apps/irssi/src/fe-common/silc/module-formats.c
apps/irssi/src/fe-common/silc/module-formats.h
apps/irssi/src/silc/core/client_ops.c

index 5949f029137a35c738cb969251ea67d0e0519936..63270c8f8869c552a139ee078b520764aeafaa33 100644 (file)
@@ -1,3 +1,8 @@
+Tue Nov 13 18:34:06 EET 2007  Pekka Riikonen <priikone@silcnet.org>
+
+       * Added support for detecting when channel founder public key
+         is changed with CMODE command (founder rights transfered).
+
 Tue Jul 10 20:13:47 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
 
        * Added support for the new PKCS API.
index 2859b9341096ce319788cd0d9cd8b4147e07ed0b..8ad3fcdd0483a4f96486d37f68e4c2a916198bf5 100644 (file)
@@ -29,6 +29,7 @@ FORMAT_REC fecommon_silc_formats[] = {
 
        { "channel_founder_you", "You are channel founder on {channel $0}", 1, { 0 } },
        { "channel_founder", "channel founder on {channel $0} is: {channick_hilight $1}", 2, { 0, 0 } },
+       { "channel_founder_changed", "Channel founder public key changed on {channel $0}", 1, { 0 } },
        { "channel_topic", "Topic for {channel $0} is: $1", 2, { 0, 0 } },
        { "channel_topic_not_set", "Topic for {channel $0} not set", 1, { 0 } },
        { "cmode", "channel mode/{channel $0} {mode $1} by {nick $2}", 3, { 0, 0, 0 } },
index 4fdae389e710e4b78671e6fb16cffad9a0915f91..408715be917b7b61ed48ecb9b6d507f462239185 100644 (file)
@@ -26,6 +26,7 @@ enum {
 
   SILCTXT_CHANNEL_FOUNDER_YOU,
   SILCTXT_CHANNEL_FOUNDER,
+  SILCTXT_CHANNEL_FOUNDER_CHANGED,
   SILCTXT_CHANNEL_TOPIC,
   SILCTXT_CHANNEL_TOPIC_NOT_SET,
   SILCTXT_CHANNEL_CMODE,
index 1045495340929d31e331d1e763fda0e038a93d4d..5da2cea29017314d1cdee99b6bd993928fe992be 100644 (file)
@@ -2293,24 +2293,35 @@ void silc_command_reply(SilcClient client, SilcClientConnection conn,
     {
       SilcChannelEntry channel_entry;
       SilcDList chpks;
+      SilcPublicKey founder_key;
 
       channel_entry = va_arg(vp, SilcChannelEntry);
       (void)va_arg(vp, SilcUInt32);
-      (void)va_arg(vp, SilcPublicKey);
+      founder_key = va_arg(vp, SilcPublicKey);
       chpks = va_arg(vp, SilcDList);
 
-      if (SILC_STATUS_IS_ERROR(status) || !cmode_list_chpks ||
-         !channel_entry || !channel_entry->channel_name)
+      if (SILC_STATUS_IS_ERROR(status) || !channel_entry ||
+         !channel_entry->channel_name)
        return;
 
-      /* Print the channel public key list */
-      if (chpks)
-        silc_parse_channel_public_keys(server, channel_entry, chpks);
-      else
+      /* If founder was changed successfully, tell it to user */
+      if (founder_key && channel_entry->founder_key &&
+         !silc_pkcs_public_key_compare(founder_key,
+                                       channel_entry->founder_key)) {
         printformat_module("fe-common/silc", server, NULL,
-                         MSGLEVEL_CRAP, SILCTXT_CHANNEL_PK_NO_LIST,
-                         channel_entry->channel_name);
+                          MSGLEVEL_CRAP, SILCTXT_CHANNEL_FOUNDER_CHANGED,
+                          channel_entry->channel_name);
+      }
 
+      /* Print the channel public key list */
+      if (cmode_list_chpks) {
+       if (chpks)
+         silc_parse_channel_public_keys(server, channel_entry, chpks);
+       else
+         printformat_module("fe-common/silc", server, NULL,
+                            MSGLEVEL_CRAP, SILCTXT_CHANNEL_PK_NO_LIST,
+                            channel_entry->channel_name);
+      }
     }
     break;