4 * Manage user preferences with a little help from the Citadel server.
12 HashList *PreferenceHooks;
13 extern HashList *HandlerHash;
15 typedef struct _PrefDef {
23 typedef struct _Preference {
33 void DestroyPrefDef(void *vPrefDef)
35 PrefDef *Prefdef = (PrefDef*) vPrefDef;
36 FreeStrBuf(&Prefdef->Setting);
37 FreeStrBuf(&Prefdef->OnLoadName);
41 void DestroyPreference(void *vPref)
43 Preference *Pref = (Preference*) vPref;
44 FreeStrBuf(&Pref->Key);
45 FreeStrBuf(&Pref->Val);
46 FreeStrBuf(&Pref->DeQPed);
50 void _RegisterPreference(const char *Setting, long SettingLen,
54 const char *OnLoadName)
56 PrefDef *Newpref = (PrefDef*) malloc(sizeof(PrefDef));
57 Newpref->Setting = NewStrBufPlain(Setting, SettingLen);
58 Newpref->PrefStr = PrefStr;
60 Newpref->OnLoad = OnLoad;
61 if (Newpref->OnLoad != NULL) {
62 Newpref->OnLoadName = NewStrBufPlain(OnLoadName, -1);
65 Newpref->OnLoadName = NULL;
66 Put(PreferenceHooks, Setting, SettingLen, Newpref, DestroyPrefDef);
69 const char *PrefGetLocalStr(const char *Setting, long len)
72 if (GetHash(PreferenceHooks, Setting, len, &hash_value) != 0) {
73 PrefDef *Newpref = (PrefDef*) hash_value;
74 return _(Newpref->PrefStr);
81 inline const char *PrintPref(void *vPref)
83 Preference *Pref = (Preference*) vPref;
84 if (Pref->DeQPed != NULL)
85 return ChrPtr(Pref->DeQPed);
87 return ChrPtr(Pref->Val);
91 void GetPrefTypes(HashList *List)
101 It = GetNewHashPos(List, 0);
102 while (GetNextHashPos(List, It, &len, &Key, &vSetting))
104 Pref = (Preference*) vSetting;
105 if (GetHash(PreferenceHooks, SKEY(Pref->Key), &vPrefDef) &&
108 PrefType = (PrefDef*) vPrefDef;
109 Pref->Type = PrefType;
111 lprintf(1, "Loading [%s]with type [%ld] [\"%s\"]\n",
116 switch (Pref->Type->Type)
122 Pref->lval = StrTol(Pref->Val);
126 Pref->DeQPed = NewStrBufPlain(NULL, StrLength(Pref->Val));
127 StrBufEUid_unescapize(Pref->DeQPed, Pref->Val);
131 Pref->lval = strcmp(ChrPtr(Pref->Val), "yes") == 0;
136 if (PrefType->OnLoad != NULL){
138 lprintf(1, "Loading with: -> %s(\"%s\", %ld)\n",
139 ChrPtr(PrefType->OnLoadName),
142 PrefType->OnLoad(Pref->Val, Pref->lval);
149 void ParsePref(HashList **List, StrBuf *ReadBuf)
152 Preference *Data = NULL;
153 Preference *LastData = NULL;
156 StrBuf_ServGetln(ReadBuf);
157 if ( (StrLength(ReadBuf)==3) &&
158 !strcmp(ChrPtr(ReadBuf), "000")) {
163 if ((ChrPtr(ReadBuf)[0] == ' ') &&
164 (LastData != NULL)) {
165 StrBufAppendBuf(LastData->Val, ReadBuf, 1);
168 LastData = Data = malloc(sizeof(Preference));
169 memset(Data, 0, sizeof(Preference));
170 Data->Key = NewStrBuf();
171 Data->Val = NewStrBuf();
172 StrBufExtract_token(Data->Key, ReadBuf, 0, '|');
173 StrBufExtract_token(Data->Val, ReadBuf, 1, '|');
174 if (!IsEmptyStr(ChrPtr(Data->Key)))
184 lprintf(1, "ignoring spurious preference line: [%s]\n",
186 DestroyPreference(Data);
197 * display preferences dialog
199 void load_preferences(void)
207 memset(&Room, 0, sizeof(folder));
208 ReadBuf = NewStrBufPlain(NULL, SIZ * 4);
209 if (goto_config_room(ReadBuf, &Room) != 0) {
210 FreeStrBuf(&ReadBuf);
213 return; /* oh well. */
216 serv_puts("MSGS ALL|0|1");
217 StrBuf_ServGetln(ReadBuf);
218 if (GetServerStatus(ReadBuf, NULL) == 8) {
219 serv_puts("subj|__ WebCit Preferences __");
223 StrBuf_ServGetln(ReadBuf)) {
224 if ( (StrLength(ReadBuf)==3) &&
225 !strcmp(ChrPtr(ReadBuf), "000")) {
229 msgnum = StrTol(ReadBuf);
233 serv_printf("MSG0 %ld", msgnum);
234 StrBuf_ServGetln(ReadBuf);
235 if (GetServerStatus(ReadBuf, NULL) == 1) {
236 while (StrBuf_ServGetln(ReadBuf),
237 (strcmp(ChrPtr(ReadBuf), "text") &&
238 strcmp(ChrPtr(ReadBuf), "000"))) {
240 if (!strcmp(ChrPtr(ReadBuf), "text")) {
241 ParsePref(&WCC->hash_prefs, ReadBuf);
246 /* Go back to the room we're supposed to be in */
247 if (StrLength(WCC->CurRoom.name) > 0) {
248 serv_printf("GOTO %s", ChrPtr(WCC->CurRoom.name));
249 StrBuf_ServGetln(ReadBuf);
250 GetServerStatus(ReadBuf, NULL);
252 FreeStrBuf(&ReadBuf);
257 * Goto the user's configuration room, creating it if necessary.
258 * returns 0 on success or nonzero upon failure.
260 int goto_config_room(StrBuf *Buf, folder *Room)
262 serv_printf("GOTO %s", USERCONFIGROOM);
263 StrBuf_ServGetln(Buf);
264 if (GetServerStatus(Buf, NULL) != 2) { /* try to create the config room if not there */
265 serv_printf("CRE8 1|%s|4|0", USERCONFIGROOM);
266 StrBuf_ServGetln(Buf);
267 GetServerStatus(Buf, NULL);
269 serv_printf("GOTO %s", USERCONFIGROOM);
270 StrBuf_ServGetln(Buf);
271 if (GetServerStatus(Buf, NULL) != 2) {
275 ParseGoto(Room, Buf);
279 void WritePrefsToServer(HashList *Hash)
287 StrBuf *SubBuf = NULL;
289 Hash = WCC->hash_prefs;
290 #ifdef DBG_PREFS_HASH
291 dbg_PrintHash(Hash, PrintPref, NULL);
293 HashPos = GetNewHashPos(Hash, 0);
294 while (GetNextHashPos(Hash, HashPos, &len, &Key, &vPref)!=0)
299 Pref = (Preference*) vPref;
300 nchars = StrLength(Pref->Val);
303 size_t offset, nchars;
305 SubBuf = NewStrBufPlain(NULL, SIZ);
314 nchars = StrBufSub(SubBuf, Pref->Val, offset, nchars);
317 serv_printf("%s|%s", ChrPtr(Pref->Key), ChrPtr(SubBuf));
319 serv_printf(" %s", ChrPtr(SubBuf));
322 nchars = StrLength(Pref->Val) - offset;
328 serv_printf("%s|%s", ChrPtr(Pref->Key), ChrPtr(Pref->Val));
332 DeleteHashPos(&HashPos);
336 * \brief save the modifications
338 void save_preferences(void)
346 ReadBuf = NewStrBuf();
347 memset(&Room, 0, sizeof(folder));
348 if (goto_config_room(ReadBuf, &Room) != 0) {
349 FreeStrBuf(&ReadBuf);
352 return; /* oh well. */
355 /* make shure the config room has the right type, else it might reject our config */
356 if (Room.view != VIEW_BBS) {
357 serv_printf("VIEW %d", VIEW_BBS);
358 StrBuf_ServGetln(ReadBuf);
359 if (GetServerStatus(ReadBuf, NULL) != 2) {
362 else if (goto_config_room(ReadBuf, &Room) != 0) {
363 FreeStrBuf(&ReadBuf);
366 return; /* oh well. */
370 serv_puts("MSGS ALL|0|1");
371 StrBuf_ServGetln(ReadBuf);
372 if (GetServerStatus(ReadBuf, NULL) == 8) {
373 serv_puts("subj|__ WebCit Preferences __");
377 StrBuf_ServGetln(ReadBuf)) {
378 if ( (StrLength(ReadBuf)==3) &&
379 !strcmp(ChrPtr(ReadBuf), "000")) {
383 msgnum = StrTol(ReadBuf);
387 serv_printf("DELE %ld", msgnum);
388 StrBuf_ServGetln(ReadBuf);
389 GetServerStatus(ReadBuf, NULL);
392 serv_printf("ENT0 1||0|1|__ WebCit Preferences __|");
393 StrBuf_ServGetln(ReadBuf);
394 if (GetServerStatus(ReadBuf, NULL) == 4) {
396 WritePrefsToServer(WCC->hash_prefs);
401 /** Go back to the room we're supposed to be in */
402 if (StrLength(WCC->CurRoom.name) > 0) {
403 serv_printf("GOTO %s", ChrPtr(WCC->CurRoom.name));
404 StrBuf_ServGetln(ReadBuf);
405 GetServerStatus(ReadBuf, NULL);
407 FreeStrBuf(&ReadBuf);
412 * \brief query the actual setting of key in the citadel database
413 * \param key config key to query
414 * \param keylen length of the key string
415 * \param value StrBuf-value to the key to get
418 int get_pref_backend(const char *key, size_t keylen, Preference **Pref)
420 void *hash_value = NULL;
421 #ifdef DBG_PREFS_HASH
422 dbg_PrintHash(WC->hash_prefs, PrintPref, NULL);
424 if (GetHash(WC->hash_prefs, key, keylen, &hash_value) == 0) {
429 *Pref = (Preference*) hash_value;
434 int get_PREFERENCE(const char *key, size_t keylen, StrBuf **value)
439 Ret = get_pref_backend(key, keylen, &Pref);
448 * \brief Write a key into the webcit preferences database for this user
450 * \params key key whichs value is to be modified
451 * \param keylen length of the key string
452 * \param value value to set
453 * \param save_to_server 1 = flush all data to the server, 0 = cache it for now
455 void set_preference_backend(const char *key, size_t keylen,
466 Pref = (Preference*) malloc(sizeof(Preference));
467 memset(Pref, 0, sizeof(Preference));
468 Pref->Key = NewStrBufPlain(key, keylen);
470 if ((PrefType == NULL) &&
471 GetHash(PreferenceHooks, SKEY(Pref->Key), &vPrefDef) &&
473 PrefType = (PrefDef*) vPrefDef;
475 if (PrefType != NULL)
477 Pref->Type = PrefType;
478 if (Pref->Type->Type != lPrefType)
479 lprintf(1, "warning: saving preference with wrong type [%s] %ld != %ld \n",
480 key, Pref->Type->Type, lPrefType);
481 switch (Pref->Type->Type)
490 if (Pref->Val == NULL)
491 Pref->Val = NewStrBufPlain(NULL, 64);
492 StrBufPrintf(Pref->Val, "%ld", lvalue);
496 Pref->DeQPed = value;
497 Pref->Val = NewStrBufPlain(NULL, StrLength(Pref->DeQPed) * 3);
498 StrBufEUid_escapize(Pref->Val, Pref->DeQPed);
504 Pref->Val = NewStrBufPlain(HKEY("yes"));
506 Pref->Val = NewStrBufPlain(HKEY("no"));
510 if (Pref->Type->OnLoad != NULL)
511 Pref->Type->OnLoad(Pref->Val, Pref->lval);
523 if (Pref->Val == NULL)
524 Pref->Val = NewStrBufPlain(NULL, 64);
525 StrBufPrintf(Pref->Val, "%ld", lvalue);
529 Pref->DeQPed = value;
530 Pref->Val = NewStrBufPlain(NULL, StrLength(Pref->DeQPed) * 3);
531 StrBufEUid_escapize(Pref->Val, Pref->DeQPed);
537 Pref->Val = NewStrBufPlain(HKEY("yes"));
539 Pref->Val = NewStrBufPlain(HKEY("no"));
544 Put(WCC->hash_prefs, key, keylen, Pref, DestroyPreference);
546 if (save_to_server) WCC->SavePrefsToServer = 1;
549 void set_PREFERENCE(const char *key, size_t keylen, StrBuf *value, int save_to_server)
551 set_preference_backend(key, keylen, 0, value, PRF_STRING, save_to_server, NULL);
554 int get_PREF_LONG(const char *key, size_t keylen, long *value, long Default)
559 Ret = get_pref_backend(key, keylen, &Pref);
568 *value = Pref->lval = atol(ChrPtr(Pref->Val));
575 void set_PREF_LONG(const char *key, size_t keylen, long value, int save_to_server)
577 set_preference_backend(key, keylen, value, NULL, PRF_INT, save_to_server, NULL);
580 int get_PREF_YESNO(const char *key, size_t keylen, int *value, int Default)
585 Ret = get_pref_backend(key, keylen, &Pref);
594 *value = Pref->lval = strcmp(ChrPtr(Pref->Val), "yes") == 0;
600 void set_PREF_YESNO(const char *key, size_t keylen, long value, int save_to_server)
602 set_preference_backend(key, keylen, value, NULL, PRF_YESNO, save_to_server, NULL);
605 int get_room_prefs_backend(const char *key, size_t keylen,
611 pref_name = NewStrBufPlain (HKEY("ROOM:"));
612 StrBufAppendBuf(pref_name, WC->CurRoom.name, 0);
613 StrBufAppendBufPlain(pref_name, HKEY(":"), 0);
614 StrBufAppendBufPlain(pref_name, key, keylen, 0);
615 Ret = get_pref_backend(SKEY(pref_name), Pref);
616 FreeStrBuf(&pref_name);
621 const StrBuf *get_X_PREFS(const char *key, size_t keylen,
622 const char *xkey, size_t xkeylen)
628 pref_name = NewStrBufPlain (HKEY("XPREF:"));
629 StrBufAppendBufPlain(pref_name, xkey, xkeylen, 0);
630 StrBufAppendBufPlain(pref_name, HKEY(":"), 0);
631 StrBufAppendBufPlain(pref_name, key, keylen, 0);
633 ret = get_pref_backend(SKEY(pref_name), &Prf);
634 FreeStrBuf(&pref_name);
641 void set_X_PREFS(const char *key, size_t keylen, const char *xkey, size_t xkeylen, StrBuf *value, int save_to_server)
645 pref_name = NewStrBufPlain (HKEY("XPREF:"));
646 StrBufAppendBufPlain(pref_name, xkey, xkeylen, 0);
647 StrBufAppendBufPlain(pref_name, HKEY(":"), 0);
648 StrBufAppendBufPlain(pref_name, key, keylen, 0);
650 set_preference_backend(SKEY(pref_name), 0, value, PRF_STRING, save_to_server, NULL);
651 FreeStrBuf(&pref_name);
655 long get_ROOM_PREFS_LONG(const char *key, size_t keylen, long *value, long Default)
660 Ret = get_room_prefs_backend(key, keylen, &Pref);
670 *value = Pref->lval = atol(ChrPtr(Pref->Val));
677 StrBuf *get_ROOM_PREFS(const char *key, size_t keylen)
682 Ret = get_room_prefs_backend(key, keylen, &Pref);
691 void set_ROOM_PREFS(const char *key, size_t keylen, StrBuf *value, int save_to_server)
695 pref_name = NewStrBufPlain (HKEY("ROOM:"));
696 StrBufAppendBuf(pref_name, WC->CurRoom.name, 0);
697 StrBufAppendBufPlain(pref_name, HKEY(":"), 0);
698 StrBufAppendBufPlain(pref_name, key, keylen, 0);
699 set_preference_backend(SKEY(pref_name), 0, value, PRF_STRING, save_to_server, NULL);
700 FreeStrBuf(&pref_name);
704 void GetPreferences(HashList *Setting)
716 Tmp = WCC->hash_prefs;
717 WCC->hash_prefs = Setting;
719 It = GetNewHashPos(PreferenceHooks, 0);
720 while (GetNextHashPos(PreferenceHooks, It, &len, &Key, &vSetting)) {
721 PrefType = (PrefDef*) vSetting;
723 if (!HaveBstr(SKEY(PrefType->Setting)))
725 switch (PrefType->Type) {
727 Buf = NewStrBufDup(SBstr(SKEY(PrefType->Setting)));
728 set_preference_backend(SKEY(PrefType->Setting),
736 lval = LBstr(SKEY(PrefType->Setting));
737 set_preference_backend(SKEY(PrefType->Setting),
745 Buf = NewStrBufDup(SBstr(SKEY(PrefType->Setting)));
746 set_preference_backend(SKEY(PrefType->Setting),
754 lval = YesBstr(SKEY(PrefType->Setting));
755 set_preference_backend(SKEY(PrefType->Setting),
764 WCC->hash_prefs = Tmp;
770 * \brief Commit new preferences and settings
772 void set_preferences(void)
774 if (!havebstr("change_button")) {
775 safestrncpy(WC->ImportantMessage,
776 _("Cancelled. No settings were changed."),
777 sizeof WC->ImportantMessage);
781 GetPreferences(WC->hash_prefs);
786 void tmplput_CFG_Value(StrBuf *Target, WCTemplputParams *TP)
789 if (get_pref_backend(TKEY(0), &Pref))
791 if (Pref->Type == NULL) {
792 StrBufAppendTemplate(Target, TP, Pref->Val, 1);
794 switch (Pref->Type->Type)
797 StrBufAppendTemplate(Target, TP, Pref->Val, 1);
800 if (Pref->decoded != 1) {
801 if (Pref->Val == NULL)
802 Pref->Val = NewStrBufPlain(NULL, 64);
803 StrBufPrintf(Pref->Val, "%ld", Pref->lval);
806 StrBufAppendTemplate(Target, TP, Pref->Val, 1);
809 if (Pref->decoded != 1) {
810 if (Pref->DeQPed == NULL)
811 Pref->DeQPed = NewStrBufPlain(NULL, StrLength(Pref->Val));
813 StrBufEUid_unescapize(Pref->DeQPed, Pref->Val);
816 StrBufAppendTemplate(Target, TP, Pref->DeQPed, 1);
819 if (Pref->decoded != 1) {
820 Pref->lval = strcmp(ChrPtr(Pref->Val), "yes") == 0;
823 StrBufAppendTemplate(Target, TP, Pref->Val, 1);
829 void tmplput_CFG_Descr(StrBuf *Target, WCTemplputParams *TP)
831 const char *SettingStr;
832 SettingStr = PrefGetLocalStr(TKEY(0));
833 if (SettingStr != NULL)
834 StrBufAppendBufPlain(Target, SettingStr, -1, 0);
836 void tmplput_CFG_RoomValueLong(StrBuf *Target, WCTemplputParams *TP)
842 defval = GetTemplateTokenNumber(Target, TP, 1, 0);
843 get_ROOM_PREFS_LONG(TKEY(0), &lvalue, defval);
844 StrBufAppendPrintf(Target, "%ld", lvalue);
846 void tmplput_CFG_RoomValue(StrBuf *Target, WCTemplputParams *TP)
848 StrBuf *pref = get_ROOM_PREFS(TKEY(0));
850 StrBufAppendBuf(Target, pref, 0);
852 int ConditionalHasRoomPreference(StrBuf *Target, WCTemplputParams *TP)
854 if (get_ROOM_PREFS(TP->Tokens->Params[0]->Start,
855 TP->Tokens->Params[0]->len) != NULL)
861 int ConditionalPreference(StrBuf *Target, WCTemplputParams *TP)
865 if (!get_PREFERENCE(TKEY(2), &Pref))
868 if (!HAVE_PARAM(3)) {
871 else if (TP->Tokens->Params[3]->Type == TYPE_STR)
872 return ((TP->Tokens->Params[3]->len == StrLength(Pref)) &&
873 (strcmp(TP->Tokens->Params[3]->Start, ChrPtr(Pref)) == 0));
875 return (StrTol(Pref) == TP->Tokens->Params[3]->lvalue);
878 int ConditionalHasPreference(StrBuf *Target, WCTemplputParams *TP)
882 if (!get_PREFERENCE(TKEY(2), &Pref) ||
890 /********************************************************************************
891 * preferences stored discrete in citserver
892 ********************************************************************************/
893 HashList *GetGVEAHash(StrBuf *Target, WCTemplputParams *TP)
896 HashList *List = NULL;
903 StrBuf_ServGetln(Rcp);
904 if (GetServerStatus(Rcp, NULL) == 1) {
906 List = NewHash(1, NULL);
907 while (!Done && (StrBuf_ServGetln(Rcp)>=0)) {
908 if ( (StrLength(Rcp)==3) &&
909 !strcmp(ChrPtr(Rcp), "000"))
914 i = snprintf(N, sizeof(N), "%d", n);
916 Put(List, N, i, Rcp, HFreeStrBuf);
925 void DeleteGVEAHash(HashList **KillMe)
930 HashList *GetGVSNHash(StrBuf *Target, WCTemplputParams *TP)
933 HashList *List = NULL;
940 StrBuf_ServGetln(Rcp);
941 if (GetServerStatus(Rcp, NULL) == 1) {
943 List = NewHash(1, NULL);
944 while (!Done && (StrBuf_ServGetln(Rcp)>=0)) {
945 if ( (StrLength(Rcp)==3) &&
946 !strcmp(ChrPtr(Rcp), "000"))
951 i = snprintf(N, sizeof(N), "%d", n);
953 Put(List, N, i, Rcp, HFreeStrBuf);
962 void DeleteGVSNHash(HashList **KillMe)
971 * Offer to make any page the user's "start page."
973 void offer_start_page(StrBuf *Target, WCTemplputParams *TP)
975 wc_printf("<a href=\"change_start_page?startpage=");
976 urlescputs(ChrPtr(WC->Hdr->this_page));
978 wc_printf(_("Make this my start page"));
984 * Change the user's start page
986 void change_start_page(void)
991 int ProhibitSave = 0;
992 const StrBuf *pStartPage = sbstr("startpage");
994 if (pStartPage != NULL) {
995 pch = strchr(ChrPtr(pStartPage), '?');
997 if ((pch != NULL) && (
998 GetHash(HandlerHash, ChrPtr(pStartPage), pch - ChrPtr(pStartPage), &vHandler),
999 (vHandler != NULL) &&
1000 ((((WebcitHandler*)vHandler)->Flags & PROHIBIT_STARTPAGE) != 0)))
1001 { /* OK, This handler doesn't want to be set as start page, prune it. */
1006 if ((pStartPage == NULL) ||
1007 (ProhibitSave == 1))
1009 set_preference_backend(HKEY("startpage"),
1011 NewStrBufPlain(HKEY("")),
1015 if (ProhibitSave == 1)
1016 StrBufAppendBufPlain(WCC->ImportantMsg,
1017 _("This isn't allowed to become the start page."),
1020 StrBufAppendBufPlain(WCC->ImportantMsg,
1021 _("You no longer have a start page selected."),
1023 display_main_menu();
1029 set_preference_backend(HKEY("startpage"),
1031 NewStrBufDup(pStartPage),
1036 output_headers(1, 1, 0, 0, 0, 0);
1037 do_template("newstartpage", NULL);
1042 void LoadStartpage(StrBuf *URL, long lvalue)
1046 pch = strchr(ChrPtr(URL), '?');
1048 /* purge the sins of the past... */
1049 pch = strchr(ChrPtr(URL), '&');
1051 StrBufPeek(URL, pch, -1, '?');
1052 WC->SavePrefsToServer = 1;
1055 else if (GetHash(HandlerHash, ChrPtr(URL), pch - ChrPtr(URL), &vHandler),
1056 (vHandler != NULL) &&
1057 ((((WebcitHandler*)vHandler)->Flags & PROHIBIT_STARTPAGE) != 0))
1058 { /* OK, This handler doesn't want to be set as start page, prune it. */
1060 WC->SavePrefsToServer = 1;
1066 InitModule_PREFERENCES
1069 WebcitAddUrlHandler(HKEY("set_preferences"), "", 0, set_preferences, 0);
1070 WebcitAddUrlHandler(HKEY("change_start_page"), "", 0, change_start_page, 0);
1072 RegisterPreference("startpage", _("Prefered startpage"), PRF_STRING, LoadStartpage);
1074 RegisterNamespace("OFFERSTARTPAGE", 0, 0, offer_start_page, NULL, CTX_NONE);
1075 RegisterNamespace("PREF:ROOM:VALUE", 1, 2, tmplput_CFG_RoomValue, NULL, CTX_NONE);
1076 RegisterNamespace("PREF:ROOM:VALUE:INT", 1, 2, tmplput_CFG_RoomValueLong, NULL, CTX_NONE);
1077 RegisterNamespace("PREF:VALUE", 1, 2, tmplput_CFG_Value, NULL, CTX_NONE);
1079 RegisterNamespace("PREF:DESCR", 1, 1, tmplput_CFG_Descr, NULL, CTX_NONE);
1081 RegisterConditional(HKEY("COND:PREF"), 4, ConditionalPreference, CTX_NONE);
1082 RegisterConditional(HKEY("COND:PREF:SET"), 4, ConditionalHasPreference, CTX_NONE);
1083 RegisterConditional(HKEY("COND:ROOM:SET"), 4, ConditionalHasRoomPreference, CTX_NONE);
1085 RegisterIterator("PREF:VALID:EMAIL:ADDR", 0, NULL,
1086 GetGVEAHash, NULL, DeleteGVEAHash, CTX_STRBUF, CTX_NONE, IT_NOFLAG);
1087 RegisterIterator("PREF:VALID:EMAIL:NAME", 0, NULL,
1088 GetGVSNHash, NULL, DeleteGVSNHash, CTX_STRBUF, CTX_NONE, IT_NOFLAG);
1094 ServerStartModule_PREFERENCES
1097 PreferenceHooks = NewHash(1, NULL);
1103 ServerShutdownModule_PREFERENCES
1106 DeleteHash(&PreferenceHooks);
1110 SessionDetachModule__PREFERENCES
1113 if (sess->SavePrefsToServer) {
1115 sess->SavePrefsToServer = 0;
1120 SessionNewModule_PREFERENCES
1123 sess->hash_prefs = NewHash(1,NULL);
1127 SessionDestroyModule_PREFERENCES
1130 DeleteHash(&sess->hash_prefs);