]> git.0d.be Git - empathy.git/commitdiff
Added ft-related functions to EmpathyContact. (Jonny Lamb)
authorJonny Lamb <jonny.lamb@collabora.co.uk>
Fri, 21 Nov 2008 16:13:20 +0000 (16:13 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Fri, 21 Nov 2008 16:13:20 +0000 (16:13 +0000)
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
svn path=/trunk/; revision=1733

libempathy/empathy-contact.c
libempathy/empathy-contact.h

index 6aed12acc1bde4bd29545a7f2bf08d865ddb14d0..7c8539fba3c0f151fd09305562498a1354221c25 100644 (file)
@@ -560,6 +560,20 @@ empathy_contact_get_handle (EmpathyContact *contact)
   return priv->handle;
 }
 
+static gboolean
+is_salut (EmpathyContact *contact)
+{
+  McAccount *account;
+  McProfile *profile;
+  const gchar *name;
+
+  account = empathy_contact_get_account (contact);
+  profile = mc_account_get_profile (account);
+  name = mc_profile_get_protocol_name (profile);
+
+  return (strcmp (name, "local-xmpp") == 0);
+}
+
 void
 empathy_contact_set_handle (EmpathyContact *contact,
                             guint handle)
@@ -575,6 +589,19 @@ empathy_contact_set_handle (EmpathyContact *contact,
     {
       priv->handle = handle;
       g_object_notify (G_OBJECT (contact), "handle");
+
+      /* FIXME salut does not yet support the Capabilities interface, so for
+       * now we use this hack.
+       */
+      if (is_salut (contact))
+        {
+          EmpathyCapabilities caps;
+
+          caps = empathy_contact_get_capabilities (contact);
+          caps |= EMPATHY_CAPABILITIES_FT;
+
+          empathy_contact_set_capabilities (contact, caps);
+        }
     }
   contact_set_ready_flag (contact, EMPATHY_CONTACT_READY_HANDLE);
   g_object_unref (contact);
@@ -680,6 +707,18 @@ empathy_contact_can_voip (EmpathyContact *contact)
       EMPATHY_CAPABILITIES_VIDEO);
 }
 
+gboolean
+empathy_contact_can_send_files (EmpathyContact *contact)
+{
+  EmpathyContactPriv *priv;
+
+  g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), FALSE);
+
+  priv = GET_PRIV (contact);
+
+  return priv->capabilities & EMPATHY_CAPABILITIES_FT;
+}
+
 EmpathyContactReady
 empathy_contact_get_ready (EmpathyContact *contact)
 {
index da018fd95d3d1b755e03816cfb7b7a50e288a3c4..d8a1a791f068e4ee7108857992d0dfa44e4bb8df 100644 (file)
@@ -66,6 +66,7 @@ typedef enum {
   EMPATHY_CAPABILITIES_NONE = 0,
   EMPATHY_CAPABILITIES_AUDIO = 1 << 0,
   EMPATHY_CAPABILITIES_VIDEO = 1 << 1,
+  EMPATHY_CAPABILITIES_FT = 1 << 2,
   EMPATHY_CAPABILITIES_UNKNOWN = 1 << 7
 } EmpathyCapabilities;
 
@@ -108,6 +109,7 @@ void empathy_contact_set_is_user (EmpathyContact *contact,
 gboolean empathy_contact_is_online (EmpathyContact *contact);
 const gchar * empathy_contact_get_status (EmpathyContact *contact);
 gboolean empathy_contact_can_voip (EmpathyContact *contact);
+gboolean empathy_contact_can_send_files (EmpathyContact *contact);
 gboolean empathy_contact_equal (gconstpointer v1, gconstpointer v2);
 guint empathy_contact_hash (gconstpointer key);
 void empathy_contact_run_until_ready (EmpathyContact *contact,