X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fpreferences.c;h=bf416215d4b0ec25bdb34398031cf27def04825c;hb=1e4d0c96c1b661d89785653729ecfc500359ad20;hp=437287b767e066536ad89d3a970676a9b38519af;hpb=0cb097cb436138481a62845f45118ee7979ae75d;p=citadel.git diff --git a/webcit/preferences.c b/webcit/preferences.c index 437287b76..bf416215d 100644 --- a/webcit/preferences.c +++ b/webcit/preferences.c @@ -9,6 +9,35 @@ #include "webserver.h" #include "groupdav.h" + +HashList *PreferenceHooks; + +typedef struct _Prefs { + long Type; + const char *Setting; + const char *PrefStr; +} Prefs; + +void RegisterPreference(const char *Setting, const char *PrefStr, long Type) +{ + Prefs *Newpref = (Prefs*) malloc(sizeof(Prefs)); + Newpref->Setting = Setting; + Newpref->PrefStr = PrefStr; + Newpref->Type = Type; + Put(PreferenceHooks, Setting, strlen(Setting), Newpref, NULL); +} + +const char *PrefGetLocalStr(const char *Setting, long len) +{ + void *hash_value; + if (GetHash(PreferenceHooks, Setting, len, &hash_value) != 0) { + Prefs *Newpref = (Prefs*) hash_value; + return _(Newpref->PrefStr); + + } + return ""; +} + #ifdef DBG_PREFS_HASH inline const char *PrintPref(void *Prefstr) { @@ -354,7 +383,7 @@ void display_preferences(void) */ get_preference("roomlistview", &Buf); wprintf(""); - wprintf(_("Room list view")); + wprintf(PrefGetLocalStr(HKEY("roomlistview"))); wprintf(""); wprintf(""); - wprintf(_("Time format")); + wprintf(PrefGetLocalStr(HKEY("calhourformat"))); wprintf(""); wprintf(""); - wprintf(_("Calendar day view begins at:")); + wprintf(PrefGetLocalStr(HKEY("daystart"))); wprintf(""); wprintf("\n"); @@ -458,7 +487,7 @@ void display_preferences(void) */ get_pref_long("weekstart", &WeekStart, 17); wprintf(""); - wprintf(_("Week starts on:")); + wprintf(PrefGetLocalStr(HKEY("weekstart"))); wprintf(""); wprintf(""); @@ -507,7 +538,7 @@ void display_preferences(void) wprintf(""); - wprintf(_("Use this signature:")); + wprintf(PrefGetLocalStr(HKEY("signature"))); wprintf("
" "