summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2011-06-09 11:20:53 (GMT)
committerWill Thompson <will.thompson@collabora.co.uk>2011-06-09 11:20:53 (GMT)
commit5f61ae42d2cfbdc858ab89adfd4d24311467f387 (patch)
treeb7271b00289d48fecb4dead7101452ce95702c23
parentd7b57afa374e68e43fc466b38d1ce00eab3dea15 (diff)
downloadtelepathy-haze-5f61ae42d2cfbdc858ab89adfd4d24311467f387.tar.gz
telepathy-haze-5f61ae42d2cfbdc858ab89adfd4d24311467f387.tar.xz
Blocking: implement can_block and add to Conn.Interfaces
-rw-r--r--src/connection.c11
-rw-r--r--src/contact-list.c11
2 files changed, 21 insertions, 1 deletions
diff --git a/src/connection.c b/src/connection.c
index 949b45f..f82fbc5 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -92,7 +92,8 @@ static const gchar * implemented_interfaces[] = {
TP_IFACE_CONNECTION_INTERFACE_AVATARS,
HAZE_IFACE_CONNECTION_INTERFACE_MAIL_NOTIFICATION,
-# define HAZE_NUM_CONDITIONAL_INTERFACES 2
+ TP_IFACE_CONNECTION_INTERFACE_CONTACT_BLOCKING,
+# define HAZE_NUM_CONDITIONAL_INTERFACES 3
/* Always present */
@@ -161,6 +162,14 @@ connected_cb (PurpleConnection *pc)
tp_base_connection_add_interfaces (base_conn, avatar_ifaces);
}
+ if (prpl_info->add_deny != NULL)
+ {
+ static const gchar *blocking_ifaces[] = {
+ TP_IFACE_CONNECTION_INTERFACE_CONTACT_BLOCKING,
+ NULL };
+ tp_base_connection_add_interfaces (base_conn, blocking_ifaces);
+ }
+
tp_base_contact_list_set_list_received (
(TpBaseContactList *) conn->contact_list);
diff --git a/src/contact-list.c b/src/contact-list.c
index e333850..fb70081 100644
--- a/src/contact-list.c
+++ b/src/contact-list.c
@@ -1296,6 +1296,15 @@ unblock_contacts_async(TpBaseContactList *cl,
user_data, unblock_contacts_async);
}
+static gboolean
+can_block (TpBaseContactList *cl)
+{
+ HazeContactList *self = HAZE_CONTACT_LIST (cl);
+
+ return (self->priv->conn->account->gc != NULL &&
+ HAZE_CONNECTION_GET_PRPL_INFO (self->priv->conn)->add_deny != NULL);
+}
+
static void
haze_contact_list_blockable_init(
TpBlockableContactListInterface *vtable)
@@ -1303,4 +1312,6 @@ haze_contact_list_blockable_init(
vtable->dup_blocked_contacts = dup_blocked_contacts;
vtable->block_contacts_async = block_contacts_async;
vtable->unblock_contacts_async = unblock_contacts_async;
+
+ vtable->can_block = can_block;
}