aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorDavyd Madeley <davyd@madeley.id.au>2009-04-24 15:16:46 +0800
committerDavyd Madeley <davyd@madeley.id.au>2009-07-15 18:12:15 +0800
commit4afeb994e1fb9bdef315d0eaa24c3821536e30c1 (patch)
treef1e59f72796be2ccad0e7ec44fa1783c48dc57d3 /libempathy
parent8b3f04ee2d55d07d298c0183c355e9e41e868c2a (diff)
downloadgsoc2013-empathy-4afeb994e1fb9bdef315d0eaa24c3821536e30c1.tar
gsoc2013-empathy-4afeb994e1fb9bdef315d0eaa24c3821536e30c1.tar.gz
gsoc2013-empathy-4afeb994e1fb9bdef315d0eaa24c3821536e30c1.tar.bz2
gsoc2013-empathy-4afeb994e1fb9bdef315d0eaa24c3821536e30c1.tar.lz
gsoc2013-empathy-4afeb994e1fb9bdef315d0eaa24c3821536e30c1.tar.xz
gsoc2013-empathy-4afeb994e1fb9bdef315d0eaa24c3821536e30c1.tar.zst
gsoc2013-empathy-4afeb994e1fb9bdef315d0eaa24c3821536e30c1.zip
call GetAliasFlags() to determine if an alias can be set on a ContactList
Pending FIXMEs: - need to lookup RequestableChannelClasses to see if Groups can be requested on this connection - need to work out the best way to pass ContactListFlags to empathy_contact_menu_new()
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-contact-list.h2
-rw-r--r--libempathy/empathy-tp-contact-list.c37
2 files changed, 38 insertions, 1 deletions
diff --git a/libempathy/empathy-contact-list.h b/libempathy/empathy-contact-list.h
index 0296b6486..28238e44a 100644
--- a/libempathy/empathy-contact-list.h
+++ b/libempathy/empathy-contact-list.h
@@ -37,6 +37,8 @@ G_BEGIN_DECLS
typedef enum {
EMPATHY_CONTACT_LIST_CAN_ADD = 1 << 0,
EMPATHY_CONTACT_LIST_CAN_REMOVE = 1 << 1,
+ EMPATHY_CONTACT_LIST_CAN_ALIAS = 1 << 2,
+ EMPATHY_CONTACT_LIST_CAN_GROUP = 1 << 3,
} EmpathyContactListFlags;
typedef struct _EmpathyContactListIface EmpathyContactListIface;
diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c
index 514f7a6b5..e81528c80 100644
--- a/libempathy/empathy-tp-contact-list.c
+++ b/libempathy/empathy-tp-contact-list.c
@@ -50,6 +50,8 @@ typedef struct {
GHashTable *pendings; /* handle -> EmpathyContact */
GHashTable *groups; /* group name -> TpChannel */
GHashTable *add_to_group; /* group name -> GArray of handles */
+
+ EmpathyContactListFlags flags;
} EmpathyTpContactListPriv;
typedef enum {
@@ -509,6 +511,25 @@ tp_contact_list_publish_request_channel_cb (TpConnection *connection,
}
static void
+tp_contact_list_get_alias_flags_cb (TpConnection *connection,
+ guint flags,
+ const GError *error,
+ gpointer user_data,
+ GObject *list)
+{
+ EmpathyTpContactListPriv *priv = GET_PRIV (list);
+
+ if (error) {
+ DEBUG ("Error: %s", error->message);
+ return;
+ }
+
+ if (flags & TP_CONNECTION_ALIAS_FLAG_USER_SET) {
+ priv->flags |= EMPATHY_CONTACT_LIST_CAN_ALIAS;
+ }
+}
+
+static void
tp_contact_list_publish_request_handle_cb (TpConnection *connection,
const GArray *handles,
const GError *error,
@@ -722,6 +743,19 @@ tp_contact_list_constructed (GObject *list)
priv->factory = empathy_tp_contact_factory_dup_singleton (priv->connection);
+ /* call GetAliasFlags() */
+ if (tp_proxy_has_interface_by_id (priv->connection,
+ TP_IFACE_QUARK_CONNECTION_INTERFACE_ALIASING)) {
+ tp_cli_connection_interface_aliasing_call_get_alias_flags (
+ priv->connection,
+ -1,
+ tp_contact_list_get_alias_flags_cb,
+ NULL, NULL,
+ G_OBJECT (list));
+ }
+
+ /* FIXME: lookup RequestableChannelClasses */
+
names[0] = "publish";
tp_cli_connection_call_request_handles (priv->connection,
-1,
@@ -1078,12 +1112,13 @@ static EmpathyContactListFlags
tp_contact_list_get_flags (EmpathyContactList *list)
{
EmpathyTpContactListPriv *priv;
- EmpathyContactListFlags flags = 0;
+ EmpathyContactListFlags flags;
TpChannelGroupFlags group_flags;
g_return_val_if_fail (EMPATHY_IS_TP_CONTACT_LIST (list), FALSE);
priv = GET_PRIV (list);
+ flags = priv->flags;
group_flags = tp_channel_group_get_flags (priv->subscribe);