Added settings to show message text in notifications
This commit is contained in:
@@ -1168,6 +1168,11 @@ _cons_notify_setting(void)
|
||||
else
|
||||
cons_show("Messages current (/notify message) : OFF");
|
||||
|
||||
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE_TEXT))
|
||||
cons_show("Messages text (/notify message) : ON");
|
||||
else
|
||||
cons_show("Messages text (/notify message) : OFF");
|
||||
|
||||
char *room_setting = prefs_get_string(PREF_NOTIFY_ROOM);
|
||||
cons_show ("Room messages (/notify room) : %s", room_setting);
|
||||
|
||||
@@ -1176,6 +1181,11 @@ _cons_notify_setting(void)
|
||||
else
|
||||
cons_show("Room current (/notify room) : OFF");
|
||||
|
||||
if (prefs_get_boolean(PREF_NOTIFY_ROOM_TEXT))
|
||||
cons_show("Room text (/notify room) : ON");
|
||||
else
|
||||
cons_show("Room text (/notify room) : OFF");
|
||||
|
||||
if (prefs_get_boolean(PREF_NOTIFY_TYPING))
|
||||
cons_show("Composing (/notify typing) : ON");
|
||||
else
|
||||
|
||||
@@ -376,7 +376,11 @@ _ui_incoming_msg(const char * const from, const char * const message,
|
||||
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE)) {
|
||||
gboolean is_current = wins_is_current(window);
|
||||
if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_MESSAGE_CURRENT)) ) {
|
||||
notify_message(display_from, ui_index);
|
||||
if (prefs_get_boolean(PREF_NOTIFY_MESSAGE_TEXT)) {
|
||||
notify_message(display_from, ui_index, message);
|
||||
} else {
|
||||
notify_message(display_from, ui_index, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1723,7 +1727,11 @@ _ui_room_message(const char * const room_jid, const char * const nick,
|
||||
gboolean is_current = wins_is_current(window);
|
||||
if ( !is_current || (is_current && prefs_get_boolean(PREF_NOTIFY_ROOM_CURRENT)) ) {
|
||||
Jid *jidp = jid_create(room_jid);
|
||||
notify_room_message(nick, jidp->localpart, ui_index);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,25 +85,31 @@ _notify_invite(const char * const from, const char * const room,
|
||||
}
|
||||
|
||||
static void
|
||||
_notify_message(const char * const handle, int win)
|
||||
_notify_message(const char * const handle, int win, const char * const text)
|
||||
{
|
||||
char message[strlen(handle) + 1 + 14];
|
||||
sprintf(message, "%s: message (%d).", handle, win);
|
||||
GString *message = g_string_new("");
|
||||
g_string_append_printf(message, "%s (win %d)", handle, win);
|
||||
if (text != NULL) {
|
||||
g_string_append_printf(message, "\n%s", text);
|
||||
}
|
||||
|
||||
_notify(message, 10000, "incoming message");
|
||||
_notify(message->str, 10000, "incoming message");
|
||||
|
||||
g_string_free(message, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
_notify_room_message(const char * const handle, const char * const room, int win)
|
||||
_notify_room_message(const char * const handle, const char * const room, int win, const char * const text)
|
||||
{
|
||||
GString *text = g_string_new("");
|
||||
GString *message = g_string_new("");
|
||||
g_string_append_printf(message, "%s in %s (win %d)", handle, room, win);
|
||||
if (text != NULL) {
|
||||
g_string_append_printf(message, "\n%s", text);
|
||||
}
|
||||
|
||||
g_string_append_printf(text, "Room: %s\n", room);
|
||||
g_string_append_printf(text, "%s: message (%d).", handle, win);
|
||||
_notify(message->str, 10000, "incoming message");
|
||||
|
||||
_notify(text->str, 10000, "incoming message");
|
||||
|
||||
g_string_free(text, TRUE);
|
||||
g_string_free(message, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -165,7 +171,6 @@ _notify(const char * const message, int timeout,
|
||||
const char * const category)
|
||||
{
|
||||
#ifdef HAVE_LIBNOTIFY
|
||||
|
||||
if (notify_is_initted()) {
|
||||
NotifyNotification *notification;
|
||||
notification = notify_notification_new("Profanity", message, NULL);
|
||||
|
||||
@@ -260,9 +260,9 @@ void (*notifier_init)(void);
|
||||
void (*notifier_uninit)(void);
|
||||
|
||||
void (*notify_typing)(const char * const handle);
|
||||
void (*notify_message)(const char * const handle, int win);
|
||||
void (*notify_message)(const char * const handle, int win, const char * const text);
|
||||
void (*notify_room_message)(const char * const handle, const char * const room,
|
||||
int win);
|
||||
int win, const char * const text);
|
||||
void (*notify_remind)(void);
|
||||
void (*notify_invite)(const char * const from, const char * const room,
|
||||
const char * const reason);
|
||||
|
||||
Reference in New Issue
Block a user