Back to index

webcit  8.12-dfsg
preferences.h
Go to the documentation of this file.
00001 
00002 typedef enum _ePrefType{
00003        PRF_UNSET = 0,
00004        PRF_STRING = 1,
00005        PRF_INT = 2,
00006        PRF_QP_STRING = 3,
00007        PRF_YESNO = 4
00008 } ePrefType;
00009 
00010 
00011 typedef void (*PrefEvalFunc)(StrBuf *Preference, long lvalue); 
00012 
00013 void _RegisterPreference(const char *Setting, long SettingLen, 
00014                       const char *PrefStr, 
00015                       ePrefType Type, 
00016                       PrefEvalFunc OnLoad, 
00017                       const char *OnLoadName);
00018 
00019 #define RegisterPreference(a, b, c, d) _RegisterPreference(a, sizeof(a) -1, b, c, d, #d)
00020 
00021 void load_preferences(void);
00022 void save_preferences(void);
00023 #define get_preference(a, b) get_PREFERENCE(a, sizeof(a) - 1, b)
00024 #define get_pref(a, b)       get_PREFERENCE(SKEY(a), b)
00025 int get_PREFERENCE(const char *key, size_t keylen, StrBuf **value);
00026 #define set_preference(a, b, c) set_PREFERENCE(a, sizeof(a) - 1, b, c)
00027 #define set_pref(a, b, c)       set_PREFERENCE(SKEY(a), b, c)
00028 void set_PREFERENCE(const char *key, size_t keylen, StrBuf *value, int save_to_server);
00029 
00030 #define get_pref_long(a, b, c) get_PREF_LONG(a, sizeof(a) - 1, b, c)
00031 int get_PREF_LONG(const char *key, size_t keylen, long *value, long Default);
00032 #define set_pref_long(a, b, c) set_PREF_LONG(a, sizeof(a) - 1, b, c)
00033 void set_PREF_LONG(const char *key, size_t keylen, long value, int save_to_server);
00034 
00035 #define get_pref_yesno(a, b, c) get_PREF_YESNO(a, sizeof(a) - 1, b, c)
00036 int get_PREF_YESNO(const char *key, size_t keylen, int *value, int Default);
00037 #define set_pref_yesno(a, b, c) set_PREF_YESNO(a, sizeof(a) - 1, b, c)
00038 void set_PREF_YESNO(const char *key, size_t keylen, long value, int save_to_server);
00039 
00040 #define get_room_pref(a) get_ROOM_PREFS(a, sizeof(a) - 1)
00041 StrBuf *get_ROOM_PREFS(const char *key, size_t keylen);
00042 
00043 #define set_room_pref(a, b, c) set_ROOM_PREFS(a, sizeof(a) - 1, b, c)
00044 void set_ROOM_PREFS(const char *key, size_t keylen, StrBuf *value, int save_to_server);
00045 #define get_room_pref_long(a, b, c) get_ROOM_PREFS_LONG(a, sizeof(a) - 1, b, c)
00046 long get_ROOM_PREFS_LONG(const char *key, size_t keylen, long *value, long Default);
00047 
00048 
00049 #define get_x_pref(a, b) get_ROOM_PREFS(a, sizeof(a) - 1, b, sizeof(b) - 1)
00050 const StrBuf *get_X_PREFS(const char *key, size_t keylen, 
00051                        const char *xkey, size_t xkeylen);
00052 
00053 #define set_x_pref(a, b, c) set_ROOM_PREFS(a, sizeof(a) - 1, b, sizeof(b) - 1, c, d)
00054 void set_X_PREFS(const char *key, size_t keylen, const char *xkey, size_t xkeylen, StrBuf *value, int save_to_server);
00055 
00056 int goto_config_room(StrBuf *Buf, folder *room);