Signed messages support
authorPekka Riikonen <priikone@silcnet.org>
Thu, 12 Dec 2002 13:19:30 +0000 (13:19 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Thu, 12 Dec 2002 13:19:30 +0000 (13:19 +0000)
tutorial/mybot/mybot.c

index e1c8d2162e958f771fdfabe7c58dd6f6aa0e64ad..10163ef81abd84d4a19da91f0f8114f8041789fe 100644 (file)
@@ -171,7 +171,11 @@ silc_channel_message(SilcClient client, SilcClientConnection conn,
                     SilcUInt32 message_len)
 {
   /* Yay! We got a message from channel. */
-  fprintf(stdout, "<%s> %s\n", sender->nickname, message);
+
+  if (flags & SILC_MESSAGE_FLAG_SIGNED)
+    fprintf(stdout, "[SIGNED] <%s> %s\n", sender->nickname, message);
+  else
+    fprintf(stdout, "<%s> %s\n", sender->nickname, message);
 }
 
 
@@ -303,6 +307,13 @@ silc_command_reply(SilcClient client, SilcClientConnection conn,
     silc_client_send_channel_message(client, conn, channel, NULL, 0,
                                     "hello", strlen("hello"), FALSE);
     fprintf(stdout, "MyBot: Sent 'hello' to channel\n");
+
+    /* Now send digitally signed "hello" to the channel */
+    silc_client_send_channel_message(client, conn, channel, NULL,
+                                    SILC_MESSAGE_FLAG_SIGNED,
+                                    "hello, with signature", 
+                                    strlen("hello, with signature"), FALSE);
+    fprintf(stdout, "MyBot: Sent 'hello, with signature' to channel\n");
   }
 
   va_end(va);