aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-28 17:20:27 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-28 17:20:27 +0800
commit1d153c1cf91edce537bc64efb01b5a496b35518e (patch)
treede8ba4359a0341bd0c8c6e1a7495f4f39fb565f1 /libempathy
parentb50b7039d3b52f33df94e5a3526d9f43a51401ad (diff)
parent6df1c4bdd81fbbb288b8e49c3bea9a1dd2e005a6 (diff)
downloadgsoc2013-empathy-1d153c1cf91edce537bc64efb01b5a496b35518e.tar
gsoc2013-empathy-1d153c1cf91edce537bc64efb01b5a496b35518e.tar.gz
gsoc2013-empathy-1d153c1cf91edce537bc64efb01b5a496b35518e.tar.bz2
gsoc2013-empathy-1d153c1cf91edce537bc64efb01b5a496b35518e.tar.lz
gsoc2013-empathy-1d153c1cf91edce537bc64efb01b5a496b35518e.tar.xz
gsoc2013-empathy-1d153c1cf91edce537bc64efb01b5a496b35518e.tar.zst
gsoc2013-empathy-1d153c1cf91edce537bc64efb01b5a496b35518e.zip
Merge commit 'upstream/master' into mc5
Conflicts: libempathy-gtk/empathy-account-widget.c src/empathy.c
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-chatroom-manager.c2
-rw-r--r--libempathy/empathy-contact-groups.c4
-rw-r--r--libempathy/empathy-contact-list.c11
-rw-r--r--libempathy/empathy-contact-list.h12
-rw-r--r--libempathy/empathy-contact-manager.c34
-rw-r--r--libempathy/empathy-contact-manager.h4
-rw-r--r--libempathy/empathy-contact.c24
-rw-r--r--libempathy/empathy-contact.h2
-rw-r--r--libempathy/empathy-debug.h1
-rw-r--r--libempathy/empathy-log-store-empathy.c8
-rw-r--r--libempathy/empathy-message.c36
-rw-r--r--libempathy/empathy-message.h3
-rw-r--r--libempathy/empathy-status-presets.c4
-rw-r--r--libempathy/empathy-tp-chat.c65
-rw-r--r--libempathy/empathy-tp-contact-list.c133
15 files changed, 299 insertions, 44 deletions
diff --git a/libempathy/empathy-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c
index a512f5b25..649dcc9cf 100644
--- a/libempathy/empathy-chatroom-manager.c
+++ b/libempathy/empathy-chatroom-manager.c
@@ -411,7 +411,7 @@ empathy_chatroom_manager_constructor (GType type,
/* Set the default file path */
gchar *dir;
- dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
+ dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
if (!g_file_test (dir, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_DIR))
g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR);
diff --git a/libempathy/empathy-contact-groups.c b/libempathy/empathy-contact-groups.c
index a9040f2df..22d81d051 100644
--- a/libempathy/empathy-contact-groups.c
+++ b/libempathy/empathy-contact-groups.c
@@ -67,7 +67,7 @@ empathy_contact_groups_get_all (void)
groups = NULL;
}
- dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
+ dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
file_with_path = g_build_filename (dir, CONTACT_GROUPS_XML_FILENAME, NULL);
g_free (dir);
@@ -190,7 +190,7 @@ contact_groups_file_save (void)
gchar *dir;
gchar *file;
- dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
+ dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR);
file = g_build_filename (dir, CONTACT_GROUPS_XML_FILENAME, NULL);
g_free (dir);
diff --git a/libempathy/empathy-contact-list.c b/libempathy/empathy-contact-list.c
index 1fe894e99..d9493af1e 100644
--- a/libempathy/empathy-contact-list.c
+++ b/libempathy/empathy-contact-list.c
@@ -229,3 +229,14 @@ empathy_contact_list_remove_group (EmpathyContactList *list,
}
}
+EmpathyContactListFlags
+empathy_contact_list_get_flags (EmpathyContactList *list)
+{
+ g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST (list), 0);
+
+ if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->get_flags) {
+ return EMPATHY_CONTACT_LIST_GET_IFACE (list)->get_flags (list);
+ } else {
+ return 0;
+ }
+}
diff --git a/libempathy/empathy-contact-list.h b/libempathy/empathy-contact-list.h
index 5eabf32c3..28238e44a 100644
--- a/libempathy/empathy-contact-list.h
+++ b/libempathy/empathy-contact-list.h
@@ -34,6 +34,13 @@ G_BEGIN_DECLS
#define EMPATHY_IS_CONTACT_LIST(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CONTACT_LIST))
#define EMPATHY_CONTACT_LIST_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), EMPATHY_TYPE_CONTACT_LIST, EmpathyContactListIface))
+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;
struct _EmpathyContactListIface {
@@ -64,6 +71,8 @@ struct _EmpathyContactListIface {
const gchar *group);
EmpathyContactMonitor *
(*get_monitor) (EmpathyContactList *list);
+ EmpathyContactListFlags
+ (*get_flags) (EmpathyContactList *list);
};
GType empathy_contact_list_get_type (void) G_GNUC_CONST;
@@ -92,6 +101,9 @@ void empathy_contact_list_remove_group (EmpathyContactList *list,
EmpathyContactMonitor *
empathy_contact_list_get_monitor (EmpathyContactList *list);
+EmpathyContactListFlags
+ empathy_contact_list_get_flags (EmpathyContactList *list);
+
G_END_DECLS
#endif /* __EMPATHY_CONTACT_LIST_H__ */
diff --git a/libempathy/empathy-contact-manager.c b/libempathy/empathy-contact-manager.c
index 7af2bd349..302fad3c5 100644
--- a/libempathy/empathy-contact-manager.c
+++ b/libempathy/empathy-contact-manager.c
@@ -204,6 +204,23 @@ contact_manager_constructor (GType type,
return retval;
}
+/**
+ * empathy_contact_manager_initialized:
+ *
+ * Reports whether or not the singleton has already been created.
+ *
+ * There can be instances where you want to access the #EmpathyContactManager
+ * only if it has been set up for this process.
+ *
+ * Returns: %TRUE if the #EmpathyContactManager singleton has previously
+ * been initialized.
+ */
+gboolean
+empathy_contact_manager_initialized (void)
+{
+ return (manager_singleton != NULL);
+}
+
static void
empathy_contact_manager_class_init (EmpathyContactManagerClass *klass)
{
@@ -527,19 +544,24 @@ contact_manager_iface_init (EmpathyContactListIface *iface)
iface->remove_group = contact_manager_remove_group;
}
-gboolean
-empathy_contact_manager_can_add (EmpathyContactManager *manager,
- TpConnection *connection)
+EmpathyContactListFlags
+empathy_contact_manager_get_flags_for_connection (
+ EmpathyContactManager *manager,
+ TpConnection *connection)
{
EmpathyContactManagerPriv *priv = GET_PRIV (manager);
- EmpathyTpContactList *list;
+ EmpathyContactList *list;
+ EmpathyContactListFlags flags;
g_return_val_if_fail (EMPATHY_IS_CONTACT_MANAGER (manager), FALSE);
+ g_return_val_if_fail (connection != NULL, FALSE);
list = g_hash_table_lookup (priv->lists, connection);
- if (list == NULL)
+ if (list == NULL) {
return FALSE;
+ }
+ flags = empathy_contact_list_get_flags (list);
- return empathy_tp_contact_list_can_add (list);
+ return flags;
}
diff --git a/libempathy/empathy-contact-manager.h b/libempathy/empathy-contact-manager.h
index fbe9e2df0..97e21464a 100644
--- a/libempathy/empathy-contact-manager.h
+++ b/libempathy/empathy-contact-manager.h
@@ -50,10 +50,12 @@ struct _EmpathyContactManagerClass {
};
GType empathy_contact_manager_get_type (void) G_GNUC_CONST;
+gboolean empathy_contact_manager_initialized (void);
EmpathyContactManager *empathy_contact_manager_dup_singleton (void);
EmpathyTpContactList * empathy_contact_manager_get_list (EmpathyContactManager *manager,
TpConnection *connection);
-gboolean empathy_contact_manager_can_add (EmpathyContactManager *manager,
+EmpathyContactListFlags empathy_contact_manager_get_flags_for_connection (
+ EmpathyContactManager *manager,
TpConnection *connection);
G_END_DECLS
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index d351aecbc..c82ecd467 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -802,6 +802,30 @@ empathy_contact_can_voip (EmpathyContact *contact)
}
gboolean
+empathy_contact_can_voip_audio (EmpathyContact *contact)
+{
+ EmpathyContactPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), FALSE);
+
+ priv = GET_PRIV (contact);
+
+ return priv->capabilities & EMPATHY_CAPABILITIES_AUDIO;
+}
+
+gboolean
+empathy_contact_can_voip_video (EmpathyContact *contact)
+{
+ EmpathyContactPriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), FALSE);
+
+ priv = GET_PRIV (contact);
+
+ return priv->capabilities & EMPATHY_CAPABILITIES_VIDEO;
+}
+
+gboolean
empathy_contact_can_send_files (EmpathyContact *contact)
{
EmpathyContactPriv *priv;
diff --git a/libempathy/empathy-contact.h b/libempathy/empathy-contact.h
index d4e385924..4e9c98756 100644
--- a/libempathy/empathy-contact.h
+++ b/libempathy/empathy-contact.h
@@ -99,6 +99,8 @@ 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_voip_audio (EmpathyContact *contact);
+gboolean empathy_contact_can_voip_video (EmpathyContact *contact);
gboolean empathy_contact_can_send_files (EmpathyContact *contact);
gboolean empathy_contact_can_use_stream_tube (EmpathyContact *contact);
guint empathy_contact_hash (gconstpointer key);
diff --git a/libempathy/empathy-debug.h b/libempathy/empathy-debug.h
index 9df728922..0d25f22dd 100644
--- a/libempathy/empathy-debug.h
+++ b/libempathy/empathy-debug.h
@@ -41,6 +41,7 @@ typedef enum
EMPATHY_DEBUG_FT = 1 << 7,
EMPATHY_DEBUG_LOCATION = 1 << 8,
EMPATHY_DEBUG_OTHER = 1 << 9,
+ EMPATHY_DEBUG_SHARE_DESKTOP = 1 << 10,
} EmpathyDebugFlags;
gboolean empathy_debug_flag_is_set (EmpathyDebugFlags flag);
diff --git a/libempathy/empathy-log-store-empathy.c b/libempathy/empathy-log-store-empathy.c
index d0487e761..4bb17e428 100644
--- a/libempathy/empathy-log-store-empathy.c
+++ b/libempathy/empathy-log-store-empathy.c
@@ -27,7 +27,14 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+
+/* FIXME: g_mapped_file_free has been deprecated in GLib 2.22, but the
+ * replacement symbol, g_mapped_file_unref is not available in older Glib
+ * and we're not ready to bump our version requirement just for this. When
+ * we're ready to bump our version requirement, just revert this patch. */
+#undef G_DISABLE_DEPRECATED
#include <glib/gstdio.h>
+#define G_DISABLE_DEPRECATED
#include <telepathy-glib/util.h>
@@ -515,6 +522,7 @@ log_store_empathy_get_messages_for_file (EmpathyLogStore *self,
empathy_message_set_sender (message, sender);
empathy_message_set_timestamp (message, t);
empathy_message_set_tptype (message, msg_type);
+ empathy_message_set_is_backlog (message, TRUE);
if (cm_id_str)
empathy_message_set_id (message, cm_id);
diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c
index d020b72e4..a8fe6084c 100644
--- a/libempathy/empathy-message.c
+++ b/libempathy/empathy-message.c
@@ -39,6 +39,7 @@ typedef struct {
EmpathyContact *receiver;
gchar *body;
time_t timestamp;
+ gboolean is_backlog;
guint id;
} EmpathyMessagePriv;
@@ -61,6 +62,7 @@ enum {
PROP_RECEIVER,
PROP_BODY,
PROP_TIMESTAMP,
+ PROP_IS_BACKLOG,
};
static void
@@ -112,6 +114,13 @@ empathy_message_class_init (EmpathyMessageClass *class)
G_MAXLONG,
-1,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_IS_BACKLOG,
+ g_param_spec_boolean ("is-backlog",
+ "History message",
+ "If the message belongs to history",
+ FALSE,
+ G_PARAM_READWRITE));
g_type_class_add_private (object_class, sizeof (EmpathyMessagePriv));
@@ -387,6 +396,33 @@ empathy_message_set_timestamp (EmpathyMessage *message,
g_object_notify (G_OBJECT (message), "timestamp");
}
+gboolean
+empathy_message_is_backlog (EmpathyMessage *message)
+{
+ EmpathyMessagePriv *priv;
+
+ g_return_val_if_fail (EMPATHY_IS_MESSAGE (message), FALSE);
+
+ priv = GET_PRIV (message);
+
+ return priv->is_backlog;
+}
+
+void
+empathy_message_set_is_backlog (EmpathyMessage *message,
+ gboolean is_backlog)
+{
+ EmpathyMessagePriv *priv;
+
+ g_return_if_fail (EMPATHY_IS_MESSAGE (message));
+
+ priv = GET_PRIV (message);
+
+ priv->is_backlog = is_backlog;
+
+ g_object_notify (G_OBJECT (message), "is-backlog");
+}
+
#define IS_SEPARATOR(ch) (ch == ' ' || ch == ',' || ch == '.' || ch == ':')
gboolean
empathy_message_should_highlight (EmpathyMessage *message)
diff --git a/libempathy/empathy-message.h b/libempathy/empathy-message.h
index 2172c9784..00064df57 100644
--- a/libempathy/empathy-message.h
+++ b/libempathy/empathy-message.h
@@ -68,6 +68,9 @@ void empathy_message_set_body (EmpathyMessage
time_t empathy_message_get_timestamp (EmpathyMessage *message);
void empathy_message_set_timestamp (EmpathyMessage *message,
time_t timestamp);
+gboolean empathy_message_is_backlog (EmpathyMessage *message);
+void empathy_message_set_is_backlog (EmpathyMessage *message,
+ gboolean is_backlog);
gboolean empathy_message_should_highlight (EmpathyMessage *message);
TpChannelTextMessageType empathy_message_type_from_str (const gchar *type_str);
const gchar * empathy_message_type_to_str (TpChannelTextMessageType type);
diff --git a/libempathy/empathy-status-presets.c b/libempathy/empathy-status-presets.c
index 135212cc5..1fa991b0b 100644
--- a/libempathy/empathy-status-presets.c
+++ b/libempathy/empathy-status-presets.c
@@ -176,7 +176,7 @@ empathy_status_presets_get_all (void)
presets = NULL;
}
- dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
+ dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR);
file_with_path = g_build_filename (dir, STATUS_PRESETS_XML_FILENAME, NULL);
g_free (dir);
@@ -203,7 +203,7 @@ status_presets_file_save (void)
count[i] = 0;
}
- dir = g_build_filename (g_get_home_dir (), ".gnome2", PACKAGE_NAME, NULL);
+ dir = g_build_filename (g_get_user_config_dir (), PACKAGE_NAME, NULL);
g_mkdir_with_parents (dir, S_IRUSR | S_IWUSR | S_IXUSR);
file = g_build_filename (dir, STATUS_PRESETS_XML_FILENAME, NULL);
g_free (dir);
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index 091871034..51ce79bb6 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -876,6 +876,34 @@ tp_chat_got_added_contacts_cb (EmpathyTpContactFactory *factory,
tp_chat_check_if_ready (EMPATHY_TP_CHAT (chat));
}
+static EmpathyContact *
+chat_lookup_contact (EmpathyTpChat *chat,
+ TpHandle handle,
+ gboolean remove)
+{
+ EmpathyTpChatPriv *priv = GET_PRIV (chat);
+ GList *l;
+
+ for (l = priv->members; l; l = l->next) {
+ EmpathyContact *c = l->data;
+
+ if (empathy_contact_get_handle (c) != handle) {
+ continue;
+ }
+
+ if (remove) {
+ /* Caller takes the reference. */
+ priv->members = g_list_delete_link (priv->members, l);
+ } else {
+ g_object_ref (c);
+ }
+
+ return c;
+ }
+
+ return NULL;
+}
+
static void
tp_chat_group_members_changed_cb (TpChannel *self,
gchar *message,
@@ -889,23 +917,30 @@ tp_chat_group_members_changed_cb (TpChannel *self,
{
EmpathyTpChatPriv *priv = GET_PRIV (chat);
EmpathyContact *contact;
- TpHandle handle;
+ EmpathyContact *actor_contact = NULL;
guint i;
- GList *l;
+
+ if (actor != 0) {
+ actor_contact = chat_lookup_contact (chat, actor, FALSE);
+ if (actor_contact == NULL) {
+ /* FIXME: handle this a tad more gracefully: perhaps
+ * the actor was a server op. We could use the
+ * contact-ids detail of MembersChangedDetailed.
+ */
+ DEBUG ("actor %u not a channel member", actor);
+ }
+ }
/* Remove contacts that are not members anymore */
for (i = 0; i < removed->len; i++) {
- for (l = priv->members; l; l = l->next) {
- contact = l->data;
- handle = empathy_contact_get_handle (contact);
- if (handle == g_array_index (removed, TpHandle, i)) {
- priv->members = g_list_delete_link (priv->members, l);
- g_signal_emit_by_name (chat, "members-changed",
- contact, NULL, reason,
- message, FALSE);
- g_object_unref (contact);
- break;
- }
+ contact = chat_lookup_contact (chat,
+ g_array_index (removed, TpHandle, i), TRUE);
+
+ if (contact != NULL) {
+ g_signal_emit_by_name (chat, "members-changed", contact,
+ actor_contact, reason, message,
+ FALSE);
+ g_object_unref (contact);
}
}
@@ -918,6 +953,10 @@ tp_chat_group_members_changed_cb (TpChannel *self,
}
tp_chat_update_remote_contact (chat);
+
+ if (actor_contact != NULL) {
+ g_object_unref (actor_contact);
+ }
}
static void
diff --git a/libempathy/empathy-tp-contact-list.c b/libempathy/empathy-tp-contact-list.c
index 6564deb2b..4bbe46b4f 100644
--- a/libempathy/empathy-tp-contact-list.c
+++ b/libempathy/empathy-tp-contact-list.c
@@ -51,6 +51,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 {
@@ -470,7 +472,7 @@ tp_contact_list_publish_group_members_changed_cb (TpChannel *channel,
/* We refuse to send our presence to those contacts, remove from pendings */
for (i = 0; i < removed->len; i++) {
tp_contact_list_remove_handle (list, priv->pendings,
- g_array_index (added, TpHandle, i));
+ g_array_index (removed, TpHandle, i));
}
/* Those contacts want our presence, auto accept those that are already
@@ -510,6 +512,64 @@ 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_get_requestablechannelclasses_cb (TpProxy *connection,
+ const GValue *value,
+ const GError *error,
+ gpointer user_data,
+ GObject *list)
+{
+ EmpathyTpContactListPriv *priv = GET_PRIV (list);
+ GPtrArray *classes;
+ int i;
+
+ if (error) {
+ DEBUG ("Error: %s", error->message);
+ return;
+ }
+
+ classes = g_value_get_boxed (value);
+ for (i = 0; i < classes->len; i++) {
+ GValueArray *class = g_ptr_array_index (classes, i);
+ GHashTable *props;
+ const char *channel_type;
+ guint handle_type;
+
+ props = g_value_get_boxed (g_value_array_get_nth (class, 0));
+
+ channel_type = tp_asv_get_string (props,
+ TP_IFACE_CHANNEL ".ChannelType");
+ handle_type = tp_asv_get_uint32 (props,
+ TP_IFACE_CHANNEL ".TargetHandleType", NULL);
+
+ if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_CONTACT_LIST) &&
+ handle_type == TP_HANDLE_TYPE_GROUP) {
+ DEBUG ("Got channel class for a contact group");
+ priv->flags |= EMPATHY_CONTACT_LIST_CAN_GROUP;
+ break;
+ }
+ }
+}
+
+static void
tp_contact_list_publish_request_handle_cb (TpConnection *connection,
const GArray *handles,
const GError *error,
@@ -559,7 +619,7 @@ tp_contact_list_subscribe_group_members_changed_cb (TpChannel *channel,
/* Those contacts refuse to send us their presence, remove from members. */
for (i = 0; i < removed->len; i++) {
tp_contact_list_remove_handle (list, priv->members,
- g_array_index (added, TpHandle, i));
+ g_array_index (removed, TpHandle, i));
}
/* We want those contacts in our contact list but we don't get their
@@ -723,6 +783,32 @@ 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));
+ }
+
+ /* lookup RequestableChannelClasses */
+ if (tp_proxy_has_interface_by_id (priv->connection,
+ TP_IFACE_QUARK_CONNECTION_INTERFACE_REQUESTS)) {
+ tp_cli_dbus_properties_call_get (priv->connection,
+ -1,
+ TP_IFACE_CONNECTION_INTERFACE_REQUESTS,
+ "RequestableChannelClasses",
+ tp_contact_list_get_requestablechannelclasses_cb,
+ NULL, NULL,
+ G_OBJECT (list));
+ } else {
+ /* we just don't know... better mark the flag just in case */
+ priv->flags |= EMPATHY_CONTACT_LIST_CAN_GROUP;
+ }
+
names[0] = "publish";
tp_cli_connection_call_request_handles (priv->connection,
-1,
@@ -1075,6 +1161,31 @@ tp_contact_list_remove_group (EmpathyContactList *list,
g_array_free (handles, TRUE);
}
+static EmpathyContactListFlags
+tp_contact_list_get_flags (EmpathyContactList *list)
+{
+ EmpathyTpContactListPriv *priv;
+ 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);
+
+ if (group_flags & TP_CHANNEL_GROUP_FLAG_CAN_ADD) {
+ flags |= EMPATHY_CONTACT_LIST_CAN_ADD;
+ }
+
+ if (group_flags & TP_CHANNEL_GROUP_FLAG_CAN_REMOVE) {
+ flags |= EMPATHY_CONTACT_LIST_CAN_REMOVE;
+ }
+
+ return flags;
+}
+
static void
tp_contact_list_iface_init (EmpathyContactListIface *iface)
{
@@ -1088,23 +1199,7 @@ tp_contact_list_iface_init (EmpathyContactListIface *iface)
iface->remove_from_group = tp_contact_list_remove_from_group;
iface->rename_group = tp_contact_list_rename_group;
iface->remove_group = tp_contact_list_remove_group;
-}
-
-gboolean
-empathy_tp_contact_list_can_add (EmpathyTpContactList *list)
-{
- EmpathyTpContactListPriv *priv;
- TpChannelGroupFlags flags;
-
- g_return_val_if_fail (EMPATHY_IS_TP_CONTACT_LIST (list), FALSE);
-
- priv = GET_PRIV (list);
-
- if (priv->subscribe == NULL)
- return FALSE;
-
- flags = tp_channel_group_get_flags (priv->subscribe);
- return (flags & TP_CHANNEL_GROUP_FLAG_CAN_ADD) != 0;
+ iface->get_flags = tp_contact_list_get_flags;
}
void