Added desktop notifications for chat room invites

Use "/notify invite on|off"
This commit is contained in:
James Booth
2013-04-22 23:48:23 +01:00
parent 9373f41fa4
commit f099bf9a7c
6 changed files with 45 additions and 1 deletions

View File

@@ -34,6 +34,7 @@
#include "config/preferences.h"
#include "contact_list.h"
#include "config/theme.h"
#include "ui/notifier.h"
#include "ui/window.h"
#include "ui/ui.h"
@@ -675,6 +676,10 @@ cons_show_room_invite(const char * const invitor, const char * const room,
cons_show("Type \"/join %s\" to accept the invitation", display_room);
if (prefs_get_boolean(PREF_NOTIFY_INVITE)) {
notify_invite(invitor, room);
}
jid_destroy(room_jid);
g_string_free(default_service, TRUE);
@@ -897,6 +902,11 @@ cons_show_desktop_prefs(void)
else
cons_show("Composing (/notify typing) : OFF");
if (prefs_get_boolean(PREF_NOTIFY_INVITE))
cons_show("Room invites (/notify invite) : ON");
else
cons_show("Room invites (/notify invite) : OFF");
gint remind_period = prefs_get_notify_remind();
if (remind_period == 0) {
cons_show("Reminder period (/notify remind) : OFF");

View File

@@ -65,6 +65,19 @@ notify_typing(const char * const from)
_notify(message, 10000, "Incoming message");
}
void
notify_invite(const char * const from, const char * const room)
{
GString *message = g_string_new("Room invite\nfrom: ");
g_string_append(message, from);
g_string_append(message, "\nto: ");
g_string_append(message, room);
_notify(message->str, 10000, "Incoming message");
g_string_free(message, FALSE);
}
void
notify_message(const char * const short_from)
{

View File

@@ -26,3 +26,4 @@ void notifier_uninit(void);
void notify_typing(const char * const from);
void notify_message(const char * const short_from);
void notify_remind(void);
void notify_invite(const char * const from, const char * const room);