[folks] Implement the IMable interface on TpfPersona
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Implement the IMable interface on TpfPersona
- Date: Mon, 9 Aug 2010 17:44:54 +0000 (UTC)
commit 5fb93c5290afbc3946308910eec826dc8b3f009c
Author: Philip Withnall <philip withnall collabora co uk>
Date: Mon Aug 9 12:44:03 2010 +0100
Implement the IMable interface on TpfPersona
Use it to expose the Persona's IM address. Do not allow setting the IM
address.
backends/telepathy/tpf-persona.vala | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/backends/telepathy/tpf-persona.vala b/backends/telepathy/tpf-persona.vala
index 5acb443..f7f0c9d 100644
--- a/backends/telepathy/tpf-persona.vala
+++ b/backends/telepathy/tpf-persona.vala
@@ -37,11 +37,13 @@ public class Tpf.Persona : Folks.Persona,
Avatar,
Favourite,
Groups,
+ IMable,
Presence
{
private HashTable<string, bool> _groups;
private bool _is_favourite;
private string _alias;
+ private HashTable<string, GenericArray<string>> _im_addresses;
/* Whether we've finished being constructed; this is used to prevent
* unnecessary trips to the Telepathy service to tell it about properties
@@ -103,6 +105,15 @@ public class Tpf.Persona : Folks.Persona,
/**
* { inheritDoc}
*/
+ public HashTable<string, GenericArray<string>> im_addresses
+ {
+ get { return this._im_addresses; }
+ private set {}
+ }
+
+ /**
+ * { inheritDoc}
+ */
public HashTable<string, bool> groups
{
get { return this._groups; }
@@ -170,6 +181,8 @@ public class Tpf.Persona : Folks.Persona,
*/
public Persona (Contact contact, PersonaStore store) throws Tpf.PersonaError
{
+ string[] linkable_properties = { "im-addresses" };
+
/* FIXME: There is the possibility of a crash in the error condition below
* due to bgo#604299, where the C self variable isn't initialised until we
* chain up to the Object constructor, below. */
@@ -194,12 +207,22 @@ public class Tpf.Persona : Folks.Persona,
* bgo#624842 being fixed. */
iid: account.get_protocol () + ":" + id,
uid: uid,
- store: store);
+ store: store,
+ linkable_properties: linkable_properties);
debug ("Creating new Tpf.Persona '%s' for service-specific UID '%s': %p",
uid, id, this);
this.is_constructed = true;
+ /* Set our single IM address */
+ GenericArray<string> im_address_array = new GenericArray<string> ();
+ im_address_array.add (id);
+
+ this._im_addresses =
+ new HashTable<string, GenericArray<string>> (str_hash, str_equal);
+ this._im_addresses.insert (account.get_protocol (), im_address_array);
+
+ /* Groups */
this._groups = new HashTable<string, bool> (str_hash, str_equal);
contact.notify["avatar-file"].connect ((s, p) =>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]