aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-ui-utils.c
diff options
context:
space:
mode:
authorTravis Reitter <travis.reitter@collabora.co.uk>2011-04-30 04:33:04 +0800
committerTravis Reitter <travis.reitter@collabora.co.uk>2011-06-07 00:30:52 +0800
commit736b4f3d04f1e826dd8252fed88a7445b52ad461 (patch)
treee043a1787299eed54393477c1d540fe56710538c /libempathy-gtk/empathy-ui-utils.c
parentfaa40483fd000099a0593c09d0e92b938beaaaa7 (diff)
downloadgsoc2013-empathy-736b4f3d04f1e826dd8252fed88a7445b52ad461.tar
gsoc2013-empathy-736b4f3d04f1e826dd8252fed88a7445b52ad461.tar.gz
gsoc2013-empathy-736b4f3d04f1e826dd8252fed88a7445b52ad461.tar.bz2
gsoc2013-empathy-736b4f3d04f1e826dd8252fed88a7445b52ad461.tar.lz
gsoc2013-empathy-736b4f3d04f1e826dd8252fed88a7445b52ad461.tar.xz
gsoc2013-empathy-736b4f3d04f1e826dd8252fed88a7445b52ad461.tar.zst
gsoc2013-empathy-736b4f3d04f1e826dd8252fed88a7445b52ad461.zip
Adapt to API break in folks_individual_get_personas.
Helps: bgo#648822 - Port Empathy to Folks 0.5.1
Diffstat (limited to 'libempathy-gtk/empathy-ui-utils.c')
-rw-r--r--libempathy-gtk/empathy-ui-utils.c57
1 files changed, 34 insertions, 23 deletions
diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c
index cf3228da5..0b0bf3050 100644
--- a/libempathy-gtk/empathy-ui-utils.c
+++ b/libempathy-gtk/empathy-ui-utils.c
@@ -1959,7 +1959,9 @@ empathy_individual_match_string (FolksIndividual *individual,
GPtrArray *words)
{
const gchar *str;
- GList *personas, *l;
+ GeeSet *personas;
+ GeeIterator *iter;
+ gboolean retval = FALSE;
/* check alias name */
str = folks_alias_details_get_alias (FOLKS_ALIAS_DETAILS (individual));
@@ -1970,33 +1972,42 @@ empathy_individual_match_string (FolksIndividual *individual,
personas = folks_individual_get_personas (individual);
/* check contact id, remove the @server.com part */
- for (l = personas; l; l = l->next)
+ iter = gee_iterable_iterator (GEE_ITERABLE (personas));
+ while (retval == FALSE && gee_iterator_next (iter))
{
+ FolksPersona *persona = gee_iterator_get (iter);
const gchar *p;
- gchar *dup_str = NULL;
- gboolean visible;
- if (!empathy_folks_persona_is_interesting (FOLKS_PERSONA (l->data)))
- 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);
-
- visible = empathy_live_search_match_words (str, words);
- g_free (dup_str);
- if (visible)
- return TRUE;
+ if (empathy_folks_persona_is_interesting (persona))
+ {
+ str = folks_persona_get_display_id (persona);
+
+ /* 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))
+ {
+ retval = TRUE;
+ }
+ else
+ {
+ gchar *dup_str = NULL;
+ gboolean visible;
+
+ p = strstr (str, "@");
+ if (p != NULL)
+ str = dup_str = g_strndup (str, p - str);
+
+ visible = empathy_live_search_match_words (str, words);
+ g_free (dup_str);
+ if (visible)
+ retval = TRUE;
+ }
+ }
+ g_clear_object (&persona);
}
+ g_clear_object (&iter);
/* FIXME: Add more rules here, we could check phone numbers in
* contact's vCard for example. */
- return FALSE;
+ return retval;
}