summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-09-19 13:43:13 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-09-19 13:45:14 +0200
commit0979408634389bb28853820c2f7cfc840f74c026 (patch)
tree3100a2c760936f51fb64bf1b5a4db9bc396f2dec
parent9b8846bbb243134981494377ff683777b0ea5c4c (diff)
downloadtelepathy-salut-0979408634389bb28853820c2f7cfc840f74c026.tar.gz
protocol: implement Presences
https://bugs.freedesktop.org/show_bug.cgi?id=31108
-rw-r--r--src/connection.c6
-rw-r--r--src/connection.h2
-rw-r--r--src/protocol.c7
-rw-r--r--tests/twisted/cm/protocol.py8
4 files changed, 23 insertions, 0 deletions
diff --git a/src/connection.c b/src/connection.c
index 186997bd..00a6d56e 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -4203,3 +4203,9 @@ salut_connection_dup_avatar_requirements (GStrv *supported_mime_types,
if (max_bytes != NULL)
*max_bytes = AVATAR_MAX_BYTES;
}
+
+const TpPresenceStatusSpec *
+salut_connection_get_presence_statuses (void)
+{
+ return presence_statuses;
+}
diff --git a/src/connection.h b/src/connection.h
index d33e1921..dcc0128d 100644
--- a/src/connection.h
+++ b/src/connection.h
@@ -118,6 +118,8 @@ void salut_connection_dup_avatar_requirements (GStrv *supported_mime_types,
guint *max_width,
guint *max_bytes);
+const TpPresenceStatusSpec * salut_connection_get_presence_statuses (void);
+
G_END_DECLS
#endif /* #ifndef __SALUT_CONNECTION_H__*/
diff --git a/src/protocol.c b/src/protocol.c
index 1ab5f3d7..2b805c85 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -302,6 +302,12 @@ get_avatar_details (TpBaseProtocol *base,
min_width, rec_height, rec_width, max_height, max_width, max_bytes);
}
+static const TpPresenceStatusSpec *
+get_presence_statuses (TpBaseProtocol *self)
+{
+ return salut_connection_get_presence_statuses ();
+}
+
static void
salut_protocol_class_init (SalutProtocolClass *klass)
{
@@ -318,6 +324,7 @@ salut_protocol_class_init (SalutProtocolClass *klass)
base_class->get_connection_details = get_connection_details;
base_class->get_interfaces_array = get_interfaces_array;
base_class->get_avatar_details = get_avatar_details;
+ base_class->get_statuses = get_presence_statuses;
object_class->get_property = salut_protocol_get_property;
object_class->set_property = salut_protocol_set_property;
diff --git a/tests/twisted/cm/protocol.py b/tests/twisted/cm/protocol.py
index 05cffc49..51bf6d62 100644
--- a/tests/twisted/cm/protocol.py
+++ b/tests/twisted/cm/protocol.py
@@ -74,5 +74,13 @@ def test(q, bus, conn):
assertContains(cs.PROTOCOL_IFACE_PRESENCES, proto_props['Interfaces'])
+ expected_status = {'available': (cs.PRESENCE_AVAILABLE, True, True),
+ 'dnd' : (cs.PRESENCE_BUSY, True, True),
+ 'away' : (cs.PRESENCE_AWAY, True, True),
+ 'offline' : (cs.PRESENCE_OFFLINE, False, False)}
+
+ presences = proto_prop_iface.Get(cs.PROTOCOL_IFACE_PRESENCES, 'Statuses');
+ assertEquals(expected_status, presences)
+
if __name__ == '__main__':
exec_test(test)