X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=blobdiff_plain;f=tutorial%2Fmybot%2Fmybot.c;h=10163ef81abd84d4a19da91f0f8114f8041789fe;hp=8e16c897ec72c7a650ad112a20addef4562bd40e;hb=382d15d447b7a95390decfa783836ae4fe255b3d;hpb=3cf38201f9ffaad2da53757ed48a5546e1d03636 diff --git a/tutorial/mybot/mybot.c b/tutorial/mybot/mybot.c index 8e16c897..10163ef8 100644 --- a/tutorial/mybot/mybot.c +++ b/tutorial/mybot/mybot.c @@ -166,11 +166,16 @@ silc_say(SilcClient client, SilcClientConnection conn, static void silc_channel_message(SilcClient client, SilcClientConnection conn, SilcClientEntry sender, SilcChannelEntry channel, + SilcMessagePayload payload, SilcMessageFlags flags, const unsigned char *message, 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); } @@ -182,7 +187,8 @@ silc_channel_message(SilcClient client, SilcClientConnection conn, static void silc_private_message(SilcClient client, SilcClientConnection conn, - SilcClientEntry sender, SilcMessageFlags flags, + SilcClientEntry sender, SilcMessagePayload payload, + SilcMessageFlags flags, const unsigned char *message, SilcUInt32 message_len) { @@ -301,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);