From: Pekka Riikonen Date: Sat, 8 Sep 2001 07:40:27 +0000 (+0000) Subject: updates. X-Git-Tag: silcertest~121 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=87cb73b7c7fd30288ff35f0b228f2fde011584e2 updates. --- diff --git a/CHANGES b/CHANGES index 99be7f2b..470788e2 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,10 @@ Sat Sep 8 10:22:10 EEST 2001 Pekka Riikonen if the userinfo field is missing. Affected file is lib/silcclient/command_reply.c. + * Do not print error in silc_file_read if the read file does + not exist. Just silently return NULL. Affected file is + lib/silcutil/silcutil.c. + Fri Sep 7 22:16:38 EEST 2001 Pekka Riikonen * Fixed various printing bugs on the user interface in the diff --git a/TODO b/TODO index 4a2c7460..85a83d76 100644 --- a/TODO +++ b/TODO @@ -10,22 +10,17 @@ TODO/bugs in Irssi SILC client that the user has. And a local command to dump the contents of the public key to the screen. Something like LISTKEYS, SHOWKEY... - o We should get rid of the clientconfig.[ch] in Irssi SILC and move the - cipher, hash, hmac and pkcs configuration to the Irssi SILC's config - file. - - o Resolve the users during the JOIN process with WHOIS and not with - IDENTIFY. Otherwise the userinfo is never resolved without explicitly - doing WHOIS to the user. - o The QUIT command should wait for server's disconnection (at least for a while) before exiting the application. o The JOIN command's HELP is generated from Irssi IRCs JOIN help and - the syntax is not same in SILC. This must be fixed. + the syntax is not same in SILC. This must be fixed. Most likely + we must forget the Irssi's JOIN command and mimic it to get our + required syntax for it too. - o With USERS command to a channel user is not joined the name of the - channel is printed as garbled. + o We should get rid of the clientconfig.[ch] in Irssi SILC and move the + cipher, hash, hmac and pkcs configuration to the Irssi SILC's config + file. o Add PERL scripting support from Irssi CVS. diff --git a/apps/irssi/src/silc/core/client_ops.c b/apps/irssi/src/silc/core/client_ops.c index 1cc9a1c9..e56e6a55 100644 --- a/apps/irssi/src/silc/core/client_ops.c +++ b/apps/irssi/src/silc/core/client_ops.c @@ -117,6 +117,7 @@ void silc_private_message(SilcClient client, SilcClientConnection conn, char userhost[256]; server = conn == NULL ? NULL : conn->context; + memset(userhost, 0, sizeof(userhost)); if (sender->username) snprintf(userhost, sizeof(userhost) - 1, "%s@%s", sender->username, sender->hostname); diff --git a/apps/irssi/src/silc/core/silc-channels.c b/apps/irssi/src/silc/core/silc-channels.c index 9febc670..1292aa82 100644 --- a/apps/irssi/src/silc/core/silc-channels.c +++ b/apps/irssi/src/silc/core/silc-channels.c @@ -162,6 +162,7 @@ static void event_join(SILC_SERVER_REC *server, va_list va) } } + memset(userhost, 0, sizeof(userhost)); if (client->username) snprintf(userhost, sizeof(userhost) - 1, "%s@%s", client->username, client->hostname); @@ -185,6 +186,7 @@ static void event_leave(SILC_SERVER_REC *server, va_list va) client = va_arg(va, SilcClientEntry); channel = va_arg(va, SilcChannelEntry); + memset(userhost, 0, sizeof(userhost)); if (client->username) snprintf(userhost, sizeof(userhost) - 1, "%s@%s", client->username, client->hostname); @@ -214,6 +216,7 @@ static void event_signoff(SILC_SERVER_REC *server, va_list va) client = va_arg(va, SilcClientEntry); message = va_arg(va, char *); + memset(userhost, 0, sizeof(userhost)); if (client->username) snprintf(userhost, sizeof(userhost) - 1, "%s@%s", client->username, client->hostname); @@ -253,6 +256,7 @@ static void event_topic(SILC_SERVER_REC *server, va_list va) signal_emit("channel topic changed", 1, chanrec); } + memset(userhost, 0, sizeof(userhost)); snprintf(userhost, sizeof(userhost) - 1, "%s@%s", client->username, client->hostname); signal_emit("message topic", 5, server, channel->channel_name, @@ -274,6 +278,7 @@ static void event_invite(SILC_SERVER_REC *server, va_list va) channel_name = va_arg(va, char *); client = va_arg(va, SilcClientEntry); + memset(userhost, 0, sizeof(userhost)); snprintf(userhost, sizeof(userhost) - 1, "%s@%s", client->username, client->hostname); signal_emit("message invite", 4, server, channel ? channel->channel_name : @@ -296,6 +301,7 @@ static void event_nick(SILC_SERVER_REC *server, va_list va) oldclient, oldclient->nickname, newclient, newclient->nickname); + memset(userhost, 0, sizeof(userhost)); snprintf(userhost, sizeof(userhost) - 1, "%s@%s", newclient->username, newclient->hostname); signal_emit("message nick", 4, server, newclient->nickname, @@ -543,6 +549,7 @@ static void command_part(const char *data, SILC_SERVER_REC *server, if (chanrec == NULL) cmd_return_error(CMDERR_CHAN_NOT_FOUND); + memset(userhost, 0, sizeof(userhost)); snprintf(userhost, sizeof(userhost) - 1, "%s@%s", server->conn->local_entry->username, server->conn->local_entry->hostname); diff --git a/apps/irssi/src/silc/core/silc-servers.c b/apps/irssi/src/silc/core/silc-servers.c index 4afc3517..cd15aed9 100644 --- a/apps/irssi/src/silc/core/silc-servers.c +++ b/apps/irssi/src/silc/core/silc-servers.c @@ -284,7 +284,7 @@ char *silc_server_get_channels(SILC_SERVER_REC *server) /* SYNTAX: KEY MSG set|unset|list|agreement|negotiate [] */ /* SYNTAX: KEY CHANNEL set|unset|list|agreement|negotiate [] */ /* SYNTAX: KICK [@] [] */ -/* SYNTAX: KILL [@] [] */ +/* SYNTAX: KILL [@] [] */ /* SYNTAX: OPER [-pubkey] */ /* SYNTAX: SILCOPER [-pubkey] */ /* SYNTAX: TOPIC [] */ diff --git a/lib/silcclient/command_reply.c b/lib/silcclient/command_reply.c index 79acee69..2fc508ac 100644 --- a/lib/silcclient/command_reply.c +++ b/lib/silcclient/command_reply.c @@ -1767,7 +1767,8 @@ SILC_CLIENT_CMD_REPLY_FUNC(users) silc_hash_client_id_compare, NULL, &id_cache); - if (!id_cache || !((SilcClientEntry)id_cache->context)->username) { + if (!id_cache || !((SilcClientEntry)id_cache->context)->username || + !((SilcClientEntry)id_cache->context)->realname) { /* No we don't have it (or it is incomplete in information), query it from the server. Assemble argument table that will be sent for the WHOIS command later. */ diff --git a/lib/silcutil/silclog.c b/lib/silcutil/silclog.c index a0c9181a..bb26dece 100644 --- a/lib/silcutil/silclog.c +++ b/lib/silcutil/silclog.c @@ -96,35 +96,38 @@ void silc_log_output(const char *filename, uint32 maxsize, } if (!filename) - filename = " "; - - /* Purge the log file if the max size is defined. */ - if (maxsize) { - fp = fopen(filename, "r"); - if (fp) { - int filelen; - - filelen = fseek(fp, (off_t)0L, SEEK_END); - fseek(fp, (off_t)0L, SEEK_SET); - - /* Purge? */ - if (filelen >= maxsize) - unlink(filename); + fp = stderr; - fclose(fp); + if (filename) { + /* Purge the log file if the max size is defined. */ + if (maxsize) { + fp = fopen(filename, "r"); + if (fp) { + int filelen; + + filelen = fseek(fp, (off_t)0L, SEEK_END); + fseek(fp, (off_t)0L, SEEK_SET); + + /* Purge? */ + if (filelen >= maxsize) + unlink(filename); + + fclose(fp); + } + } + + /* Open the log file */ + if ((fp = fopen(filename, "a+")) == NULL) { + fprintf(stderr, "warning: could not open log file " + "%s: %s\n", filename, strerror(errno)); + fprintf(stderr, "warning: log messages will be displayed on " + "the screen\n"); + fp = stderr; } } - /* Open the log file */ - if ((fp = fopen(filename, "a+")) == NULL) { - fprintf(stderr, "warning: could not open log file " - "%s: %s\n", filename, strerror(errno)); - fprintf(stderr, "warning: log messages will be displayed on the screen\n"); - fp = stderr; - } - /* Get the log type name */ - for(np = silc_log_types; np->name; np++) { + for (np = silc_log_types; np->name; np++) { if (np->type == type) break; } diff --git a/lib/silcutil/silcutil.c b/lib/silcutil/silcutil.c index d571b8a6..6bc8261b 100644 --- a/lib/silcutil/silcutil.c +++ b/lib/silcutil/silcutil.c @@ -36,6 +36,8 @@ char *silc_file_read(const char *filename, uint32 *return_len) fd = open(filename, O_RDONLY); if (fd < 0) { + if (errno == ENOENT) + return NULL; SILC_LOG_ERROR(("Cannot open file %s: %s", filename, strerror(errno))); return NULL; }