diff options
author | Jilles Tjoelker <jilles@irssi.org> | 2010-02-26 21:01:39 +0000 |
---|---|---|
committer | jilles <jilles@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2010-02-26 21:01:39 +0000 |
commit | 59142d845df4551530561b8dfe78c3f468764679 (patch) | |
tree | ba46b47cd0e8f39b12de60c14c2bbb200f24f785 | |
parent | bf6afc4a94815439465ab7a5db57beb764dbcab5 (diff) | |
download | irssi-59142d845df4551530561b8dfe78c3f468764679.zip |
Show "target changing too fast" messages in the channel/query window.
This is about numerics 707 (ratbox and derivatives) and
439 (most other ircds that implement target change
limitations).
If the channel is not yet joined, the message is still
shown in the status window.
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@5120 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/fe-common/irc/fe-events-numeric.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index 50a4278e..99b622db 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -529,6 +529,25 @@ static void event_477(IRC_SERVER_REC *server, const char *data, g_free(params); } +static void event_target_too_fast(IRC_SERVER_REC *server, const char *data, + const char *nick) +{ + /* Target change too fast, could be nick or channel. + * If we tried to join this channel, display the error in the + * status window. Otherwise display it in the channel window. + */ + IRC_CHANNEL_REC *chanrec; + char *params, *channel; + + g_return_if_fail(data != NULL); + + params = event_get_params(data, 2, NULL, &channel); + + chanrec = irc_channel_find(server, channel); + print_event_received(server, data, nick, chanrec == NULL || chanrec->joined); + g_free(params); +} + static void event_unknown_mode(IRC_SERVER_REC *server, const char *data) { char *params, *mode; @@ -666,6 +685,8 @@ void fe_events_numeric_init(void) signal_add("event 376", (SIGNAL_FUNC) event_motd); signal_add("event 372", (SIGNAL_FUNC) event_motd); signal_add("event 422", (SIGNAL_FUNC) event_motd); + signal_add("event 439", (SIGNAL_FUNC) event_target_too_fast); + signal_add("event 707", (SIGNAL_FUNC) event_target_too_fast); signal_add("default event numeric", (SIGNAL_FUNC) event_numeric); /* Because default event numeric only fires if there is no specific @@ -685,7 +706,6 @@ void fe_events_numeric_init(void) signal_add("event 436", (SIGNAL_FUNC) event_received); signal_add("event 438", (SIGNAL_FUNC) event_received); signal_add("event 465", (SIGNAL_FUNC) event_received); - signal_add("event 439", (SIGNAL_FUNC) event_received); signal_add("event 470", (SIGNAL_FUNC) event_received); signal_add("event 479", (SIGNAL_FUNC) event_received); @@ -756,6 +776,8 @@ void fe_events_numeric_deinit(void) signal_remove("event 376", (SIGNAL_FUNC) event_motd); signal_remove("event 372", (SIGNAL_FUNC) event_motd); signal_remove("event 422", (SIGNAL_FUNC) event_motd); + signal_remove("event 439", (SIGNAL_FUNC) event_target_too_fast); + signal_remove("event 707", (SIGNAL_FUNC) event_target_too_fast); signal_remove("default event numeric", (SIGNAL_FUNC) event_numeric); signal_remove("event 001", (SIGNAL_FUNC) event_received); @@ -771,7 +793,6 @@ void fe_events_numeric_deinit(void) signal_remove("event 436", (SIGNAL_FUNC) event_received); signal_remove("event 438", (SIGNAL_FUNC) event_received); signal_remove("event 465", (SIGNAL_FUNC) event_received); - signal_remove("event 439", (SIGNAL_FUNC) event_received); signal_remove("event 470", (SIGNAL_FUNC) event_received); signal_remove("event 479", (SIGNAL_FUNC) event_received); |