1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Wildcards didn't with /OP (/DEOP, /VOICE, etc.) if there was more than

one masks used.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@780 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-10-22 15:25:17 +00:00 committed by cras
parent 4ee8b929b9
commit c78f0d12c8

View File

@ -506,28 +506,16 @@ void channel_set_mode(IRC_SERVER_REC *server, const char *channel,
g_free(orig);
}
static char *get_nicks(IRC_CHANNEL_REC *channel,
const char *data, int op, int voice)
static void get_wildcard_nicks(GString *output, const char *mask,
IRC_CHANNEL_REC *channel, int op, int voice)
{
GString *str;
GSList *nicks, *tmp;
char **matches, **match, *ret;
g_return_val_if_fail(channel != NULL, NULL);
g_return_val_if_fail(data != NULL, NULL);
if (*data == '\0') return NULL;
g_return_if_fail(output != NULL);
g_return_if_fail(mask != NULL);
g_return_if_fail(IS_IRC_CHANNEL(channel));
str = g_string_new(NULL);
matches = g_strsplit(data, " ", -1);
for (match = matches; *match != NULL; match++) {
if (strchr(*match, '*') == NULL && strchr(*match, '?') == NULL) {
/* no wildcards */
g_string_sprintfa(str, "%s ", *match);
continue;
}
/* wildcards */
nicks = nicklist_find_multiple(CHANNEL(channel), data);
nicks = nicklist_find_multiple(CHANNEL(channel), mask);
for (tmp = nicks; tmp != NULL; tmp = tmp->next) {
NICK_REC *rec = tmp->data;
@ -538,9 +526,31 @@ static char *get_nicks(IRC_CHANNEL_REC *channel,
if (g_strcasecmp(rec->nick, channel->server->nick) == 0)
continue;
g_string_sprintfa(str, "%s ", rec->nick);
g_string_sprintfa(output, "%s ", rec->nick);
}
g_slist_free(nicks);
}
static char *get_nicks(IRC_CHANNEL_REC *channel,
const char *data, int op, int voice)
{
GString *str;
char **matches, **match, *ret;
g_return_val_if_fail(channel != NULL, NULL);
g_return_val_if_fail(data != NULL, NULL);
if (*data == '\0') return NULL;
str = g_string_new(NULL);
matches = g_strsplit(data, " ", -1);
for (match = matches; *match != NULL; match++) {
if (strchr(*match, '*') == NULL &&
strchr(*match, '?') == NULL) {
/* no wildcards */
g_string_sprintfa(str, "%s ", *match);
} else {
get_wildcard_nicks(str, *match, channel, op, voice);
}
}
if (str->len > 0) g_string_truncate(str, str->len-1);