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

Slightly optimize activity_hide_targets matching.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4469 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Emanuele Giaquinta 2007-04-29 09:15:36 +00:00 committed by exg
parent aa172e0afb
commit 09f2bf2c05

View File

@ -69,14 +69,9 @@ void window_item_activity(WI_ITEM_REC *item, int data_level,
GINT_TO_POINTER(old_data_level)); GINT_TO_POINTER(old_data_level));
} }
#define hide_target_activity(data_level, target) \
((target) != NULL && hide_targets != NULL && \
strarray_find(hide_targets, target) != -1)
static void sig_hilight_text(TEXT_DEST_REC *dest, const char *msg) static void sig_hilight_text(TEXT_DEST_REC *dest, const char *msg)
{ {
WI_ITEM_REC *item; WI_ITEM_REC *item;
char *tagtarget;
int data_level; int data_level;
if (dest->window == active_win || (dest->level & hide_level)) if (dest->window == active_win || (dest->level & hide_level))
@ -89,19 +84,18 @@ static void sig_hilight_text(TEXT_DEST_REC *dest, const char *msg)
DATA_LEVEL_MSG : DATA_LEVEL_TEXT; DATA_LEVEL_MSG : DATA_LEVEL_TEXT;
} }
if ((dest->level & MSGLEVEL_HILIGHT) == 0 && dest->target != NULL) { if (hide_targets != NULL && (dest->level & MSGLEVEL_HILIGHT) == 0 && dest->target != NULL) {
/* check for both target and tag/target */ /* check for both target and tag/target */
if (hide_target_activity(data_level, dest->target)) if (strarray_find(hide_targets, dest->target) != -1)
return; return;
tagtarget = dest->server_tag == NULL ? NULL : if (dest->server_tag != NULL) {
g_strdup_printf("%s/%s", dest->server_tag, char *tagtarget = g_strdup_printf("%s/%s", dest->server_tag, dest->target);
dest->target); int ret = strarray_find(hide_targets, tagtarget);
if (hide_target_activity(data_level, tagtarget)) {
g_free(tagtarget); g_free(tagtarget);
if (ret != -1)
return; return;
} }
g_free(tagtarget);
} }
if (dest->target != NULL) { if (dest->target != NULL) {