Bring in new dkim code
[citadel.git] / webcit / preferences.h
index 779ad3c2a9dec6773b678bef78d90712ea3fa694..7a30a7bbde56a33d5aee5088b0775594ebc881ef 100644 (file)
@@ -1,18 +1,34 @@
+/*
+ * Copyright (c) 1996-2013 by the citadel.org team
+ *
+ * This program is open source software.  You can redistribute it and/or
+ * modify it under the terms of the GNU General Public License, version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 
 
-#define PRF_STRING 1
-#define PRF_INT 2
-#define PRF_QP_STRING 3
-#define PRF_YESNO 4
-
+typedef enum _ePrefType{
+       PRF_UNSET = 0,
+       PRF_STRING = 1,
+       PRF_INT = 2,
+       PRF_QP_STRING = 3,
+       PRF_YESNO = 4
+} ePrefType;
 
 
 typedef void (*PrefEvalFunc)(StrBuf *Preference, long lvalue); 
-void RegisterPreference(const char *Setting, long SettingLen, 
-                       const char *PrefStr, 
-                       long Type, 
-                       PrefEvalFunc OnLoad);
 
+void _RegisterPreference(const char *Setting, long SettingLen, 
+                        const char *PrefStr, 
+                        ePrefType Type, 
+                        PrefEvalFunc OnLoad, 
+                        const char *OnLoadName);
+
+#define RegisterPreference(a, b, c, d) _RegisterPreference(a, sizeof(a) -1, b, c, d, #d)
 
 void load_preferences(void);
 void save_preferences(void);
@@ -38,3 +54,15 @@ StrBuf *get_ROOM_PREFS(const char *key, size_t keylen);
 
 #define set_room_pref(a, b, c) set_ROOM_PREFS(a, sizeof(a) - 1, b, c)
 void set_ROOM_PREFS(const char *key, size_t keylen, StrBuf *value, int save_to_server);
+#define get_room_pref_long(a, b, c) get_ROOM_PREFS_LONG(a, sizeof(a) - 1, b, c)
+long get_ROOM_PREFS_LONG(const char *key, size_t keylen, long *value, long Default);
+
+
+#define get_x_pref(a, b) get_ROOM_PREFS(a, sizeof(a) - 1, b, sizeof(b) - 1)
+const StrBuf *get_X_PREFS(const char *key, size_t keylen, 
+                         const char *xkey, size_t xkeylen);
+
+#define set_x_pref(a, b, c) set_ROOM_PREFS(a, sizeof(a) - 1, b, sizeof(b) - 1, c, d)
+void set_X_PREFS(const char *key, size_t keylen, const char *xkey, size_t xkeylen, StrBuf *value, int save_to_server);
+
+int goto_config_room(StrBuf *Buf, folder *room);