[folks] core: Add PresenceDetails::client-types and implement on Individual and Tpf.Persona
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] core: Add PresenceDetails::client-types and implement on Individual and Tpf.Persona
- Date: Mon, 1 Jul 2013 12:35:06 +0000 (UTC)
commit 0659f8b044d7d2845502c07ef775ecf1b854e68a
Author: Serhat Demircan <demircan serhat gmail com>
Date: Tue May 7 22:27:53 2013 +0300
core: Add PresenceDetails::client-types and implement on Individual and Tpf.Persona
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=699865
NEWS | 6 ++++++
backends/telepathy/lib/tpf-persona.vala | 23 +++++++++++++++++++++++
folks/individual.vala | 15 ++++++++++++++-
folks/presence-details.vala | 13 +++++++++++++
4 files changed, 56 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index f0166b5..b20088f 100644
--- a/NEWS
+++ b/NEWS
@@ -6,8 +6,14 @@ Dependencies:
Major changes:
Bugs fixed:
+• Bug 699865 — Folks needs to expose chat/VoIP service client types
API changes:
+• Add PresenceDetails.client_types
+• Add new Individual property:
+ - client_types
+• Add new Tpf.Persona property:
+ - client_types
Overview of changes from libfolks 0.9.2 to libfolks 0.9.3
=========================================================
diff --git a/backends/telepathy/lib/tpf-persona.vala b/backends/telepathy/lib/tpf-persona.vala
index 57cdb1b..b891436 100644
--- a/backends/telepathy/lib/tpf-persona.vala
+++ b/backends/telepathy/lib/tpf-persona.vala
@@ -251,6 +251,15 @@ public class Tpf.Persona : Folks.Persona,
public string presence_message { get; set; }
/**
+ * The Persona's client types.
+ *
+ * See { link Folks.PresenceDetails.client_types}.
+ *
+ * @since UNRELEASED
+ */
+ public string[] client_types { get; set; }
+
+ /**
* The names of the Persona's linkable properties.
*
* See { link Folks.Persona.linkable_properties}.
@@ -849,9 +858,15 @@ public class Tpf.Persona : Folks.Persona,
{
this._contact_notify_presence_status ();
});
+ contact.notify["client-types"].connect ((s, p) =>
+ {
+ this._contact_notify_client_types ();
+ });
+
this._contact_notify_presence_message ();
this._contact_notify_presence_type ();
this._contact_notify_presence_status ();
+ this._contact_notify_client_types ();
contact.notify["contact-info"].connect ((s, p) =>
{
@@ -1227,6 +1242,7 @@ public class Tpf.Persona : Folks.Persona,
this.presence_type = PresenceType.OFFLINE;
this.presence_message = "";
this.presence_status = "offline";
+ this.client_types = {};
this._writeable_properties = {};
}
@@ -1257,6 +1273,13 @@ public class Tpf.Persona : Folks.Persona,
contact.get_presence_type ());
}
+ private void _contact_notify_client_types ()
+ {
+ var contact = (Contact?) this._contact.get ();
+ assert (contact != null); /* should never be called while cached */
+ this.client_types = contact.get_client_types ();
+ }
+
private void _contact_notify_presence_status ()
{
var contact = (Contact?) this._contact.get ();
diff --git a/folks/individual.vala b/folks/individual.vala
index 1362b45..b94bb15 100644
--- a/folks/individual.vala
+++ b/folks/individual.vala
@@ -239,6 +239,13 @@ public class Folks.Individual : Object,
public string presence_message { get; set; }
/**
+ * { inheritDoc}
+ *
+ * @since UNRELEASED
+ */
+ public string[] client_types { get; set; }
+
+ /**
* Whether the Individual is the user.
*
* Iff the Individual represents the user – the person who owns the
@@ -1582,6 +1589,7 @@ public class Folks.Individual : Object,
{
var presence_message = ""; /* must not be null */
var presence_status = ""; /* must not be null */
+ string[] client_types = {};
var presence_type = Folks.PresenceType.UNSET;
if (p != null)
@@ -1589,17 +1597,20 @@ public class Folks.Individual : Object,
presence_type = ((PresenceDetails) p).presence_type;
presence_message = ((PresenceDetails) p).presence_message;
presence_status = ((PresenceDetails) p).presence_status;
+ client_types = ((PresenceDetails) p).client_types;
}
/* Only notify if any of the values have changed. */
if (this.presence_type != presence_type ||
this.presence_message != presence_message ||
- this.presence_status != presence_status)
+ this.presence_status != presence_status ||
+ this.client_types != client_types)
{
this.freeze_notify ();
this.presence_message = presence_message;
this.presence_type = presence_type;
this.presence_status = presence_status;
+ this.client_types = client_types;
this.thaw_notify ();
}
});
@@ -1823,6 +1834,7 @@ public class Folks.Individual : Object,
persona.notify["alias"].connect (this._notify_alias_cb);
persona.notify["avatar"].connect (this._notify_avatar_cb);
persona.notify["presence-message"].connect (this._notify_presence_cb);
+ persona.notify["client-types"].connect (this._notify_presence_cb);
persona.notify["presence-type"].connect (this._notify_presence_cb);
persona.notify["im-addresses"].connect (this._notify_im_addresses_cb);
persona.notify["web-service-addresses"].connect
@@ -1961,6 +1973,7 @@ public class Folks.Individual : Object,
persona.notify["avatar"].disconnect (this._notify_avatar_cb);
persona.notify["presence-message"].disconnect (
this._notify_presence_cb);
+ persona.notify["client-types"].connect (this._notify_presence_cb);
persona.notify["presence-type"].disconnect (this._notify_presence_cb);
persona.notify["im-addresses"].disconnect (
this._notify_im_addresses_cb);
diff --git a/folks/presence-details.vala b/folks/presence-details.vala
index bca24da..7e30424 100644
--- a/folks/presence-details.vala
+++ b/folks/presence-details.vala
@@ -101,6 +101,19 @@ public interface Folks.PresenceDetails : Object
public abstract string presence_message { get; set; default = ""; }
/**
+ * The contact's client types.
+ *
+ * One can connect to instant messaging networks on a huge variety of devices,
+ * from PCs, to phones to consoles.
+ * The client types are represented in strings, using the values
+ * [[http://xmpp.org/registrar/disco-categories.html#client|documented by the
+ * XMPP registrar]]
+ *
+ * @since UNRELEASED
+ */
+ public abstract string[] client_types { get; set; }
+
+ /**
* The contact's detailed presence status.
*
* This is a more detailed representation of the contact's presence than
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]