summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2004-08-31 22:32:58 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2004-08-31 22:32:58 +0000
commit119c028945c0285218c5e6dbbf9ea9286bbdf8de (patch)
tree581c2c17e271761a80c56f23a1d407a5a8d9ff16
parent259331e0b195573495f1e372af0373ad21a2d0e2 (diff)
downloadirssi-119c028945c0285218c5e6dbbf9ea9286bbdf8de.zip
send max 15 005 parameters at once. Patch by Valentin Batz
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3288 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/irc/proxy/dump.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/src/irc/proxy/dump.c b/src/irc/proxy/dump.c
index 1aeea5e5..135fd366 100644
--- a/src/irc/proxy/dump.c
+++ b/src/irc/proxy/dump.c
@@ -227,9 +227,11 @@ static void proxy_dump_data_005(gpointer key, gpointer value, gpointer context)
void proxy_dump_data(CLIENT_REC *client)
{
- GString *isupport_out;
+ GString *isupport_out, *paramstr;
+ char **paramlist, **tmp;
+ int count;
- proxy_client_reset_nick(client);
+ proxy_client_reset_nick(client);
/* welcome info */
proxy_outdata(client, ":%s 001 %s :Welcome to the Internet Relay Network\n", client->proxy_address, client->nick);
@@ -242,12 +244,39 @@ void proxy_dump_data(CLIENT_REC *client)
if (client->server != NULL && client->server->isupport_sent) {
isupport_out = g_string_new(NULL);
- g_string_sprintf(isupport_out, ":%s 005 %s ", client->proxy_address, client->nick);
- /* FIXME: should be limited to 15 params */
g_hash_table_foreach(client->server->isupport, proxy_dump_data_005, isupport_out);
- g_string_sprintfa(isupport_out, ":are supported by this server\n");
- proxy_outdata(client, "%s", isupport_out->str);
+ if (isupport_out->len > 0)
+ g_string_truncate(isupport_out, isupport_out->len-1);
+
+ proxy_outdata(client, ":%s 005 %s ", client->proxy_address, client->nick);
+
+ paramstr = g_string_new(NULL);
+ paramlist = g_strsplit(isupport_out->str, " ", -1);
+ count = 0;
+ tmp = paramlist;
+
+ for (;; tmp++) {
+ if (*tmp != NULL) {
+ g_string_sprintfa(paramstr, "%s ", *tmp);
+ if (++count < 15)
+ continue;
+ }
+
+ count = 0;
+ if (paramstr->len > 0)
+ g_string_truncate(paramstr, paramstr->len-1);
+ g_string_sprintfa(paramstr, " :are supported by this server\n");
+ proxy_outdata(client, "%s", paramstr->str);
+ g_string_truncate(paramstr, 0);
+ g_string_sprintf(paramstr, ":%s 005 %s ", client->proxy_address, client->nick);
+
+ if (*tmp == NULL || tmp[1] == NULL)
+ break;
+ }
+
g_string_free(isupport_out, TRUE);
+ g_string_free(paramstr, TRUE);
+ g_strfreev(paramlist);
}
proxy_outdata(client, ":%s 251 %s :There are 0 users and 0 invisible on 1 servers\n", client->proxy_address, client->nick);