From 0f2514932221f4ab411400b88b7ec648bb542503 Mon Sep 17 00:00:00 2001
From: pierre-luc <pierre-luc.bacon@savoirfairelinux.com>
Date: Tue, 11 Aug 2009 16:45:52 -0400
Subject: [PATCH] [#2028] Notify the client with libnotify when the zrtp
 negotiation failed.

---
 sflphone-client-gnome/src/dbus/dbus.c |  5 +++++
 sflphone-client-gnome/src/sflnotify.c | 15 +++++++++++++++
 sflphone-client-gnome/src/sflnotify.h |  6 ++++++
 3 files changed, 26 insertions(+)

diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c
index f9e457077c..4445af8f17 100644
--- a/sflphone-client-gnome/src/dbus/dbus.c
+++ b/sflphone-client-gnome/src/dbus/dbus.c
@@ -76,6 +76,11 @@ zrtp_negotiation_failed_cb (DBusGProxy *proxy UNUSED,
 {
     DEBUG ("Zrtp negotiation failed.");
     main_window_zrtp_negotiation_failed(callID, reason, severity);
+    callable_obj_t * c = NULL;
+    c = calllist_get(current_calls, callID);
+    if(c) {
+        notify_zrtp_negotiation_failed(c);
+    }
 }
 
     static void
diff --git a/sflphone-client-gnome/src/sflnotify.c b/sflphone-client-gnome/src/sflnotify.c
index 246612f809..ab1ccabe5a 100644
--- a/sflphone-client-gnome/src/sflnotify.c
+++ b/sflphone-client-gnome/src/sflnotify.c
@@ -210,6 +210,21 @@ notify_zrtp_not_supported (callable_obj_t* c)
                                         &_gnome_notification); 
 }
 
+    void
+notify_zrtp_negotiation_failed (callable_obj_t* c)
+{
+
+        gchar* callerid;
+        gchar* title;
+        title = g_markup_printf_escaped ("ZRTP Error.");
+        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,
+                                        &_gnome_notification); 
+}
+
     void
 notify_secure_off (callable_obj_t* c)
 {
diff --git a/sflphone-client-gnome/src/sflnotify.h b/sflphone-client-gnome/src/sflnotify.h
index cf5cc8f57a..69d686dd55 100644
--- a/sflphone-client-gnome/src/sflnotify.h
+++ b/sflphone-client-gnome/src/sflnotify.h
@@ -90,6 +90,12 @@ void notify_secure_on (callable_obj_t* c);
  */
 void notify_secure_off (callable_obj_t* c);
 
+/**
+ * Notify that the ZRTP negotiation failed
+ */
+ 
+void notify_zrtp_negotiation_failed (callable_obj_t* c);
+
 /**
  * Notify that the RTP session is now more secured
  */
-- 
GitLab