irc: fix parsing of TAGMSG message when there is a colon before the channel

This fixes the display of typing notifications on some IRC servers like
inspircd.
This commit is contained in:
Sébastien Helleu 2021-09-21 20:41:18 +02:00
parent a6826af796
commit edd1971ae8
2 changed files with 11 additions and 3 deletions

View File

@ -22,6 +22,10 @@ New features::
* api: add user variables in evaluation of expressions with "define:name,value"
Bug fixes::
* irc: fix parsing of TAGMSG message when there is a colon before the channel
[[v3.3]]
== Version 3.3 (2021-09-19)

View File

@ -2978,12 +2978,14 @@ IRC_PROTOCOL_CALLBACK(setname)
*
* Message looks like:
* @msgid=6gqz7dxd22v7r3x9pvu;+typing=active :nick!user@host TAGMSG #channel
* @msgid=6gqz7dxd22v7r3x9pvu;+typing=active :nick!user@host TAGMSG :#channel
*/
IRC_PROTOCOL_CALLBACK(tagmsg)
{
struct t_irc_channel *ptr_channel;
const char *ptr_typing_value;
char *pos_channel;
int state;
IRC_PROTOCOL_MIN_ARGS(3);
@ -2994,10 +2996,12 @@ IRC_PROTOCOL_CALLBACK(tagmsg)
if (!tags)
return WEECHAT_RC_OK;
pos_channel = (argv[2][0] == ':') ? argv[2] + 1 : argv[2];
ptr_channel = NULL;
if (irc_channel_is_channel (server, argv[2]))
ptr_channel = irc_channel_search (server, argv[2]);
else if (irc_server_strcasecmp (server, argv[2], server->nick) == 0)
if (irc_channel_is_channel (server, pos_channel))
ptr_channel = irc_channel_search (server, pos_channel);
else if (irc_server_strcasecmp (server, pos_channel, server->nick) == 0)
ptr_channel = irc_channel_search (server, nick);
if (!ptr_channel)
return WEECHAT_RC_OK;