Detect hilights in NOTICEs

This commit is contained in:
Flisk 2019-04-04 23:38:39 +02:00
parent c1091c38b8
commit 4ac7664a06
5 changed files with 16 additions and 0 deletions

View File

@ -935,6 +935,7 @@ inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id,
char *ptr = to;
session *sess = 0;
int server_notice = FALSE;
int hilight = FALSE;
if (is_channel (serv, ptr))
sess = find_channel (serv, ptr);
@ -1021,9 +1022,15 @@ inbound_notice (server *serv, char *to, char *nick, char *msg, char *ip, int id,
msg[len - 1] = '\000';
}
if (is_hilight (nick, msg, sess, serv))
hilight = TRUE;
if (server_notice)
EMIT_SIGNAL_TIMESTAMP (XP_TE_SERVNOTICE, sess, msg, nick, NULL, NULL, 0,
tags_data->timestamp);
else if (hilight)
EMIT_SIGNAL_TIMESTAMP (XP_TE_HCHANNOTICE, sess, nick, to, msg, NULL, 0,
tags_data->timestamp);
else if (ptr)
EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANNOTICE, sess, nick, to, msg, NULL, 0,
tags_data->timestamp);

View File

@ -2083,6 +2083,7 @@ text_emit (int index, session *sess, char *a, char *b, char *c, char *d,
/* ===Highlighted message=== */
case XP_TE_HCHANACTION:
case XP_TE_HCHANMSG:
case XP_TE_HCHANNOTICE:
if (chanopt_is_set (prefs.hex_input_beep_hilight, sess->alert_beep) && (!prefs.hex_away_omit_alerts || !sess->server->is_away))
sound_beep (sess);
if (chanopt_is_set (prefs.hex_input_flash_hilight, sess->alert_taskbar) && (!prefs.hex_away_omit_alerts || !sess->server->is_away))

View File

@ -148,6 +148,12 @@ pevt_channotice_help
-%C18$1%C/%C22$2%C-$t$3%O
n3
Channel Notice Hilight
XP_TE_HCHANNOTICE
pevt_channotice_help
%C19-%B$1%B/$2-$t$3%O
n3
Channel Operator
XP_TE_CHANOP
pevt_chanop_help

View File

@ -192,6 +192,7 @@ notification_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name, cha
hexchat_hook_print (ph, "Channel Msg Hilight", HEXCHAT_PRI_LOWEST, incoming_hilight_cb, NULL);
hexchat_hook_print (ph, "Channel Action Hilight", HEXCHAT_PRI_LOWEST, incoming_hilight_cb, NULL);
hexchat_hook_print (ph, "Channel Notice Hilight", HEXCHAT_PRI_LOWEST, incoming_hilight_cb, NULL);
hexchat_hook_print (ph, "Channel Message", HEXCHAT_PRI_LOWEST, incoming_message_cb, NULL);
hexchat_hook_print (ph, "Channel Action", HEXCHAT_PRI_LOWEST, incoming_message_cb, NULL);

View File

@ -783,6 +783,7 @@ tray_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name,
hexchat_hook_print (ph, "Channel Msg Hilight", -1, tray_hilight_cb, NULL);
hexchat_hook_print (ph, "Channel Action Hilight", -1, tray_hilight_cb, NULL);
hexchat_hook_print (ph, "Channel Notice Hilight", -1, tray_hilight_cb, NULL);
hexchat_hook_print (ph, "Channel Message", -1, tray_message_cb, NULL);
hexchat_hook_print (ph, "Channel Action", -1, tray_message_cb, NULL);