libpurple/request.h

changeset 34329
ddbc1337332c
parent 34193
95e4bd9d5b9c
child 34330
35d5e8fcc07b
equal deleted inserted replaced
34328:d0b5e37899e1 34329:ddbc1337332c
44 44
45 /** 45 /**
46 * A group of fields with a title. 46 * A group of fields with a title.
47 */ 47 */
48 typedef struct _PurpleRequestFieldGroup PurpleRequestFieldGroup; 48 typedef struct _PurpleRequestFieldGroup PurpleRequestFieldGroup;
49
50 /**
51 * Common parameters for UI operations.
52 */
53 typedef struct _PurpleRequestCommonParameters PurpleRequestCommonParameters;
49 54
50 #include "account.h" 55 #include "account.h"
51 56
52 #define PURPLE_DEFAULT_ACTION_NONE -1 57 #define PURPLE_DEFAULT_ACTION_NONE -1
53 58
92 void *(*request_input)(const char *title, const char *primary, 97 void *(*request_input)(const char *title, const char *primary,
93 const char *secondary, const char *default_value, 98 const char *secondary, const char *default_value,
94 gboolean multiline, gboolean masked, gchar *hint, 99 gboolean multiline, gboolean masked, gchar *hint,
95 const char *ok_text, GCallback ok_cb, 100 const char *ok_text, GCallback ok_cb,
96 const char *cancel_text, GCallback cancel_cb, 101 const char *cancel_text, GCallback cancel_cb,
97 PurpleAccount *account, const char *who, 102 PurpleRequestCommonParameters *cpar,
98 PurpleConversation *conv, void *user_data); 103 void *user_data);
99 104
100 /** @see purple_request_choice_varg(). */ 105 /** @see purple_request_choice_varg(). */
101 void *(*request_choice)(const char *title, const char *primary, 106 void *(*request_choice)(const char *title, const char *primary,
102 const char *secondary, int default_value, 107 const char *secondary, int default_value,
103 const char *ok_text, GCallback ok_cb, 108 const char *ok_text, GCallback ok_cb,
163 typedef void (*PurpleRequestChoiceCb)(void *, int); 168 typedef void (*PurpleRequestChoiceCb)(void *, int);
164 typedef void (*PurpleRequestFieldsCb)(void *, PurpleRequestFields *fields); 169 typedef void (*PurpleRequestFieldsCb)(void *, PurpleRequestFields *fields);
165 typedef void (*PurpleRequestFileCb)(void *, const char *filename); 170 typedef void (*PurpleRequestFileCb)(void *, const char *filename);
166 171
167 G_BEGIN_DECLS 172 G_BEGIN_DECLS
173
174 /**************************************************************************/
175 /** @name Common parameters API */
176 /**************************************************************************/
177 /*@{*/
178
179 /**
180 * Creates new parameters set for the request, which may or may not be used by
181 * the UI to display the request.
182 *
183 * @return The new parameters set.
184 */
185 PurpleRequestCommonParameters *
186 purple_request_cpar_new(void);
187
188 /**
189 * Creates new parameters set initially bound with the #PurpleConnection.
190 *
191 * @return The new parameters set.
192 */
193 PurpleRequestCommonParameters *
194 purple_request_cpar_from_connection(PurpleConnection *gc);
195
196 /**
197 * Creates new parameters set initially bound with the #PurpleAccount.
198 *
199 * @return The new parameters set.
200 */
201 PurpleRequestCommonParameters *
202 purple_request_cpar_from_account(PurpleAccount *account);
203
204 /*
205 * Increases the reference count on the parameters set.
206 *
207 * @param cpar The object to ref.
208 */
209 void
210 purple_request_cpar_ref(PurpleRequestCommonParameters *cpar);
211
212 /**
213 * Decreases the reference count on the parameters set.
214 *
215 * The object will be destroyed when this reaches 0.
216 *
217 * @param cpar The parameters set object to unref and possibly destroy.
218 *
219 * @return The NULL, if object was destroyed, cpar otherwise.
220 */
221 PurpleRequestCommonParameters *
222 purple_request_cpar_unref(PurpleRequestCommonParameters *cpar);
223
224 /**
225 * Sets the #PurpleAccount associated with the request, or @c NULL, if none is.
226 *
227 * @param cpar The parameters set.
228 * @param account The #PurpleAccount to associate.
229 */
230 void
231 purple_request_cpar_set_account(PurpleRequestCommonParameters *cpar,
232 PurpleAccount *account);
233
234 /**
235 * Gets the #PurpleAccount associated with the request.
236 *
237 * @param cpar The parameters set (may be @c NULL).
238 *
239 * @return The associated #PurpleAccount, or NULL if none is.
240 */
241 PurpleAccount *
242 purple_request_cpar_get_account(PurpleRequestCommonParameters *cpar);
243
244 /**
245 * Sets the #PurpleConversation associated with the request, or @c NULL, if
246 * none is.
247 *
248 * @param cpar The parameters set.
249 * @param conv The #PurpleConversation to associate.
250 */
251 void
252 purple_request_cpar_set_conversation(PurpleRequestCommonParameters *cpar,
253 PurpleConversation *conv);
254
255 /**
256 * Gets the #PurpleConversation associated with the request.
257 *
258 * @param cpar The parameters set (may be @c NULL).
259 *
260 * @return The associated #PurpleConversation, or NULL if none is.
261 */
262 PurpleConversation *
263 purple_request_cpar_get_conversation(PurpleRequestCommonParameters *cpar);
264
265 /*@}*/
168 266
169 /**************************************************************************/ 267 /**************************************************************************/
170 /** @name Field List API */ 268 /** @name Field List API */
171 /**************************************************************************/ 269 /**************************************************************************/
172 /*@{*/ 270 /*@{*/
1379 * NULL. 1477 * NULL.
1380 * @param cancel_text The text for the @c Cancel button, which may not be @c 1478 * @param cancel_text The text for the @c Cancel button, which may not be @c
1381 * NULL. 1479 * NULL.
1382 * @param cancel_cb The callback for the @c Cancel button, which may be 1480 * @param cancel_cb The callback for the @c Cancel button, which may be
1383 * @c NULL. 1481 * @c NULL.
1384 * @param account The #PurpleAccount associated with this request, or @c 1482 * @param cpar The #PurpleRequestCommonParameters object, which gets
1385 * NULL if none is. 1483 * unref'ed after this call.
1386 * @param who The username of the buddy associated with this request,
1387 * or @c NULL if none is.
1388 * @param conv The #PurpleConversation associated with this request, or
1389 * @c NULL if none is.
1390 * @param user_data The data to pass to the callback. 1484 * @param user_data The data to pass to the callback.
1391 * 1485 *
1392 * @return A UI-specific handle. 1486 * @return A UI-specific handle.
1393 */ 1487 */
1394 void *purple_request_input(void *handle, const char *title, const char *primary, 1488 void *purple_request_input(void *handle, const char *title, const char *primary,
1395 const char *secondary, const char *default_value, gboolean multiline, 1489 const char *secondary, const char *default_value, gboolean multiline,
1396 gboolean masked, gchar *hint, 1490 gboolean masked, gchar *hint,
1397 const char *ok_text, GCallback ok_cb, 1491 const char *ok_text, GCallback ok_cb,
1398 const char *cancel_text, GCallback cancel_cb, 1492 const char *cancel_text, GCallback cancel_cb,
1399 PurpleAccount *account, const char *who, PurpleConversation *conv, 1493 PurpleRequestCommonParameters *cpar,
1400 void *user_data); 1494 void *user_data);
1401 1495
1402 /** 1496 /**
1403 * Prompts the user for multiple-choice input. 1497 * Prompts the user for multiple-choice input.
1404 * 1498 *

mercurial