From eb772dc02cf885a82ab9c829127e0c94d629b591 Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Tue, 13 Nov 2007 16:39:02 +0000 Subject: [PATCH] Added support for detecting founder public key changing with CMODE command. --- apps/irssi/CHANGES | 5 ++++ .../irssi/src/fe-common/silc/module-formats.c | 1 + .../irssi/src/fe-common/silc/module-formats.h | 1 + apps/irssi/src/silc/core/client_ops.c | 29 +++++++++++++------ 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/apps/irssi/CHANGES b/apps/irssi/CHANGES index 5949f029..63270c8f 100644 --- a/apps/irssi/CHANGES +++ b/apps/irssi/CHANGES @@ -1,3 +1,8 @@ +Tue Nov 13 18:34:06 EET 2007 Pekka Riikonen + + * 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 * Added support for the new PKCS API. diff --git a/apps/irssi/src/fe-common/silc/module-formats.c b/apps/irssi/src/fe-common/silc/module-formats.c index 2859b934..8ad3fcdd 100644 --- a/apps/irssi/src/fe-common/silc/module-formats.c +++ b/apps/irssi/src/fe-common/silc/module-formats.c @@ -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 } }, diff --git a/apps/irssi/src/fe-common/silc/module-formats.h b/apps/irssi/src/fe-common/silc/module-formats.h index 4fdae389..408715be 100644 --- a/apps/irssi/src/fe-common/silc/module-formats.h +++ b/apps/irssi/src/fe-common/silc/module-formats.h @@ -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, diff --git a/apps/irssi/src/silc/core/client_ops.c b/apps/irssi/src/silc/core/client_ops.c index 10454953..5da2cea2 100644 --- a/apps/irssi/src/silc/core/client_ops.c +++ b/apps/irssi/src/silc/core/client_ops.c @@ -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; -- 2.24.0