diff --git a/src/fe-common/core/fe-common-core.c b/src/fe-common/core/fe-common-core.c index abd5fed3..423c0946 100644 --- a/src/fe-common/core/fe-common-core.c +++ b/src/fe-common/core/fe-common-core.c @@ -469,51 +469,51 @@ gboolean strarray_find_dest(char **array, const TEXT_DEST_REC *dest) if (strarray_find(array, "*") != -1) return TRUE; // we ignore all channels - else if (type & WITEM_TYPE_CHANNEL && strarray_find(array, "#") != -1) + else if (type & WI_TYPE_CHANNEL && strarray_find(array, "#") != -1) return TRUE; // Is this a dcc chat? - else if (type & WITEM_TYPE_DCCCHAT && strarray_find(array, "=") != -1) + else if (type & WI_TYPE_DCCCHAT && strarray_find(array, "=") != -1) return TRUE; // Is this a private query window? - else if (type & WITEM_TYPE_PRIVMSG && strarray_find(array, "@") != -1) + else if (type & WI_TYPE_PRIVMSG && strarray_find(array, "@") != -1) return TRUE; - else if (dest->server_tag != NULL) { - char *prefix = g_strdup_printf("%s/", dest->server_tag); - if (!strarray_find_prefix(array, prefix)) { - g_free(prefix); - return FALSE; - } - GSList *targets = NULL, *iterator = NULL; - gboolean found = FALSE; - // create a list of types to look for - targets = g_slist_append(targets, g_strdup("*")); - if (type & WITEM_TYPE_CHANNEL) { - targets = g_slist_append(targets, g_strdup("#")); - targets = g_slist_append(targets, g_strdup(dest->target)); - } - else if (type & WITEM_TYPE_QUERY) { - if (type & WITEM_TYPE_DCCCHAT) - targets = g_slist_append(targets, g_strdup("=")); - else - targets = g_slist_append(targets, g_strdup("@")); - } + if (dest->server_tag == NULL) + return FALSE; - for (iterator = targets; iterator; iterator = iterator->next) { - char *tagtarget = g_strdup_printf("%s/%s", dest->server_tag, (char *) iterator->data); - int ret = strarray_find(array, tagtarget); - g_free(tagtarget); - if (ret != -1) { - found = TRUE; - break; - } - } - - g_slist_foreach(targets, (GFunc)g_free, NULL); - g_slist_free(targets); + char *prefix = g_strdup_printf("%s/", dest->server_tag); + if (!strarray_find_prefix(array, prefix)) { g_free(prefix); - return found; + return FALSE; } - return FALSE; + GSList *targets = NULL, *iterator = NULL; + gboolean found = FALSE; + // create a list of types to look for + targets = g_slist_append(targets, g_strdup("*")); + if (type & WI_TYPE_CHANNEL) { + targets = g_slist_append(targets, g_strdup("#")); + targets = g_slist_append(targets, g_strdup(dest->target)); + } + else if (type & WI_TYPE_QUERY) { + if (type & WI_TYPE_DCCCHAT) + targets = g_slist_append(targets, g_strdup("=")); + else + targets = g_slist_append(targets, g_strdup("@")); + } + + for (iterator = targets; iterator; iterator = iterator->next) { + char *tagtarget = g_strdup_printf("%s/%s", dest->server_tag, (char *) iterator->data); + int ret = strarray_find(array, tagtarget); + g_free(tagtarget); + if (ret != -1) { + found = TRUE; + break; + } + } + + g_slist_foreach(targets, (GFunc)g_free, NULL); + g_slist_free(targets); + g_free(prefix); + return found; } diff --git a/src/fe-common/core/window-items.c b/src/fe-common/core/window-items.c index 7d864e3e..90545ea3 100644 --- a/src/fe-common/core/window-items.c +++ b/src/fe-common/core/window-items.c @@ -140,19 +140,19 @@ void window_item_set_active(WINDOW_REC *window, WI_ITEM_REC *item) WindowType window_item_get_type(WI_ITEM_REC *item) { - g_return_val_if_fail(item != NULL, WITEM_TYPE_OTHER); + g_return_val_if_fail(item != NULL, WI_TYPE_OTHER); const char *type = module_find_id_str("WINDOW ITEM TYPE", item->type); if (g_ascii_strcasecmp(type, "CHANNEL") == 0) - return WITEM_TYPE_CHANNEL; + return WI_TYPE_CHANNEL; else if (g_ascii_strcasecmp(type, "QUERY") == 0) { if (g_str_has_prefix("=", item->name)) - return WITEM_TYPE_QUERY | WITEM_TYPE_DCCCHAT; + return WI_TYPE_QUERY | WI_TYPE_DCCCHAT; else - return WITEM_TYPE_QUERY | WITEM_TYPE_PRIVMSG; + return WI_TYPE_QUERY | WI_TYPE_PRIVMSG; } else - return WITEM_TYPE_OTHER; + return WI_TYPE_OTHER; } /* Return TRUE if `item' is the active window item in the window. diff --git a/src/fe-common/core/window-items.h b/src/fe-common/core/window-items.h index 96f3cfe9..1ef9119e 100644 --- a/src/fe-common/core/window-items.h +++ b/src/fe-common/core/window-items.h @@ -4,11 +4,11 @@ #include "fe-windows.h" typedef enum { - WITEM_TYPE_CHANNEL = 1, - WITEM_TYPE_QUERY = 2, - WITEM_TYPE_PRIVMSG = 4, - WITEM_TYPE_DCCCHAT = 8, - WITEM_TYPE_OTHER = 16 + WI_TYPE_CHANNEL = 1, + WI_TYPE_QUERY = 2, + WI_TYPE_PRIVMSG = 4, + WI_TYPE_DCCCHAT = 8, + WI_TYPE_OTHER = 16 } WindowType; /* Add/remove/destroy window item from `window' */