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