mirror of
https://github.com/irssi/irssi.git
synced 2024-10-27 05:20:20 -04:00
Add strarray_find_dest(). Useful for checking whether a server_tag/target or target is found in a vector of strings.
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@5002 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
b12bd857a5
commit
32e01a5a06
@ -463,3 +463,20 @@ void fe_common_core_finish_init(void)
|
||||
autorun_startup();
|
||||
autoconnect_servers();
|
||||
}
|
||||
|
||||
gboolean strarray_find_dest(char **array, const TEXT_DEST_REC *dest)
|
||||
{
|
||||
g_return_val_if_fail(array != NULL, FALSE);
|
||||
|
||||
if (strarray_find(array, dest->target) != -1)
|
||||
return TRUE;
|
||||
|
||||
if (dest->server_tag != NULL) {
|
||||
char *tagtarget = g_strdup_printf("%s/%s", dest->server_tag, dest->target);
|
||||
int ret = strarray_find(array, tagtarget);
|
||||
g_free(tagtarget);
|
||||
if (ret != -1)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -6,4 +6,8 @@ void fe_common_core_init(void);
|
||||
void fe_common_core_deinit(void);
|
||||
void fe_common_core_finish_init(void);
|
||||
|
||||
/* Returns TRUE if "dest->target" or "dest->server_tag/dest->target" is found in
|
||||
* array, otherwise FALSE. */
|
||||
gboolean strarray_find_dest(char **array, const TEXT_DEST_REC *dest);
|
||||
|
||||
#endif
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "nicklist.h"
|
||||
#include "hilight-text.h"
|
||||
#include "formats.h"
|
||||
#include "fe-common-core.h"
|
||||
|
||||
static char **hide_targets;
|
||||
static int hide_level, msg_level, hilight_level;
|
||||
@ -86,16 +87,8 @@ static void sig_hilight_text(TEXT_DEST_REC *dest, const char *msg)
|
||||
|
||||
if (hide_targets != NULL && (dest->level & MSGLEVEL_HILIGHT) == 0 && dest->target != NULL) {
|
||||
/* check for both target and tag/target */
|
||||
if (strarray_find(hide_targets, dest->target) != -1)
|
||||
if (strarray_find_dest(hide_targets, dest))
|
||||
return;
|
||||
|
||||
if (dest->server_tag != NULL) {
|
||||
char *tagtarget = g_strdup_printf("%s/%s", dest->server_tag, dest->target);
|
||||
int ret = strarray_find(hide_targets, tagtarget);
|
||||
g_free(tagtarget);
|
||||
if (ret != -1)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (dest->target != NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user