r7064 - in dumbhippo/trunk/client: common/ddm linux/src



Author: hp
Date: 2007-12-14 16:35:07 -0600 (Fri, 14 Dec 2007)
New Revision: 7064

Modified:
   dumbhippo/trunk/client/common/ddm/ddm-data-model.c
   dumbhippo/trunk/client/linux/src/hippo-dbus-im-client.c
   dumbhippo/trunk/client/linux/src/hippo-dbus-local.c
   dumbhippo/trunk/client/linux/src/hippo-im.c
   dumbhippo/trunk/client/linux/src/hippo-im.h
Log:
add buddy status message to data model

Modified: dumbhippo/trunk/client/common/ddm/ddm-data-model.c
===================================================================
--- dumbhippo/trunk/client/common/ddm/ddm-data-model.c	2007-12-14 22:26:30 UTC (rev 7063)
+++ dumbhippo/trunk/client/common/ddm/ddm-data-model.c	2007-12-14 22:35:07 UTC (rev 7064)
@@ -597,6 +597,7 @@
         g_hash_table_insert(model->changed_resources, resource, ddm_data_resource_ref(resource));
     }
 
+    g_debug("Scheduling flush due to mark_changed");
     ddm_data_model_schedule_flush(model);
 }
 
@@ -674,6 +675,7 @@
     }
     
 
+    g_debug("Scheduling flush due to work item");
     ddm_data_model_schedule_flush(model);
 }
 

Modified: dumbhippo/trunk/client/linux/src/hippo-dbus-im-client.c
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-dbus-im-client.c	2007-12-14 22:26:30 UTC (rev 7063)
+++ dumbhippo/trunk/client/linux/src/hippo-dbus-im-client.c	2007-12-14 22:35:07 UTC (rev 7064)
@@ -136,6 +136,7 @@
     const char *status = NULL;
     const char *webdav_url = NULL;
     const char *icon = NULL;    
+    const char *status_message = NULL;
     
     while (dbus_message_iter_get_arg_type(buddy_iter) != DBUS_TYPE_INVALID) {
         DBusMessageIter entry_iter, variant_iter;
@@ -162,6 +163,8 @@
             read_basic_variant(&variant_iter, DBUS_TYPE_STRING, &alias);
         } else if (strcmp(field, "status") == 0) {
             read_basic_variant(&variant_iter, DBUS_TYPE_STRING, &status);
+        } else if (strcmp(field, "status-message") == 0) {
+            read_basic_variant(&variant_iter, DBUS_TYPE_STRING, &status_message);
         } else if (strcmp(field, "online") == 0) {
             read_basic_variant(&variant_iter, DBUS_TYPE_BOOLEAN, &is_online);
         } else if (strcmp(field, "webdav-url") == 0) {
@@ -185,6 +188,7 @@
                           name, alias,
                           is_online,
                           status,
+                          status_message,
                           webdav_url);
 
     /* has_icon_hash() allows icon==NULL. It checks whether

Modified: dumbhippo/trunk/client/linux/src/hippo-dbus-local.c
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-dbus-local.c	2007-12-14 22:26:30 UTC (rev 7063)
+++ dumbhippo/trunk/client/linux/src/hippo-dbus-local.c	2007-12-14 22:35:07 UTC (rev 7064)
@@ -192,7 +192,7 @@
          */
         hippo_im_update_buddy(resource_id,
                               "mugshot-local", local_buddy->user_resource_id, NULL,
-                              TRUE, "Around", local_buddy->webdav_url);
+                              TRUE, "Around", NULL, local_buddy->webdav_url);
     }
     
     g_free(resource_id);

Modified: dumbhippo/trunk/client/linux/src/hippo-im.c
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-im.c	2007-12-14 22:26:30 UTC (rev 7063)
+++ dumbhippo/trunk/client/linux/src/hippo-im.c	2007-12-14 22:35:07 UTC (rev 7064)
@@ -22,6 +22,7 @@
     char *alias; /* Human visible name */
     gboolean is_online;
     char *status;
+    char *status_message;
     char *webdav_url;
     char *icon_hash;
     char *icon_data_url;
@@ -35,6 +36,7 @@
     g_free(buddy->name);
     g_free(buddy->alias);
     g_free(buddy->status);
+    g_free(buddy->status_message);
     g_free(buddy->webdav_url);
     g_free(buddy->icon_hash);
     g_free(buddy->icon_data_url);
@@ -279,6 +281,7 @@
                       const char           *alias,
                       gboolean              is_online,
                       const char           *status,
+                      const char           *status_message,
                       const char           *webdav_url)
 {
     HippoDataCache *cache = hippo_app_get_data_cache(hippo_get_app());
@@ -425,6 +428,23 @@
         buddy_changed = !new_buddy;
     }
 
+    if (new_buddy || !compare_strings(status_message, buddy->status_message)) {
+        g_free(buddy->status_message);
+        buddy->status_message = g_strdup(status_message);
+
+        value.type = DDM_DATA_STRING;
+        value.u.string = buddy->status_message;
+
+        ddm_data_resource_update_property(buddy_resource,
+                                          ddm_qname_get(BUDDY_CLASS, "statusMessage"),
+                                          buddy->status_message ? DDM_DATA_UPDATE_REPLACE : DDM_DATA_UPDATE_CLEAR,
+                                          DDM_DATA_CARDINALITY_01,
+                                          TRUE, NULL,
+                                          &value);
+        
+        buddy_changed = !new_buddy;
+    }
+    
     if (new_buddy || !compare_strings(webdav_url, buddy->webdav_url)) {
         g_free(buddy->webdav_url);
         buddy->webdav_url = g_strdup(webdav_url);

Modified: dumbhippo/trunk/client/linux/src/hippo-im.h
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-im.h	2007-12-14 22:26:30 UTC (rev 7063)
+++ dumbhippo/trunk/client/linux/src/hippo-im.h	2007-12-14 22:35:07 UTC (rev 7064)
@@ -16,6 +16,7 @@
                                      const char *alias,
                                      gboolean    is_online,
                                      const char *status,
+                                     const char *status_message,
                                      const char *webdav_url);
 void     hippo_im_update_buddy_icon (const char *buddy_id,
                                      const char *icon_hash,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]