Merge commit 'origin/silc.1.1.branch'
[silc.git] / apps / irssi / src / silc / core / client_ops.c
index 25afdb040150321991474180add62f4e30ef6d08..5da2cea29017314d1cdee99b6bd993928fe992be 100644 (file)
@@ -191,7 +191,7 @@ static void silc_parse_channel_public_keys(SILC_SERVER_REC *server,
 
     fingerprint = silc_hash_fingerprint(NULL, pk, pk_len);
     babbleprint = silc_hash_babbleprint(NULL, pk, pk_len);
-    silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, pubkey);
+    silc_pubkey = silc_pkcs_public_key_get_pkcs(SILC_PKCS_SILC, pubkey);
 
     printformat_module("fe-common/silc", server, NULL,
                       MSGLEVEL_CRAP, SILCTXT_CHANNEL_PK_LIST_ENTRY,
@@ -299,7 +299,7 @@ int verify_message_signature(SilcClientEntry sender,
     SilcPublicKey cached_pk=NULL;
 
     /* try to load the file */
-    if (!silc_pkcs_load_public_key(filename, &cached_pk)) {
+    if (!silc_pkcs_load_public_key(filename, SILC_PKCS_ANY, &cached_pk)) {
       printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
                         SILCTXT_PUBKEY_COULD_NOT_LOAD, "client");
       if (pk == NULL)
@@ -1427,7 +1427,7 @@ void silc_getkey_cb(bool success, void *context)
                              ((SilcServerEntry)getkey->entry)->public_key);
   SilcSILCPublicKey silc_pubkey;
 
-  silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key);
+  silc_pubkey = silc_pkcs_public_key_get_pkcs(SILC_PKCS_SILC, public_key);
 
   if (success) {
     if (getkey->id_type == SILC_ID_CLIENT)
@@ -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;
 
@@ -2450,7 +2461,7 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn,
     return;
   }
 
-  silc_pubkey = silc_pkcs_get_context(SILC_PKCS_SILC, public_key);
+  silc_pubkey = silc_pkcs_public_key_get_pkcs(SILC_PKCS_SILC, public_key);
 
   pw = getpwuid(getuid());
   if (!pw) {
@@ -2554,8 +2565,9 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn,
     SilcUInt32 encpk_len;
 
     /* Load the key file, try for both IP filename and hostname filename */
-    if (!silc_pkcs_load_public_key(ipf, &local_pubkey) &&
-       (!hostf || (!silc_pkcs_load_public_key(hostf, &local_pubkey)))) {
+    if (!silc_pkcs_load_public_key(ipf, SILC_PKCS_ANY, &local_pubkey) &&
+       (!hostf || (!silc_pkcs_load_public_key(hostf, SILC_PKCS_ANY,
+                                              &local_pubkey)))) {
       printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
                         SILCTXT_PUBKEY_RECEIVED,verify->entity_name ?
                         verify->entity_name : entity);