mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added room name, and window index to desktop message notifications
closes #176
This commit is contained in:
parent
0ced96f578
commit
486cbd6245
@ -426,10 +426,15 @@ ui_incoming_msg(const char * const from, const char * const message,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ui_index = win_index + 1;
|
||||||
|
if (ui_index == 10) {
|
||||||
|
ui_index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (prefs_get_boolean(PREF_BEEP))
|
if (prefs_get_boolean(PREF_BEEP))
|
||||||
beep();
|
beep();
|
||||||
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE))
|
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE))
|
||||||
notify_message(display_from);
|
notify_message(display_from, ui_index);
|
||||||
|
|
||||||
FREE_SET_NULL(display_from);
|
FREE_SET_NULL(display_from);
|
||||||
}
|
}
|
||||||
@ -1227,12 +1232,19 @@ ui_room_message(const char * const room_jid, const char * const nick,
|
|||||||
windows[win_index]->unread++;
|
windows[win_index]->unread++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ui_index = win_index + 1;
|
||||||
|
if (ui_index == 10) {
|
||||||
|
ui_index = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (strcmp(nick, muc_get_room_nick(room_jid)) != 0) {
|
if (strcmp(nick, muc_get_room_nick(room_jid)) != 0) {
|
||||||
if (prefs_get_boolean(PREF_BEEP)) {
|
if (prefs_get_boolean(PREF_BEEP)) {
|
||||||
beep();
|
beep();
|
||||||
}
|
}
|
||||||
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) {
|
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) {
|
||||||
notify_message(nick);
|
Jid *jidp = jid_create(room_jid);
|
||||||
|
notify_room_message(nick, jidp->localpart, ui_index);
|
||||||
|
jid_destroy(jidp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,12 +84,25 @@ notify_invite(const char * const from, const char * const room,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
notify_message(const char * const handle)
|
notify_message(const char * const handle, int win)
|
||||||
{
|
{
|
||||||
char message[strlen(handle) + 1 + 10];
|
char message[strlen(handle) + 1 + 14];
|
||||||
sprintf(message, "%s: message.", handle);
|
sprintf(message, "%s: message (%d).", handle, win);
|
||||||
|
|
||||||
_notify(message, 10000, "Incoming message");
|
_notify(message, 10000, "incoming message");
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
notify_room_message(const char * const handle, const char * const room, int win)
|
||||||
|
{
|
||||||
|
GString *text = g_string_new("");
|
||||||
|
|
||||||
|
g_string_append_printf(text, "Room: %s\n", room);
|
||||||
|
g_string_append_printf(text, "%s: message (%d).", handle, win);
|
||||||
|
|
||||||
|
_notify(text->str, 10000, "incoming message");
|
||||||
|
|
||||||
|
g_string_free(text, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -24,7 +24,9 @@ void notifier_init(void);
|
|||||||
void notifier_uninit(void);
|
void notifier_uninit(void);
|
||||||
|
|
||||||
void notify_typing(const char * const handle);
|
void notify_typing(const char * const handle);
|
||||||
void notify_message(const char * const handle);
|
void notify_message(const char * const handle, int win);
|
||||||
|
void notify_room_message(const char * const handle, const char * const room,
|
||||||
|
int win);
|
||||||
void notify_remind(void);
|
void notify_remind(void);
|
||||||
void notify_invite(const char * const from, const char * const room,
|
void notify_invite(const char * const from, const char * const room,
|
||||||
const char * const reason);
|
const char * const reason);
|
||||||
|
Loading…
Reference in New Issue
Block a user