mirror of
https://github.com/weechat/weechat.git
synced 2026-07-10 03:33:12 +02:00
irc: fix parsing of MODE command when there are colons after the first mode argument (closes #1296)
This commit is contained in:
@@ -34,6 +34,49 @@
|
||||
#include "irc-modelist.h"
|
||||
|
||||
|
||||
/*
|
||||
* Gets mode arguments: skip colons before arguments.
|
||||
*/
|
||||
|
||||
char *
|
||||
irc_mode_get_arguments (const char *arguments)
|
||||
{
|
||||
char **argv, **argv2, *new_arguments;
|
||||
int argc, i;
|
||||
|
||||
if (!arguments || !arguments[0])
|
||||
return strdup ("");
|
||||
|
||||
argv = weechat_string_split (arguments, " ",
|
||||
WEECHAT_STRING_SPLIT_STRIP_LEFT
|
||||
| WEECHAT_STRING_SPLIT_STRIP_RIGHT
|
||||
| WEECHAT_STRING_SPLIT_COLLAPSE_SEPS,
|
||||
0, &argc);
|
||||
if (!argv)
|
||||
return strdup ("");
|
||||
|
||||
argv2 = malloc (sizeof (*argv) * (argc + 1));
|
||||
if (!argv2)
|
||||
{
|
||||
weechat_string_free_split (argv);
|
||||
return strdup ("");;
|
||||
}
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
argv2[i] = (argv[i][0] == ':') ? argv[i] + 1 : argv[i];
|
||||
}
|
||||
argv2[argc] = NULL;
|
||||
|
||||
new_arguments = weechat_string_build_with_split_string (
|
||||
(const char **)argv2, " ");
|
||||
|
||||
weechat_string_free_split (argv);
|
||||
free (argv2);
|
||||
|
||||
return new_arguments;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gets type of channel mode, which is a letter from 'A' to 'D':
|
||||
* A = Mode that adds or removes a nick or address to a list. Always has a
|
||||
@@ -397,7 +440,11 @@ irc_mode_channel_set (struct t_irc_server *server,
|
||||
break;
|
||||
}
|
||||
if (ptr_arg)
|
||||
{
|
||||
if (ptr_arg[0] == ':')
|
||||
ptr_arg++;
|
||||
current_arg++;
|
||||
}
|
||||
|
||||
if (smart_filter
|
||||
&& !irc_mode_smart_filtered (server, pos[0]))
|
||||
|
||||
Reference in New Issue
Block a user