]> git.0d.be Git - empathy.git/blobdiff - libempathy/gossip-contact.c
Fix indentation Fix not returning the contact in tp_contact_list_find()
[empathy.git] / libempathy / gossip-contact.c
index f198254372c0005ec64da4b05b153e3ff5e82d1e..51015f3653744910f5bba9073caee1bf9e74985d 100644 (file)
@@ -30,6 +30,7 @@
 #include "gossip-contact.h"
 #include "gossip-utils.h"
 #include "gossip-debug.h"
+#include "empathy-contact-manager.h"
 
 #define DEBUG_DOMAIN "Contact"
 
@@ -610,6 +611,24 @@ gossip_contact_is_online (GossipContact *contact)
        return (priv->presence != NULL);
 }
 
+gboolean
+gossip_contact_is_in_group (GossipContact *contact,
+                           const gchar   *group)
+{
+       GossipContactPriv *priv;
+
+       g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), FALSE);
+       g_return_val_if_fail (!G_STR_EMPTY (group), FALSE);
+
+       priv = GET_PRIV (contact);
+
+       if (g_list_find_custom (priv->groups, group, (GCompareFunc) strcmp)) {
+               return TRUE;
+       }
+
+       return FALSE;
+}
+
 const gchar *
 gossip_contact_get_status (GossipContact *contact)
 {
@@ -624,7 +643,7 @@ gossip_contact_get_status (GossipContact *contact)
 
                status = gossip_presence_get_status (priv->presence);
                if (!status) {
-                       GossipPresenceState state;
+                       McPresence state;
 
                        state = gossip_presence_get_state (priv->presence);
                        status = gossip_presence_state_get_default_status (state);
@@ -636,6 +655,24 @@ gossip_contact_get_status (GossipContact *contact)
        return _("Offline");
 }
 
+GossipContact *
+gossip_contact_get_user (GossipContact *contact)
+{
+       GossipContactPriv     *priv;
+       EmpathyContactManager *manager;
+       GossipContact         *user_contact;
+
+       g_return_val_if_fail (GOSSIP_IS_CONTACT (contact), NULL);
+
+       priv = GET_PRIV (contact);
+
+       manager = empathy_contact_manager_new ();
+       user_contact = empathy_contact_manager_get_user (manager, priv->account);
+       g_object_unref (manager);
+
+       return user_contact;
+}
+
 gboolean
 gossip_contact_equal (gconstpointer v1,
                      gconstpointer v2)