From 8fde32b77a0ffeac64e83c70b61fcac9e454a42f Mon Sep 17 00:00:00 2001
From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
Date: Tue, 29 Jun 2010 17:52:31 -0400
Subject: [PATCH] [#3620] Display incoming message in a GNOME notification

---
 sflphone-client-gnome/src/dbus/dbus.c | 9 ++++++++-
 sflphone-client-gnome/src/sflnotify.c | 5 ++---
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/sflphone-client-gnome/src/dbus/dbus.c b/sflphone-client-gnome/src/dbus/dbus.c
index 15977c49ff..4aa9c393df 100644
--- a/sflphone-client-gnome/src/dbus/dbus.c
+++ b/sflphone-client-gnome/src/dbus/dbus.c
@@ -124,7 +124,14 @@ incoming_message_cb(DBusGProxy *proxy UNUSED, const gchar* callID UNUSED,
     const gchar* msg, void * foo  UNUSED )
 {
 	DEBUG ("Message %s!",msg);
-	notify_incoming_message (callID, msg);
+
+	// Get the call information. Does this call exist?
+	callable_obj_t * c = calllist_get (current_calls, callID);
+	if (c) {
+		notify_incoming_message (callID, msg);
+	} else {
+		ERROR ("Message received, but no recipient found");
+	}
 }
 
 static void
diff --git a/sflphone-client-gnome/src/sflnotify.c b/sflphone-client-gnome/src/sflnotify.c
index 32a529d77e..3baaeccccf 100644
--- a/sflphone-client-gnome/src/sflnotify.c
+++ b/sflphone-client-gnome/src/sflnotify.c
@@ -74,11 +74,10 @@ notify_incoming_message (const gchar *callID, const gchar *msg)
         gchar* text;
         gchar* title;
 
-        title = g_markup_printf_escaped(_("New message"));
-		text = g_markup_printf_escaped (_("%s says: %s"), callID, msg);
+        title = g_markup_printf_escaped(_("%s says:"), callID);
 
         create_new_gnome_notification (title,
-                                        text, 
+										msg,
                                         NOTIFY_URGENCY_CRITICAL, 
                                         (g_strcasecmp(__TIMEOUT_MODE, "default") == 0 )? __TIMEOUT_TIME : NOTIFY_EXPIRES_NEVER,
                                         &_gnome_notification); 
-- 
GitLab