/*
- * $Id$
- *
* Functions which handle Internet domain configuration etc.
*/
ic_localhost,
ic_directory,
ic_smarthost,
+ ic_fallback,
ic_rbl,
ic_spamass,
ic_masq,
ic_max
} ECfg;
-typedef struct _ConstStrBuf {
- const char *name;
- size_t len;
-} ConstStrBuf;
-
/* These are server config keywords; do not localize! */
-ConstStrBuf CfgNames[] = {
+ConstStr CfgNames[] = {
{ HKEY("localhost") },
{ HKEY("directory") },
{ HKEY("smarthost") },
+ { HKEY("fallbackhost") },
{ HKEY("rbl") },
{ HKEY("spamassassin") },
{ HKEY("masqdomain") },
WCC->InetCfg = NewHash(1, NULL);
- for (i = 0; i < (sizeof(CfgNames) / sizeof(ConstStrBuf)); i++) {
+ for (i = 0; i < (sizeof(CfgNames) / sizeof(ConstStr)); i++) {
Hash = NewHash(1, NULL);
- Put(WCC->InetCfg, CfgNames[i].name, CfgNames[i].len, Hash, HDeleteHash);
+ Put(WCC->InetCfg, CKEY(CfgNames[i]), Hash, HDeleteHash);
}
serv_printf("CONF GETSYS|application/x-citadel-internet-config");
serv_printf("CONF PUTSYS|application/x-citadel-internet-config");
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, NULL) == 4) {
- for (i = 0; i < (sizeof(CfgNames) / sizeof(ConstStrBuf)); i++) {
+ for (i = 0; i < (sizeof(CfgNames) / sizeof(ConstStr)); i++) {
HashPos *where;
const char *Key;
long KeyLen;
- GetHash(WCC->InetCfg, CfgNames[i].name, CfgNames[i].len, &vHash);
+ GetHash(WCC->InetCfg, CKEY(CfgNames[i]), &vHash);
Hash = (HashList*) vHash;
if (Hash == NULL) {
sprintf(WC->ImportantMessage, _("Invalid Parameter"));
if ((Str!= NULL) && (StrLength(Str) > 0))
serv_printf("%s|%s",
ChrPtr(Str),
- CfgNames[i].name);
+ CfgNames[i].Key);
}
DeleteHashPos(&where);
}
url_do_template();
}
-void InetCfgSubst(StrBuf *TemplBuffer, WCTemplputParams *TP)
-{
- SVPutBuf("SERVCFG:INET:HOSTNAME", CTX, 1);
-}
-
void DeleteInetConfHash(StrBuf *Target, WCTemplputParams *TP)
{
wcsession *WCC = WC;
if (WCC->InetCfg == NULL)
load_inetconf();
GetHash(WCC->InetCfg, TKEY(5), &vHash);
- svprintf(HKEY("SERVCFG:INET:TYPE"), WCS_STRING, TP->Tokens->Params[5]->Start);
+ PutBstr(HKEY("__SERVCFG:INET:TYPE"), NewStrBufPlain(TKEY(5)));
return vHash;
}
InitModule_INETCONF
(void)
{
- WebcitAddUrlHandler(HKEY("save_inetconf"), new_save_inetconf, 0);
- RegisterIterator("SERVCFG:INET", 1, NULL, GetInetConfHash, InetCfgSubst, NULL, CTX_INETCFG, CTX_NONE, IT_NOFLAG);
- RegisterNamespace("SERVCFG:FLUSHINETCFG",0, 0, DeleteInetConfHash, CTX_NONE);
+ WebcitAddUrlHandler(HKEY("save_inetconf"), "", 0, new_save_inetconf, 0);
+ RegisterIterator("SERVCFG:INET", 1, NULL, GetInetConfHash, NULL, NULL, CTX_STRBUF, CTX_NONE, IT_NOFLAG);
+ RegisterNamespace("SERVCFG:FLUSHINETCFG",0, 0, DeleteInetConfHash, NULL, CTX_NONE);
}