summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-09-17 14:34:44 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-09-18 08:08:42 +0200
commit92067c3f489af9beee16bbcefe721a0fc3c7482c (patch)
tree8b4bb009b835f28a0b27de8747038a5e9dc9f631
parent92814a55d012c3a6cd5111486f3505ceb6f31984 (diff)
downloadtelepathy-haze-92067c3f489af9beee16bbcefe721a0fc3c7482c.tar.gz
connection: factor out protocol_info_supports_{avatar,blocking}
https://bugs.freedesktop.org/show_bug.cgi?id=69466
-rw-r--r--src/connection.c16
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,