accountopt.h
Go to the documentation of this file.
1
6 /* purple
7 *
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 */
26 #ifndef _PURPLE_ACCOUNTOPT_H_
27 #define _PURPLE_ACCOUNTOPT_H_
28
29 #include "prefs.h"
30
37 typedef struct
38 {
39 PurplePrefType type;
41 char *text;
42 char *pref_name;
44 union
45 {
46 gboolean boolean;
47 int integer;
48 char *string;
49 GList *list;
51 } default_value;
52
53 gboolean masked;
57 } PurpleAccountOption;
58
65 typedef struct
66 {
67 char *text;
68 char *default_value;
69 char field_sep;
70 gboolean reverse;
74 } PurpleAccountUserSplit;
75
76 #ifdef __cplusplus
77 extern "C" {
78 #endif
79
80 /**************************************************************************/
82 /**************************************************************************/
97 PurpleAccountOption *purple_account_option_new(PurplePrefType type,
98 const char *text, const char *pref_name);
99
109 PurpleAccountOption *purple_account_option_bool_new(const char *text,
110 const char *pref_name, gboolean default_value);
111
121 PurpleAccountOption *purple_account_option_int_new(const char *text,
122 const char *pref_name, int default_value);
123
133 PurpleAccountOption *purple_account_option_string_new(const char *text,
134 const char *pref_name, const char *default_value);
135
153 PurpleAccountOption *purple_account_option_list_new(const char *text,
154 const char *pref_name, GList *list);
155
161 void purple_account_option_destroy(PurpleAccountOption *option);
162
169 void purple_account_option_set_default_bool(PurpleAccountOption *option,
170 gboolean value);
171
178 void purple_account_option_set_default_int(PurpleAccountOption *option,
179 int value);
180
187 void purple_account_option_set_default_string(PurpleAccountOption *option,
188 const char *value);
189
198 void
199 purple_account_option_set_masked(PurpleAccountOption *option, gboolean masked);
200
213 void purple_account_option_set_list(PurpleAccountOption *option, GList *values);
214
222 void purple_account_option_add_list_item(PurpleAccountOption *option,
223 const char *key, const char *value);
224
232 PurplePrefType purple_account_option_get_type(const PurpleAccountOption *option);
233
241 const char *purple_account_option_get_text(const PurpleAccountOption *option);
242
252 const char *purple_account_option_get_setting(const PurpleAccountOption *option);
253
261 gboolean purple_account_option_get_default_bool(const PurpleAccountOption *option);
262
270 int purple_account_option_get_default_int(const PurpleAccountOption *option);
271
279 const char *purple_account_option_get_default_string(
280 const PurpleAccountOption *option);
281
289 const char *purple_account_option_get_default_list_value(
290 const PurpleAccountOption *option);
291
301 gboolean
302 purple_account_option_get_masked(const PurpleAccountOption *option);
303
314 GList *purple_account_option_get_list(const PurpleAccountOption *option);
315
319 /**************************************************************************/
321 /**************************************************************************/
333 PurpleAccountUserSplit *purple_account_user_split_new(const char *text,
334 const char *default_value,
335 char sep);
336
342 void purple_account_user_split_destroy(PurpleAccountUserSplit *split);
343
351 const char *purple_account_user_split_get_text(const PurpleAccountUserSplit *split);
352
360 const char *purple_account_user_split_get_default_value(
361 const PurpleAccountUserSplit *split);
362
370 char purple_account_user_split_get_separator(const PurpleAccountUserSplit *split);
371
379 gboolean purple_account_user_split_get_reverse(const PurpleAccountUserSplit *split);
380
387 void purple_account_user_split_set_reverse(PurpleAccountUserSplit *split, gboolean reverse);
388
391 #ifdef __cplusplus
392 }
393 #endif
394
395 #endif /* _PURPLE_ACCOUNTOPT_H_ */
purple_account_option_set_default_bool
void purple_account_option_set_default_bool(PurpleAccountOption *option, gboolean value)
Sets the default boolean value for an account option.
purple_account_option_get_default_int
int purple_account_option_get_default_int(const PurpleAccountOption *option)
Returns the default integer value for an account option.
purple_account_user_split_get_separator
char purple_account_user_split_get_separator(const PurpleAccountUserSplit *split)
Returns the field separator for an account split.
PurplePrefType
enum _PurplePrefType PurplePrefType
Preference data types.
PurpleAccountOption::list
GList * list
The default list value.
Definition: accountopt.h:49
purple_account_option_string_new
PurpleAccountOption * purple_account_option_string_new(const char *text, const char *pref_name, const char *default_value)
Creates a new string account option.
PurpleAccountUserSplit
A username split.
Definition: accountopt.h:65
purple_account_user_split_get_text
const char * purple_account_user_split_get_text(const PurpleAccountUserSplit *split)
Returns the text for an account username split.
PurpleAccountUserSplit::default_value
char * default_value
The default value.
Definition: accountopt.h:68
purple_account_option_set_list
void purple_account_option_set_list(PurpleAccountOption *option, GList *values)
Sets the list values for an account option.
PurpleAccountOption::integer
int integer
The default integer value.
Definition: accountopt.h:47
purple_account_option_list_new
PurpleAccountOption * purple_account_option_list_new(const char *text, const char *pref_name, GList *list)
Creates a new list account option.
purple_account_option_bool_new
PurpleAccountOption * purple_account_option_bool_new(const char *text, const char *pref_name, gboolean default_value)
Creates a new boolean account option.
prefs.h
Prefs API.
purple_account_option_set_masked
void purple_account_option_set_masked(PurpleAccountOption *option, gboolean masked)
Sets the masking for an account option.
purple_account_option_get_default_bool
gboolean purple_account_option_get_default_bool(const PurpleAccountOption *option)
Returns the default boolean value for an account option.
PurpleAccountOption
An option for an account.
Definition: accountopt.h:37
PurpleAccountUserSplit::reverse
gboolean reverse
TRUE if the separator should be found starting a the end of the string, FALSE otherwise.
Definition: accountopt.h:70
PurpleAccountOption::type
PurplePrefType type
The type of value.
Definition: accountopt.h:39
option
Definition: finch/getopt.h:84
purple_account_user_split_destroy
void purple_account_user_split_destroy(PurpleAccountUserSplit *split)
Destroys an account username split.
purple_account_option_get_setting
const char * purple_account_option_get_setting(const PurpleAccountOption *option)
Returns the name of an account option.
PurpleAccountOption::pref_name
char * pref_name
The name of the associated preference.
Definition: accountopt.h:42
purple_account_option_get_list
GList * purple_account_option_get_list(const PurpleAccountOption *option)
Returns the list values for an account option.
PurpleAccountUserSplit::field_sep
char field_sep
The field separator.
Definition: accountopt.h:69
PurpleAccountUserSplit::text
char * text
The text that will appear to the user.
Definition: accountopt.h:67
purple_account_option_destroy
void purple_account_option_destroy(PurpleAccountOption *option)
Destroys an account option.
PurpleAccountOption::boolean
gboolean boolean
The default boolean value.
Definition: accountopt.h:46
PurpleAccountOption::masked
gboolean masked
Whether the value entered should be obscured from view (for passwords and similar options) ...
Definition: accountopt.h:53
purple_account_option_get_masked
gboolean purple_account_option_get_masked(const PurpleAccountOption *option)
Returns whether an option&#39;s value should be masked from view, like a password.
purple_account_option_int_new
PurpleAccountOption * purple_account_option_int_new(const char *text, const char *pref_name, int default_value)
Creates a new integer account option.
purple_account_option_set_default_string
void purple_account_option_set_default_string(PurpleAccountOption *option, const char *value)
Sets the default string value for an account option.
purple_account_user_split_get_reverse
gboolean purple_account_user_split_get_reverse(const PurpleAccountUserSplit *split)
Returns the &#39;reverse&#39; value for an account split.
purple_account_option_get_default_list_value
const char * purple_account_option_get_default_list_value(const PurpleAccountOption *option)
Returns the default string value for a list account option.
purple_account_user_split_get_default_value
const char * purple_account_user_split_get_default_value(const PurpleAccountUserSplit *split)
Returns the default string value for an account split.
purple_account_option_set_default_int
void purple_account_option_set_default_int(PurpleAccountOption *option, int value)
Sets the default integer value for an account option.
purple_account_user_split_set_reverse
void purple_account_user_split_set_reverse(PurpleAccountUserSplit *split, gboolean reverse)
Sets the &#39;reverse&#39; value for an account split.
purple_account_option_get_text
const char * purple_account_option_get_text(const PurpleAccountOption *option)
Returns the text for an account option.
purple_account_option_get_default_string
const char * purple_account_option_get_default_string(const PurpleAccountOption *option)
Returns the default string value for an account option.
purple_account_option_new
PurpleAccountOption * purple_account_option_new(PurplePrefType type, const char *text, const char *pref_name)
Creates a new account option.
PurpleAccountOption::text
char * text
The text that will appear to the user.
Definition: accountopt.h:41
PurpleAccountOption::string
char * string
The default string value.
Definition: accountopt.h:48
purple_account_option_add_list_item
void purple_account_option_add_list_item(PurpleAccountOption *option, const char *key, const char *value)
Adds an item to a list account option.
purple_account_option_get_type
PurplePrefType purple_account_option_get_type(const PurpleAccountOption *option)
Returns the specified account option&#39;s type.
purple_account_user_split_new
PurpleAccountUserSplit * purple_account_user_split_new(const char *text, const char *default_value, char sep)
Creates a new account username split.