mirror of
https://github.com/weechat/weechat.git
synced 2026-07-01 15:26:37 +02:00
Add isupport value in IRC servers (content of IRC message 005), with new infos: irc_server_isupport and irc_server_isupport_value
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user