Mercurial > pidgin
annotate src/accountopt.h @ 8377:c1ca19c8f749
[gaim-migrate @ 9104]
" This is xgrimx's patch to fix a crash if you click the
join button twice without changing the selection in the
room list dialog. He had me take a look at it and I did
and it fixes the problem." --marv
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Mon, 01 Mar 2004 18:01:11 +0000 |
parents | fa6395637e2c |
children | 1a62ab7225f3 |
rev | line source |
---|---|
5639 | 1 /** |
2 * @file accountopt.h Account Options API | |
3 * @ingroup core | |
4 * | |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
6902
e30bedfb99db
[gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
10 * |
5639 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
25 #ifndef _GAIM_ACCOUNT_OPT_H_ | |
26 #define _GAIM_ACCOUNT_OPT_H_ | |
27 | |
28 #include "prefs.h" | |
29 | |
30 /** | |
31 * An option for an account. | |
6902
e30bedfb99db
[gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
32 * |
5639 | 33 * This is set by protocol plugins, and appears in the account settings |
34 * dialogs. | |
35 */ | |
36 typedef struct | |
37 { | |
38 GaimPrefType type; /**< The type of value. */ | |
39 | |
40 char *text; /**< The text that will appear to the user. */ | |
41 char *pref_name; /**< The name of the associated preference. */ | |
42 | |
43 union | |
44 { | |
45 gboolean boolean; /**< The default boolean value. */ | |
46 int integer; /**< The default integer value. */ | |
47 char *string; /**< The default string value. */ | |
48 | |
49 } default_value; | |
50 | |
51 } GaimAccountOption; | |
52 | |
53 /** | |
54 * A username split. | |
55 * | |
56 * This is used by some protocols to separate the fields of the username | |
57 * into more human-readable components. | |
58 */ | |
59 typedef struct | |
60 { | |
61 char *text; /**< The text that will appear to the user. */ | |
62 char *default_value; /**< The default value. */ | |
63 char field_sep; /**< The field separator. */ | |
64 | |
65 } GaimAccountUserSplit; | |
66 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
67 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
68 extern "C" { |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
69 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
70 |
5639 | 71 /**************************************************************************/ |
72 /** @name Account Option API */ | |
73 /**************************************************************************/ | |
74 /*@{*/ | |
75 | |
76 /** | |
77 * Creates a new account option. | |
78 * | |
79 * @param type The type of option. | |
80 * @param text The text of the option. | |
81 * @param pref_name The account preference name for the option. | |
82 * | |
83 * @return The account option. | |
84 */ | |
85 GaimAccountOption *gaim_account_option_new(GaimPrefType type, const char *text, | |
86 const char *pref_name); | |
87 | |
88 /** | |
89 * Creates a new boolean account option. | |
90 * | |
91 * @param text The text of the option. | |
92 * @param pref_name The account preference name for the option. | |
93 * @param default_value The default value. | |
94 * | |
95 * @return The account option. | |
96 */ | |
97 GaimAccountOption *gaim_account_option_bool_new(const char *text, | |
98 const char *pref_name, | |
99 gboolean default_value); | |
100 | |
101 /** | |
102 * Creates a new integer account option. | |
103 * | |
104 * @param text The text of the option. | |
105 * @param pref_name The account preference name for the option. | |
106 * @param default_value The default value. | |
107 * | |
108 * @return The account option. | |
109 */ | |
110 GaimAccountOption *gaim_account_option_int_new(const char *text, | |
111 const char *pref_name, | |
112 int default_value); | |
113 | |
114 /** | |
115 * Creates a new string account option. | |
116 * | |
117 * @param text The text of the option. | |
118 * @param pref_name The account preference name for the option. | |
119 * @param default_value The default value. | |
120 * | |
121 * @return The account option. | |
122 */ | |
123 GaimAccountOption *gaim_account_option_string_new(const char *text, | |
124 const char *pref_name, | |
125 const char *default_value); | |
126 | |
127 /** | |
128 * Destroys an account option. | |
129 * | |
130 * @param option The option to destroy. | |
131 */ | |
132 void gaim_account_option_destroy(GaimAccountOption *option); | |
133 | |
134 /** | |
135 * Sets the default boolean value for an account option. | |
136 * | |
137 * @param option The account option. | |
138 * @param value The default boolean value. | |
139 */ | |
140 void gaim_account_option_set_default_bool(GaimAccountOption *option, | |
141 gboolean value); | |
142 | |
143 /** | |
144 * Sets the default integer value for an account option. | |
145 * | |
146 * @param option The account option. | |
147 * @param value The default integer value. | |
148 */ | |
149 void gaim_account_option_set_default_int(GaimAccountOption *option, | |
150 int value); | |
151 | |
152 /** | |
153 * Sets the default string value for an account option. | |
154 * | |
155 * @param option The account option. | |
156 * @param value The default string value. | |
157 */ | |
158 void gaim_account_option_set_default_string(GaimAccountOption *option, | |
159 const char *value); | |
160 | |
161 /** | |
162 * Returns the specified account option's type. | |
163 * | |
164 * @param option The account option. | |
165 * | |
166 * @return The account option's type. | |
167 */ | |
168 GaimPrefType gaim_account_option_get_type(const GaimAccountOption *option); | |
169 | |
170 /** | |
171 * Returns the text for an account option. | |
172 * | |
173 * @param option The accont option. | |
174 * | |
175 * @return The account option's text. | |
176 */ | |
177 const char *gaim_account_option_get_text(const GaimAccountOption *option); | |
178 | |
179 /** | |
5660
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
180 * Returns the account setting for an account option. |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
181 * |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
182 * @param option The accont option. |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
183 * |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
184 * @return The account setting. |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
185 */ |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
186 const char *gaim_account_option_get_setting(const GaimAccountOption *option); |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
187 |
1709a545a7bd
[gaim-migrate @ 6074]
Christian Hammond <chipx86@chipx86.com>
parents:
5654
diff
changeset
|
188 /** |
5639 | 189 * Returns the default boolean value for an account option. |
190 * | |
191 * @param option The account option. | |
6902
e30bedfb99db
[gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
192 * |
5639 | 193 * @return The default boolean value. |
194 */ | |
195 gboolean gaim_account_option_get_default_bool(const GaimAccountOption *option); | |
196 | |
197 /** | |
198 * Returns the default integer value for an account option. | |
199 * | |
200 * @param option The account option. | |
6902
e30bedfb99db
[gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
201 * |
5639 | 202 * @return The default integer value. |
203 */ | |
204 int gaim_account_option_get_default_int(const GaimAccountOption *option); | |
205 | |
206 /** | |
207 * Returns the default string value for an account option. | |
208 * | |
209 * @param option The account option. | |
6902
e30bedfb99db
[gaim-migrate @ 7449]
Christian Hammond <chipx86@chipx86.com>
parents:
5944
diff
changeset
|
210 * |
5639 | 211 * @return The default string value. |
212 */ | |
213 const char *gaim_account_option_get_default_string( | |
214 const GaimAccountOption *option); | |
215 | |
216 /*@}*/ | |
217 | |
218 | |
219 /**************************************************************************/ | |
220 /** @name Account User Split API */ | |
221 /**************************************************************************/ | |
222 /*@{*/ | |
223 | |
224 /** | |
225 * Creates a new account username split. | |
226 * | |
227 * @param text The text of the option. | |
228 * @param default_value The default value. | |
229 * @param sep The field separator. | |
230 * | |
231 * @return The new user split. | |
232 */ | |
233 GaimAccountUserSplit *gaim_account_user_split_new(const char *text, | |
234 const char *default_value, | |
235 char sep); | |
236 | |
237 /** | |
238 * Destroys an account username split. | |
239 * | |
240 * @param split The split to destroy. | |
241 */ | |
242 void gaim_account_user_split_destroy(GaimAccountUserSplit *split); | |
243 | |
244 /** | |
5654
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
245 * Returns the text for an account username split. |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
246 * |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
247 * @param split The account username split. |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
248 * |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
249 * @return The account username split's text. |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
250 */ |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
251 const char *gaim_account_user_split_get_text(const GaimAccountUserSplit *split); |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
252 |
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
253 /** |
5639 | 254 * Returns the default string value for an account split. |
255 * | |
256 * @param split The account username split. | |
257 * | |
258 * @return The default string. | |
259 */ | |
5654
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
260 const char *gaim_account_user_split_get_default_value( |
5639 | 261 const GaimAccountUserSplit *split); |
262 | |
263 /** | |
264 * Returns the field separator for an account split. | |
265 * | |
266 * @param split The account username split. | |
267 * | |
268 * @return The field separator. | |
269 */ | |
5654
c52a97f3739e
[gaim-migrate @ 6068]
Christian Hammond <chipx86@chipx86.com>
parents:
5639
diff
changeset
|
270 char gaim_account_user_split_get_separator(const GaimAccountUserSplit *split); |
5639 | 271 |
272 /*@}*/ | |
273 | |
5944
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
274 #ifdef __cplusplus |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
275 } |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
276 #endif |
158196b2db19
[gaim-migrate @ 6385]
Christian Hammond <chipx86@chipx86.com>
parents:
5660
diff
changeset
|
277 |
5639 | 278 #endif /* _GAIM_ACCOUNT_OPT_H_ */ |