]> git.0d.be Git - empathy.git/commitdiff
Only retrieve server-stored groups for Individuals with TpContacts.
authorTravis Reitter <travis.reitter@collabora.co.uk>
Tue, 10 May 2011 23:41:04 +0000 (16:41 -0700)
committerTravis Reitter <travis.reitter@collabora.co.uk>
Mon, 6 Jun 2011 16:30:52 +0000 (09:30 -0700)
Helps: bgo#648822 - Port Empathy to Folks 0.5.1

libempathy-gtk/empathy-individual-store.c

index 01ec8943688f0218314707478e84c265329ad98c..ac1a96c0231ef880c505c3df899be5c06dd5df45 100644 (file)
@@ -419,9 +419,6 @@ individual_store_add_individual (EmpathyIndividualStore *self,
   EmpathyIndividualStorePriv *priv;
   GtkTreeIter iter;
   GeeIterator *group_iter = NULL;
-  EmpathyContact *contact;
-  TpConnection *connection;
-  gchar *protocol_name;
 
   priv = GET_PRIV (self);
 
@@ -440,18 +437,23 @@ individual_store_add_individual (EmpathyIndividualStore *self,
         group_iter = gee_iterable_iterator (GEE_ITERABLE (group_set));
     }
 
-  contact = empathy_contact_dup_from_folks_individual (individual);
-  connection = empathy_contact_get_connection (contact);
-
-  tp_connection_parse_object_path (connection, &protocol_name, NULL);
-
   /* fall-back groups, in case there are no named groups */
   if (group_iter == NULL)
     {
       GtkTreeIter iter_group, *parent;
+      EmpathyContact *contact;
+      TpConnection *connection;
+      gchar *protocol_name = NULL;
 
       parent = &iter_group;
 
+      contact = empathy_contact_dup_from_folks_individual (individual);
+      if (contact != NULL)
+        {
+          connection = empathy_contact_get_connection (contact);
+          tp_connection_parse_object_path (connection, &protocol_name, NULL);
+        }
+
       if (!priv->show_groups)
         parent = NULL;
       else if (!tp_strdiff (protocol_name, "local-xmpp"))
@@ -470,9 +472,10 @@ individual_store_add_individual (EmpathyIndividualStore *self,
 
       add_individual_to_store (GTK_TREE_STORE (self), &iter, parent,
           individual);
-    }
 
-  g_free (protocol_name);
+      g_free (protocol_name);
+      g_clear_object (&contact);
+    }
 
   /* Else add to each group. */
   while (group_iter != NULL && gee_iterator_next (group_iter))
@@ -505,8 +508,6 @@ individual_store_add_individual (EmpathyIndividualStore *self,
     }
 
   individual_store_contact_update (self, individual);
-
-  tp_clear_object (&contact);
 }
 
 static void