cpw.darkrain42.2.6.1: 12c37241: jabber: Prompt before cancelling presenc...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Aug 2 01:40:44 EDT 2009


-----------------------------------------------------------------
Revision: 12c3724151d596918b28a63d3e9abf33f2183c06
Ancestor: bff8757700e8f2f407bba4885f0a91bd33027bf1
Author: darkrain42 at pidgin.im
Date: 2009-08-01T21:36:16
Branch: im.pidgin.cpw.darkrain42.2.6.1
URL: http://d.pidgin.im/viewmtn/revision/info/12c3724151d596918b28a63d3e9abf33f2183c06

Modified files:
        ChangeLog libpurple/protocols/jabber/buddy.c

ChangeLog: 

jabber: Prompt before cancelling presence notification to a buddy.

-------------- next part --------------
============================================================
--- ChangeLog	e997843b9ae2354c38619a6001b0eeb3bf7c7e7f
+++ ChangeLog	5c38a63c87c50dd8ba4492a78632b24b4a0518b5
@@ -1,5 +1,9 @@ Pidgin and Finch: The Pimpin' Penguin IM
 Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
 
+version 2.6.1 (??/??/2009):
+	XMPP:
+	* Prompt the user before cancelling a presence subscription.
+
 version 2.6.0 (??/??/2009):
 	libpurple:
 	* Theme support in libpurple thanks to Justin Rodriguez's summer of code
============================================================
--- libpurple/protocols/jabber/buddy.c	cea44f1f631bf38134388d49be6b5c0af910fd35
+++ libpurple/protocols/jabber/buddy.c	279bee0db495fea2536f3879343b4fda31171e3a
@@ -1660,21 +1660,42 @@ static void jabber_buddy_make_visible(Pu
 	jabber_buddy_set_invisibility(js, purple_buddy_get_name(buddy), FALSE);
 }
 
-static void jabber_buddy_cancel_presence_notification(PurpleBlistNode *node,
-		gpointer data)
+static void cancel_presence_notification(gpointer data)
 {
 	PurpleBuddy *buddy;
 	PurpleConnection *gc;
 	JabberStream *js;
 
+	buddy = data;
+	gc = purple_account_get_connection(purple_buddy_get_account(buddy));
+	js = purple_connection_get_protocol_data(gc);
+
+	jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribed");
+}
+
+static void
+jabber_buddy_cancel_presence_notification(PurpleBlistNode *node,
+                                          gpointer data)
+{
+	PurpleBuddy *buddy;
+	PurpleAccount *account;
+	PurpleConnection *gc;
+	const gchar *name;
+	char *msg;
+
 	g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
 
 	buddy = (PurpleBuddy *) node;
-	gc = purple_account_get_connection(purple_buddy_get_account(buddy));
-	js = purple_connection_get_protocol_data(gc);
+	name = purple_buddy_get_name(buddy);
+	account = purple_buddy_get_account(buddy);
+	gc = purple_account_get_connection(account);
 
-	/* I wonder if we should prompt the user before doing this */
-	jabber_presence_subscription_set(js, purple_buddy_get_name(buddy), "unsubscribed");
+	msg = g_strdup_printf(_("%s will no longer be able to see your status "
+	                        "updates.  Do you want to continue?"), name);
+	purple_request_yes_no(gc, NULL, _("Cancel Presence Notification"),
+	                      msg, 0 /* Yes */, account, name, NULL, buddy,
+	                      cancel_presence_notification, NULL /* Do nothing */);
+	g_free(msg);
 }
 
 static void jabber_buddy_rerequest_auth(PurpleBlistNode *node, gpointer data)


More information about the Commits mailing list