/pidgin/main: c8486462bb63: Request API refactoring: switch purp...
Tomasz Wasilczyk
twasilczyk at pidgin.im
Tue Sep 10 15:47:48 EDT 2013
Changeset: c8486462bb63f1f820aa7efdf920db67b469651c
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2013-09-10 21:47 +0200
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/c8486462bb63
Description:
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
diffstat:
finch/gntaccount.c | 22 ++--
finch/gntblist.c | 2 +-
finch/gntcertmgr.c | 2 +-
finch/gntconn.c | 3 +-
finch/gntpounce.c | 3 +-
finch/gntrequest.c | 2 +-
finch/gntstatus.c | 3 +-
libpurple/conversation.c | 8 +-
libpurple/ft.c | 27 ++---
libpurple/plugins/offlinemsg.c | 3 +-
libpurple/plugins/perl/common/Request.xs | 2 +-
libpurple/protocols/gg/purplew.c | 4 +-
libpurple/protocols/jabber/auth.c | 2 +-
libpurple/protocols/jabber/auth_plain.c | 2 +-
libpurple/protocols/jabber/buddy.c | 2 +-
libpurple/protocols/jabber/presence.c | 2 +-
libpurple/protocols/msn/error.c | 2 +-
libpurple/protocols/msn/msn.c | 4 +-
libpurple/protocols/msn/userlist.c | 3 +-
libpurple/protocols/myspace/myspace.c | 4 +-
libpurple/protocols/myspace/user.c | 4 +-
libpurple/protocols/novell/novell.c | 2 +-
libpurple/protocols/oscar/oscar.c | 6 +-
libpurple/protocols/oscar/peer.c | 2 +-
libpurple/protocols/silc/buddy.c | 6 +-
libpurple/protocols/silc/pk.c | 2 +-
libpurple/protocols/silc/util.c | 4 +-
libpurple/protocols/silc/wb.c | 2 +-
libpurple/protocols/yahoo/libymsg.c | 10 +-
libpurple/request.c | 128 +++++++++++++-----------------
libpurple/request.h | 127 +++++++++++++-----------------
libpurple/server.c | 10 +-
pidgin/gtkaccount.c | 8 +-
pidgin/gtkblist.c | 2 +-
pidgin/gtkcertmgr.c | 2 +-
pidgin/gtkdialogs.c | 21 ++--
pidgin/gtklog.c | 2 +-
pidgin/gtkmedia.c | 9 +-
pidgin/gtkplugin.c | 11 +-
pidgin/gtkpounce.c | 7 +-
pidgin/gtkprivacy.c | 22 ++--
pidgin/gtkrequest.c | 31 ++----
pidgin/gtksavedstatuses.c | 2 +-
pidgin/gtkstatusbox.c | 2 +-
pidgin/gtkutils.c | 2 +-
45 files changed, 233 insertions(+), 293 deletions(-)
diffs (truncated from 1228 to 300 lines):
diff --git a/finch/gntaccount.c b/finch/gntaccount.c
--- a/finch/gntaccount.c
+++ b/finch/gntaccount.c
@@ -719,10 +719,9 @@ delete_account_cb(GntWidget *widget, Gnt
purple_account_get_username(account));
purple_request_action(account, _("Delete Account"), prompt, NULL,
- PURPLE_DEFAULT_ACTION_NONE,
- account, NULL, NULL, account, 2,
- _("Delete"), really_delete_account,
- _("Cancel"), NULL);
+ PURPLE_DEFAULT_ACTION_NONE,
+ purple_request_cpar_from_account(account), account, 2,
+ _("Delete"), really_delete_account, _("Cancel"), NULL);
g_free(prompt);
}
@@ -1014,12 +1013,11 @@ request_add(PurpleAccount *account, cons
data->alias = (alias != NULL ? g_strdup(alias) : NULL);
buffer = make_info(account, gc, remote_user, id, alias, msg);
- purple_request_action(NULL, NULL, _("Add buddy to your list?"),
- buffer, PURPLE_DEFAULT_ACTION_NONE,
- account, remote_user, NULL,
- data, 2,
- _("Add"), G_CALLBACK(add_user_cb),
- _("Cancel"), G_CALLBACK(free_add_user_data));
+ purple_request_action(NULL, NULL, _("Add buddy to your list?"), buffer,
+ PURPLE_DEFAULT_ACTION_NONE,
+ purple_request_cpar_from_account(account), data, 2,
+ _("Add"), G_CALLBACK(add_user_cb),
+ _("Cancel"), G_CALLBACK(free_add_user_data));
g_free(buffer);
}
@@ -1104,7 +1102,7 @@ finch_request_authorize(PurpleAccount *a
widget = purple_request_action(NULL, _("Authorize buddy?"), buffer, NULL,
PURPLE_DEFAULT_ACTION_NONE,
- account, remote_user, NULL,
+ purple_request_cpar_from_account(account),
aa, 2,
_("Authorize"), authorize_and_add_cb,
_("Deny"), deny_no_add_cb);
@@ -1131,7 +1129,7 @@ finch_request_authorize(PurpleAccount *a
} else {
uihandle = purple_request_action(NULL, _("Authorize buddy?"), buffer, NULL,
PURPLE_DEFAULT_ACTION_NONE,
- account, remote_user, NULL,
+ purple_request_cpar_from_account(account),
user_data, 2,
_("Authorize"), auth_cb,
_("Deny"), deny_cb);
diff --git a/finch/gntblist.c b/finch/gntblist.c
--- a/finch/gntblist.c
+++ b/finch/gntblist.c
@@ -1534,7 +1534,7 @@ finch_blist_remove_node_cb(PurpleBlistNo
purple_request_action(node, _("Confirm Remove"),
primary, sec,
1,
- account, name, NULL,
+ purple_request_cpar_from_account(account),
node, 2,
_("Remove"), finch_blist_remove_node,
_("Cancel"), NULL);
diff --git a/finch/gntcertmgr.c b/finch/gntcertmgr.c
--- a/finch/gntcertmgr.c
+++ b/finch/gntcertmgr.c
@@ -235,7 +235,7 @@ delete_cert_cb(GntWidget *button, gpoint
purple_request_yes_no((void *)key, _("Confirm certificate delete"),
primary, NULL,
0,
- NULL, NULL, NULL,
+ NULL,
g_strdup(key),
tls_peers_mgmt_delete_confirm_cb,
g_free);
diff --git a/finch/gntconn.c b/finch/gntconn.c
--- a/finch/gntconn.c
+++ b/finch/gntconn.c
@@ -132,8 +132,7 @@ finch_connection_report_disconnect(Purpl
"correct the error and re-enable the account."), text);
purple_request_action(account, NULL, primary, secondary, 2,
- account, NULL, NULL,
- account, 3,
+ purple_request_cpar_from_account(account), account, 3,
_("OK"), NULL,
_("Modify Account"), PURPLE_CALLBACK(ce_modify_account_cb),
_("Re-enable Account"), PURPLE_CALLBACK(ce_enable_account_cb));
diff --git a/finch/gntpounce.c b/finch/gntpounce.c
--- a/finch/gntpounce.c
+++ b/finch/gntpounce.c
@@ -675,8 +675,7 @@ pounces_manager_delete_cb(GntButton *but
pouncee = purple_pounce_get_pouncee(pounce);
buf = g_strdup_printf(_("Are you sure you want to delete the pounce on %s for %s?"), pouncee, pouncer);
purple_request_action(pounce, NULL, buf, NULL, 0,
- account, pouncee, NULL,
- pounce, 2,
+ purple_request_cpar_from_account(account), pounce, 2,
_("Delete"), pounces_manager_delete_confirm_cb,
_("Cancel"), NULL);
g_free(buf);
diff --git a/finch/gntrequest.c b/finch/gntrequest.c
--- a/finch/gntrequest.c
+++ b/finch/gntrequest.c
@@ -257,7 +257,7 @@ request_action_cb(GntWidget *button, Gnt
static void*
finch_request_action(const char *title, const char *primary,
const char *secondary, int default_value,
- PurpleAccount *account, const char *who, PurpleConversation *conv,
+ PurpleRequestCommonParameters *cpar,
void *user_data, size_t actioncount,
va_list actions)
{
diff --git a/finch/gntstatus.c b/finch/gntstatus.c
--- a/finch/gntstatus.c
+++ b/finch/gntstatus.c
@@ -141,8 +141,7 @@ ask_before_delete(GntWidget *button, gpo
purple_savedstatus_get_title(saved));
purple_request_action(saved, _("Delete Status"), ask, NULL, 0,
- NULL, NULL, NULL,
- saved, 2,
+ NULL, saved, 2,
_("Delete"), really_delete_status,
_("Cancel"), NULL);
g_free(ask);
diff --git a/libpurple/conversation.c b/libpurple/conversation.c
--- a/libpurple/conversation.c
+++ b/libpurple/conversation.c
@@ -1430,10 +1430,10 @@ purple_conv_send_confirm(PurpleConversat
data[1] = (gpointer)message;
purple_request_action(conv, NULL, _("Send Message"), text, 0,
- purple_conversation_get_account(conv), NULL, conv,
- data, 2,
- _("_Send Message"), G_CALLBACK(purple_conv_send_confirm_cb),
- _("Cancel"), NULL);
+ purple_request_cpar_from_account(
+ purple_conversation_get_account(conv)),
+ data, 2, _("_Send Message"),
+ G_CALLBACK(purple_conv_send_confirm_cb), _("Cancel"), NULL);
}
void
diff --git a/libpurple/ft.c b/libpurple/ft.c
--- a/libpurple/ft.c
+++ b/libpurple/ft.c
@@ -498,6 +498,7 @@ purple_xfer_ask_recv(PurpleXfer *xfer)
/* If we have already accepted the request, ask the destination file
name directly */
if (purple_xfer_get_status(xfer) != PURPLE_XFER_STATUS_ACCEPTED) {
+ PurpleRequestCommonParameters *cpar;
PurpleBuddy *buddy = purple_find_buddy(xfer->account, xfer->who);
if (purple_xfer_get_filename(xfer) != NULL)
@@ -519,19 +520,17 @@ purple_xfer_ask_recv(PurpleXfer *xfer)
serv_got_im(purple_account_get_connection(xfer->account),
xfer->who, xfer->message, 0, time(NULL));
+ cpar = purple_request_cpar_from_account(xfer->account);
if ((thumb = purple_xfer_get_thumbnail(xfer, &thumb_size))) {
- purple_request_accept_cancel_with_icon(xfer, NULL, buf, NULL,
- PURPLE_DEFAULT_ACTION_NONE, xfer->account, xfer->who, NULL,
- thumb, thumb_size, xfer,
- G_CALLBACK(purple_xfer_choose_file),
- G_CALLBACK(cancel_recv_cb));
- } else {
- purple_request_accept_cancel(xfer, NULL, buf, NULL,
- PURPLE_DEFAULT_ACTION_NONE, xfer->account, xfer->who, NULL,
- xfer, G_CALLBACK(purple_xfer_choose_file),
- G_CALLBACK(cancel_recv_cb));
+ purple_request_cpar_set_custom_icon(cpar, thumb,
+ thumb_size);
}
+ purple_request_accept_cancel(xfer, NULL, buf, NULL,
+ PURPLE_DEFAULT_ACTION_NONE, cpar, xfer,
+ G_CALLBACK(purple_xfer_choose_file),
+ G_CALLBACK(cancel_recv_cb));
+
g_free(buf);
} else
purple_xfer_choose_file(xfer);
@@ -569,11 +568,9 @@ purple_xfer_ask_accept(PurpleXfer *xfer)
purple_xfer_get_remote_ip(xfer),
purple_xfer_get_remote_port(xfer));
purple_request_accept_cancel(xfer, NULL, buf, buf2,
- PURPLE_DEFAULT_ACTION_NONE,
- xfer->account, xfer->who, NULL,
- xfer,
- G_CALLBACK(ask_accept_ok),
- G_CALLBACK(ask_accept_cancel));
+ PURPLE_DEFAULT_ACTION_NONE,
+ purple_request_cpar_from_account(xfer->account), xfer,
+ G_CALLBACK(ask_accept_ok), G_CALLBACK(ask_accept_cancel));
g_free(buf);
g_free(buf2);
}
diff --git a/libpurple/plugins/offlinemsg.c b/libpurple/plugins/offlinemsg.c
--- a/libpurple/plugins/offlinemsg.c
+++ b/libpurple/plugins/offlinemsg.c
@@ -165,8 +165,7 @@ sending_msg_cb(PurpleAccount *account, c
purple_request_action(handle, _("Offline Message"), ask,
_("You can edit/delete the pounce from the `Buddy Pounces' dialog"),
- 0,
- offline->account, offline->who, offline->conv,
+ 0, purple_request_cpar_from_conversation(offline->conv),
offline, 2,
_("Yes"), record_pounce,
_("No"), cancel_poune);
diff --git a/libpurple/plugins/perl/common/Request.xs b/libpurple/plugins/perl/common/Request.xs
--- a/libpurple/plugins/perl/common/Request.xs
+++ b/libpurple/plugins/perl/common/Request.xs
@@ -144,7 +144,7 @@ CODE:
gpr->cancel_fun = purple_perl_sv_from_fun(handle, cancel_cb);
g_free(basename);
- RETVAL = purple_request_input(handle, title, primary, secondary, default_value, multiline, masked, hint, ok_text, G_CALLBACK(purple_perl_request_ok_cb), cancel_text, G_CALLBACK(purple_perl_request_cancel_cb), NULL, NULL, NULL, gpr);
+ RETVAL = purple_request_input(handle, title, primary, secondary, default_value, multiline, masked, hint, ok_text, G_CALLBACK(purple_perl_request_ok_cb), cancel_text, G_CALLBACK(purple_perl_request_cancel_cb), NULL, gpr);
OUTPUT:
RETVAL
diff --git a/libpurple/protocols/gg/purplew.c b/libpurple/protocols/gg/purplew.c
--- a/libpurple/protocols/gg/purplew.c
+++ b/libpurple/protocols/gg/purplew.c
@@ -69,8 +69,8 @@ ggp_purplew_request_processing_handle *
handle->user_data = user_data;
handle->request_handle = purple_request_action(gc, _("Please wait..."),
(msg ? msg : _("Please wait...")), NULL,
- PURPLE_DEFAULT_ACTION_NONE, purple_connection_get_account(gc),
- NULL, NULL, handle, 1,
+ PURPLE_DEFAULT_ACTION_NONE,
+ purple_request_cpar_from_connection(gc), handle, 1,
_("Cancel"), G_CALLBACK(ggp_purplew_request_processing_cancel));
return handle;
diff --git a/libpurple/protocols/jabber/auth.c b/libpurple/protocols/jabber/auth.c
--- a/libpurple/protocols/jabber/auth.c
+++ b/libpurple/protocols/jabber/auth.c
@@ -313,7 +313,7 @@ static void auth_old_cb(JabberStream *js
_("Plaintext Authentication"),
msg,
1,
- account, NULL, NULL,
+ purple_request_cpar_from_account(account),
account, allow_plaintext_auth,
disallow_plaintext_auth);
g_free(msg);
diff --git a/libpurple/protocols/jabber/auth_plain.c b/libpurple/protocols/jabber/auth_plain.c
--- a/libpurple/protocols/jabber/auth_plain.c
+++ b/libpurple/protocols/jabber/auth_plain.c
@@ -97,7 +97,7 @@ jabber_plain_start(JabberStream *js, xml
_("Plaintext Authentication"),
msg,
1,
- account, NULL, NULL,
+ purple_request_cpar_from_account(account),
account, allow_plaintext_auth, disallow_plaintext_auth);
g_free(msg);
return JABBER_SASL_STATE_CONTINUE;
diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c
--- a/libpurple/protocols/jabber/buddy.c
+++ b/libpurple/protocols/jabber/buddy.c
@@ -1755,7 +1755,7 @@ jabber_buddy_cancel_presence_notificatio
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,
+ msg, 0 /* Yes */, purple_request_cpar_from_account(account), buddy,
cancel_presence_notification, NULL /* Do nothing */);
g_free(msg);
}
diff --git a/libpurple/protocols/jabber/presence.c b/libpurple/protocols/jabber/presence.c
--- a/libpurple/protocols/jabber/presence.c
+++ b/libpurple/protocols/jabber/presence.c
@@ -600,7 +600,7 @@ handle_presence_chat(JabberStream *js, J
" you like to configure it, or"
" accept the default settings?"),
/* Default Action */ 1,
- purple_connection_get_account(js->gc), NULL, chat->conv,
+ purple_request_cpar_from_conversation(chat->conv),
chat, 2,
_("_Configure Room"), G_CALLBACK(jabber_chat_request_room_configure),
_("_Accept Defaults"), G_CALLBACK(jabber_chat_create_instant_room));
diff --git a/libpurple/protocols/msn/error.c b/libpurple/protocols/msn/error.c
--- a/libpurple/protocols/msn/error.c
+++ b/libpurple/protocols/msn/error.c
@@ -373,7 +373,7 @@ msn_error_sync_issue(MsnSession *session
}
purple_request_action(gc, NULL, msg, reason, PURPLE_DEFAULT_ACTION_NONE,
- account, data->who, NULL,
+ purple_request_cpar_from_account(account),
data, 2,
_("Yes"), G_CALLBACK(msn_add_cb),
_("No"), G_CALLBACK(msn_rem_cb));
diff --git a/libpurple/protocols/msn/msn.c b/libpurple/protocols/msn/msn.c
More information about the Commits
mailing list