summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-10-10 01:55:24 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-10-10 01:55:24 +0000
commit01c9fddeba983d01bc2889dae9e86b41a682833f (patch)
tree224ba62801b0b78bc3f2e6e1db477d08e5250908 /src
parent3a7f566173da01a5ffb1be8a7d4980cdd4d096f4 (diff)
downloadirssi-01c9fddeba983d01bc2889dae9e86b41a682833f.zip
Less kludgy way to handle /SET skip_motd. Works now with laggy servers.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2937 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r--src/fe-common/irc/fe-events-numeric.c3
-rw-r--r--src/irc/core/irc-servers.c9
-rw-r--r--src/irc/core/irc-servers.h1
3 files changed, 11 insertions, 2 deletions
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c
index 038c28de..386417f7 100644
--- a/src/fe-common/irc/fe-events-numeric.c
+++ b/src/fe-common/irc/fe-events-numeric.c
@@ -867,8 +867,7 @@ static void event_motd(IRC_SERVER_REC *server, const char *data,
{
/* don't ignore motd anymore after 3 seconds of connection time -
we might have called /MOTD */
- if (settings_get_bool("skip_motd") &&
- time(NULL)-3 <= server->real_connect_time)
+ if (settings_get_bool("skip_motd") && !server->motd_got)
return;
print_event_received(server, data, nick, FALSE);
diff --git a/src/irc/core/irc-servers.c b/src/irc/core/irc-servers.c
index 5ead92f9..f715e1ee 100644
--- a/src/irc/core/irc-servers.c
+++ b/src/irc/core/irc-servers.c
@@ -528,6 +528,11 @@ static void event_motd(IRC_SERVER_REC *server, const char *data, const char *fro
event_connected(server, data, from);
}
+static void event_end_of_motd(IRC_SERVER_REC *server, const char *data)
+{
+ server->motd_got = TRUE;
+}
+
static void event_channels_formed(IRC_SERVER_REC *server, const char *data)
{
char *params, *channels;
@@ -585,6 +590,8 @@ void irc_servers_init(void)
signal_add("event 001", (SIGNAL_FUNC) event_connected);
signal_add("event 004", (SIGNAL_FUNC) event_server_info);
signal_add("event 375", (SIGNAL_FUNC) event_motd);
+ signal_add_last("event 376", (SIGNAL_FUNC) event_end_of_motd);
+ signal_add_last("event 422", (SIGNAL_FUNC) event_end_of_motd); /* no motd */
signal_add("event 254", (SIGNAL_FUNC) event_channels_formed);
signal_add("event 465", (SIGNAL_FUNC) event_server_banned);
signal_add("event error", (SIGNAL_FUNC) event_error);
@@ -607,6 +614,8 @@ void irc_servers_deinit(void)
signal_remove("event 001", (SIGNAL_FUNC) event_connected);
signal_remove("event 004", (SIGNAL_FUNC) event_server_info);
signal_remove("event 375", (SIGNAL_FUNC) event_motd);
+ signal_remove("event 376", (SIGNAL_FUNC) event_end_of_motd);
+ signal_remove("event 422", (SIGNAL_FUNC) event_end_of_motd); /* no motd */
signal_remove("event 254", (SIGNAL_FUNC) event_channels_formed);
signal_remove("event 465", (SIGNAL_FUNC) event_server_banned);
signal_remove("event error", (SIGNAL_FUNC) event_error);
diff --git a/src/irc/core/irc-servers.h b/src/irc/core/irc-servers.h
index ce6da564..1286a15e 100644
--- a/src/irc/core/irc-servers.h
+++ b/src/irc/core/irc-servers.h
@@ -60,6 +60,7 @@ struct _IRC_SERVER_REC {
unsigned int one_endofwho:1; /* /WHO #a,#b,.. replies only with one End of WHO message */
unsigned int disable_lag:1; /* Disable lag detection (PING command doesn't exist) */
unsigned int nick_collision:1; /* We're just now being killed because of nick collision */
+ unsigned int motd_got:1; /* We've received MOTD */
int max_kicks_in_cmd; /* max. number of people to kick with one /KICK command */
int max_modes_in_cmd; /* max. number of mode changes in one /MODE command */