telepathy-haze: connection: factor out protocol_info_supports_{avatar, blocking}
Guillaume Desmottes
gdesmott at kemper.freedesktop.org
Wed Sep 18 04:10:36 PDT 2013
Module: telepathy-haze
Branch: master
Commit: 92067c3f489af9beee16bbcefe721a0fc3c7482c
URL: http://cgit.freedesktop.org/telepathy/telepathy-haze/commit/?id=92067c3f489af9beee16bbcefe721a0fc3c7482c
Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date: Tue Sep 17 14:34:44 2013 +0200
connection: factor out protocol_info_supports_{avatar,blocking}
https://bugs.freedesktop.org/show_bug.cgi?id=69466
---
src/connection.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/connection.c b/src/connection.c
index 3c98304..6fd12d3 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -155,6 +155,18 @@ struct _HazeConnectionPrivate
#define PC_GET_BASE_CONN(pc) \
(ACCOUNT_GET_TP_BASE_CONNECTION (purple_connection_get_account (pc)))
+static gboolean
+protocol_info_supports_avatar (PurplePluginProtocolInfo *prpl_info)
+{
+ return (prpl_info->icon_spec.format != NULL);
+}
+
+static gboolean
+protocol_info_supports_blocking (PurplePluginProtocolInfo *prpl_info)
+{
+ return (prpl_info->add_deny != NULL);
+}
+
static void
connected_cb (PurpleConnection *pc)
{
@@ -162,7 +174,7 @@ connected_cb (PurpleConnection *pc)
HazeConnection *conn = HAZE_CONNECTION (base_conn);
PurplePluginProtocolInfo *prpl_info = HAZE_CONNECTION_GET_PRPL_INFO (conn);
- if (prpl_info->icon_spec.format != NULL)
+ if (protocol_info_supports_avatar (prpl_info))
{
static const gchar *avatar_ifaces[] = {
TP_IFACE_CONNECTION_INTERFACE_AVATARS,
@@ -170,7 +182,7 @@ connected_cb (PurpleConnection *pc)
tp_base_connection_add_interfaces (base_conn, avatar_ifaces);
}
- if (prpl_info->add_deny != NULL)
+ if (protocol_info_supports_blocking (prpl_info))
{
static const gchar *blocking_ifaces[] = {
TP_IFACE_CONNECTION_INTERFACE_CONTACT_BLOCKING,
More information about the telepathy-commits
mailing list