diff options
author | Timo Sirainen <cras@irssi.org> | 2002-02-06 04:20:34 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-02-06 04:20:34 +0000 |
commit | f2c78cf482860030104722b390568cf15dfb38c8 (patch) | |
tree | e691deeae163f14d121f79cfe0d1e6abd306168e | |
parent | 75e724fdf7d1976dd36c8e2d4f3f74c0c2703059 (diff) | |
download | irssi-f2c78cf482860030104722b390568cf15dfb38c8.zip |
Fixed the generic event_received() hadler not to remove ':' char twice in
some situations..
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2394 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/fe-common/irc/fe-events-numeric.c | 43 |
1 files changed, 17 insertions, 26 deletions
diff --git a/src/fe-common/irc/fe-events-numeric.c b/src/fe-common/irc/fe-events-numeric.c index 92580c88..3b5437d1 100644 --- a/src/fe-common/irc/fe-events-numeric.c +++ b/src/fe-common/irc/fe-events-numeric.c @@ -752,31 +752,22 @@ static void event_not_chanop(IRC_SERVER_REC *server, const char *data) static void event_received(IRC_SERVER_REC *server, const char *data) { - char *params, *args, *ptr; + char *args, *ptr; g_return_if_fail(data != NULL); - params = event_get_params(data, 2 | PARAM_FLAG_GETREST, NULL, &args); - ptr = strstr(args, " :"); - if (ptr != NULL) - g_memmove(ptr+1, ptr+2, strlen(ptr+1)); - printtext(server, NULL, MSGLEVEL_CRAP, "%s", args); - g_free(params); -} - -static void event_target_received(IRC_SERVER_REC *server, const char *data) -{ - char *params, *target, *args, *ptr; - - g_return_if_fail(data != NULL); + /* skip first param, it's always our nick */ + ptr = strchr(data, ' '); + if (ptr == NULL) + return; - params = event_get_params(data, 3 | PARAM_FLAG_GETREST, - NULL, &target, &args); + /* param1 param2 ... :last parameter */ + args = g_strdup(ptr); ptr = strstr(args, " :"); if (ptr != NULL) g_memmove(ptr+1, ptr+2, strlen(ptr+1)); - printtext(server, target, MSGLEVEL_CRAP, "%s %s", target, args); - g_free(params); + printtext(server, NULL, MSGLEVEL_CRAP, "%s", args); + g_free(args); } static void event_motd(IRC_SERVER_REC *server, const char *data) @@ -869,10 +860,10 @@ void fe_events_numeric_init(void) signal_add("event 438", (SIGNAL_FUNC) event_received); signal_add("event 465", (SIGNAL_FUNC) event_received); - signal_add("event 368", (SIGNAL_FUNC) event_target_received); - signal_add("event 347", (SIGNAL_FUNC) event_target_received); - signal_add("event 349", (SIGNAL_FUNC) event_target_received); - signal_add("event 442", (SIGNAL_FUNC) event_target_received); + signal_add("event 368", (SIGNAL_FUNC) event_received); + signal_add("event 347", (SIGNAL_FUNC) event_received); + signal_add("event 349", (SIGNAL_FUNC) event_received); + signal_add("event 442", (SIGNAL_FUNC) event_received); } void fe_events_numeric_deinit(void) @@ -950,8 +941,8 @@ void fe_events_numeric_deinit(void) signal_remove("event 438", (SIGNAL_FUNC) event_received); signal_remove("event 465", (SIGNAL_FUNC) event_received); - signal_remove("event 368", (SIGNAL_FUNC) event_target_received); - signal_remove("event 347", (SIGNAL_FUNC) event_target_received); - signal_remove("event 349", (SIGNAL_FUNC) event_target_received); - signal_remove("event 442", (SIGNAL_FUNC) event_target_received); + signal_remove("event 368", (SIGNAL_FUNC) event_received); + signal_remove("event 347", (SIGNAL_FUNC) event_received); + signal_remove("event 349", (SIGNAL_FUNC) event_received); + signal_remove("event 442", (SIGNAL_FUNC) event_received); } |