X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fsiteconfig.c;h=4038bd03fd0a02cdd61a241cd8dce0ef642a7612;hb=9045713bf3089e4b6d2c9719580f011adf4d6f97;hp=de631b4400c3cc72abce7e6bd232e6f01ddbb937;hpb=43949548bb3f69a7e3baf419323d95f6a293c412;p=citadel.git diff --git a/webcit/siteconfig.c b/webcit/siteconfig.c index de631b440..4038bd03f 100644 --- a/webcit/siteconfig.c +++ b/webcit/siteconfig.c @@ -35,8 +35,7 @@ void LoadExpirePolicy(GPEXWhichPolicy which) WCC->Policy[which].expire_value = StrBufExtractNext_long(Buf, &Pos, '|'); } else if (State == 550) - StrBufAppendBufPlain(WCC->ImportantMsg, - _("Higher access is required to access this function."), -1, 0); + AppendImportantMessage(_("Higher access is required to access this function."), -1); FreeStrBuf(&Buf); } @@ -54,8 +53,7 @@ void SaveExpirePolicyFromHTTP(GPEXWhichPolicy which) StrBuf_ServGetln(Buf); GetServerStatus(Buf, &State); if (State == 550) - StrBufAppendBufPlain(WC->ImportantMsg, - _("Higher access is required to access this function."), -1, 0); + AppendImportantMessage(_("Higher access is required to access this function."), -1); FreeStrBuf(&Buf); } @@ -109,7 +107,7 @@ void LoadZoneFiles(void) Put(ZoneHash, HKEY("UTC"), ZName, HFreeStrBuf); zones = icaltimezone_get_builtin_timezones(); for (z = 0; z < zones->num_elements; ++z) { - /* lprintf(9, "Location: %-40s tzid: %s\n", + /* syslog(9, "Location: %-40s tzid: %s\n", icaltimezone_get_location(icalarray_element_at(zones, z)), icaltimezone_get_tzid(icalarray_element_at(zones, z)) ); */ @@ -199,7 +197,8 @@ CfgMapping ServerConfig[] = { {CFG_STR, HKEY("c_xmpp_s2s_port")}, {CFG_STR, HKEY("c_pop3_fetch")}, {CFG_STR, HKEY("c_pop3_fastest")}, - {CFG_YES , HKEY("c_spam_flag_only")} + {CFG_YES , HKEY("c_spam_flag_only")}, + {CFG_YES , HKEY("c_guest_logins")} }; @@ -225,14 +224,15 @@ void load_siteconfig(void) if (GetServerStatus(Buf, NULL) != 1) { StrBufCutLeft(Buf, 4); AppendImportantMessage(SKEY(Buf)); + FreeStrBuf(&Buf); return; } i = 0; while (len = StrBuf_ServGetln(Buf), + (len >= 0) && (i <= (sizeof(ServerConfig) / sizeof(CfgMapping))) && - ((len != 3) || (strcmp(ChrPtr(Buf), "000")!= 0)) - ) + ((len != 3) || strcmp(ChrPtr(Buf), "000"))) { Put(Cfg, ServerConfig[i].Key, @@ -251,6 +251,7 @@ void load_siteconfig(void) while ((len = StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000"))) {} AppendImportantMessage(_("WARNING: Failed to parse Server Config; do you run a to new citserver?"), -1); + FreeStrBuf(&Buf); return; } FreeStrBuf(&Buf); @@ -268,20 +269,23 @@ void siteconfig(void) { wcsession *WCC = WC; int i; - char buf[256]; + StrBuf *Line; if (strlen(bstr("ok_button")) == 0) { display_aide_menu(); return; } + Line = NewStrBuf(); serv_printf("CONF set"); - serv_getln(buf, sizeof buf); - if (buf[0] != '4') { - safestrncpy(WCC->ImportantMessage, &buf[4], sizeof WCC->ImportantMessage); + StrBuf_ServGetln(Line); + if (GetServerStatusMsg(Line, NULL, 1, 4) != 4) { display_aide_menu(); + FreeStrBuf(&Line); return; } + FreeStrBuf(&Line); + for (i=0; i < (sizeof(ServerConfig) / sizeof(CfgMapping)); i ++) { switch (ServerConfig[i].type) { @@ -309,8 +313,7 @@ void siteconfig(void) FreeStrBuf(&WCC->serv_info->serv_default_cal_zone); WCC->serv_info->serv_default_cal_zone = NewStrBufDup(sbstr("c_default_cal_zone")); - safestrncpy(WCC->ImportantMessage, _("Your system configuration has been updated."), - sizeof WCC->ImportantMessage); + AppendImportantMessage(_("Your system configuration has been updated."), -1); DeleteHash(&WCC->ServCfg); display_aide_menu(); }