[telepathy-gabble/master] Use mapping table when parsing unextended search fields

Will Thompson will.thompson at collabora.co.uk
Wed Aug 26 09:21:56 PDT 2009


---
 src/search-channel.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/search-channel.c b/src/search-channel.c
index 29a0c90..aa2a71c 100644
--- a/src/search-channel.c
+++ b/src/search-channel.c
@@ -202,21 +202,21 @@ parse_search_field_response (GabbleSearchChannel *chan,
 
   for (field = query_node->children; field != NULL; field = field->next)
     {
+      gchar *tp_name;
+
       if (!strcmp (field->name, "instructions"))
         {
           DEBUG ("server gave us some instructions: %s",
               lm_message_node_get_value (field));
+          continue;
         }
-#define MAP_FIELD_TO(xep_name, tp_name) \
-      else if (!strcmp (field->name, xep_name)) \
-        { \
-          g_ptr_array_add (search_keys, tp_name); \
+
+      tp_name = g_hash_table_lookup (xmpp_to_tp, field->name);
+
+      if (tp_name != NULL)
+        {
+          g_ptr_array_add (search_keys, tp_name);
         }
-      MAP_FIELD_TO ("first", "x-n-given")
-      MAP_FIELD_TO ("last", "x-n-family")
-      MAP_FIELD_TO ("nick", "nickname")
-      MAP_FIELD_TO ("email", "email")
-#undef MAP_FIELD_TO
       else
         {
           GError error = { TP_ERRORS, TP_ERROR_NOT_AVAILABLE, NULL };
-- 
1.5.6.5




More information about the telepathy-commits mailing list