mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Tidy notify_room_message()
This commit is contained in:
parent
c14ef33906
commit
e1962261a9
@ -305,22 +305,11 @@ sv_ev_room_message(const char *const room_jid, const char *const nick, const cha
|
||||
beep();
|
||||
}
|
||||
|
||||
if (!notify) {
|
||||
return;
|
||||
if (notify) {
|
||||
Jid *jidp = jid_create(mucwin->roomjid);
|
||||
notify_room_message(nick, jidp->localpart, num, message);
|
||||
jid_destroy(jidp);
|
||||
}
|
||||
|
||||
Jid *jidp = jid_create(mucwin->roomjid);
|
||||
int ui_index = num;
|
||||
if (ui_index == 10) {
|
||||
ui_index = 0;
|
||||
}
|
||||
|
||||
if (prefs_get_boolean(PREF_NOTIFY_ROOM_TEXT)) {
|
||||
notify_room_message(nick, jidp->localpart, ui_index, message);
|
||||
} else {
|
||||
notify_room_message(nick, jidp->localpart, ui_index, NULL);
|
||||
}
|
||||
jid_destroy(jidp);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -117,11 +117,16 @@ notify_message(const char *const name, int num, const char *const text)
|
||||
}
|
||||
|
||||
void
|
||||
notify_room_message(const char *const nick, const char *const room, int win, const char *const text)
|
||||
notify_room_message(const char *const nick, const char *const room, int num, const char *const text)
|
||||
{
|
||||
int ui_index = num;
|
||||
if (ui_index == 10) {
|
||||
ui_index = 0;
|
||||
}
|
||||
|
||||
GString *message = g_string_new("");
|
||||
g_string_append_printf(message, "%s in %s (win %d)", nick, room, win);
|
||||
if (text) {
|
||||
g_string_append_printf(message, "%s in %s (win %d)", nick, room, ui_index);
|
||||
if (text && prefs_get_boolean(PREF_NOTIFY_ROOM_TEXT)) {
|
||||
g_string_append_printf(message, "\n%s", text);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user