updates.
authorPekka Riikonen <priikone@silcnet.org>
Sat, 8 Sep 2001 07:40:27 +0000 (07:40 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 8 Sep 2001 07:40:27 +0000 (07:40 +0000)
CHANGES
TODO
apps/irssi/src/silc/core/client_ops.c
apps/irssi/src/silc/core/silc-channels.c
apps/irssi/src/silc/core/silc-servers.c
lib/silcclient/command_reply.c
lib/silcutil/silclog.c
lib/silcutil/silcutil.c

diff --git a/CHANGES b/CHANGES
index 99be7f2b69b076c1da9cc166a69ad2ce3494551b..470788e2644140dad7cf887b1fe8bc76f482143f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,10 @@ Sat Sep  8 10:22:10 EEST 2001  Pekka Riikonen <priikone@silcnet.org>
          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 <priikone@silcnet.org>
 
        * Fixed various printing bugs on the user interface in the
diff --git a/TODO b/TODO
index 4a2c746083401dc28d4a5a95badac7ed274603a7..85a83d768010022510ff470004054f754db981a7 100644 (file)
--- 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.
 
index 1cc9a1c9456894a6bd088df6c3529c65c67720c4..e56e6a55ec872ed1d57b8bc24d0f3b34806f5a0e 100644 (file)
@@ -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);
index 9febc67084e5259fa02a8348d68f6379fc204165..1292aa82ae2174bd0fdf548062a1bd8061f5dafc 100644 (file)
@@ -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);
index 4afc351790fa9bd65f574b910c5af4782d70bade..cd15aed98e638dff3f18ddec7f4737bdeaf59228 100644 (file)
@@ -284,7 +284,7 @@ char *silc_server_get_channels(SILC_SERVER_REC *server)
 /* SYNTAX: KEY MSG <nickname> set|unset|list|agreement|negotiate [<arguments>] */
 /* SYNTAX: KEY CHANNEL <channel> set|unset|list|agreement|negotiate [<arguments>] */
 /* SYNTAX: KICK <channel> <nickname>[@<hostname>] [<comment>] */
-/* SYNTAX: KILL <channel> <nickname>[@<hostname>] [<comment>] */
+/* SYNTAX: KILL <nickname>[@<hostname>] [<comment>] */
 /* SYNTAX: OPER <username> [-pubkey] */
 /* SYNTAX: SILCOPER <username> [-pubkey] */
 /* SYNTAX: TOPIC <channel> [<topic>] */
index 79acee69291f3865e8a859debadc8201eab32c59..2fc508ac4bc0cd13d84a0ba9dca7a6056e4b1a23 100644 (file)
@@ -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. */
index a0c9181a7f72a93a8f2b80931aa3ea11b05f057c..bb26deceacfd3205ba2f647b9fd8a61aa5daed04 100644 (file)
@@ -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;
   }
index d571b8a62a4dd328b3a1b901a8ac00f59f8e2934..6bc8261b1d0a8c90a252ccfd32cc5bf90bd5250f 100644 (file)
@@ -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;
   }