1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

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
This commit is contained in:
Timo Sirainen 2002-10-10 01:55:24 +00:00 committed by cras
parent 3a7f566173
commit 01c9fddeba
3 changed files with 11 additions and 2 deletions

View File

@ -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 - /* don't ignore motd anymore after 3 seconds of connection time -
we might have called /MOTD */ we might have called /MOTD */
if (settings_get_bool("skip_motd") && if (settings_get_bool("skip_motd") && !server->motd_got)
time(NULL)-3 <= server->real_connect_time)
return; return;
print_event_received(server, data, nick, FALSE); print_event_received(server, data, nick, FALSE);

View File

@ -528,6 +528,11 @@ static void event_motd(IRC_SERVER_REC *server, const char *data, const char *fro
event_connected(server, data, from); 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) static void event_channels_formed(IRC_SERVER_REC *server, const char *data)
{ {
char *params, *channels; char *params, *channels;
@ -585,6 +590,8 @@ void irc_servers_init(void)
signal_add("event 001", (SIGNAL_FUNC) event_connected); signal_add("event 001", (SIGNAL_FUNC) event_connected);
signal_add("event 004", (SIGNAL_FUNC) event_server_info); signal_add("event 004", (SIGNAL_FUNC) event_server_info);
signal_add("event 375", (SIGNAL_FUNC) event_motd); 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 254", (SIGNAL_FUNC) event_channels_formed);
signal_add("event 465", (SIGNAL_FUNC) event_server_banned); signal_add("event 465", (SIGNAL_FUNC) event_server_banned);
signal_add("event error", (SIGNAL_FUNC) event_error); 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 001", (SIGNAL_FUNC) event_connected);
signal_remove("event 004", (SIGNAL_FUNC) event_server_info); signal_remove("event 004", (SIGNAL_FUNC) event_server_info);
signal_remove("event 375", (SIGNAL_FUNC) event_motd); 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 254", (SIGNAL_FUNC) event_channels_formed);
signal_remove("event 465", (SIGNAL_FUNC) event_server_banned); signal_remove("event 465", (SIGNAL_FUNC) event_server_banned);
signal_remove("event error", (SIGNAL_FUNC) event_error); signal_remove("event error", (SIGNAL_FUNC) event_error);

View File

@ -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 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 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 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_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 */ int max_modes_in_cmd; /* max. number of mode changes in one /MODE command */