Fixed a bug in disconnecting in irssi. silc.client.0.9.2
authorPekka Riikonen <priikone@silcnet.org>
Wed, 19 Jun 2002 13:04:21 +0000 (13:04 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Wed, 19 Jun 2002 13:04:21 +0000 (13:04 +0000)
CHANGES
apps/irssi/src/silc/core/client_ops.c
apps/irssi/src/silc/core/silc-core.c
lib/silcclient/client.c

diff --git a/CHANGES b/CHANGES
index 4bf0a2b18ee239c4f7ab1f583f18bb2ad89ba052..a6e6ce1aba22c4bf8ca9a564dfa8a7e1d86fb8a1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,9 @@
+Wed Jun 19 16:01:51 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
+
+       * Fixed a bug in Irssi SILC client to close the connection
+         properly when disconnecting from server.  Affected file
+         irssi/src/silc/core/client_ops.c.
+
 Tue Jun 18 17:14:52 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
 
        * When authenticating as founder during JOIN command, check
index 1651b20058013e9760f1e049164e7f39f1f5209f..5c83a211be2e3eb2ffe39a20e626f8074f6d26c4 100644 (file)
@@ -833,7 +833,7 @@ void silc_connect(SilcClient client, SilcClientConnection conn,
 {
   SILC_SERVER_REC *server = conn->context;
 
-  if (!server) {
+  if (!server || server->disconnected) {
     silc_client_close_connection(client, conn);
     return;
   }
index 28c3d38bf6b021ea767cbb2d6c7b2daec378eb01..6b09e1f6f7261f7ddd2901c7e9986707c8699dc3 100644 (file)
@@ -150,7 +150,7 @@ static bool i_debug;
 static bool silc_irssi_debug_print(char *file, char *function, int line,
                                   char *message, void *context)
 {
-  printtext(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
+  printtext(NULL, NULL, MSGLEVEL_CLIENTCRAP,
            "DEBUG: %s:%d: %s", function, line, message);
   return TRUE;
 }
@@ -175,7 +175,9 @@ static void sig_debug_setup_changed(void)
 
 static bool silc_log_misc(SilcLogType type, char *message, void *context)
 {
-  printtext(NULL, NULL, MSGLEVEL_CLIENTCRAP, "%s", message);
+  printtext(NULL, NULL, MSGLEVEL_CLIENTCRAP, "%s: %s", 
+           (type == SILC_LOG_INFO ? "[Info]" :
+            type == SILC_LOG_WARNING ? "[Warning]" : "[Error]"), message);
   return TRUE;
 }
 
@@ -293,10 +295,6 @@ void silc_opt_callback(poptContext con,
     silc_debug = TRUE;
     silc_debug_hexdump = TRUE;
     silc_log_set_debug_string(arg);
-    silc_log_set_callback(SILC_LOG_INFO, silc_log_misc, NULL);
-    silc_log_set_callback(SILC_LOG_WARNING, silc_log_misc, NULL);
-    silc_log_set_callback(SILC_LOG_ERROR, silc_log_misc, NULL);
-    silc_log_set_callback(SILC_LOG_FATAL, silc_log_misc, NULL);
 #ifndef SILC_DEBUG
     fprintf(stdout, 
            "Run-time debugging is not enabled. To enable it recompile\n"
@@ -424,6 +422,11 @@ void silc_core_init(void)
     return;
   }
 
+  silc_log_set_callback(SILC_LOG_INFO, silc_log_misc, NULL);
+  silc_log_set_callback(SILC_LOG_WARNING, silc_log_misc, NULL);
+  silc_log_set_callback(SILC_LOG_ERROR, silc_log_misc, NULL);
+  silc_log_set_callback(SILC_LOG_FATAL, silc_log_misc, NULL);
+
   /* Register SILC to the irssi */
   rec = g_new0(CHAT_PROTOCOL_REC, 1);
   rec->name = "SILC";
index ea7aa8734869d211e56c313c0a7bc435edeba900..0e3d8387f3cd5c6a40602146a1b99fdc40588ea9 100644 (file)
@@ -194,6 +194,8 @@ silc_client_add_connection(SilcClient client,
   SilcClientConnection conn;
   int i;
 
+  SILC_LOG_DEBUG(("Adding new connection to %s:%d", hostname, port));
+
   conn = silc_calloc(1, sizeof(*conn));
 
   /* Initialize ID caches */
@@ -237,6 +239,9 @@ void silc_client_del_connection(SilcClient client, SilcClientConnection conn)
 {
   int i;
 
+  SILC_LOG_DEBUG(("Deleting connection %s%d", conn->remote_host,
+                 conn->remote_port));
+
   for (i = 0; i < client->internal->conns_count; i++)
     if (client->internal->conns[i] == conn) {