From: Pekka Riikonen Date: Wed, 5 Jul 2000 06:12:34 +0000 (+0000) Subject: Tweaked NAMES command reply for better. Should now show users X-Git-Tag: SILC.0.1~510 X-Git-Url: http://git.silcnet.org/gitweb/?a=commitdiff_plain;h=fb91b15cba920f9359e78e5a517bbe514696c4ed;p=silc.git Tweaked NAMES command reply for better. Should now show users joined to a channel. --- diff --git a/apps/silc/client.h b/apps/silc/client.h index 8c9c4f2d..8cf5bec1 100644 --- a/apps/silc/client.h +++ b/apps/silc/client.h @@ -72,7 +72,6 @@ typedef struct { /* Keys */ SilcCipher send_key; SilcCipher receive_key; - SilcPKCS public_key; SilcHmac hmac; unsigned char *hmac_key; unsigned int hmac_key_len; @@ -109,6 +108,11 @@ typedef struct { char *username; char *realname; + /* Private and public key */ + SilcPKCS pkcs; + SilcPublicKey public_key; + SilcPrivateKey private_key; + /* SILC client task queues */ SilcTaskQueue io_queue; SilcTaskQueue timeout_queue; diff --git a/apps/silc/command_reply.c b/apps/silc/command_reply.c index 4d4e8daa..776b9b9d 100644 --- a/apps/silc/command_reply.c +++ b/apps/silc/command_reply.c @@ -24,6 +24,10 @@ /* * $Id$ * $Log$ + * Revision 1.4 2000/07/05 06:12:34 priikone + * Tweaked NAMES command reply for better. Should now show users + * joined to a channel. + * * Revision 1.3 2000/07/04 08:27:14 priikone * Changes to LEAVE command -- more consistent now and does error * handling better. Added INVITE, PING and part of NAMES commands. @@ -33,7 +37,7 @@ * Implemented LEAVE command. Minor bug fixes. * * Revision 1.1.1.1 2000/06/27 11:36:56 priikone - * Importet from internal CVS/Added Log headers. + * Imported from internal CVS/Added Log headers. * * */ @@ -67,7 +71,7 @@ SilcClientCommandReply silc_command_reply_list[] = SILC_CLIENT_CMD_REPLY(die, DIE), SILC_CLIENT_CMD_REPLY(silcoper, SILCOPER), SILC_CLIENT_CMD_REPLY(leave, LEAVE), - SILC_CLIENT_CMD_REPLY(names, LEAVE), + SILC_CLIENT_CMD_REPLY(names, NAMES), { NULL, 0 }, }; @@ -580,16 +584,17 @@ SILC_CLIENT_CMD_REPLY_FUNC(leave) SILC_CLIENT_CMD_REPLY_FUNC(names) { SilcClientCommandReplyContext cmd = (SilcClientCommandReplyContext)context; - SilcClient client = cmd->client; SilcClientWindow win = (SilcClientWindow)cmd->sock->user_data; SilcCommandStatus status; SilcIDCache *id_cache = NULL; - SilcChannelEntry *channel; + SilcChannelEntry channel; SilcChannelID *channel_id = NULL; unsigned char *tmp; - char *name_list, channel_name; + char *name_list; int i, len; + SILC_LOG_DEBUG(("Start")); + #define CIDC(x) win->channel_id_cache[(x)] #define CIDCC(x) win->channel_id_cache_count[(x)] @@ -625,15 +630,22 @@ SILC_CLIENT_CMD_REPLY_FUNC(names) channel = (SilcChannelEntry)id_cache->context; /* If there are pending commands set for this command reply we will - execute them and let them handle the received name list. They can - If there is no pending callback it means that this command reply - has been received without calling the command, ie. server has sent - the reply without getting the command from us first. This happens - with SILC servers that sends NAMES reply after joining to a channel. */ - if (cmd->callback) + execute them and let them handle the received name list. */ + if (cmd->callback) { SILC_CLIENT_COMMAND_EXEC_PENDING(cmd, SILC_COMMAND_WHOIS); - else - silc_say(cmd->client, "xxx"); + } else { + /* there is no pending callback it means that this command reply + has been received without calling the command, ie. server has sent + the reply without getting the command from us first. This happens + with SILC servers that sends NAMES reply after joining to a channel. */ + + /* Remove commas from list */ + for (i = 0; i < len; i++) + if (name_list[i] == ',') + name_list[i] = ' '; + + silc_say(cmd->client, "Users on %s: %s", channel->channel_name, name_list); + } out: if (channel_id)