irssi: better public key print out
authorPekka Riikonen <priikone@silcnet.org>
Mon, 28 Apr 2014 20:01:30 +0000 (23:01 +0300)
committerPekka Riikonen <priikone@silcnet.org>
Mon, 28 Apr 2014 20:01:30 +0000 (23:01 +0300)
When verifying public key show more information about it.

apps/irssi/src/silc/core/client_ops.c
apps/irssi/src/silc/core/clientutil.c

index 41ace322591b7268ead442d55c4fb7cd2ca241c9..0b0396496a13d3cc1889fbefc3dc9e9a3d0c30a9 100644 (file)
@@ -2599,6 +2599,14 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn,
                         silc_pubkey->identifier.realname,
                         silc_pubkey->identifier.email ?
                         silc_pubkey->identifier.email : "");
+    else if (conn_type == SILC_CONN_CLIENT &&
+            (silc_pubkey->identifier.realname ||
+             silc_pubkey->identifier.email))
+      printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
+                        SILCTXT_PUBKEY_RECEIVED_CLIENT, "",
+                        silc_pubkey->identifier.realname,
+                        silc_pubkey->identifier.email ?
+                        silc_pubkey->identifier.email : "");
     printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
                       SILCTXT_PUBKEY_FINGERPRINT, entity, fingerprint);
     printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
@@ -2606,7 +2614,8 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn,
     format = format_get_text("fe-common/silc", NULL, NULL, NULL,
                             SILCTXT_PUBKEY_ACCEPT);
     silc_keyboard_entry_redirect(verify_public_key_completion,
-                           format, 0, verify, &server->prompt_op);
+                                format, 0, verify,
+                                server ? &server->prompt_op : NULL);
     g_free(format);
     silc_free(fingerprint);
     silc_free(babbleprint);
@@ -2630,6 +2639,14 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn,
                           silc_pubkey->identifier.realname,
                           silc_pubkey->identifier.email ?
                           silc_pubkey->identifier.email : "");
+      else if (conn_type == SILC_CONN_CLIENT &&
+              (silc_pubkey->identifier.realname ||
+               silc_pubkey->identifier.email))
+       printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
+                          SILCTXT_PUBKEY_RECEIVED_CLIENT, "",
+                          silc_pubkey->identifier.realname,
+                          silc_pubkey->identifier.email ?
+                          silc_pubkey->identifier.email : "");
       printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
                         SILCTXT_PUBKEY_FINGERPRINT, entity, fingerprint);
       printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
@@ -2639,7 +2656,9 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn,
       format = format_get_text("fe-common/silc", NULL, NULL, NULL,
                               SILCTXT_PUBKEY_ACCEPT_ANYWAY);
       silc_keyboard_entry_redirect(verify_public_key_completion,
-                             format, 0, verify, &server->prompt_op);
+                                  format, 0, verify,
+                                  server ? &server->prompt_op : NULL);
+
       g_free(format);
       silc_free(fingerprint);
       silc_free(babbleprint);
@@ -2660,6 +2679,14 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn,
                           silc_pubkey->identifier.realname,
                           silc_pubkey->identifier.email ?
                           silc_pubkey->identifier.email : "");
+      else if (conn_type == SILC_CONN_CLIENT &&
+              (silc_pubkey->identifier.realname ||
+               silc_pubkey->identifier.email))
+       printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
+                          SILCTXT_PUBKEY_RECEIVED_CLIENT, "",
+                          silc_pubkey->identifier.realname,
+                          silc_pubkey->identifier.email ?
+                          silc_pubkey->identifier.email : "");
       printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
                         SILCTXT_PUBKEY_FINGERPRINT, entity, fingerprint);
       printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
@@ -2669,7 +2696,8 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn,
       format = format_get_text("fe-common/silc", NULL, NULL, NULL,
                               SILCTXT_PUBKEY_ACCEPT_ANYWAY);
       silc_keyboard_entry_redirect(verify_public_key_completion,
-                             format, 0, verify, &server->prompt_op);
+                                  format, 0, verify,
+                                  server ? &server->prompt_op : NULL);
       g_free(format);
       silc_free(fingerprint);
       silc_free(babbleprint);
@@ -2690,6 +2718,14 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn,
                           silc_pubkey->identifier.realname,
                           silc_pubkey->identifier.email ?
                           silc_pubkey->identifier.email : "");
+      else if (conn_type == SILC_CONN_CLIENT &&
+              (silc_pubkey->identifier.realname ||
+               silc_pubkey->identifier.email))
+       printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
+                          SILCTXT_PUBKEY_RECEIVED_CLIENT, "",
+                          silc_pubkey->identifier.realname,
+                          silc_pubkey->identifier.email ?
+                          silc_pubkey->identifier.email : "");
       printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
                         SILCTXT_PUBKEY_FINGERPRINT, entity, fingerprint);
       printformat_module("fe-common/silc", NULL, NULL, MSGLEVEL_CRAP,
@@ -2705,7 +2741,8 @@ silc_verify_public_key_internal(SilcClient client, SilcClientConnection conn,
       format = format_get_text("fe-common/silc", NULL, NULL, NULL,
                               SILCTXT_PUBKEY_ACCEPT_ANYWAY);
       silc_keyboard_entry_redirect(verify_public_key_completion,
-                             format, 0, verify, &server->prompt_op);
+                                  format, 0, verify,
+                                  server ? &server->prompt_op : NULL);
       g_free(format);
       silc_free(fingerprint);
       silc_free(babbleprint);
index 9717d393519a2e2ce4c691159cd93fd2ade629e6..a8a1b5b7328e318b547ac8f36e3a2b9d86049c51 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2006, 2008 Pekka Riikonen
+  Copyright (C) 1997 - 2014 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -545,7 +545,8 @@ SilcBool silc_keyboard_entry_redirect(SILC_KEYBOARD_PROMPT_PROC prompt_func,
    * assuming that it doesn't as there's already many other things that seem
    * to make this assumption.
    */
-  *async = ctx->async_context;
+  if (async)
+    *async = ctx->async_context;
 
   /*
    * All done.  Irssi will invoke the callback on this thread at a later point