From 266835f4f2885c11109bd0777ed970241c52622e Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Wed, 9 Jun 2010 15:15:57 +0200 Subject: Strip the @server.com part of the contact ID for the live search matching. --- libempathy-gtk/empathy-contact-list-view.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'libempathy-gtk/empathy-contact-list-view.c') diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index 873fe4ac4..5ae2e990a 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -145,17 +145,29 @@ contact_list_view_is_visible_contact (EmpathyContactListView *self, EmpathyContactListViewPriv *priv = GET_PRIV (self); EmpathyLiveSearch *live = EMPATHY_LIVE_SEARCH (priv->search_widget); const gchar *str; + const gchar *p; + gchar *dup_str = NULL; + gboolean visible; /* check alias name */ str = empathy_contact_get_name (contact); if (empathy_live_search_match (live, str)) return TRUE; - /* check contact id */ + /* check contact id, remove the @server.com part */ str = empathy_contact_get_id (contact); - if (empathy_live_search_match (live, str)) + p = strstr (str, "@"); + if (p != NULL) + str = dup_str = g_strndup (str, p - str); + + visible = empathy_live_search_match (live, str); + g_free (dup_str); + if (visible) return TRUE; + /* FIXME: Add more rules here, we could check phone numbers in + * contact's vCard for example. */ + return FALSE; } -- cgit v1.2.3