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

Ignore case for chat room mention notification

This commit is contained in:
James Booth 2014-05-24 16:59:45 +01:00
parent 866d87af79
commit 8e14946aad
2 changed files with 14 additions and 8 deletions

View File

@ -488,7 +488,7 @@ static struct cmd_t command_defs[] =
" : on|off", " : on|off",
"", "",
"Example : /notify message on (enable message notifications)", "Example : /notify message on (enable message notifications)",
"Example : /notify message on (enable chat room notifications)", "Example : /notify room mention (enable chat room notifications only on mention)",
"Example : /notify remind 10 (remind every 10 seconds)", "Example : /notify remind 10 (remind every 10 seconds)",
"Example : /notify remind 0 (switch off reminders)", "Example : /notify remind 0 (switch off reminders)",
"Example : /notify typing on (enable typing notifications)", "Example : /notify typing on (enable typing notifications)",

View File

@ -1701,9 +1701,15 @@ _ui_room_message(const char * const room_jid, const char * const nick,
if (g_strcmp0(room_setting, "on") == 0) { if (g_strcmp0(room_setting, "on") == 0) {
notify = TRUE; notify = TRUE;
} }
if ( (g_strcmp0(room_setting, "mention") == 0) && (g_strrstr(message, nick) != NULL) ) { if (g_strcmp0(room_setting, "mention") == 0) {
char *message_lower = g_utf8_strdown(message, -1);
char *nick_lower = g_utf8_strdown(nick, -1);
if (g_strrstr(message_lower, nick_lower) != NULL) {
notify = TRUE; notify = TRUE;
} }
g_free(message_lower);
g_free(nick_lower);
}
if (notify) { if (notify) {
Jid *jidp = jid_create(room_jid); Jid *jidp = jid_create(room_jid);
notify_room_message(nick, jidp->localpart, ui_index); notify_room_message(nick, jidp->localpart, ui_index);