diff options
author | Timo Sirainen <cras@irssi.org> | 2002-05-09 03:01:40 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2002-05-09 03:01:40 +0000 |
commit | ac61d089765385a9f498d229f53b8e65d832081d (patch) | |
tree | def8441ec6ec44d091599f3b475c3460de4defba /src/irc | |
parent | 2c3d24e1da87c1b6f5ca92296d54f9756b49ed4d (diff) | |
download | irssi-ac61d089765385a9f498d229f53b8e65d832081d.zip |
fixed /WHO handling
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2762 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc')
-rw-r--r-- | src/irc/proxy/listen.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/irc/proxy/listen.c b/src/irc/proxy/listen.c index 203551fc..5531720c 100644 --- a/src/irc/proxy/listen.c +++ b/src/irc/proxy/listen.c @@ -74,26 +74,32 @@ static void proxy_redirect_event(CLIENT_REC *client, const char *command, static void grab_who(CLIENT_REC *client, const char *channel) { - char *chlist, *chanevent; + GString *arg; char **list, **tmp; + int count; /* /WHO a,b,c may respond with either one "a,b,c End of WHO" message or three different "a End of WHO", "b End of WHO", .. messages */ - chlist = g_strdup(channel); list = g_strsplit(channel, ",", -1); - for (tmp = list; *tmp != NULL; tmp++) { + arg = g_string_new(channel); + + for (tmp = list, count = 0; *tmp != NULL; tmp++, count++) { if (strcmp(*tmp, "0") == 0) { /* /who 0 displays everyone */ **tmp = '*'; } - chanevent = g_strdup_printf("%s %s", chlist, *tmp); - proxy_redirect_event(client, "who", 1, chanevent, -1); - g_free(chanevent); + g_string_append_c(arg, ' '); + g_string_append(arg, *tmp); } + + proxy_redirect_event(client, "who", + client->server->one_endofwho ? 1 : count, + arg->str, -1); + g_strfreev(list); - g_free(chlist); + g_string_free(arg, TRUE); } static void handle_client_connect_cmd(CLIENT_REC *client, |