changeset 3730:a20bf3d247ff

[gaim-migrate @ 3868] Pretty do_ask_dialog. I also "fixed" the "hitting yes calls the 'no' function anyway" behavior. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 17 Oct 2002 21:29:53 +0000
parents a8f0c169e529
children d3592d407c9b
files src/ft.c src/multi.c src/protocols/icq/gaim_icq.c src/protocols/irc/irc.c src/protocols/jabber/jabber.c src/protocols/msn/msn.c src/protocols/oscar/oscar.c src/protocols/toc/toc.c src/prpl.c src/prpl.h
diffstat 10 files changed, 135 insertions(+), 116 deletions(-) [+]
line wrap: on
line diff
--- a/src/ft.c	Thu Oct 17 21:23:09 2002 +0000
+++ b/src/ft.c	Thu Oct 17 21:29:53 2002 +0000
@@ -78,8 +78,8 @@
 
 
 
-static int ft_choose_file(gpointer a, struct file_transfer *xfer);
-static void ft_cancel(gpointer w, struct file_transfer *xfer);
+static int ft_choose_file(struct file_transfer *xfer);
+static void ft_cancel(struct file_transfer *xfer);
 static void ft_delete(struct file_transfer *xfer);
 static void ft_callback(gpointer data, gint source, GaimInputCondition condition);
 static void ft_nextfile(struct file_transfer *xfer);
@@ -144,7 +144,7 @@
 		buf = newmsg;
 	}
 
-	do_ask_dialog(buf, xfer, ft_choose_file, ft_cancel);
+	do_ask_dialog(buf, NULL, xfer, _("Accept"), ft_choose_file, _("Cancel"), ft_cancel);
 	g_free(buf);
 
 	return xfer;
@@ -156,7 +156,7 @@
 	struct file_transfer *xfer = ft_new(FILE_TRANSFER_TYPE_SEND, gc,
 			who);
 
-	ft_choose_file(NULL, xfer);
+	ft_choose_file(xfer);
 
 	return xfer;
 }
@@ -164,7 +164,7 @@
 /* We canceled the transfer, either by declining the initial
  * confirmation dialog or canceling the file dialog.
  */
-static void ft_cancel(gpointer w, struct file_transfer *xfer)
+static void ft_cancel(struct file_transfer *xfer)
 {
 	/* Make sure we weren't aborted while waiting for
 	 * confirmation from the user.
@@ -367,7 +367,7 @@
 	return 0;
 }
 
-static int ft_choose_file(gpointer a, struct file_transfer *xfer)
+static int ft_choose_file(struct file_transfer *xfer)
 {
 	char *curdir = g_get_current_dir(); /* should be freed */
 	char *initstr;
--- a/src/multi.c	Thu Oct 17 21:23:09 2002 +0000
+++ b/src/multi.c	Thu Oct 17 21:29:53 2002 +0000
@@ -971,7 +971,7 @@
 			return;
 
 		g_snprintf(buf, sizeof(buf), _("Are you sure you want to delete %s?"), u->username);
-		do_ask_dialog(buf, u, do_del_acct, NULL);
+		do_ask_dialog(buf, NULL, u, _("Delete"), do_del_acct, _("Cancel"), NULL);
 		l = l->next;
 	}
 }
--- a/src/protocols/icq/gaim_icq.c	Thu Oct 17 21:23:09 2002 +0000
+++ b/src/protocols/icq/gaim_icq.c	Thu Oct 17 21:29:53 2002 +0000
@@ -246,20 +246,21 @@
 	struct gaim_connection *gc;
 };
 
-static void icq_den_auth(gpointer x, struct icq_auth *iq)
+static void icq_den_auth(struct icq_auth *iq)
 {
 	g_free(iq->nick);
 	g_free(iq);
 }
 
-static void icq_add_after_auth(gpointer x, struct icq_auth *iq)
+static void icq_add_after_auth(struct icq_auth *iq)
 {
 	char uin[16];
 	g_snprintf(uin, sizeof(uin), "%ld", iq->uin);
 	show_add_buddy(iq->gc, uin, NULL, iq->nick);
+	icq_den_auth(iq);
 }
 
-static void icq_acc_auth(gpointer x, struct icq_auth *iq)
+static void icq_acc_auth(struct icq_auth *iq)
 {
 	char msg[1024];
 	char uin[16];
@@ -275,7 +276,8 @@
 	iqnew->nick = g_strdup(iq->nick);
 
 	g_snprintf(msg, sizeof(msg), "Add %ld to your buddy list?", iq->uin);
-	do_ask_dialog(msg, iqnew, icq_add_after_auth, icq_den_auth);
+	do_ask_dialog(msg, NULL, iqnew, _("Add"), icq_add_after_auth, _("Cancel"), icq_den_auth);
+	icq_den_auth(iq);
 }
 
 static void icq_auth_req(icq_Link *link, unsigned long uin, unsigned char hour, unsigned char minute,
@@ -292,7 +294,7 @@
 	g_snprintf(msg, sizeof(msg), "The user %s (%s%s%s%s%s) wants you to authorize them.",
 			nick, first ? first : "", first && last ? " " : "", last ? last : "",
 			(first || last) && email ? ", " : "", email ? email : "");
-	do_ask_dialog(msg, iq, icq_acc_auth, icq_den_auth);
+	do_ask_dialog(msg, NULL, iq, _("Authorize"), icq_acc_auth, _("Deny"), icq_den_auth);
 }
 
 static void icq_login(struct aim_user *user) {
--- a/src/protocols/irc/irc.c	Thu Oct 17 21:23:09 2002 +0000
+++ b/src/protocols/irc/irc.c	Thu Oct 17 21:29:53 2002 +0000
@@ -443,7 +443,7 @@
 	g_string_free(str, TRUE);
 }
 
-static void dcc_chat_cancel(void *, struct dcc_chat *);
+static void dcc_chat_cancel(struct dcc_chat *);
 
 void
 dcc_chat_in (gpointer data, gint source, GaimInputCondition condition)
@@ -473,7 +473,7 @@
 		convo = new_conversation (chat->nick);
 		write_to_conv (convo, buf, WFLAG_SYSTEM, NULL,
 			       time ((time_t) NULL), -1);
-		dcc_chat_cancel (NULL,chat);
+		dcc_chat_cancel (chat);
 	}
 }
 
@@ -1107,18 +1107,11 @@
 	}
 }
 
-static void dcc_chat_init(gpointer obj, struct dcc_chat *data) {
-	struct dcc_chat * chat = g_new0(struct dcc_chat, 1);
-	
-	memcpy(chat, data, sizeof(struct dcc_chat));  /* we have to make a new one
-						       * because the old one get's freed by
-						       * dcc_chat_cancel. */
-
-	printf("ONE MORE TIME: %s:%d\n", chat->ip_address, chat->port);
-	proxy_connect(chat->ip_address, chat->port, dcc_chat_callback, chat);
+static void dcc_chat_init(struct dcc_chat *data) {
+	proxy_connect(data->ip_address, data->port, dcc_chat_callback, data);
 }
 
-static void dcc_chat_cancel(gpointer obj, struct dcc_chat *data){
+static void dcc_chat_cancel(struct dcc_chat *data){
 	if (find_dcc_chat(data->gc, data->nick)) {
 		dcc_chat_list = g_slist_remove(dcc_chat_list, data); 
 		gaim_input_remove (data->inpa);
@@ -1133,7 +1126,7 @@
 	if (!dchat)
 		return;
 
-	dcc_chat_cancel(NULL, dchat);
+	dcc_chat_cancel(dchat);
 }
 
 static void handle_ctcp(struct gaim_connection *gc, char *to, char *nick,
@@ -1172,9 +1165,8 @@
 		printf("DCC CHAT DEBUG CRAP: %s\n", dccchat->ip_address);
 		dccchat->port=atoi(chat_args[4]);		
 		g_snprintf(dccchat->nick, sizeof(dccchat->nick), nick);	
-		g_snprintf(ask, sizeof(ask), _("%s has requested a DCC chat.  "
-					       "Would you like to establish the direct connection?"), nick);
-		do_ask_dialog(ask, dccchat, dcc_chat_init, dcc_chat_cancel);
+		g_snprintf(ask, sizeof(ask), _("%s would like to establish a DCC chat"), nick);
+		do_ask_dialog(ask, _("This requires a direct connection to be established between the two computers.  Messages sent will not pass through the IRC server"), dccchat, _("Connect"), dcc_chat_init, _("Cancel"), dcc_chat_cancel);
 	}
 
 
@@ -2124,7 +2116,7 @@
 	addr.sin_addr.s_addr = INADDR_ANY;
 	chat->fd = accept (chat->fd, (struct sockaddr *) (&addr), &addrlen);
 	if (!chat->fd) {
-		dcc_chat_cancel (NULL,chat);
+		dcc_chat_cancel (chat);
 		convo = new_conversation (chat->nick);
 		g_snprintf (buf, sizeof buf, _("DCC Chat with %s closed"),
 			    chat->nick);
@@ -2300,7 +2292,7 @@
 	chat->gc = gc;
 	g_snprintf (chat->nick, sizeof (chat->nick), "%s", who);
 	if (chat->fd < 0)  {
-		dcc_chat_cancel (NULL,chat);
+		dcc_chat_cancel (chat);
 		return;
 	}
 	addr.sin_family = AF_INET;
--- a/src/protocols/jabber/jabber.c	Thu Oct 17 21:23:09 2002 +0000
+++ b/src/protocols/jabber/jabber.c	Thu Oct 17 21:29:53 2002 +0000
@@ -1599,7 +1599,7 @@
 /*
  * Callback from "accept" in do_ask_dialog() invoked by jabber_handles10n()
  */
-static void jabber_accept_add(gpointer w, struct jabber_add_permit *jap)
+static void jabber_accept_add(struct jabber_add_permit *jap)
 {
 	jabber_accept_deny_add(jap, "subscribed");
 	/*
@@ -1616,7 +1616,7 @@
 /*
  * Callback from "deny/cancel" in do_ask_dialog() invoked by jabber_handles10n()
  */
-static void jabber_deny_add(gpointer w, struct jabber_add_permit *jap)
+static void jabber_deny_add(struct jabber_add_permit *jap)
 {
 	jabber_accept_deny_add(jap, "unsubscribed");
 	g_free(jap->user);
@@ -1645,7 +1645,7 @@
 
 		jap->gjc = gjc;
 		jap->user = g_strdup(Jid);
-		do_ask_dialog(msg, jap, jabber_accept_add, jabber_deny_add);
+		do_ask_dialog(msg, NULL, jap, _("Authorize"), jabber_accept_add, _("Deny"), jabber_deny_add);
 
 		g_free(msg);
 		xmlnode_free(g);	/* Never needed it here anyway */
--- a/src/protocols/msn/msn.c	Thu Oct 17 21:23:09 2002 +0000
+++ b/src/protocols/msn/msn.c	Thu Oct 17 21:29:53 2002 +0000
@@ -835,7 +835,7 @@
 	char *friend;
 };
 
-static void msn_accept_add(gpointer w, struct msn_add_permit *map)
+static void msn_accept_add(struct msn_add_permit *map)
 {
 	struct msn_data *md = map->gc->proto_data;
 	char buf[MSN_BUF_LEN];
@@ -850,24 +850,25 @@
 	map->gc->permit = g_slist_append(map->gc->permit, map->user);
 	build_allow_list(); /* er. right. we'll need to have a thing for this in CUI too */
 	show_got_added(map->gc, NULL, map->user, map->friend, NULL);
-	*(map->user) = 0;
+	g_free(map->user);
+	g_free(map->friend);
+	g_free(map);
 }
 
-static void msn_cancel_add(gpointer w, struct msn_add_permit *map)
+static void msn_cancel_add(struct msn_add_permit *map)
 {
 	struct msn_data *md = map->gc->proto_data;
 	char buf[MSN_BUF_LEN];
 
-	if (*(map->user)) {
-		g_snprintf(buf, sizeof(buf), "ADD %d BL %s %s\r\n", ++md->trId, map->user, url_encode(map->friend));
-		if (msn_write(md->fd, buf, strlen(buf)) < 0) {
-			hide_login_progress(map->gc, "Write error");
-			signoff(map->gc);
-			return;
-		}
-		map->gc->deny = g_slist_append(map->gc->deny, map->user);
-		build_block_list();
+	g_snprintf(buf, sizeof(buf), "ADD %d BL %s %s\r\n", ++md->trId, map->user, url_encode(map->friend));
+	if (msn_write(md->fd, buf, strlen(buf)) < 0) {
+		hide_login_progress(map->gc, "Write error");
+		signoff(map->gc);
+		return;
 	}
+	map->gc->deny = g_slist_append(map->gc->deny, map->user);
+	build_block_list();
+	
 	
 	g_free(map->user);
 	g_free(map->friend);
@@ -913,7 +914,7 @@
 		g_snprintf(msg, sizeof(msg), _("The user %s (%s) wants to add %s to his or her buddy list."),
 				ap->user, ap->friend, ap->gc->username);
 
-		do_ask_dialog(msg, ap, msn_accept_add, msn_cancel_add);
+		do_ask_dialog(msg, NULL, ap, _("Authorize"), msn_accept_add, _("Deny"), msn_cancel_add);
 	} else if (!g_strncasecmp(buf, "BLP", 3)) {
 		char *type, *tmp = buf;
 
@@ -1068,7 +1069,7 @@
 				ap->gc = gc;
                          
 		                g_snprintf(msg, sizeof(msg), _("The user %s (%s) wants to add you to their buddy list"),ap->user, ap->friend);
-				do_ask_dialog(msg, ap, msn_accept_add, msn_cancel_add);
+				do_ask_dialog(msg, NULL, ap, _("Authorize"), msn_accept_add, _("Deny"), msn_cancel_add);
 			}
 		    }
 			
--- a/src/protocols/oscar/oscar.c	Thu Oct 17 21:23:09 2002 +0000
+++ b/src/protocols/oscar/oscar.c	Thu Oct 17 21:29:53 2002 +0000
@@ -1455,7 +1455,7 @@
 	return 1;
 }
 
-static void cancel_direct_im(gpointer w, struct ask_direct *d) {
+static void cancel_direct_im(struct ask_direct *d) {
 	debug_printf("Freeing DirectIM prompts.\n");
 
 	g_free(d->sn);
@@ -1687,7 +1687,7 @@
 	g_free(oft);
 }
 
-static int accept_direct_im(gpointer w, struct ask_direct *d) {
+static int accept_direct_im(struct ask_direct *d) {
 	struct gaim_connection *gc = d->gc;
 	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
 	struct direct_im *dim;
@@ -1698,7 +1698,7 @@
 
 	dim = find_direct_im(od, d->sn);
 	if (dim) {
-		cancel_direct_im(w, d); /* 40 */
+		cancel_direct_im(d); /* 40 */
 		return TRUE;
 	}
 	dim = g_new0(struct direct_im, 1);
@@ -1708,7 +1708,7 @@
 	dim->conn = aim_directim_connect(od->sess, d->sn, NULL, d->cookie);
 	if (!dim->conn) {
 		g_free(dim);
-		cancel_direct_im(w, d);
+		cancel_direct_im(d);
 		return TRUE;
 	}
 
@@ -1731,11 +1731,11 @@
 	if (dim->conn->fd < 0) {
 		aim_conn_kill(od->sess, &dim->conn);
 		g_free(dim);
-		cancel_direct_im(w, d);
+		cancel_direct_im(d);
 		return TRUE;
 	}
 
-	cancel_direct_im(w, d);
+	cancel_direct_im(d);
 
 	return TRUE;
 }
@@ -1929,7 +1929,7 @@
 		memcpy(d->cookie, args->cookie, 8);
 		g_snprintf(buf, sizeof buf, "%s has just asked to directly connect to %s.",
 				userinfo->sn, gc->username);
-		do_ask_dialog(buf, d, accept_direct_im, cancel_direct_im);
+		do_ask_dialog(buf, _("This requires a direct connection between the two computers and is necessary for IM Images.  Because your IP address will be revealed, this may be considered a privacy risk."), d, _("Connect"), accept_direct_im, _("Cancel"), cancel_direct_im);
 	} else {
 		debug_printf("Unknown reqclass %d\n", args->reqclass);
 	}
@@ -1940,25 +1940,23 @@
 /*
  * Next 2 functions are for when other people ask you for authorization
  */
-static void gaim_icq_authgrant(gpointer w, struct channel4_data *data) {
+static void gaim_icq_authgrant(struct channel4_data *data) {
 	char message;
 	struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
 	message = 0;
 	aim_send_im_ch4(od->sess, data->uin, AIM_ICQMSG_AUTHGRANTED, &message);
 	show_got_added(data->gc, NULL, data->uin, NULL, NULL);
 	g_free(data->uin);
-	data->uin = NULL;
+	g_free(data);
 }
 
-static void gaim_icq_authdeny(gpointer w, struct channel4_data *data) {
-	if (data->uin) {
-		gchar *message;
-		struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
-		message = g_strdup_printf("No reason given.");
-		aim_send_im_ch4(od->sess, data->uin, AIM_ICQMSG_AUTHDENIED, message);
-		g_free(data->uin);
-		g_free(message);
-	}
+static void gaim_icq_authdeny(struct channel4_data *data) {
+	gchar *message;
+	struct oscar_data *od = (struct oscar_data *)data->gc->proto_data;
+	message = g_strdup_printf("No reason given.");
+	aim_send_im_ch4(od->sess, data->uin, AIM_ICQMSG_AUTHDENIED, message);
+	g_free(data->uin);
+	g_free(message);
 	g_free(data);
 }
 
@@ -1968,22 +1966,25 @@
 static void gaim_icq_authask(struct gaim_connection *gc, fu32_t uin, char *msg) {
 	struct channel4_data *data = g_new(struct channel4_data, 1);
 	/* The first 6 chars of the message are some type of alien gibberish, so skip them */
-	char *dialog_msg = g_strdup_printf("The user %lu wants to add you to their buddy list for the following reason:\n\n%s", uin, (msg && strlen(msg)>6) ? msg+6 : "No reason given.");
+	char *dialog_msg = g_strdup_printf("The user %lu wants to add you to their buddy list for the following reason:", uin, (msg && strlen(msg)>6) ? msg+6 : "No reason given.");
 	debug_printf("Received an authorization request from UIN %lu\n", uin);
 	data->gc = gc;
 	data->uin = g_strdup_printf("%lu", uin);
-	do_ask_dialog(dialog_msg, data, gaim_icq_authgrant, gaim_icq_authdeny);
+	do_ask_dialog(dialog_msg, (msg && strlen(msg) > 6) ? msg+6 : _("No reason given."), data, _("Authorize"), gaim_icq_authgrant, _("Deny"), gaim_icq_authdeny);
 	g_free(dialog_msg);
 }
 
 /*
  * Next 2 functions are for when someone sends you contacts
  */
-static void gaim_icq_contactadd(gpointer w, struct channel4_data *data) {
+static void gaim_icq_contactadd(struct channel4_data *data) {
 	show_add_buddy(data->gc, data->uin, NULL, data->nick);
+	free(data->uin);
+	free(data->nick);
+	g_free(data);
 }
 
-static void gaim_icq_contactdontadd(gpointer w, struct channel4_data *data) {
+static void gaim_icq_contactdontadd(struct channel4_data *data) {
 	free(data->uin);
 	free(data->nick);
 	g_free(data);
@@ -2050,11 +2051,11 @@
 					num = num*10 + text[0][i]-48;
 				for (i=0; i<num; i++) {
 					struct channel4_data *data = g_new(struct channel4_data, 1);
-					gchar *message = g_strdup_printf("ICQ user %lu has sent you a contact: %s (%s)\nDo you want to add this contact to your contact list?", args->uin, text[i*2+2], text[i*2+1]);
+					gchar *message = g_strdup_printf(_("ICQ user %lu has sent you a contact: %s (%s)"), args->uin, text[i*2+2], text[i*2+1]);
 					data->gc = gc;
 					data->uin = g_strdup(text[i*2+2]);
 					data->nick = g_strdup(text[i*2+1]);
-					do_ask_dialog(message, data, gaim_icq_contactadd, gaim_icq_contactdontadd);
+					do_ask_dialog(message, "Do you want to add this contact to your Buddy List?", data, _("Add"), gaim_icq_contactadd, _("Deny"), gaim_icq_contactdontadd);
 					g_free(message);
 				}
 				g_strfreev(text);
@@ -4323,11 +4324,11 @@
 	struct gaim_connection *gc;
 };
 
-static void oscar_cancel_direct_im(gpointer obj, struct ask_do_dir_im *data) {
+static void oscar_cancel_direct_im(struct ask_do_dir_im *data) {
 	g_free(data);
 }
 
-static void oscar_direct_im(gpointer obj, struct ask_do_dir_im *data) {
+static void oscar_direct_im(struct ask_do_dir_im *data) {
 	struct gaim_connection *gc = data->gc;
 	struct oscar_data *od = (struct oscar_data *)gc->proto_data;
 	struct direct_im *dim;
@@ -4366,10 +4367,8 @@
 	struct ask_do_dir_im *data = g_new0(struct ask_do_dir_im, 1);
 	data->who = who;
 	data->gc = gc;
-	g_snprintf(buf, sizeof(buf),  _("You have selected to open a Direct IM connection with %s."
-					" Doing this will let them see your IP address, and may be"
-					" a security risk. Do you wish to continue?"), who);
-	do_ask_dialog(buf, data, oscar_direct_im, oscar_cancel_direct_im);
+	g_snprintf(buf, sizeof(buf),  _("You have selected to open a Direct IM connection with %s."), who);
+	do_ask_dialog(buf, _("Because this reveals your IP address, it may be considered a privacy risk.  Do you wish to continue?"), data, _("Connect"), oscar_direct_im, _("Cancel"), oscar_cancel_direct_im);
 }
 
 static void oscar_get_away_msg(struct gaim_connection *gc, char *who) {
--- a/src/protocols/toc/toc.c	Thu Oct 17 21:23:09 2002 +0000
+++ b/src/protocols/toc/toc.c	Thu Oct 17 21:29:53 2002 +0000
@@ -1919,7 +1919,7 @@
 	}
 }
 
-static void toc_accept_ft(gpointer a, struct ft_request *fr) {
+static void toc_accept_ft(struct ft_request *fr) {
 	GtkWidget *window;
 	char buf[BUF_LEN];
 
@@ -1947,9 +1947,10 @@
 				   GTK_SIGNAL_FUNC(toc_get_file), ft);
 
 	gtk_widget_show(window);
+	toc_reject_ft(ft);
 }
 
-static void toc_reject_ft(gpointer a, struct ft_request *ft) {
+static void toc_reject_ft(struct ft_request *ft) {
 	g_free(ft->user);
 	g_free(ft->filename);
 	g_free(ft->ip);
@@ -1980,5 +1981,5 @@
 	} else {
 		g_snprintf(buf, sizeof(buf), _("%s requests you to send them a file"), ft->user);
 	}
-	do_ask_dialog(buf, ft, toc_accept_ft, toc_reject_ft);
+	do_ask_dialog(buf, NULL, ft, _("Accept"), toc_accept_ft, _("Cancel"), toc_reject_ft);
 }
--- a/src/prpl.c	Thu Oct 17 21:23:09 2002 +0000
+++ b/src/prpl.c	Thu Oct 17 21:29:53 2002 +0000
@@ -137,45 +137,68 @@
 	gtk_widget_destroy(b);
 }
 
-void do_ask_dialog(const char *text, void *data, void *doit, void *dont)
+struct doaskstruct {
+	void (*yesfunc)(gpointer);
+	void (*nofunc)(gpointer);
+	gpointer data;
+};
+
+static void do_ask_callback(GtkDialog *d, gint resp, struct doaskstruct *doask)
+{
+	switch (resp) 
+		{
+		case GTK_RESPONSE_YES:
+			if (doask->yesfunc)
+				doask->yesfunc(doask->data);
+			break;
+		case GTK_RESPONSE_NO:
+		case GTK_RESPONSE_DELETE_EVENT:
+			if (doask->nofunc)
+				doask->nofunc(doask->data);
+			break;
+		}
+	g_free(doask);
+}
+
+
+void do_ask_dialog(const char *prim, const char *sec, void *data, char *yestext, void *doit, char *notext, void *dont)
 {
 	GtkWidget *window;
-	GtkWidget *vbox;
+	GtkWidget *hbox;
 	GtkWidget *label;
-	GtkWidget *hbox;
-	GtkWidget *button;
+	char labeltext[1024 * 2];
+	char filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL);
+	GtkWidget *img = gtk_image_new_from_file(filename);
+	struct doaskstruct *doask = g_new0(struct doaskstruct, 1);
 
-	GAIM_DIALOG(window);
-	gtk_window_set_wmclass(GTK_WINDOW(window), "accept", "Gaim");
-	gtk_window_set_policy(GTK_WINDOW(window), FALSE, TRUE, TRUE);
-	gtk_window_set_title(GTK_WINDOW(window), _("Accept?"));
-	gtk_widget_realize(window);
-	if (dont)
-		gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(dont), data);
+	doask->yesfunc = doit;
+	doask->nofunc  = dont;
+	doask->data    = data;
 
-	vbox = gtk_vbox_new(FALSE, 5);
-	gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
-	gtk_container_add(GTK_CONTAINER(window), vbox);
+	g_free(filename);
+	gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
 
-	label = gtk_label_new(text);
-	gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
-	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
-
-	hbox = gtk_hbox_new(FALSE, 5);
-	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
+	window = gtk_dialog_new_with_buttons("", NULL, GTK_DIALOG_MODAL, yestext, GTK_RESPONSE_YES, notext, GTK_RESPONSE_NO, NULL);
+	gtk_dialog_set_default_response (GTK_DIALOG(window), GTK_RESPONSE_YES);
+	g_signal_connect(G_OBJECT(window), "response", G_CALLBACK(do_ask_callback), doask);
+	
+	gtk_container_set_border_width (GTK_CONTAINER(window), 6);
+	gtk_window_set_resizable(GTK_WINDOW(window), FALSE);
+	gtk_dialog_set_has_separator(GTK_DIALOG(window), FALSE);
+	gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(window)->vbox), 12);
+	gtk_container_set_border_width (GTK_CONTAINER(GTK_DIALOG(window)->vbox), 6);
 
-	button = picture_button(window, _("Cancel"), cancel_xpm);
-	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(des_win), window);
-
-	button = picture_button(window, _("Accept"), ok_xpm);
-	gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
-	if (dont)
-		gtk_object_set_user_data(GTK_OBJECT(button), data);
-	if (doit)
-		gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(doit), data);
-	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(rem_win), window);
-
+	hbox = gtk_hbox_new(FALSE, 12);
+	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(window)->vbox), hbox);
+	gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
+	
+	g_snprintf(labeltext, sizeof(labeltext), "<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s", prim, sec ? sec : "");
+	label = gtk_label_new(NULL);
+	gtk_label_set_markup(GTK_LABEL(label), labeltext);
+	gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
+	gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
+	gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
+	
 	gtk_widget_show_all(window);
 }
 
@@ -562,7 +585,7 @@
 	char *alias;
 };
 
-static void dont_add(gpointer x, struct got_add *ga)
+static void dont_add(struct got_add *ga)
 {
 	g_free(ga->who);
 	if (ga->alias)
@@ -570,10 +593,11 @@
 	g_free(ga);
 }
 
-static void do_add(gpointer x, struct got_add *ga)
+static void do_add(struct got_add *ga)
 {
 	if (g_slist_find(connections, ga->gc))
 		show_add_buddy(ga->gc, ga->who, NULL, ga->alias);
+	dont_add(ga);
 }
 
 void show_got_added(struct gaim_connection *gc, const char *id,
@@ -598,7 +622,7 @@
 	if (find_buddy(gc, ga->who))
 		do_error_dialog(buf, NULL, GAIM_INFO);
 	else
-		do_ask_dialog(buf, ga, do_add, dont_add);
+		do_ask_dialog(buf, NULL, ga, _("Add"), do_add, _("Cancel"), dont_add);
 }
 
 static GtkWidget *regdlg = NULL;
--- a/src/prpl.h	Thu Oct 17 21:23:09 2002 +0000
+++ b/src/prpl.h	Thu Oct 17 21:29:53 2002 +0000
@@ -210,7 +210,7 @@
 extern void show_got_added(struct gaim_connection *, const char *,
 			   const char *, const char *, const char *);
 
-extern void do_ask_dialog(const char *, void *, void *, void *);
+extern void do_ask_dialog(const char *, const char *, void *, char*, void *, char *, void *);
 extern void do_prompt_dialog(const char *, const char *, void *, void *, void *);
 
 extern void connection_has_mail(struct gaim_connection *, int, const char *, const char *, const char *);