1
0
mirror of https://github.com/irssi/irssi.git synced 2025-01-03 14:56:47 -05:00

Use glob matching for activity_hide_targets

spaces vs tabs!

strarray_find* needs to return -1 if no index found
This commit is contained in:
Jari Matilainen 2016-03-11 09:12:38 +01:00
parent 66e9c4bb39
commit 94b823c3cd
3 changed files with 20 additions and 1 deletions

View File

@ -181,6 +181,24 @@ int strarray_find(char **array, const char *item)
return -1;
}
int strarray_find_glob(char **array, const char *item)
{
char **tmp;
int index;
g_return_val_if_fail(array != NULL, -1);
g_return_val_if_fail(item != NULL, -1);
index = 0;
for (tmp = array; *tmp != NULL; tmp++, index++) {
if (g_pattern_match_simple(*tmp, item))
return index;
}
return -1;
}
GSList *gslist_find_string(GSList *list, const char *key)
{
for (; list != NULL; list = list->next)

View File

@ -111,6 +111,7 @@ char *replace_chars(char *str, char from, char to);
int strarray_length(char **array);
/* return index of `item' in `array' or -1 if not found */
int strarray_find(char **array, const char *item);
int strarray_find_glob(char **array, const char *item);
/* string -> uoff_t */
uoff_t str_to_uofft(const char *str);

View File

@ -464,7 +464,7 @@ gboolean strarray_find_dest(char **array, const TEXT_DEST_REC *dest)
if (dest->server_tag != NULL) {
char *tagtarget = g_strdup_printf("%s/%s", dest->server_tag, dest->target);
int ret = strarray_find(array, tagtarget);
int ret = strarray_find_glob(array, tagtarget);
g_free(tagtarget);
if (ret != -1)
return TRUE;