Mercurial > pidgin
changeset 27977:b6a1ade72555
jabber: Prompt before cancelling presence notification to a buddy.
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Sat, 01 Aug 2009 21:36:16 +0000 |
parents | 0ab7b436a563 |
children | 088a828fe2e2 |
files | ChangeLog libpurple/protocols/jabber/buddy.c |
diffstat | 2 files changed, 31 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sat Aug 01 16:14:02 2009 +0000 +++ b/ChangeLog Sat Aug 01 21:36:16 2009 +0000 @@ -1,5 +1,9 @@ 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
--- a/libpurple/protocols/jabber/buddy.c Sat Aug 01 16:14:02 2009 +0000 +++ b/libpurple/protocols/jabber/buddy.c Sat Aug 01 21:36:16 2009 +0000 @@ -1660,21 +1660,42 @@ 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)