diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2010-06-09 21:15:57 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2010-06-09 21:15:57 +0800 |
commit | 266835f4f2885c11109bd0777ed970241c52622e (patch) | |
tree | 792b554a1ffce700384b10dde5f38e24e8eac3fc | |
parent | a7bf51e52c22b1b5c4d2d86ea8ead88adfe97f75 (diff) | |
download | gsoc2013-empathy-266835f4f2885c11109bd0777ed970241c52622e.tar gsoc2013-empathy-266835f4f2885c11109bd0777ed970241c52622e.tar.gz gsoc2013-empathy-266835f4f2885c11109bd0777ed970241c52622e.tar.bz2 gsoc2013-empathy-266835f4f2885c11109bd0777ed970241c52622e.tar.lz gsoc2013-empathy-266835f4f2885c11109bd0777ed970241c52622e.tar.xz gsoc2013-empathy-266835f4f2885c11109bd0777ed970241c52622e.tar.zst gsoc2013-empathy-266835f4f2885c11109bd0777ed970241c52622e.zip |
Strip the @server.com part of the contact ID for the live search matching.
-rw-r--r-- | libempathy-gtk/empathy-contact-list-view.c | 16 |
1 files changed, 14 insertions, 2 deletions
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; } |