[empathy] Strip the @server.com part of the contact ID for the live search matching.
- From: Xavier Claessens <xclaesse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] Strip the @server.com part of the contact ID for the live search matching.
- Date: Wed, 9 Jun 2010 13:21:58 +0000 (UTC)
commit 266835f4f2885c11109bd0777ed970241c52622e
Author: Xavier Claessens <xclaesse gmail com>
Date: Wed Jun 9 15:15:57 2010 +0200
Strip the @server.com part of the contact ID for the live search matching.
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 873fe4a..5ae2e99 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]