From db6773ebf31853608353b1bb156156879b303569 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 1 Jun 2011 11:06:28 +0200 Subject: allow user to search for contacts using their full identifier --- libempathy-gtk/empathy-ui-utils.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'libempathy-gtk/empathy-ui-utils.c') diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index ee73c14c8..cf3228da5 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -1949,8 +1949,13 @@ empathy_get_current_action_time (void) return (tp_user_action_time_from_x11 (gtk_get_current_event_time ())); } +/* @words = empathy_live_search_strip_utf8_string (@text); + * + * User has to pass both so we don't have to compute @words ourself each time + * this function is called. */ gboolean -empathy_individual_match_words (FolksIndividual *individual, +empathy_individual_match_string (FolksIndividual *individual, + const char *text, GPtrArray *words) { const gchar *str; @@ -1975,6 +1980,12 @@ empathy_individual_match_words (FolksIndividual *individual, continue; str = folks_persona_get_display_id (l->data); + + /* Accept the persona if @text is a full prefix of his ID; that allows + * user to find, say, a jabber contact by typing his JID. */ + if (g_str_has_prefix (str, text)) + return TRUE; + p = strstr (str, "@"); if (p != NULL) str = dup_str = g_strndup (str, p - str); -- cgit v1.2.3