Check that remote-uid is not an empty string
authorArtem Garmash <artemgarmash@gmail.com>
Sun, 10 Jan 2010 20:26:41 +0000 (22:26 +0200)
committerArtem Garmash <artem.garmash@nokia.com>
Sun, 27 Jun 2010 19:13:42 +0000 (22:13 +0300)
src/el-home-applet.c

index c73026d..82388c9 100644 (file)
@@ -648,30 +648,39 @@ show_event (ELHomeApplet *self, RTComElIter *it)
         g_warning (G_STRFUNC);
         gchar *remote = NULL;
         gchar *received = NULL;
-        const gchar *icon_name = NULL;
+        /* const gchar *icon_name = NULL; */
 
         if (it && rtcom_el_iter_first (it)) {
                 rtcom_el_iter_dup_string (it, "free-text", &priv->message);
                 if (priv->message) {
-                        const gchar *service;
+                        /* const gchar *service; */
                         time_t received_t;
 
                         rtcom_el_iter_get_int (it, "id", &priv->event_id);
                         if (rtcom_el_iter_get_int (it, "start-time", (gint*)&received_t))
                                 received = format_time (received_t);
 
-                        rtcom_el_iter_dup_string (it, "remote-uid", &priv->remote_id);
-                        if (!rtcom_el_iter_dup_string (it, "remote-name", &remote))
-                                remote = g_strdup (priv->remote_id);
-
-                        rtcom_el_iter_dup_string (it, "remote-ebook-uid", &priv->contact_id);
-                        rtcom_el_iter_dup_string (it, "local-uid", &priv->local_id);
-                        g_warning ("abook uid %s", priv->contact_id);
+                        if (rtcom_el_iter_dup_string (it, "remote-uid", &priv->remote_id)) {
+                                if (priv->remote_id && priv->remote_id[0])  {
+                                        if (!rtcom_el_iter_dup_string (it, "remote-name", &remote))
+                                                remote = g_strdup (priv->remote_id);
+
+                                        rtcom_el_iter_dup_string (it, "remote-ebook-uid", &priv->contact_id);
+                                        rtcom_el_iter_dup_string (it, "local-uid", &priv->local_id);
+                                        g_warning ("abook uid %s", priv->contact_id);
+                                }
+                                else if (priv->remote_id) {
+                                        g_free (priv->remote_id);
+                                        priv->remote_id = NULL;
+                                }
+                        }
+#if 0
                         service = rtcom_el_iter_get_service (it);
                         if (!g_strcmp0 (service, "RTCOM_EL_SERVICE_SMS"))
                                 icon_name = "chat_unread_sms";
                         else if (!g_strcmp0 (service, "RTCOM_EL_SERVICE_CHAT"))
                                 icon_name = "chat_unread_chat";
+#endif
                 }
         }
         else {