diff src/protocols/msn/msn.c @ 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 34c95669952f
children f53370197bb9
line wrap: on
line diff
--- 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);
 			}
 		    }