1 #ifndef __MCABBER_SETTINGS_H__
2 #define __MCABBER_SETTINGS_H__ 1
3 
4 #include <ctype.h>
5 #include <glib.h>
6 
7 #include <mcabber/roster.h>
8 #include <mcabber/config.h>
9 
10 #ifndef isblank
11 # define isblank(c)  ((c) == 0x20 || (c) == 0x09)
12 #endif
13 
14 
15 #define SETTINGS_TYPE_OPTION    1
16 #define SETTINGS_TYPE_ALIAS     2
17 #define SETTINGS_TYPE_BINDING   3
18 #ifdef HAVE_LIBOTR
19 #define SETTINGS_TYPE_OTR       4
20 #endif
21 
22 #define settings_opt_get(k)     settings_get(SETTINGS_TYPE_OPTION, k)
23 #define settings_opt_get_int(k) settings_get_int(SETTINGS_TYPE_OPTION, k)
24 
25 #define COMMAND_CHAR    (vi_mode ? ':' : '/')
26 #define COMMAND_CHARSTR (vi_mode ? ":" : "/")
27 #define VI_SEARCH_COMMAND_CHAR  '/'
28 
29 extern gboolean vi_mode;
30 
31 typedef gchar *(*settings_guard_t)(const gchar *key, const gchar *new_value);
32 
33 void    settings_init(void);
34 void    settings_free(void);
35 const gchar *settings_get_mcabber_config_dir(void);
36 int     cfg_read_file(char *filename, guint mainfile);
37 guint   parse_assigment(gchar *assignment, gchar **pkey, gchar **pval);
38 gboolean settings_set_guard(const gchar *key, settings_guard_t guard);
39 void    settings_del_guard(const gchar *key);
40 void    settings_opt_set_raw(const gchar *key, const gchar *value);
41 void    settings_set(guint type, const gchar *key, const gchar *value);
42 void    settings_del(guint type, const gchar *key);
43 const gchar *settings_get(guint type, const gchar *key);
44 int     settings_get_int(guint type, const gchar *key);
45 const gchar *settings_get_status_msg(enum imstatus status);
46 void    settings_foreach(guint type,
47                          void (*pfunc)(char *k, char *v, void *param),
48                          void *param);
49 
50 void    settings_pgp_setdisabled(const char *bjid, guint value);
51 guint   settings_pgp_getdisabled(const char *bjid);
52 void    settings_pgp_setforce(const char *bjid, guint value);
53 guint   settings_pgp_getforce(const char *bjid);
54 void    settings_pgp_setkeyid(const char *bjid, const char *keyid);
55 const char *settings_pgp_getkeyid(const char *bjid);
56 
57 #ifdef HAVE_LIBOTR
58 guint   settings_otr_getpolicy(const char *bjid);
59 void    settings_otr_setpolicy(const char *bjid, guint value);
60 #endif
61 
62 guint get_max_history_blocks(void);
63 
64 char *default_muc_nickname(const char *roomid);
65 
66 const gchar *isbound(int key);
67 
68 #endif /* __MCABBER_SETTINGS_H__ */
69 
70 /* vim: set et cindent cinoptions=>2\:2(0 ts=2 sw=2:  For Vim users... */
71