Skip to content
Snippets Groups Projects
Commit af1deb13 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #7501: disable libnotify functionality versions < 0.7.2

parent f199be60
No related branches found
No related tags found
No related merge requests found
......@@ -33,16 +33,21 @@
#include "sflnotify.h"
#include "logger.h"
#define USE_NOTIFY NOTIFY_CHECK_VERSION(0,7,2)
#if USE_NOTIFY
typedef struct {
NotifyNotification *notification;
gchar *title;
gchar *body;
GdkPixbuf *icon;
} GnomeNotification;
#endif
static void
create_new_gnome_notification(gchar *title, gchar *body, NotifyUrgency urgency, gint timeout)
{
#if USE_NOTIFY
GnomeNotification notif;
if (eel_gconf_get_integer(NOTIFY_ALL)) {
......@@ -68,22 +73,26 @@ create_new_gnome_notification(gchar *title, gchar *body, NotifyUrgency urgency,
g_free(title);
g_free(body);
#endif
}
void
notify_incoming_message(const gchar *callID, const gchar *msg)
{
#if USE_NOTIFY
gchar* title = g_markup_printf_escaped(_("%s says:"), callID);
create_new_gnome_notification(title,
(gchar *)msg,
NOTIFY_URGENCY_CRITICAL,
(g_strcasecmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER);
#endif
}
void
notify_incoming_call(callable_obj_t* c)
{
#if USE_NOTIFY
gchar* title;
if (strlen(c->_accountID) == 0)
......@@ -100,11 +109,13 @@ notify_incoming_call(callable_obj_t* c)
callerid,
NOTIFY_URGENCY_CRITICAL,
(g_strcasecmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER);
#endif
}
void
notify_voice_mails(guint count, account_t* acc)
{
#if USE_NOTIFY
// the account is different from NULL
gchar *title = g_markup_printf_escaped(_("%s account : %s") ,
(gchar*) g_hash_table_lookup(acc->properties , ACCOUNT_TYPE) ,
......@@ -115,11 +126,13 @@ notify_voice_mails(guint count, account_t* acc)
body,
NOTIFY_URGENCY_LOW,
NOTIFY_EXPIRES_DEFAULT);
#endif
}
void
notify_current_account(account_t* acc)
{
#if USE_NOTIFY
// the account is different from NULL
gchar *body = g_markup_printf_escaped(_("Calling with %s account <i>%s</i>"),
(gchar*) g_hash_table_lookup(acc->properties, ACCOUNT_TYPE) ,
......@@ -129,70 +142,83 @@ notify_current_account(account_t* acc)
create_new_gnome_notification(title, body, NOTIFY_URGENCY_NORMAL,
NOTIFY_EXPIRES_DEFAULT);
#endif
}
void
notify_no_accounts()
{
#if USE_NOTIFY
gchar *body = g_markup_printf_escaped(_("You have no accounts set up"));
gchar *title = g_markup_printf_escaped(_("Error"));
create_new_gnome_notification(title, body, NOTIFY_URGENCY_CRITICAL,
NOTIFY_EXPIRES_DEFAULT);
#endif
}
void
notify_no_registered_accounts()
{
#if USE_NOTIFY
gchar *body = g_markup_printf_escaped(_("You have no registered accounts"));
gchar *title = g_markup_printf_escaped(_("Error"));
create_new_gnome_notification(title, body, NOTIFY_URGENCY_CRITICAL,
NOTIFY_EXPIRES_DEFAULT);
#endif
}
void
notify_secure_on(callable_obj_t* c)
{
#if USE_NOTIFY
gchar *title = g_markup_printf_escaped("Secure mode on.");
gchar *callerid = g_markup_printf_escaped(_("<i>With:</i> %s \nusing %s") , c->_peer_number, c->_srtp_cipher);
create_new_gnome_notification(title,
callerid,
NOTIFY_URGENCY_CRITICAL,
(g_strcasecmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER);
#endif
}
void
notify_zrtp_not_supported(callable_obj_t* c)
{
#if USE_NOTIFY
gchar *title = g_markup_printf_escaped("ZRTP Error.");
gchar *callerid = g_markup_printf_escaped(_("%s does not support ZRTP.") , c->_peer_number);
create_new_gnome_notification(title,
callerid,
NOTIFY_URGENCY_CRITICAL,
(g_strcasecmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER);
#endif
}
void
notify_zrtp_negotiation_failed(callable_obj_t* c)
{
#if USE_NOTIFY
gchar *title = g_markup_printf_escaped("ZRTP Error.");
gchar *callerid = g_markup_printf_escaped(_("ZRTP negotiation failed with %s"), c->_peer_number);
create_new_gnome_notification(title,
callerid,
NOTIFY_URGENCY_CRITICAL,
(g_strcasecmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER);
#endif
}
void
notify_secure_off(callable_obj_t* c)
{
#if USE_NOTIFY
gchar *title = g_markup_printf_escaped("Secure mode is off.");
gchar *callerid = g_markup_printf_escaped(_("<i>With:</i> %s"), c->_peer_number);
create_new_gnome_notification(title,
callerid,
NOTIFY_URGENCY_CRITICAL,
(g_strcasecmp(__TIMEOUT_MODE, "default") == 0) ? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER);
#endif
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment