annotate src/request.c @ 5598:8b24e4d1e082

[gaim-migrate @ 6002] (10:36:12) Robot101: fixes three things: (10:36:33) Robot101: linkifies text that's inserted by the history plugin, if you have that option enabled for conversations in general (10:37:02) Robot101: validates the UTF-8 in incoming server-side aliases, so trillian can't screw us over (10:37:38) Robot101: changes the wording in the iconaway plugin so it no longer claims to minimise the away window, which for the moment is a dialog and isn't meant to be minimised committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Sat, 31 May 2003 14:38:03 +0000
parents b7c0be69c749
children 11001789cb22
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file request.c Request API
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 * @ingroup core
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * (at your option) any later version.
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * GNU General Public License for more details.
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 */
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 #include "request.h"
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 static GaimRequestUiOps *request_ui_ops = NULL;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26 static GList *handles = NULL;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 typedef struct
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 GaimRequestType type;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 void *handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 void *ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 } GaimRequestInfo;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 void *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 gaim_request_input(void *handle, const char *title, const char *primary,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 const char *secondary, const char *default_value,
5482
a41149ee8a29 [gaim-migrate @ 5878]
Christian Hammond <chipx86@chipx86.com>
parents: 5477
diff changeset
40 gboolean multiline,
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 const char *ok_text, GCallback ok_cb,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 const char *cancel_text, GCallback cancel_cb,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 void *user_data)
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 GaimRequestUiOps *ops;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 g_return_val_if_fail(primary != NULL, NULL);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 g_return_val_if_fail(ok_text != NULL, NULL);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 g_return_val_if_fail(ok_cb != NULL, NULL);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 ops = gaim_get_request_ui_ops();
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 if (ops != NULL && ops->request_input != NULL) {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 GaimRequestInfo *info;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 info = g_new0(GaimRequestInfo, 1);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 info->type = GAIM_REQUEST_INPUT;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 info->handle = handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 info->ui_handle = ops->request_input(title, primary, secondary,
5482
a41149ee8a29 [gaim-migrate @ 5878]
Christian Hammond <chipx86@chipx86.com>
parents: 5477
diff changeset
60 default_value, multiline,
a41149ee8a29 [gaim-migrate @ 5878]
Christian Hammond <chipx86@chipx86.com>
parents: 5477
diff changeset
61 ok_text, ok_cb,
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 cancel_text, cancel_cb,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63 user_data);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 handles = g_list_append(handles, info);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 return info->ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 return NULL;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 void *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74 gaim_request_choice(void *handle, const char *title, const char *primary,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 const char *secondary, unsigned int default_value,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76 const char *ok_text, GCallback ok_cb,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 const char *cancel_text, GCallback cancel_cb,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
78 void *user_data, size_t choice_count, ...)
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 void *ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 va_list args;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
83 g_return_val_if_fail(primary != NULL, NULL);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
84 g_return_val_if_fail(ok_text != NULL, NULL);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
85 g_return_val_if_fail(ok_cb != NULL, NULL);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
86 g_return_val_if_fail(choice_count > 0, NULL);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
88 va_start(args, choice_count);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 ui_handle = gaim_request_choice_varg(handle, title, primary, secondary,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 default_value, ok_text, ok_cb,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 cancel_text, cancel_cb, user_data,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
92 choice_count, args);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 va_end(args);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 return ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 void *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 gaim_request_choice_varg(void *handle, const char *title,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100 const char *primary, const char *secondary,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 unsigned int default_value,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 const char *ok_text, GCallback ok_cb,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103 const char *cancel_text, GCallback cancel_cb,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
104 void *user_data, size_t choice_count,
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
105 va_list choices)
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107 GaimRequestUiOps *ops;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
109 g_return_val_if_fail(primary != NULL, NULL);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
110 g_return_val_if_fail(ok_text != NULL, NULL);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
111 g_return_val_if_fail(ok_cb != NULL, NULL);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
112 g_return_val_if_fail(choice_count > 0, NULL);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114 ops = gaim_get_request_ui_ops();
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
116 if (ops != NULL && ops->request_choice != NULL) {
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117 GaimRequestInfo *info;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119 info = g_new0(GaimRequestInfo, 1);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 info->type = GAIM_REQUEST_CHOICE;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121 info->handle = handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122 info->ui_handle = ops->request_choice(title, primary, secondary,
5482
a41149ee8a29 [gaim-migrate @ 5878]
Christian Hammond <chipx86@chipx86.com>
parents: 5477
diff changeset
123 default_value,
a41149ee8a29 [gaim-migrate @ 5878]
Christian Hammond <chipx86@chipx86.com>
parents: 5477
diff changeset
124 ok_text, ok_cb,
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
125 cancel_text, cancel_cb,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
126 user_data, choice_count,
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
127 choices);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129 handles = g_list_append(handles, info);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 return info->ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
132 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 return NULL;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
137 void *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138 gaim_request_action(void *handle, const char *title, const char *primary,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139 const char *secondary, unsigned int default_action,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
140 void *user_data, size_t action_count, ...)
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142 void *ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143 va_list args;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
145 g_return_val_if_fail(primary != NULL, NULL);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
146 g_return_val_if_fail(action_count > 0, NULL);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
148 va_start(args, action_count);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
149 ui_handle = gaim_request_action_varg(handle, title, primary, secondary,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
150 default_action, user_data,
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
151 action_count, args);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
152 va_end(args);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154 return ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157 void *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
158 gaim_request_action_varg(void *handle, const char *title,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159 const char *primary, const char *secondary,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
160 unsigned int default_action, void *user_data,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
161 size_t action_count, va_list actions)
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
162 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
163 GaimRequestUiOps *ops;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
165 g_return_val_if_fail(primary != NULL, NULL);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
166 g_return_val_if_fail(action_count > 0, NULL);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168 ops = gaim_get_request_ui_ops();
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
170 if (ops != NULL && ops->request_action != NULL) {
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
171 GaimRequestInfo *info;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
172
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
173 info = g_new0(GaimRequestInfo, 1);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
174 info->type = GAIM_REQUEST_ACTION;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175 info->handle = handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
176 info->ui_handle = ops->request_action(title, primary, secondary,
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177 default_action, user_data,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5482
diff changeset
178 action_count, actions);
5477
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
180 handles = g_list_append(handles, info);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182 return info->ui_handle;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 return NULL;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188 void
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189 gaim_request_close(GaimRequestType type, void *ui_handle)
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191 GList *l;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192 GaimRequestUiOps *ops;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194 g_return_if_fail(ui_handle != NULL);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196 ops = gaim_get_request_ui_ops();
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198 for (l = handles; l != NULL; l = l->next) {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 GaimRequestInfo *info = l->data;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201 if (info->ui_handle == ui_handle) {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
202 handles = g_list_remove(handles, info);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204 if (ops != NULL && ops->close_request != NULL)
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
205 ops->close_request(info->type, ui_handle);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207 g_free(info);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209 break;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214 void
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 gaim_request_close_with_handle(void *handle)
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
217 GList *l, *l_next;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218 GaimRequestUiOps *ops;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 g_return_if_fail(handle != NULL);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
222 ops = gaim_get_request_ui_ops();
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
223
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224 for (l = handles; l != NULL; l = l_next) {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225 GaimRequestInfo *info = l->data;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227 l_next = l->next;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
229 if (info->handle == handle) {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230 handles = g_list_remove(handles, info);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
231
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232 if (ops != NULL && ops->close_request != NULL)
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
233 ops->close_request(info->type, info->ui_handle);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235 g_free(info);
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
238 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
239
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240 void
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241 gaim_set_request_ui_ops(GaimRequestUiOps *ops)
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
242 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
243 request_ui_ops = ops;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
245
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
246 GaimRequestUiOps *
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
247 gaim_get_request_ui_ops(void)
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
248 {
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249 return request_ui_ops;
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250 }
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251
e8e498255369 [gaim-migrate @ 5873]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252