summaryrefslogtreecommitdiff
path: root/src/plugins/irc/irc-protocol.c
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2010-05-22 10:51:43 +0200
committerSebastien Helleu <flashcode@flashtux.org>2010-05-22 10:51:43 +0200
commit2dee40dd1a7c0cca2adb262e32d92791abd37fa8 (patch)
tree5c469c1c4e21bed153589b5b32fe11749267cb9c /src/plugins/irc/irc-protocol.c
parent6253e3ac375b9203cf232329069cbd695a7ded5a (diff)
downloadweechat-2dee40dd1a7c0cca2adb262e32d92791abd37fa8.zip
Add isupport value in IRC servers (content of IRC message 005), with new infos: irc_server_isupport and irc_server_isupport_value
Diffstat (limited to 'src/plugins/irc/irc-protocol.c')
-rw-r--r--src/plugins/irc/irc-protocol.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c
index b562ffe70..2dc44bcfb 100644
--- a/src/plugins/irc/irc-protocol.c
+++ b/src/plugins/irc/irc-protocol.c
@@ -1868,7 +1868,8 @@ IRC_PROTOCOL_CALLBACK(001)
IRC_PROTOCOL_CALLBACK(005)
{
- char *pos, *pos2;
+ char *pos, *pos2, *pos_start;
+ int length_isupport, length;
/*
* 005 message looks like:
@@ -1883,7 +1884,8 @@ IRC_PROTOCOL_CALLBACK(005)
irc_protocol_cb_numeric (server,
nick, address, host, command,
ignored, argc, argv, argv_eol);
-
+
+ /* save prefix */
pos = strstr (argv_eol[3], "PREFIX=");
if (pos)
{
@@ -1898,6 +1900,33 @@ IRC_PROTOCOL_CALLBACK(005)
pos2[0] = ' ';
}
+ /* save whole message (concatenate to existing isupport, if any) */
+ pos_start = NULL;
+ pos = strstr (argv_eol[3], " :");
+ length = (pos) ? pos - argv_eol[3] : (int)strlen (argv_eol[3]);
+ if (server->isupport)
+ {
+ length_isupport = strlen (server->isupport);
+ server->isupport = realloc (server->isupport,
+ length_isupport + /* existing */
+ 1 + length + 1); /* new */
+ if (server->isupport)
+ pos_start = server->isupport + length_isupport;
+ }
+ else
+ {
+ server->isupport = malloc (1 + length + 1);
+ if (server->isupport)
+ pos_start = server->isupport;
+ }
+
+ if (pos_start)
+ {
+ pos_start[0] = ' ';
+ memcpy (pos_start + 1, argv_eol[3], length);
+ pos_start[length + 1] = '\0';
+ }
+
return WEECHAT_RC_OK;
}