[Bug 40695] Expose more caps code to plugins
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Mon Sep 26 17:47:02 CEST 2011
https://bugs.freedesktop.org/show_bug.cgi?id=40695
--- Comment #2 from Will Thompson <will.thompson at collabora.co.uk> 2011-09-26 08:47:01 PDT ---
(In reply to comment #1)
> Do you really want _get_title()? Does that give a meaningful description? Would
> the value of the FORM_TYPE field be better?
You noticed that it's never useful in the next branch... I still think
FORM_TYPE would be useful.
Could any other code that uses gabble_presence_pick_resource_by_caps() be
updated to use gabble_connection_pick_best_resource_for_caps() to delete
duplicated code?
+
+typedef struct {
+ GabblePresence *presence;
+ TpHandle handle;
+} GetJidData;
+
+static void
+find_presence (gpointer key,
+ gpointer value,
+ gpointer user_data)
+{
+ GetJidData *data = user_data;
+
+ if (data->presence == value)
+ data->handle = GPOINTER_TO_UINT (key);
+}
+
+TpHandle
+gabble_presence_cache_get_handle (GabblePresenceCache *cache,
+ GabblePresence *presence)
+{
+ GetJidData data = { presence, 0 };
+
+ g_hash_table_foreach (cache->priv->presence, find_presence, &data);
+
+ return data.handle;
+}
Ugh really? Use GHashTableIter. Or if you insist, g_hash_table_find, which lets
you terminate the iteration when you find what you're after.
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the telepathy-bugs
mailing list