[folks] Don't assume every Tpf.Persona has a contact
- From: Travis Reitter <treitter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Don't assume every Tpf.Persona has a contact
- Date: Mon, 30 Jan 2012 19:09:59 +0000 (UTC)
commit 50171f5392901dca6eb1af48cc76a7b0c7ad7b5b
Author: Travis Reitter <travis reitter collabora co uk>
Date: Tue Jan 24 18:00:29 2012 -0800
Don't assume every Tpf.Persona has a contact
backends/telepathy/lib/tpf-persona-store.vala | 38 +++++++++++++++++++++++-
1 files changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index d5f76e9..b79577b 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -1234,7 +1234,10 @@ public class Tpf.PersonaStore : Folks.PersonaStore
/* Translators: the parameter is a persona identifier and
* the second parameter is a group name. */
warning (_("Failed to add Telepathy contact â%sâ to group â%sâ."),
- persona.contact.identifier, group);
+ persona.contact != null ?
+ persona.contact.identifier :
+ "(nil)",
+ group);
}
else
{
@@ -1242,7 +1245,11 @@ public class Tpf.PersonaStore : Folks.PersonaStore
/* Translators: the parameter is a persona identifier
* and the second parameter is a group name. */
_("Failed to remove Telepathy contact â%sâ from group â%sâ."),
- persona.contact.identifier, group);
+
+ persona.contact != null ?
+ persona.contact.identifier :
+ "(nil)",
+ group);
}
}
}
@@ -1606,6 +1613,13 @@ public class Tpf.PersonaStore : Folks.PersonaStore
_("Telepathy contacts representing the local user may not be removed."));
}
+ if (tp_persona.contact == null)
+ {
+ warning ("Skipping server-side removal of Tpf.Persona %p because " +
+ "it has no attached TpContact", tp_persona);
+ return;
+ }
+
try
{
FolksTpLowlevel.channel_group_change_membership (this._stored,
@@ -1798,6 +1812,13 @@ public class Tpf.PersonaStore : Folks.PersonaStore
{
var tp_persona = (Tpf.Persona) persona;
+ if (tp_persona.contact == null)
+ {
+ warning ("Skipping Tpf.Persona %p contact list change because it " +
+ "has no attached TpContact", tp_persona);
+ return;
+ }
+
try
{
FolksTpLowlevel.channel_group_change_membership (channel,
@@ -2263,6 +2284,12 @@ public class Tpf.PersonaStore : Folks.PersonaStore
_("Failed to change favorite without a connection to the telepathy-logger service."));
}
+ if (((Tpf.Persona) persona).contact == null)
+ {
+ throw new PropertyError.INVALID_VALUE (
+ _("Failed to change favorite status of Telepathy Persona because it has no attached TpContact."));
+ }
+
try
{
/* Add or remove the persona to the list of favourites as
@@ -2291,6 +2318,13 @@ public class Tpf.PersonaStore : Folks.PersonaStore
alias = "";
}
+ if (persona.contact == null)
+ {
+ warning ("Skipping Tpf.Persona %p alias change to '%s' because it " +
+ "has no attached TpContact", persona, alias);
+ return;
+ }
+
debug ("Changing alias of persona %u to '%s'.", persona.contact.handle,
alias);
FolksTpLowlevel.connection_set_contact_alias (this._conn,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]