r6923 - in dumbhippo/trunk/client: common/hippo linux/src



Author: hp
Date: 2007-11-15 16:23:53 -0600 (Thu, 15 Nov 2007)
New Revision: 6923

Modified:
   dumbhippo/trunk/client/common/hippo/hippo-connection.c
   dumbhippo/trunk/client/linux/src/hippo-im.c
Log:
merge aimBuddies property in to contact objects; fix hippo-connection.c to allow circular connections between objects

Modified: dumbhippo/trunk/client/common/hippo/hippo-connection.c
===================================================================
--- dumbhippo/trunk/client/common/hippo/hippo-connection.c	2007-11-15 22:22:47 UTC (rev 6922)
+++ dumbhippo/trunk/client/common/hippo/hippo-connection.c	2007-11-15 22:23:53 UTC (rev 6923)
@@ -4741,9 +4741,9 @@
 }
 
 static gboolean
-dm_context_get_value(DMContext      *context,
-                     DDMDataType     type,
-                     DDMDataValue   *value)
+dm_context_get_value(DMContext       *context,
+                     DDMDataType      type,
+                     DDMDataValue    *value)
 {
     char *resource_id = dm_context_get_resource_id(context);
     
@@ -4755,14 +4755,10 @@
             return FALSE;
         }
 
-        resource = ddm_data_model_lookup_resource(context->model, resource_id);
-        
-        if (resource == NULL) {
-            // FIXME: We need to handle circular references
-            g_warning("Reference to a resource %s that we don't know about", resource_id);
-            g_free(resource_id);
-            return FALSE;
-        }
+        resource = ddm_data_model_ensure_resource(context->model, resource_id, NULL);
+
+        g_assert (resource != NULL);
+
         g_free(resource_id);
 
         value->type = DDM_DATA_RESOURCE;

Modified: dumbhippo/trunk/client/linux/src/hippo-im.c
===================================================================
--- dumbhippo/trunk/client/linux/src/hippo-im.c	2007-11-15 22:22:47 UTC (rev 6922)
+++ dumbhippo/trunk/client/linux/src/hippo-im.c	2007-11-15 22:23:53 UTC (rev 6923)
@@ -68,6 +68,7 @@
     HippoDataCache *cache = hippo_app_get_data_cache(hippo_get_app());
     DDMDataModel *model = hippo_data_cache_get_model(cache);
 
+    /* Add user property to buddies */
     ddm_data_model_add_rule(model,
                             "online-desktop:/p/o/buddy",
                             "online-desktop:/p/o/buddy#user",
@@ -76,42 +77,56 @@
                             "(source.aim = target.name and target.protocol = 'aim') or "
                             "(source.xmpp = target.name and target.protocol = 'xmpp') or "
                             "(source = target.name and target.protocol = 'mugshot-local')");
-    
+
+    /* Add aimBuddy property to users */
     ddm_data_model_add_rule(model,
                             "http://mugshot.org/p/o/user";,
                             "online-desktop:/p/o/buddy/reverse#aimBuddy",
                             "online-desktop:/p/o/buddy",
                             DDM_DATA_CARDINALITY_01, FALSE, NULL,
                             "target.aim = source.name and source.protocol = 'aim' and not source.deleted");
-    
+
+    /* Add xmppBuddy property to users */
     ddm_data_model_add_rule(model,
                             "http://mugshot.org/p/o/user";,
                             "online-desktop:/p/o/buddy/reverse#xmppBuddy",
                             "online-desktop:/p/o/buddy",
                             DDM_DATA_CARDINALITY_01, FALSE, NULL,
                             "target.xmpp = source.name and source.protocol = 'xmpp' and not source.deleted");
-    
+
+    /* Add mugshotLocalBuddy property to users */
     ddm_data_model_add_rule(model,
                             "http://mugshot.org/p/o/user";,
                             "online-desktop:/p/o/buddy/reverse#mugshotLocalBuddy",
                             "online-desktop:/p/o/buddy",
                             DDM_DATA_CARDINALITY_01, FALSE, NULL,
                             "target = source.name and source.protocol = 'mugshot-local' and not source.deleted");
+
+    /* Add aimBuddies property to contacts */
+    ddm_data_model_add_rule(model,
+                            "http://online.gnome.org/p/o/contact";,
+                            "online-desktop:/p/o/buddy/reverse#aimBuddies",
+                            "online-desktop:/p/o/buddy",
+                            DDM_DATA_CARDINALITY_N, FALSE, NULL,
+                            "source.name = target.aims and source.protocol = 'aim' and not source.deleted");    
     
+    /* Add aimBuddies property to global object */
     ddm_data_model_add_rule(model,
                             "online-desktop:/p/o/global",
                             "online-desktop:/p/o/global#aimBuddies",
                             "online-desktop:/p/o/buddy",
                             DDM_DATA_CARDINALITY_N, FALSE, NULL,
                             "source.protocol = 'aim' and not source.deleted");
-    
+
+    /* Add xmppBuddies property to global object */
     ddm_data_model_add_rule(model,
                             "online-desktop:/p/o/global",
                             "online-desktop:/p/o/global#xmppBuddies",
                             "online-desktop:/p/o/buddy",
                             DDM_DATA_CARDINALITY_N, FALSE, NULL,
                             "source.protocol = 'xmpp' and not source.deleted");
-    
+
+    /* Add mugshotLocalBuddies property to global object */
     ddm_data_model_add_rule(model,
                             "online-desktop:/p/o/global",
                             "online-desktop:/p/o/global#mugshotLocalBuddies",



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