changeset 27400:ebb0f7d27f5b

Make the use of xmpp_iq_cb_data->context explicit.
author Paul Aurich <paul@darkrain42.org>
date Tue, 07 Jul 2009 05:09:53 +0000
parents 12edccab4944
children 8a46d5528c3c
files pidgin/plugins/disco/xmppdisco.c
diffstat 1 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/plugins/disco/xmppdisco.c	Tue Jul 07 04:32:58 2009 +0000
+++ b/pidgin/plugins/disco/xmppdisco.c	Tue Jul 07 05:09:53 2009 +0000
@@ -59,13 +59,6 @@
                                const char *id, const char *from, xmlnode *iq,
                                gpointer data);
 
-struct xmpp_iq_cb_data
-{
-	gpointer context;
-	PurpleConnection *pc;
-	XmppIqCallback cb;
-};
-
 struct item_data {
 	PidginDiscoList *list;
 	XmppDiscoService *parent;
@@ -73,6 +66,20 @@
 	char *node; /* disco#info replies don't always include the node */
 };
 
+struct xmpp_iq_cb_data
+{
+	/*
+	 * Every IQ callback in this plugin uses the same structure for the
+	 * callback data. It's a hack (it wouldn't scale), but it's used so that
+	 * it's easy to clean up all the callbacks when the account disconnects
+	 * (see remove_iq_callbacks_by_pc below).
+	 */
+	struct item_data *context;
+	PurpleConnection *pc;
+	XmppIqCallback cb;
+};
+
+
 static char*
 generate_next_id()
 {
@@ -93,11 +100,6 @@
 	struct xmpp_iq_cb_data *cb_data = value;
 
 	if (cb_data && cb_data->pc == user_data) {
-		/*
-		 * This is a hack. All the IQ callback datas in this code are
-		 * the same structure so that we can free them here. Ideally they'd
-		 * be objects and this would be polymorphic. That's overkill, here.
-		 */
 		struct item_data *item_data = cb_data->context;
 
 		if (item_data) {