changeset 11201:07dc8c6a359f

[gaim-migrate @ 13329] This hopefully fixes a lot of potential crashes in the SILC PRPL. Possible things to do: -Backport these changes to oldstatus -Ask the SILC guy to make sure all of these make sense. It's likely there are better things that could be used as handles -Check for other places in Gaim that don't give handles when they should committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 08 Aug 2005 02:18:16 +0000
parents 4295083cf489
children ff4884029708
files src/protocols/silc/buddy.c src/protocols/silc/chat.c src/protocols/silc/ops.c src/protocols/silc/pk.c src/protocols/silc/silc.c src/protocols/silc/util.c src/request.h
diffstat 7 files changed, 46 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/silc/buddy.c	Mon Aug 08 01:40:41 2005 +0000
+++ b/src/protocols/silc/buddy.c	Mon Aug 08 02:18:16 2005 +0000
@@ -302,7 +302,7 @@
 		a->hostname = strdup(hostname);
 	a->port = port;
 
-	gaim_request_action(NULL, _("Key Agreement Request"), tmp,
+	gaim_request_action(client->application, _("Key Agreement Request"), tmp,
 			    hostname ? tmp2 : NULL, 1, a, 2,
 			    _("Yes"), G_CALLBACK(silcgaim_buddy_keyagr_request_cb),
 			    _("No"), G_CALLBACK(silcgaim_buddy_keyagr_request_cb));
@@ -455,7 +455,7 @@
 	p->client = sg->client;
 	p->conn = sg->conn;
 	p->client_id = *clients[0]->id;
-        gaim_request_input(NULL, _("IM With Password"), NULL,
+        gaim_request_input(gc, _("IM With Password"), NULL,
                            _("Set IM Password"), NULL, FALSE, TRUE, NULL,
                            _("OK"), G_CALLBACK(silcgaim_buddy_privkey_cb),
                            _("Cancel"), G_CALLBACK(silcgaim_buddy_privkey_cb),
@@ -1020,7 +1020,7 @@
 	}
 
 	/* Open file selector to select the public key. */
-	gaim_request_file(NULL, _("Open..."), NULL, FALSE,
+	gaim_request_file(r->client->application, _("Open..."), NULL, FALSE,
 			  G_CALLBACK(silcgaim_add_buddy_ask_import),
 			  G_CALLBACK(silcgaim_add_buddy_ask_pk_cancel), r);
 }
@@ -1031,7 +1031,7 @@
 	char tmp[512];
 	g_snprintf(tmp, sizeof(tmp), _("The %s buddy is not present in the network"),
 		   r->b->name);
-	gaim_request_action(NULL, _("Add Buddy"), tmp,
+	gaim_request_action(r->client->application, _("Add Buddy"), tmp,
 			    _("To add the buddy you must import his/her public key. "
 			      "Press Import to import a public key."), 0, r, 2,
 			    _("Cancel"), G_CALLBACK(silcgaim_add_buddy_ask_pk_cb),
@@ -1121,7 +1121,7 @@
 		gaim_request_field_list_add(f, tmp, clients[i]);
 	}
 
-	gaim_request_fields(NULL, _("Add Buddy"),
+	gaim_request_fields(r->client->application, _("Add Buddy"),
 				_("Select correct user"),
 				r->pubkey_search
 					? _("More than one user was found with the same public key. Select "
--- a/src/protocols/silc/chat.c	Mon Aug 08 01:40:41 2005 +0000
+++ b/src/protocols/silc/chat.c	Mon Aug 08 02:18:16 2005 +0000
@@ -286,7 +286,7 @@
 	f = gaim_request_fields_get_field(fields, "list");
 	if (!gaim_request_field_list_get_selected(f)) {
 		/* Add new public key */
-		gaim_request_file(NULL, _("Open Public Key..."), NULL, FALSE,
+		gaim_request_file(sg->gc, _("Open Public Key..."), NULL, FALSE,
 				  G_CALLBACK(silcgaim_chat_chpk_add),
 				  G_CALLBACK(silcgaim_chat_chpk_cancel), sgc);
 		return;
@@ -416,7 +416,7 @@
 	if (!channel_pubkeys) {
 		f = gaim_request_field_list_new("list", NULL);
 		gaim_request_field_group_add_field(g, f);
-		gaim_request_fields(NULL, _("Channel Authentication"),
+		gaim_request_fields(sg->gc, _("Channel Authentication"),
 				    _("Channel Authentication"), t, fields,
 				    _("Add / Remove"), G_CALLBACK(silcgaim_chat_chpk_cb),
 				    _("OK"), G_CALLBACK(silcgaim_chat_chauth_ok), sgc);
@@ -454,7 +454,7 @@
 	}
 
 	gaim_request_field_list_set_multi_select(f, FALSE);
-	gaim_request_fields(NULL, _("Channel Authentication"),
+	gaim_request_fields(sg->gc, _("Channel Authentication"),
 			    _("Channel Authentication"), t, fields,
 			    _("Add / Remove"), G_CALLBACK(silcgaim_chat_chpk_cb),
 			    _("OK"), G_CALLBACK(silcgaim_chat_chauth_ok), sgc);
@@ -590,7 +590,7 @@
 	g_snprintf(tmp, sizeof(tmp),
 		   _("Please enter the %s channel private group name and passphrase."),
 		   p->channel);
-	gaim_request_fields(NULL, _("Add Channel Private Group"), NULL, tmp, fields,
+	gaim_request_fields(gc, _("Add Channel Private Group"), NULL, tmp, fields,
 			    _("Add"), G_CALLBACK(silcgaim_chat_prv_add),
 			    _("Cancel"), G_CALLBACK(silcgaim_chat_prv_cancel), p);
 }
@@ -717,7 +717,7 @@
 	s->channel = ch;
 	s->sg = sg;
 	g_snprintf(tmp, sizeof(tmp), "%d", (int)channel->user_limit);
-	gaim_request_input(NULL, _("User Limit"), NULL,
+	gaim_request_input(gc, _("User Limit"), NULL,
 			   _("Set user limit on channel. Set to zero to reset user limit."),
 			   tmp, FALSE, FALSE, NULL,
 			   _("OK"), G_CALLBACK(silcgaim_chat_ulimit_cb),
--- a/src/protocols/silc/ops.c	Mon Aug 08 01:40:41 2005 +0000
+++ b/src/protocols/silc/ops.c	Mon Aug 08 02:18:16 2005 +0000
@@ -1077,7 +1077,7 @@
 			buf = g_string_free(s, FALSE);
 #if 0 /* XXX for now, let's not show attrs here */
 			if (client_entry->attrs)
-				gaim_request_action(NULL, _("User Information"),
+				gaim_request_action(gc, _("User Information"),
 						_("User Information"),
 						buf, 1, client_entry, 2,
 						_("OK"), G_CALLBACK(silcgaim_whois_more),
@@ -1695,7 +1695,7 @@
 		return;
 	internal->completion = completion;
 	internal->context = context;
-	gaim_request_input(NULL, _("Passphrase"), NULL,
+	gaim_request_input(client->application, _("Passphrase"), NULL,
 			   _("Passphrase required"), NULL, FALSE, TRUE, NULL,
 			   _("OK"), G_CALLBACK(silc_ask_passphrase_cb),
 			   _("Cancel"), G_CALLBACK(silc_ask_passphrase_cb),
--- a/src/protocols/silc/pk.c	Mon Aug 08 01:40:41 2005 +0000
+++ b/src/protocols/silc/pk.c	Mon Aug 08 02:18:16 2005 +0000
@@ -112,7 +112,7 @@
 		   _("Fingerprint and babbleprint for the %s key are:\n\n"
 		     "%s\n%s\n"), entity, fingerprint, babbleprint);
 
-	gaim_request_action(NULL, _("Verify Public Key"), tmp, tmp2, 
+	gaim_request_action(verify->client->application, _("Verify Public Key"), tmp, tmp2,
 						GAIM_DEFAULT_ACTION_NONE, verify, 3,
 			    _("Yes"), G_CALLBACK(silcgaim_verify_cb),
 			    _("No"), G_CALLBACK(silcgaim_verify_cb),
--- a/src/protocols/silc/silc.c	Mon Aug 08 01:40:41 2005 +0000
+++ b/src/protocols/silc/silc.c	Mon Aug 08 02:18:16 2005 +0000
@@ -716,7 +716,7 @@
 	gaim_request_fields_add_group(fields, g);
 
 
-	gaim_request_fields(NULL, _("User Online Status Attributes"),
+	gaim_request_fields(gc, _("User Online Status Attributes"),
 			    _("User Online Status Attributes"),
 			    _("You can let other users see your online status information "
 			      "and your personal information. Please fill the information "
--- a/src/protocols/silc/util.c	Mon Aug 08 01:40:41 2005 +0000
+++ b/src/protocols/silc/util.c	Mon Aug 08 02:18:16 2005 +0000
@@ -329,7 +329,7 @@
 
 	buf = g_string_free(s, FALSE);
 
-	gaim_request_action(NULL, _("Public Key Information"),
+	gaim_request_action(sg->gc, _("Public Key Information"),
 			    _("Public Key Information"),
 			    buf, 0, context, 1,
 			    _("Close"), callback);
--- a/src/request.h	Mon Aug 08 01:40:41 2005 +0000
+++ b/src/request.h	Mon Aug 08 02:18:16 2005 +0000
@@ -1068,7 +1068,19 @@
 /**
  * Prompts the user for text input.
  *
- * @param handle        The plugin or connection handle.
+ * @param handle        The plugin or connection handle.  For some
+ *                      things this is EXTREMELY important.  The
+ *                      handle is used to programmatically close
+ *                      the request dialog when it is no longer
+ *                      needed.  For PRPLs this is often a pointer
+ *                      to the GaimConnection instance.  For plugins
+ *                      this should be a similar, unique memory
+ *                      location.  This value is important because
+ *                      it allows a request to be closed, say, when
+ *                      you sign offline.  If the request is NOT
+ *                      closed it is VERY likely to cause a crash
+ *                      whenever the callback handler functions are
+ *                      triggered.
  * @param title         The title of the message.
  * @param primary       The main point of the message.
  * @param secondary     The secondary information.
@@ -1097,7 +1109,9 @@
 /**
  * Prompts the user for multiple-choice input.
  *
- * @param handle        The plugin or connection handle.
+ * @param handle        The plugin or connection handle.  For some
+ *                      things this is EXTREMELY important.  See
+ *                      the comments on gaim_request_input.
  * @param title         The title of the message.
  * @param primary       The main point of the message.
  * @param secondary     The secondary information.
@@ -1122,7 +1136,9 @@
 /**
  * Prompts the user for multiple-choice input.
  *
- * @param handle        The plugin or connection handle.
+ * @param handle        The plugin or connection handle.  For some
+ *                      things this is EXTREMELY important.  See
+ *                      the comments on gaim_request_input.
  * @param title         The title of the message.
  * @param primary       The main point of the message.
  * @param secondary     The secondary information.
@@ -1149,7 +1165,9 @@
  *
  * This is often represented as a dialog with a button for each action.
  *
- * @param handle         The plugin or connection handle.
+ * @param handle         The plugin or connection handle.  For some
+ *                       things this is EXTREMELY important.  See
+ *                       the comments on gaim_request_input.
  * @param title          The title of the message.
  * @param primary        The main point of the message.
  * @param secondary      The secondary information.
@@ -1170,7 +1188,9 @@
  *
  * This is often represented as a dialog with a button for each action.
  *
- * @param handle         The plugin or connection handle.
+ * @param handle         The plugin or connection handle.  For some
+ *                       things this is EXTREMELY important.  See
+ *                       the comments on gaim_request_input.
  * @param title          The title of the message.
  * @param primary        The main point of the message.
  * @param secondary      The secondary information.
@@ -1190,7 +1210,9 @@
 /**
  * Displays groups of fields for the user to fill in.
  *
- * @param handle      The plugin or connection handle.
+ * @param handle      The plugin or connection handle.  For some
+ *                    things this is EXTREMELY important.  See
+ *                    the comments on gaim_request_input.
  * @param title       The title of the message.
  * @param primary     The main point of the message.
  * @param secondary   The secondary information.
@@ -1257,7 +1279,9 @@
  * Displays a file selector request dialog.  Returns the selected filename into
  * the callback.  Can be used for either opening a file or saving a file.
  *
- * @param handle      The plugin or connection handle.
+ * @param handle      The plugin or connection handle.  For some
+ *                    things this is EXTREMELY important.  See
+ *                    the comments on gaim_request_input.
  * @param title       The title for the dialog (may be NULL)
  * @param filename    The default filename (may be NULL)
  * @param savedialog  True if this dialog is being used to save a file.