[telepathy-gabble/master] use ensure_bare_contact_from_jid

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Thu Sep 24 09:22:30 PDT 2009


---
 src/conn-location.c |    5 +----
 src/conn-olpc.c     |   23 ++++-------------------
 2 files changed, 5 insertions(+), 23 deletions(-)

diff --git a/src/conn-location.c b/src/conn-location.c
index 0968c43..a9b569e 100644
--- a/src/conn-location.c
+++ b/src/conn-location.c
@@ -112,7 +112,6 @@ get_cached_location_or_query (GabbleConnection *conn,
   GHashTable *location;
   const gchar *jid;
   TpHandleRepoIface *contact_repo;
-  WockyContactFactory *contact_factory;
   WockyBareContact *contact;
 
   contact_repo = tp_base_connection_get_handles (base, TP_HANDLE_TYPE_CONTACT);
@@ -125,9 +124,7 @@ get_cached_location_or_query (GabbleConnection *conn,
       return location;
     }
 
-  contact_factory = wocky_session_get_contact_factory (conn->session);
-  contact = wocky_contact_factory_ensure_bare_contact (contact_factory,
-      jid);
+  contact = ensure_bare_contact_from_jid (conn, jid);
 
   /* Send a query */
   wocky_pep_service_get_async (conn->pep_location, contact, NULL, pep_reply_cb,
diff --git a/src/conn-olpc.c b/src/conn-olpc.c
index ad2fa5d..731632b 100644
--- a/src/conn-olpc.c
+++ b/src/conn-olpc.c
@@ -431,7 +431,6 @@ olpc_buddy_info_get_properties (GabbleSvcOLPCBuddyInfo *iface,
   const gchar *jid;
   GHashTable *properties;
   pubsub_query_ctx *ctx;
-  WockyContactFactory *contact_factory;
   WockyBareContact *contact;
 
   DEBUG ("called");
@@ -460,10 +459,7 @@ olpc_buddy_info_get_properties (GabbleSvcOLPCBuddyInfo *iface,
     return;
 
   ctx = pubsub_query_ctx_new (conn, context);
-
-  contact_factory = wocky_session_get_contact_factory (conn->session);
-  contact = wocky_contact_factory_ensure_bare_contact (contact_factory,
-      jid);
+  contact = ensure_bare_contact_from_jid (conn, jid);
 
   wocky_pep_service_get_async (conn->pep_olpc_buddy_props, contact, NULL,
       get_properties_reply_cb, ctx);
@@ -928,12 +924,7 @@ check_activity_properties (GabbleConnection *conn,
 
   if (query_needed)
     {
-      WockyContactFactory *contact_factory;
-      WockyBareContact *contact;
-
-      contact_factory = wocky_session_get_contact_factory (conn->session);
-      contact = wocky_contact_factory_ensure_bare_contact (contact_factory,
-          from);
+      WockyBareContact *contact = ensure_bare_contact_from_jid (conn, from);
 
       wocky_pep_service_get_async (conn->pep_olpc_buddy_props, contact,
           NULL, get_activity_properties_reply_cb, conn);
@@ -1038,7 +1029,6 @@ olpc_buddy_info_get_activities (GabbleSvcOLPCBuddyInfo *iface,
   TpBaseConnection *base = (TpBaseConnection *) conn;
   const gchar *jid;
   pubsub_query_ctx *ctx;
-  WockyContactFactory *contact_factory;
   WockyBareContact *contact;
 
   DEBUG ("called");
@@ -1054,9 +1044,7 @@ olpc_buddy_info_get_activities (GabbleSvcOLPCBuddyInfo *iface,
     return;
 
   ctx = pubsub_query_ctx_new (conn, context);
-
-  contact_factory = wocky_session_get_contact_factory (conn->session);
-  contact = wocky_contact_factory_ensure_bare_contact (contact_factory, jid);
+  contact = ensure_bare_contact_from_jid (conn, jid);
 
   wocky_pep_service_get_async (conn->pep_olpc_activities, contact, NULL,
       get_activities_reply_cb, ctx);
@@ -1496,7 +1484,6 @@ olpc_buddy_info_get_current_activity (GabbleSvcOLPCBuddyInfo *iface,
   const gchar *jid;
   GabbleOlpcActivity *activity;
   pubsub_query_ctx *ctx;
-  WockyContactFactory *contact_factory;
   WockyBareContact *contact;
 
   DEBUG ("called for contact#%u", handle);
@@ -1526,9 +1513,7 @@ olpc_buddy_info_get_current_activity (GabbleSvcOLPCBuddyInfo *iface,
     DEBUG ("current activity not in cache, query PEP node");
 
   ctx = pubsub_query_ctx_new (conn, context);
-
-  contact_factory = wocky_session_get_contact_factory (conn->session);
-  contact = wocky_contact_factory_ensure_bare_contact (contact_factory, jid);
+  contact = ensure_bare_contact_from_jid (conn, jid);
 
   wocky_pep_service_get_async (conn->pep_olpc_current_act, contact,
       NULL, get_current_activity_reply_cb, ctx);
-- 
1.5.6.5




More information about the telepathy-commits mailing list