Commit 753a1862 authored by Philip Withnall's avatar Philip Withnall

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
parent d008f215
......@@ -31,7 +31,7 @@ AC_COPYRIGHT([
# Minimal version required
# Hardp deps
FOLKS_REQUIRED=0.3.4
FOLKS_REQUIRED=0.3.5
GLIB_REQUIRED=2.27.2
GNUTLS_REQUIRED=2.8.5
GTK_REQUIRED=2.99.0
......
......@@ -139,7 +139,7 @@ set_label_visibility (EmpathyIndividualInformationDialog *dialog)
personas = folks_individual_get_personas (priv->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)))
num_personas++;
}
}
......
......@@ -87,7 +87,7 @@ individual_menu_add_personas (GtkMenuShell *menu,
* functionality */
for (l = personas; l != NULL; l = l->next)
{
if (!TPF_IS_PERSONA (l->data))
if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data)))
continue;
persona_count++;
......@@ -116,7 +116,7 @@ individual_menu_add_personas (GtkMenuShell *menu,
const gchar *account;
GtkWidget *action;
if (!TPF_IS_PERSONA (persona))
if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data)))
continue;
tp_contact = tpf_persona_get_contact (persona);
......@@ -937,7 +937,7 @@ room_sub_menu_activate_cb (GtkWidget *item,
TpContact *tp_contact;
GList *rooms;
if (!TPF_IS_PERSONA (persona))
if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data)))
continue;
tp_contact = tpf_persona_get_contact (persona);
......@@ -1037,7 +1037,7 @@ empathy_individual_invite_menu_item_new (FolksIndividual *individual,
TpContact *tp_contact;
EmpathyContact *contact_cur;
if (!TPF_IS_PERSONA (persona))
if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data)))
continue;
tp_contact = tpf_persona_get_contact (persona);
......
......@@ -132,7 +132,7 @@ individual_can_audio_video_call (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));
......@@ -1954,7 +1954,7 @@ individual_store_get_individual_status_icon_with_icon_name (
personas = folks_individual_get_personas (individual);
for (l = personas, contact_count = 0; l; l = l->next)
{
if (TPF_IS_PERSONA (l->data))
if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data)))
contact_count++;
if (contact_count > 1)
......
......@@ -1681,7 +1681,7 @@ individual_view_is_visible_individual (EmpathyIndividualView *self,
EmpathyLiveSearch *live = EMPATHY_LIVE_SEARCH (priv->search_widget);
const gchar *str;
GList *personas, *l;
gboolean is_favorite;
gboolean is_favorite, contains_interesting_persona = FALSE;
/* We're only giving the visibility wrt filtering here, not things like
* presence. */
......@@ -1691,6 +1691,20 @@ individual_view_is_visible_individual (EmpathyIndividualView *self,
return FALSE;
}
/* Hide all individuals which consist entirely of uninteresting personas */
personas = folks_individual_get_personas (individual);
for (l = personas; l; l = l->next)
{
if (empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data)))
{
contains_interesting_persona = TRUE;
break;
}
}
if (contains_interesting_persona == FALSE)
return FALSE;
is_favorite = folks_favouritable_get_is_favourite (
FOLKS_FAVOURITABLE (individual));
if (is_searching == FALSE)
......@@ -1703,14 +1717,13 @@ individual_view_is_visible_individual (EmpathyIndividualView *self,
return TRUE;
/* check contact id, remove the @server.com part */
personas = folks_individual_get_personas (individual);
for (l = personas; l; l = l->next)
{
const gchar *p;
gchar *dup_str = NULL;
gboolean visible;
if (!TPF_IS_PERSONA (l->data))
if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data)))
continue;
str = folks_persona_get_display_id (l->data);
......@@ -2388,7 +2401,7 @@ individual_view_remove_activate_cb (GtkMenuItem *menuitem,
* be removed. */
for (l = personas; l != NULL; l = l->next)
{
if (!TPF_IS_PERSONA (l->data))
if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data)))
continue;
persona_count++;
......
......@@ -238,8 +238,8 @@ update_weak_contact (EmpathyIndividualWidget *self)
if (folks_presence_owner_typecmp (
folks_presence_owner_get_presence_type (presence),
presence_type) > 0
&& TPF_IS_PERSONA (presence))
presence_type) > 0 &&
empathy_folks_persona_is_interesting (FOLKS_PERSONA (presence)))
{
presence_type = folks_presence_owner_get_presence_type (presence);
tp_contact = tpf_persona_get_contact (TPF_PERSONA (l->data));
......@@ -581,7 +581,7 @@ location_update (EmpathyIndividualWidget *self)
{
FolksPersona *persona = FOLKS_PERSONA (l->data);
if (TPF_IS_PERSONA (persona))
if (empathy_folks_persona_is_interesting (persona))
{
TpContact *tp_contact;
......@@ -754,7 +754,7 @@ location_update (EmpathyIndividualWidget *self)
{
FolksPersona *persona = FOLKS_PERSONA (l->data);
if (TPF_IS_PERSONA (persona))
if (empathy_folks_persona_is_interesting (persona))
{
gdouble lat = 0.0, lon = 0.0;
ClutterActor *marker;
......@@ -877,7 +877,7 @@ persona_dup_avatar (FolksPersona *persona)
EmpathyContact *contact;
EmpathyAvatar *avatar;
if (!TPF_IS_PERSONA (persona))
if (!empathy_folks_persona_is_interesting (persona))
return NULL;
tp_contact = tpf_persona_get_contact (TPF_PERSONA (persona));
......@@ -1472,7 +1472,7 @@ add_persona (EmpathyIndividualWidget *self,
GtkWidget *label, *account_label, *account_image, *separator;
guint current_row = 0;
if (!TPF_IS_PERSONA (persona))
if (!empathy_folks_persona_is_interesting (persona))
return;
if (priv->flags & EMPATHY_INDIVIDUAL_WIDGET_EDIT_FAVOURITE)
......@@ -1575,7 +1575,7 @@ remove_persona (EmpathyIndividualWidget *self,
GtkWidget *separator;
GtkTable *table;
if (!TPF_IS_PERSONA (persona))
if (!empathy_folks_persona_is_interesting (persona))
return;
table = g_hash_table_lookup (priv->persona_tables, persona);
......@@ -1647,7 +1647,7 @@ individual_table_set_up (EmpathyIndividualWidget *self)
personas = folks_individual_get_personas (priv->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)))
num_personas++;
}
......@@ -1714,7 +1714,7 @@ personas_changed_cb (FolksIndividual *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)))
new_num_personas++;
}
......@@ -1890,7 +1890,7 @@ individual_update (EmpathyIndividualWidget *self)
personas = folks_individual_get_personas (priv->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)))
continue;
update_persona (self, FOLKS_PERSONA (l->data));
......
......@@ -248,7 +248,7 @@ empathy_linking_dialog_show (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)))
num_personas++;
}
......
......@@ -885,7 +885,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);
......@@ -1958,7 +1958,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));
......
......@@ -782,7 +782,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);
}
......@@ -809,7 +809,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;
......@@ -909,6 +909,24 @@ empathy_connection_can_group_personas (TpConnection *connection)
FOLKS_MAYBE_BOOL_TRUE);
}
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)
{
......
......@@ -113,6 +113,7 @@ TpfPersonaStore * empathy_get_persona_store_for_connection (TpConnection *connec
gboolean empathy_connection_can_add_personas (TpConnection *connection);
gboolean empathy_connection_can_alias_personas (TpConnection *connection);
gboolean empathy_connection_can_group_personas (TpConnection *connection);
gboolean empathy_folks_persona_is_interesting (FolksPersona *persona);
gchar * empathy_get_x509_certificate_hostname (gnutls_x509_crt_t cert);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment