mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Merge pull request #297 from vague666/hilight_nick_matches
Add new setting to modify behaviour of hilight_nick_matches to match anywhere in message Fixes #56
This commit is contained in:
commit
618a636f7c
@ -571,6 +571,14 @@ int nick_match_msg(CHANNEL_REC *channel, const char *msg, const char *nick)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int nick_match_msg_everywhere(CHANNEL_REC *channel, const char *msg, const char *nick)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail(nick != NULL, FALSE);
|
||||||
|
g_return_val_if_fail(msg != NULL, FALSE);
|
||||||
|
|
||||||
|
return stristr_full(msg, nick) != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void nicklist_init(void)
|
void nicklist_init(void)
|
||||||
{
|
{
|
||||||
signal_add_first("channel created", (SIGNAL_FUNC) sig_channel_created);
|
signal_add_first("channel created", (SIGNAL_FUNC) sig_channel_created);
|
||||||
|
@ -55,6 +55,7 @@ int nicklist_compare(NICK_REC *p1, NICK_REC *p2, const char *nick_prefix);
|
|||||||
|
|
||||||
/* Check is `msg' is meant for `nick'. */
|
/* Check is `msg' is meant for `nick'. */
|
||||||
int nick_match_msg(CHANNEL_REC *channel, const char *msg, const char *nick);
|
int nick_match_msg(CHANNEL_REC *channel, const char *msg, const char *nick);
|
||||||
|
int nick_match_msg_everywhere(CHANNEL_REC *channel, const char *msg, const char *nick);
|
||||||
|
|
||||||
void nicklist_init(void);
|
void nicklist_init(void);
|
||||||
void nicklist_deinit(void);
|
void nicklist_deinit(void);
|
||||||
|
@ -183,7 +183,9 @@ static void sig_message_public(SERVER_REC *server, const char *msg,
|
|||||||
nickrec = nicklist_find(chanrec, nick);
|
nickrec = nicklist_find(chanrec, nick);
|
||||||
|
|
||||||
for_me = !settings_get_bool("hilight_nick_matches") ? FALSE :
|
for_me = !settings_get_bool("hilight_nick_matches") ? FALSE :
|
||||||
nick_match_msg(chanrec, msg, server->nick);
|
!settings_get_bool("hilight_nick_matches_everywhere") ?
|
||||||
|
nick_match_msg(chanrec, msg, server->nick) :
|
||||||
|
nick_match_msg_everywhere(chanrec, msg, server->nick);
|
||||||
hilight = for_me ? NULL :
|
hilight = for_me ? NULL :
|
||||||
hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC, msg);
|
hilight_match_nick(server, target, nick, address, MSGLEVEL_PUBLIC, msg);
|
||||||
color = (hilight == NULL) ? NULL : hilight_get_color(hilight);
|
color = (hilight == NULL) ? NULL : hilight_get_color(hilight);
|
||||||
@ -694,6 +696,7 @@ void fe_messages_init(void)
|
|||||||
(GCompareFunc) g_direct_equal);
|
(GCompareFunc) g_direct_equal);
|
||||||
|
|
||||||
settings_add_bool("lookandfeel", "hilight_nick_matches", TRUE);
|
settings_add_bool("lookandfeel", "hilight_nick_matches", TRUE);
|
||||||
|
settings_add_bool("lookandfeel", "hilight_nick_matches_everywhere", FALSE);
|
||||||
settings_add_bool("lookandfeel", "emphasis", TRUE);
|
settings_add_bool("lookandfeel", "emphasis", TRUE);
|
||||||
settings_add_bool("lookandfeel", "emphasis_replace", FALSE);
|
settings_add_bool("lookandfeel", "emphasis_replace", FALSE);
|
||||||
settings_add_bool("lookandfeel", "emphasis_multiword", FALSE);
|
settings_add_bool("lookandfeel", "emphasis_multiword", FALSE);
|
||||||
|
Loading…
Reference in New Issue
Block a user