diff src/protocols/toc/toc.c @ 4249:9c7fcb211886

[gaim-migrate @ 4499] If anyone is curious, the commit before this fixed a bug which didn't allow you to delete AIM or ICQ people from a deny list. They'll show up when you sign back online, and will be deleteable now. This is a patch from the good Mr. McQueen. "Twofold attack: 1) Make sure all the callback functions don't throw a mental if the gc the dialog was asking about has disappeared. Make sure the functions still free up the data structs as necessary in this case. 2) When setting up a ask dialog, plugins (including prpls) pass in their handle. The ask dialog struct gets kept in a slist. When unloading a plugin or prpl, Gaim checks the handle against the list, and sends a cancel-type message for any outstanding dialogs. Should avoid crashes from non-modal ask dialogs lying around." Yeah, so that's a nice lil' improvement. I also fixed a think where SSI "authorization denied" messages would be gibberish. That was a bug from just a few hours ago. Whoops. Also, since this is like a grown up version of show and tell, I thought this was funny: * Robot101 fixes idiocy <KingAnt> Does that mean I'm going to be nuetered? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 08 Jan 2003 08:18:49 +0000
parents cd84b0fd63fc
children 32fcf4cf5f80
line wrap: on
line diff
--- a/src/protocols/toc/toc.c	Wed Jan 08 07:28:54 2003 +0000
+++ b/src/protocols/toc/toc.c	Wed Jan 08 08:18:49 2003 +0000
@@ -59,6 +59,8 @@
 #include "pixmaps/protocols/oscar/free_icon.xpm"
 #include "pixmaps/protocols/oscar/wireless_icon.xpm"
 
+static struct prpl *my_protocol = NULL;
+
 /* for win32 compatability */
 G_MODULE_IMPORT GSList *connections;
 
@@ -1399,8 +1401,6 @@
 	return m;
 }
 
-static struct prpl *my_protocol = NULL;
-
 G_MODULE_EXPORT void toc_init(struct prpl *ret)
 {	
 	struct proto_user_opt *puo;
@@ -1933,33 +1933,36 @@
 
 
 static void toc_accept_ft(struct ft_request *fr) {
-	GtkWidget *window;
-	char buf[BUF_LEN];
+	if(g_slist_find(connections, fr->gc)) {
+		GtkWidget *window;
+		char buf[BUF_LEN];
 
-	struct file_transfer *ft = g_new0(struct file_transfer, 1);
-	ft->gc = fr->gc;
-	ft->user = g_strdup(fr->user);
-	ft->cookie = g_strdup(fr->cookie);
-	ft->ip = g_strdup(fr->ip);
-	ft->port = fr->port;
-	ft->files = fr->files;
+		struct file_transfer *ft = g_new0(struct file_transfer, 1);
+		ft->gc = fr->gc;
+		ft->user = g_strdup(fr->user);
+		ft->cookie = g_strdup(fr->cookie);
+		ft->ip = g_strdup(fr->ip);
+		ft->port = fr->port;
+		ft->files = fr->files;
 
-	ft->window = window = gtk_file_selection_new(_("Gaim - Save As..."));
-	g_snprintf(buf, sizeof(buf), "%s/%s", gaim_home_dir(), fr->filename ? fr->filename : "");
-	gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf);
-	gtk_signal_connect(GTK_OBJECT(window), "destroy",
-			   GTK_SIGNAL_FUNC(cancel_callback), ft);
-	gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(ft->window)->cancel_button), "clicked",
-			   GTK_SIGNAL_FUNC(cancel_callback), ft);
+		ft->window = window = gtk_file_selection_new(_("Gaim - Save As..."));
+		g_snprintf(buf, sizeof(buf), "%s/%s", gaim_home_dir(), fr->filename ? fr->filename : "");
+		gtk_file_selection_set_filename(GTK_FILE_SELECTION(window), buf);
+		gtk_signal_connect(GTK_OBJECT(window), "destroy",
+				   GTK_SIGNAL_FUNC(cancel_callback), ft);
+		gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(ft->window)->cancel_button), "clicked",
+				   GTK_SIGNAL_FUNC(cancel_callback), ft);
 
-	if (!strcmp(fr->UID, FILE_SEND_UID))
-		gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), "clicked",
-				   GTK_SIGNAL_FUNC(toc_send_file), ft);
-	else
-		gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), "clicked",
-				   GTK_SIGNAL_FUNC(toc_get_file), ft);
+		if (!strcmp(fr->UID, FILE_SEND_UID))
+			gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), "clicked",
+					   GTK_SIGNAL_FUNC(toc_send_file), ft);
+		else
+			gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(window)->ok_button), "clicked",
+					   GTK_SIGNAL_FUNC(toc_get_file), ft);
 
-	gtk_widget_show(window);
+		gtk_widget_show(window);
+	}
+
 	toc_reject_ft(fr);
 }
 
@@ -1984,5 +1987,5 @@
 	} else {
 		g_snprintf(buf, sizeof(buf), _("%s requests you to send them a file"), ft->user);
 	}
-	do_ask_dialog(buf, NULL, ft, _("Accept"), toc_accept_ft, _("Cancel"), toc_reject_ft, FALSE);
+	do_ask_dialog(buf, NULL, ft, _("Accept"), toc_accept_ft, _("Cancel"), toc_reject_ft, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE);
 }