1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-30 06:45:25 +00:00

masks_match() was buggy

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@623 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-08-24 00:56:46 +00:00 committed by cras
parent 6415f506de
commit cac3d29be9

View File

@ -88,22 +88,29 @@ int irc_mask_match_address(const char *mask, const char *nick,
int irc_masks_match(const char *masks, const char *nick, const char *address) int irc_masks_match(const char *masks, const char *nick, const char *address)
{ {
char **list, **tmp, *mask; char **list, **tmp, *mask;
int found;
g_return_val_if_fail(masks != NULL, FALSE); g_return_val_if_fail(masks != NULL, FALSE);
found = FALSE;
mask = g_strdup_printf("%s!%s", nick, address); mask = g_strdup_printf("%s!%s", nick, address);
list = g_strsplit(masks, " ", -1); list = g_strsplit(masks, " ", -1);
for (tmp = list; *tmp != NULL; tmp++) { for (tmp = list; *tmp != NULL; tmp++) {
if (strchr(*tmp, '!') == NULL && g_strcasecmp(*tmp, nick) == 0) if (strchr(*tmp, '!') == NULL &&
g_strcasecmp(*tmp, nick) == 0) {
found = TRUE;
break; break;
}
if (match_wildcards(*tmp, mask)) if (match_wildcards(*tmp, mask)) {
found = TRUE;
break; break;
}
} }
g_strfreev(list); g_strfreev(list);
g_free(mask); g_free(mask);
return *tmp != NULL; return found;
} }
static char *get_domain_mask(char *host) static char *get_domain_mask(char *host)