]> code.citadel.org Git - citadel.git/blobdiff - webcit/inetconf.c
* add transitional beginboxx template and move some places to the new syntax
[citadel.git] / webcit / inetconf.c
index 1f234a4f8866f2b46b8823f7906d7dbb4a5d3a21..191f90e76787a6b3525f6893654446c411d90869 100644 (file)
@@ -26,6 +26,7 @@ void display_inetconf(void)
                ic_rbl,
                ic_spamass,
                ic_masq,
+               ic_clamav,
                ic_max
        };
 
@@ -42,6 +43,7 @@ void display_inetconf(void)
        ic_keyword[3] = "rbl";
        ic_keyword[4] = "spamassassin";
        ic_keyword[5] = "masqdomain";
+       ic_keyword[6] = "clamav";
 
        ic_boxtitle[0] = _("Local host aliases");
        ic_boxtitle[1] = _("Directory domains");
@@ -49,6 +51,7 @@ void display_inetconf(void)
        ic_boxtitle[3] = _("RBL hosts");
        ic_boxtitle[4] = _("SpamAssassin hosts");
        ic_boxtitle[5] = _("Masqueradable domains");
+       ic_boxtitle[6] = _("ClamAV clamd hosts");
 
        ic_desc[0] = _("(domains for which this host receives mail)");
        ic_desc[1] = _("(domains mapped with the Global Address Book)");
@@ -56,6 +59,7 @@ void display_inetconf(void)
        ic_desc[3] = _("(hosts running a Realtime Blackhole List)");
        ic_desc[4] = _("(hosts running the SpamAssassin service)");
        ic_desc[5] = _("(Domains as which users are allowed to masquerade)");
+       ic_desc[6] = _("(hosts running the ClamAV clamd service)");
 
        for (i=0; i<ic_max; ++i) {
                ic_spec[i] = strdup("");
@@ -99,14 +103,14 @@ void display_inetconf(void)
        wprintf("<div id=\"content\" class=\"service\">\n");
 
        wprintf("<div class=\"fix_scrollbar_bug\">"
-               "<table border=0 width=100%% cellspacing=\"10px\" cellpadding=\"10px\"> "
+               "<table border=0 width=100%% cellspacing=\"10\" cellpadding=\"10\"> "
                "<tr><td valign=top width=50%%>\n");
        for (which=0; which<ic_max; ++which) {
                if (which == (ic_max / 2)) {
                        wprintf("</td><td valign=top>");
                }
                svput("BOXTITLE", WCS_STRING, ic_boxtitle[which]);
-               do_template("beginbox", NULL);
+               do_template("beginboxx", NULL);
                wprintf("<span class=\"menudesc\">");
                escputs(ic_desc[which]);
                wprintf("</span><br />");
@@ -217,6 +221,7 @@ typedef enum _e_cfg {
        ic_rbl,
        ic_spamass,
        ic_masq,
+       ic_clamav,
        ic_max
 } ECfg;
 
@@ -233,7 +238,8 @@ ConstStrBuf CfgNames[] = {
        { HKEY("smarthost") },
        { HKEY("rbl") },
        { HKEY("spamassassin") },
-       { HKEY("masqdomain") }
+       { HKEY("masqdomain") },
+       { HKEY("clamav") }
 };
 
        
@@ -380,17 +386,17 @@ void InetCfgSubst(StrBuf *TemplBuffer, void *vContext, WCTemplateToken *Token)
        SVPutBuf("SERVCFG:INET:HOSTNAME", vContext, 1);
 }
 
-void DeleteInectConfHash(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context)
+void DeleteInetConfHash(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context, int ContextType)
 {
        struct wcsession *WCC = WC;
-       if (WCC->InetCfg == NULL)
-               load_inetconf();
-       DeleteHash(&WCC->InetCfg);
+
+       if (WCC->InetCfg != NULL)
+               DeleteHash(&WCC->InetCfg);
 
 }
 
 
-HashList *GetInetConfHash(WCTemplateToken *Token)
+HashList *GetInetConfHash(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context, int ContextType)
 {
        struct wcsession *WCC = WC;
        void *vHash;
@@ -398,10 +404,10 @@ HashList *GetInetConfHash(WCTemplateToken *Token)
        if (WCC->InetCfg == NULL)
                load_inetconf();
        GetHash(WCC->InetCfg, 
-               Token->Params[2]->Start, 
-               Token->Params[2]->len,
+               Tokens->Params[2]->Start, 
+               Tokens->Params[2]->len,
                &vHash);
-       svprintf(HKEY("SERVCFG:INET:TYPE"), WCS_STRING, Token->Params[2]->Start);
+       svprintf(HKEY("SERVCFG:INET:TYPE"), WCS_STRING, Tokens->Params[2]->Start);
        return vHash;
 }
 
@@ -411,6 +417,6 @@ InitModule_INETCONF
 {
        WebcitAddUrlHandler(HKEY("display_inetconf"), display_inetconf, 0);
        WebcitAddUrlHandler(HKEY("save_inetconf"), new_save_inetconf, AJAX);
-       RegisterIterator("SERVCFG:INET", 1, NULL, GetInetConfHash, InetCfgSubst, NULL);
-       RegisterNamespace("SERVCFG:FLUSHINETCFG",0, 0, DeleteInectConfHash);
+       RegisterIterator("SERVCFG:INET", 1, NULL, GetInetConfHash, InetCfgSubst, NULL, CTX_INETCFG, CTX_NONE);
+       RegisterNamespace("SERVCFG:FLUSHINETCFG",0, 0, DeleteInetConfHash, CTX_NONE);
 }