From: Art Cancro Date: Thu, 15 Mar 2012 21:39:07 +0000 (-0400) Subject: Reworked some suboptimal logic found in create_script() X-Git-Tag: v8.11~127^2~18 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=78e4b12f630b09d2ecc825fd8ed32045fb104d03 Reworked some suboptimal logic found in create_script() --- diff --git a/webcit/sieve.c b/webcit/sieve.c index 3761b1131..668d5f894 100644 --- a/webcit/sieve.c +++ b/webcit/sieve.c @@ -429,22 +429,19 @@ 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);