2 * Thrasher Bird - XMPP transport via libpurple
3 * Copyright (C) 2008 Barracuda Networks, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with Thrasher Bird; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 #include "threquest.h"
28 thrasher_request_input(const char *title
,
30 const char *secondary
,
31 const char *default_value
,
33 gboolean masked
, gchar
*hint
,
36 const char *cancel_text
,
38 PurpleAccount
*account
,
40 PurpleConversation
*conv
,
42 /* Non-matching input requests fire no callback, which is the
43 * default if the UI does not provide this request uiop.
46 /* Ensure callback to actually send the authorization request
47 * fires. For now, always use the default message.
49 if (0 == g_strcmp0(primary
, _("Authorization Request Message:"))) {
50 gchar
* jid
= thrasher_account_get_jid(account
);
51 purple_debug_info("thrasher request",
52 "%s: Requesting authorization from %s: %s\n",
56 ((PurpleRequestInputCb
)ok_cb
)(user_data
, default_value
);
60 purple_debug_error("thrasher_request",
61 "Unhandled thrasher_request_input(%s, %s, %s)\n",
67 /* No meaningful UI handle. */
72 thrasher_request_action(const char *title
,
74 const char *secondary
,
76 PurpleAccount
*account
,
78 PurpleConversation
*conv
,
83 PurpleRequestActionCb default_cb
= NULL
;
85 for (i
= 0; i
< action_count
; ) {
86 va_arg(actions
, char*); /* throw away label */
87 PurpleRequestActionCb cb
= va_arg(actions
, PurpleRequestActionCb
);
88 if (i
== default_action
) {
95 purple_debug_error("thrasher request",
96 "Default action not found?"
97 " thrasher_request_action(%s, %s, %s)\n",
101 /* No meaningful UI handle. */
105 if (0 == g_strcmp0(title
, _("SSL Certificate Verification"))) {
106 purple_debug_info("thrasher request",
108 /* Accept certificate for ...? */
112 default_cb(user_data
, default_action
);
116 purple_debug_error("thrasher_request",
117 "Unhandled thrasher_request_action(%s, %s, %s)\n",
123 /* No meaningful UI handle. */
127 static PurpleRequestUiOps thrasher_request_uiops
=
130 thrasher_request_input
,
136 thrasher_request_action
,
142 thrasher_request_file
, /* from thft */
157 void thrasher_request_init() {
158 purple_request_set_ui_ops(&thrasher_request_uiops
);