Hello irssi-dev,

  irssi cannot properly connect to server irc.263.net. The reason
is that the irc server used by irc.263.net does not send out a
event 004 (which give irc server information). Irssi depend
on 004 to verifying the status of connect. With of 004, irssi
never set the connected flag on.

  The server at irc.263.net works okey on most Windows irc clients
(mirc, pirch...). The attached patch makes use of event 001 instead of
004 to verify if a connect is made. It moves the works for event
004 to a new function event_server_info(). I am not sure if this is a
clean solution. I just hope all irc servers send out event 001 :).

Anyhow, the patch is attached:
==================================
--- ../../../irssi-org/src/irc-base/server.c    Sun Jan 16 05:55:45 2000
+++ server.c    Fri Jan 28 01:02:05 2000
@@ -523,29 +523,16 @@
 
 static gboolean event_connected(gchar *data, SERVER_REC *server, gchar *from)
 {
-    gchar *params, *ircd_version, *usermodes, *chanmodes, *str;
+    gchar *str;
 
     g_return_val_if_fail(server != NULL, FALSE);
 
-    params = event_get_params(data, 5, NULL, NULL, &ircd_version, &usermodes, 
&chanmodes);
-
-    if (strncmp(ircd_version, "pircd", 5) == 0)
-    {
-       /* yet another stupid irc server that can't understand even the most
-          simple command: PING. Forget about lag detection with this server. */
-        server->no_lag_check = TRUE;
-    }
-
     if (server->real_address == NULL)
     {
        /* set the server address */
        server->real_address = g_strdup(from);
     }
 
-    /* check if server understands I and e channel modes */
-    if (strchr(chanmodes, 'I') == NULL || strchr(chanmodes, 'e') == NULL)
-       server->emode_not_known = TRUE;
-
     /* last welcome message found - commands can be sent to server now. */
     server->connected = 1;
 
@@ -556,7 +543,34 @@
     g_free(str);
 
     signal_emit("event connected", 1, server);
+    return TRUE;
+}
+
+static gboolean event_server_info(gchar *data, SERVER_REC *server, gchar *from)
+{
+    gchar *params, *ircd_version, *usermodes, *chanmodes;
+
+    g_return_val_if_fail(server != NULL, FALSE);
+
+    params = event_get_params(data, 5, NULL, NULL, &ircd_version, &usermodes, 
+&chanmodes);
+
+    if (strncmp(ircd_version, "pircd", 5) == 0)
+    {
+       /* yet another stupid irc server that can't understand even the most
+          simple command: PING. Forget about lag detection with this server. */
+        server->no_lag_check = TRUE;
+    }
+
+    /* check if server understands I and e channel modes */
+    if (strchr(chanmodes, 'I') == NULL || strchr(chanmodes, 'e') == NULL)
+       server->emode_not_known = TRUE;
+
     g_free(params);
+    /* are the following g_free's needed? */
+    g_free(ircd_version);
+    g_free(usermodes);
+    g_free(chanmodes);
+
     return TRUE;
 }
 
@@ -589,7 +603,8 @@
     lookup_servers = servers = NULL;
 
     signal_add("startup settings read", (SIGNAL_FUNC) sig_config_read);
-    signal_add("event 004", (SIGNAL_FUNC) event_connected);
+    signal_add("event 001", (SIGNAL_FUNC) event_connected);
+    signal_add("event 004", (SIGNAL_FUNC) event_server_info);
     signal_add("event ping", (SIGNAL_FUNC) event_ping);
     signal_add("event empty", (SIGNAL_FUNC) event_empty);
 }
@@ -605,7 +620,8 @@
     g_list_free(lookup_servers);
 
     signal_remove("startup settings read", (SIGNAL_FUNC) sig_config_read);
-    signal_remove("event 004", (SIGNAL_FUNC) event_connected);
+    signal_remove("event 001", (SIGNAL_FUNC) event_connected);
+    signal_remove("event 004", (SIGNAL_FUNC) event_server_info);
     signal_remove("event ping", (SIGNAL_FUNC) event_ping);
     signal_remove("event empty", (SIGNAL_FUNC) event_empty);
 }

Best regards,
 hashao                          mailto:[EMAIL PROTECTED]


Reply via email to