]> code.citadel.org Git - citadel.git/blobdiff - webcit/sieve.c
Migrated the sieve screens to room_banner_override. This removes the last of the...
[citadel.git] / webcit / sieve.c
index 6b7279365e5285ec1f675cfc092567ae2b7ca4a1..52d68f7574612c1340a8a47c6cb9b98fb979923c 100644 (file)
@@ -8,6 +8,8 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
+ *
+ * FIXME: add logic to exclude the webcit-generated script from the manual script selection
  */
 
 #include "webcit.h"
@@ -427,25 +429,22 @@ void create_script(void) {
 
        serv_printf("MSIV getscript|%s", bstr("script_name"));
        serv_getln(buf, sizeof buf);
-       if (buf[0] == '1') {
+       if (buf[0] == '1') {            // does script exist already?
                while (serv_getln(buf, sizeof(buf)), strcmp(buf, "000")) {
-                       /* flush */
+                                       // yes -- flush the output
                }
-               return;
        }
-       
-       serv_printf("MSIV putscript|%s", bstr("script_name"));
-       serv_getln(buf, sizeof buf);
-       if (buf[0] == '4') {
-               serv_puts("keep;");
-               serv_puts("000");
-       output_headers(1, 1, 2, 0, 0, 0);
-       do_template("sieve_add");
-       wDumpContent(1);
-               return;
+       else {
+                                       // no -- safe to create a new one by this name
+               serv_printf("MSIV putscript|%s", bstr("script_name"));
+               serv_getln(buf, sizeof buf);
+               if (buf[0] == '4') {
+                       serv_puts("keep;");
+                       serv_puts("000");
+               }
        }
 
-       output_headers(1, 1, 2, 0, 0, 0);
+       output_headers(1, 1, 1, 0, 0, 0);
        do_template("sieve_add");
        wDumpContent(1);
 }
@@ -459,7 +458,7 @@ void delete_script(void) {
 
        serv_printf("MSIV deletescript|%s", bstr("script_name"));
        serv_getln(buf, sizeof buf);
-       output_headers(1, 1, 2, 0, 0, 0);
+       output_headers(1, 1, 1, 0, 0, 0);
        do_template("sieve_add");
        wDumpContent(1);
 }
@@ -470,7 +469,7 @@ void delete_script(void) {
  */
 void display_no_sieve(void) {
 
-       output_headers(1, 1, 2, 0, 0, 0);
+       output_headers(1, 1, 1, 0, 0, 0);
        do_template("sieve_none");
        wDumpContent(1);
 }
@@ -586,9 +585,6 @@ HashList *GetSieveScriptListing(StrBuf *Target, WCTemplputParams *TP)
                       (vRuleset != NULL))
                {
                        Ruleset = (SieveListing *) vRuleset;
-
-                       // FIXME add logic to skip if it's the webcit generated script
-
                        serv_printf("MSIV getscript|%s", ChrPtr(Ruleset->Name));
                        StrBuf_ServGetln(Line);
                        if (GetServerStatus(Line, NULL) == 1)