diff --git a/src/config/preferences.c b/src/config/preferences.c index 10ef4549..f419eff4 100644 --- a/src/config/preferences.c +++ b/src/config/preferences.c @@ -211,6 +211,29 @@ prefs_do_chat_notify(gboolean current_win, const char *const message) return FALSE; } +gboolean +prefs_message_contains_trigger(const char *const message) +{ + gboolean trigger_found = FALSE; + char *message_lower = g_utf8_strdown(message, -1); + gsize len = 0; + gchar **triggers = g_key_file_get_string_list(prefs, PREF_GROUP_NOTIFICATIONS, "room.trigger.list", &len, NULL); + int i; + for (i = 0; i < len; i++) { + char *trigger_lower = g_utf8_strdown(triggers[i], -1); + if (g_strrstr(message_lower, trigger_lower)) { + trigger_found = TRUE; + g_free(trigger_lower); + break; + } + g_free(trigger_lower); + } + g_strfreev(triggers); + g_free(message_lower); + + return trigger_found; +} + gboolean prefs_do_room_notify(gboolean current_win, const char *const roomjid, const char *const nick, const char *const message) @@ -258,27 +281,8 @@ prefs_do_room_notify(gboolean current_win, const char *const roomjid, const char } else { notify_trigger = prefs_get_boolean(PREF_NOTIFY_ROOM_TRIGGER); } - if (notify_trigger) { - gboolean trigger_found = FALSE; - char *message_lower = g_utf8_strdown(message, -1); - gsize len = 0; - gchar **triggers = g_key_file_get_string_list(prefs, PREF_GROUP_NOTIFICATIONS, "room.trigger.list", &len, NULL); - int i; - for (i = 0; i < len; i++) { - char *trigger_lower = g_utf8_strdown(triggers[i], -1); - if (g_strrstr(message_lower, trigger_lower)) { - trigger_found = TRUE; - g_free(trigger_lower); - break; - } - g_free(trigger_lower); - } - g_strfreev(triggers); - g_free(message_lower); - - if (trigger_found) { - return TRUE; - } + if (notify_trigger && prefs_message_contains_trigger(message)) { + return TRUE; } return FALSE; diff --git a/src/config/preferences.h b/src/config/preferences.h index 4fee90b9..8c94a1e1 100644 --- a/src/config/preferences.h +++ b/src/config/preferences.h @@ -226,6 +226,7 @@ void prefs_set_string(preference_t pref, char *value); gboolean prefs_do_chat_notify(gboolean current_win, const char *const message); gboolean prefs_do_room_notify(gboolean current_win, const char *const roomjid, const char *const nick, const char *const message); +gboolean prefs_message_contains_trigger(const char *const message); void prefs_set_room_notify(const char *const roomjid, gboolean value); void prefs_set_room_notify_mention(const char *const roomjid, gboolean value); diff --git a/src/config/theme.c b/src/config/theme.c index 7222e841..0e790eb2 100644 --- a/src/config/theme.c +++ b/src/config/theme.c @@ -105,6 +105,7 @@ theme_init(const char *const theme_name) g_hash_table_insert(defaults, strdup("receipt.sent"), strdup("red")); g_hash_table_insert(defaults, strdup("roominfo"), strdup("yellow")); g_hash_table_insert(defaults, strdup("roommention"), strdup("yellow")); + g_hash_table_insert(defaults, strdup("roomtrigger"), strdup("yellow")); g_hash_table_insert(defaults, strdup("online"), strdup("green")); g_hash_table_insert(defaults, strdup("offline"), strdup("red")); g_hash_table_insert(defaults, strdup("away"), strdup("cyan")); @@ -727,6 +728,7 @@ theme_attrs(theme_item_t attrs) case THEME_RECEIPT_SENT: _theme_prep_fgnd("receipt.sent", "red", lookup_str, &bold); break; case THEME_ROOMINFO: _theme_prep_fgnd("roominfo", "yellow", lookup_str, &bold); break; case THEME_ROOMMENTION: _theme_prep_fgnd("roommention", "yellow", lookup_str, &bold); break; + case THEME_ROOMTRIGGER: _theme_prep_fgnd("roomtrigger", "yellow", lookup_str, &bold); break; case THEME_ONLINE: _theme_prep_fgnd("online", "green", lookup_str, &bold); break; case THEME_OFFLINE: _theme_prep_fgnd("offline", "red", lookup_str, &bold); break; case THEME_AWAY: _theme_prep_fgnd("away", "cyan", lookup_str, &bold); break; diff --git a/src/config/theme.h b/src/config/theme.h index f4eac724..c26b84f1 100644 --- a/src/config/theme.h +++ b/src/config/theme.h @@ -68,6 +68,7 @@ typedef enum { THEME_THEM, THEME_ROOMINFO, THEME_ROOMMENTION, + THEME_ROOMTRIGGER, THEME_ONLINE, THEME_OFFLINE, THEME_AWAY, diff --git a/src/ui/console.c b/src/ui/console.c index bd8b9171..6fd6fc38 100644 --- a/src/ui/console.c +++ b/src/ui/console.c @@ -2125,6 +2125,7 @@ cons_theme_properties(void) _cons_theme_prop(THEME_ROOMINFO, "roominfo"); _cons_theme_prop(THEME_ROOMMENTION, "roommention"); + _cons_theme_prop(THEME_ROOMTRIGGER, "roomtrigger"); _cons_theme_prop(THEME_ROSTER_HEADER, "roster.header"); _cons_theme_prop(THEME_ROSTER_CHAT, "roster.chat"); diff --git a/src/ui/mucwin.c b/src/ui/mucwin.c index 4674b198..37da10dd 100644 --- a/src/ui/mucwin.c +++ b/src/ui/mucwin.c @@ -366,6 +366,8 @@ mucwin_message(ProfMucWin *mucwin, const char *const nick, const char *const mes if (g_strcmp0(nick, my_nick) != 0) { if (g_strrstr(message, my_nick)) { win_print(window, '-', 0, NULL, NO_ME, THEME_ROOMMENTION, nick, message); + } else if (prefs_message_contains_trigger(message)) { + win_print(window, '-', 0, NULL, NO_ME, THEME_ROOMTRIGGER, nick, message); } else { win_print(window, '-', 0, NULL, NO_ME, THEME_TEXT_THEM, nick, message); } diff --git a/theme_template b/theme_template index 83716865..b363c041 100644 --- a/theme_template +++ b/theme_template @@ -43,6 +43,7 @@ gone= error= roominfo= roommention= +roomtrigger= me= them= roster.header= diff --git a/themes/aqua b/themes/aqua index 7ca54abd..dbfd9d30 100644 --- a/themes/aqua +++ b/themes/aqua @@ -43,6 +43,7 @@ gone=blue error=bold_white roominfo=white roommention=bold_blue +roomtrigger=bold_blue me=cyan them=white roster.header=bold_white diff --git a/themes/batman b/themes/batman index d5fb1dee..87cb3e30 100644 --- a/themes/batman +++ b/themes/batman @@ -45,6 +45,7 @@ main.text.them=white subscribed=magenta unsubscribed=black_bold roommention=cyan +roomtrigger=cyan roster.header=yellow roster.chat=green roster.online=green diff --git a/themes/bios b/themes/bios index 14ed4dbe..2dfd4975 100644 --- a/themes/bios +++ b/themes/bios @@ -43,6 +43,7 @@ gone=bold_red error=bold_red roominfo=bold_yellow roommention=bold_green +roomtrigger=bold_green me=bold_cyan them=bold_magenta roster.header=bold_magenta diff --git a/themes/boothj5 b/themes/boothj5 index 2a627787..da42f125 100644 --- a/themes/boothj5 +++ b/themes/boothj5 @@ -42,7 +42,8 @@ typing=yellow gone=red error=red roominfo=yellow -roommention=bold_red +roommention=bold_magenta +roomtrigger=bold_cyan me=blue them=bold_green roster.header=bold_yellow diff --git a/themes/forest b/themes/forest index 92cbcc5f..9d687f3c 100644 --- a/themes/forest +++ b/themes/forest @@ -43,6 +43,7 @@ gone=bold_black error=bold_black roominfo=yellow roommention=bold_cyan +roomtrigger=bold_cyan me=blue them=bold_blue roster.header=bold_green diff --git a/themes/hacker b/themes/hacker index 09baebb9..4ece8417 100644 --- a/themes/hacker +++ b/themes/hacker @@ -43,6 +43,7 @@ gone=green error=bold_green roominfo=green roommention=bold_green +roomtrigger=bold_green me=green them=bold_green roster.header=bold_green diff --git a/themes/headache b/themes/headache index ed4b7e72..7686d99d 100644 --- a/themes/headache +++ b/themes/headache @@ -43,6 +43,7 @@ gone=yellow error=red roominfo=white roommention=bold_green +roomtrigger=bold_green me=white them=white roster.header=bold_cyan diff --git a/themes/joker b/themes/joker index 6d49e171..0f4db59f 100644 --- a/themes/joker +++ b/themes/joker @@ -43,6 +43,7 @@ gone=red error=red roominfo=green roommention=green +roomtrigger=green me=magenta them=green roster.header=magenta diff --git a/themes/mono b/themes/mono index 96882cea..c74d7509 100644 --- a/themes/mono +++ b/themes/mono @@ -43,6 +43,7 @@ gone=white error=white roominfo=white roommention=white +roomtrigger=white me=white them=white roster.header=white diff --git a/themes/orange b/themes/orange index 6bbe7490..220f448e 100644 --- a/themes/orange +++ b/themes/orange @@ -43,6 +43,7 @@ gone=green error=red roominfo=blue roommention=blue +roomtrigger=blue me=black them=black roster.header=black diff --git a/themes/original b/themes/original index bd1651f5..ab6f5b44 100644 --- a/themes/original +++ b/themes/original @@ -43,6 +43,7 @@ gone=yellow error=red roominfo=yellow roommention=yellow +roomtrigger=yellow me=yellow them=green roster.header=yellow diff --git a/themes/original_bright b/themes/original_bright index 76eb0e4c..032a8a8a 100644 --- a/themes/original_bright +++ b/themes/original_bright @@ -43,6 +43,7 @@ gone=bold_yellow error=bold_red roominfo=bold_yellow roommention=bold_yellow +roomtrigger=bold_yellow me=bold_yellow them=bold_green roster.header=bold_yellow diff --git a/themes/shade b/themes/shade index 9227945a..9bc4d2eb 100644 --- a/themes/shade +++ b/themes/shade @@ -43,6 +43,7 @@ gone=red error=red roominfo=green roommention=green +roomtrigger=green me=bold_black them=magenta roster.header=magenta diff --git a/themes/spawn b/themes/spawn index 13323309..e04ab5f5 100644 --- a/themes/spawn +++ b/themes/spawn @@ -43,6 +43,7 @@ gone=red error=red roominfo=green roommention=red +roomtrigger=red me=green them=yellow roster.header=white diff --git a/themes/whiteness b/themes/whiteness index e01ee646..22d70ef4 100644 --- a/themes/whiteness +++ b/themes/whiteness @@ -43,6 +43,7 @@ gone=red error=red roominfo=yellow roommention=yellow +roomtrigger=yellow me=black them=black roster.header=black