diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2011-01-30 00:16:29 +0800 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2011-02-18 08:04:45 +0800 |
commit | 7365b5426c1e281f49bd67506c09ce76ffb67e2c (patch) | |
tree | fc7ab108424e93aad9463308ed79b3caf5482427 /libempathy | |
parent | 6103b13b462a07a8b508ee2223ef1e5acfc8dd47 (diff) | |
download | gsoc2013-empathy-7365b5426c1e281f49bd67506c09ce76ffb67e2c.tar gsoc2013-empathy-7365b5426c1e281f49bd67506c09ce76ffb67e2c.tar.gz gsoc2013-empathy-7365b5426c1e281f49bd67506c09ce76ffb67e2c.tar.bz2 gsoc2013-empathy-7365b5426c1e281f49bd67506c09ce76ffb67e2c.tar.lz gsoc2013-empathy-7365b5426c1e281f49bd67506c09ce76ffb67e2c.tar.xz gsoc2013-empathy-7365b5426c1e281f49bd67506c09ce76ffb67e2c.tar.zst gsoc2013-empathy-7365b5426c1e281f49bd67506c09ce76ffb67e2c.zip |
Bug 637151 — Hide the user Individual from the contact list
Generalise the mechanism used to determine whether a persona is to be
displayed by Empathy to also take into account whether the persona is the
user and, if so, whether they're in the contact list.
This bumps the libfolks dependency to 0.3.5.
Closes: bgo#637151
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-contact.c | 4 | ||||
-rw-r--r-- | libempathy/empathy-utils.c | 22 | ||||
-rw-r--r-- | libempathy/empathy-utils.h | 1 |
3 files changed, 23 insertions, 4 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index f91b587c7..d9ae5f649 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -859,7 +859,7 @@ empathy_contact_get_persona (EmpathyContact *contact) { TpfPersona *persona = j->data; - if (TPF_IS_PERSONA (persona)) + if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (persona))) { TpContact *tp_contact = tpf_persona_get_contact (persona); @@ -1909,7 +1909,7 @@ empathy_contact_dup_best_for_action (FolksIndividual *individual, TpContact *tp_contact; EmpathyContact *contact; - if (!TPF_IS_PERSONA (l->data)) + if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) continue; tp_contact = tpf_persona_get_contact (TPF_PERSONA (l->data)); diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index 038334e27..eebcf9593 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -756,7 +756,7 @@ empathy_folks_individual_contains_contact (FolksIndividual *individual) personas = folks_individual_get_personas (individual); for (l = personas; l != NULL; l = l->next) { - if (TPF_IS_PERSONA (l->data)) + if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data))) return (tpf_persona_get_contact (TPF_PERSONA (l->data)) != NULL); } @@ -783,7 +783,7 @@ empathy_contact_dup_from_folks_individual (FolksIndividual *individual) { TpfPersona *persona = l->data; - if (TPF_IS_PERSONA (persona)) + if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (persona))) { TpContact *tp_contact; @@ -803,6 +803,24 @@ tp_channel_group_change_reason_from_folks_groups_change_reason ( return (TpChannelGroupChangeReason) reason; } +gboolean +empathy_folks_persona_is_interesting (FolksPersona *persona) +{ + /* We're not interested in non-Telepathy personas */ + if (!TPF_IS_PERSONA (persona)) + return FALSE; + + /* We're not interested in user personas which haven't been added to the + * contact list (see bgo#637151). */ + if (folks_persona_get_is_user (persona) && + !tpf_persona_get_is_in_contact_list (TPF_PERSONA (persona))) + { + return FALSE; + } + + return TRUE; +} + gchar * empathy_get_x509_certificate_hostname (gnutls_x509_crt_t cert) { diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h index efa5d11d1..272fada1c 100644 --- a/libempathy/empathy-utils.h +++ b/libempathy/empathy-utils.h @@ -107,6 +107,7 @@ TpConnectionPresenceType empathy_folks_presence_type_to_tp (FolksPresenceType ty gboolean empathy_folks_individual_contains_contact (FolksIndividual *individual); EmpathyContact * empathy_contact_dup_from_folks_individual (FolksIndividual *individual); TpChannelGroupChangeReason tp_channel_group_change_reason_from_folks_groups_change_reason (FolksGroupableChangeReason reason); +gboolean empathy_folks_persona_is_interesting (FolksPersona *persona); gchar * empathy_get_x509_certificate_hostname (gnutls_x509_crt_t cert); |