X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fsieve.c;h=4d60d02af13b0ba9da82da1591b0cb2562749f1f;hb=a00d51fb7d3cdb0b6545fc2248e698955ed77af7;hp=4cf8afdb3ec4a8370b31ba6a89e12d0d43c00f8d;hpb=bd5cad8b9b88376f40a564696061b9ffe845c5b9;p=citadel.git diff --git a/webcit/sieve.c b/webcit/sieve.c index 4cf8afdb3..4d60d02af 100644 --- a/webcit/sieve.c +++ b/webcit/sieve.c @@ -235,7 +235,7 @@ void parse_fields_from_rule_editor(void) { strcpy(rule, ""); sprintf(fname, "active%d", i); - active = atoi(bstr(fname)); + active = !strcasecmp(bstr(fname), "on") ; sprintf(fname, "hfield%d", i); safestrncpy(hfield, bstr(fname), sizeof hfield); @@ -493,7 +493,8 @@ void create_script(void) { void display_rules_editor_inner_div(void) { int i, j; - char buf[256]; + char buf[4096]; + char rules[MAX_RULES][2048]; struct { char name[128]; @@ -501,6 +502,30 @@ void display_rules_editor_inner_div(void) { int num_roomnames = 0; int num_roomnames_alloc = 0; + int active; + char hfield[256]; + char compare[32]; + char htext[256]; + char sizecomp[32]; + int sizeval; + char action[32]; + char fileinto[128]; + char redirect[256]; + char automsg[1024]; + char final[32]; + + /* load the rules */ + memset(rules, 0, sizeof rules); + serv_printf("MSIV getscript|%s", RULES_SCRIPT); + serv_getln(buf, sizeof buf); + if (buf[0] == '1') while(serv_getln(buf, sizeof (buf)), strcmp(buf, "000")) { + if (!strncasecmp(buf, "# WEBCIT_RULE|", 14)) { + j = extract_int(buf, 1); + remove_token(buf, 0, '|'); + remove_token(buf, 0, '|'); + CtdlDecodeBase64(rules[j], buf, strlen(buf)); + } + } /* load the roomnames */ serv_puts("LKRA"); @@ -621,8 +646,7 @@ void display_rules_editor_inner_div(void) { " } \n" "} \n" /* - * Delete a rule (percolate the deleted rule out to the end, - * and then decrement highest_active_rule) + * Delete a rule (percolate the deleted rule out to the end, then deactivate it) */ "function DeleteRule(rd) { \n" " for (i=rd; i"); for (i=0; i", i, ((i%2) ? "DDDDDD" : "FFFFFF") @@ -648,7 +687,10 @@ void display_rules_editor_inner_div(void) { wprintf(""); wprintf("
"); - wprintf("", i); + wprintf("", + i, i, + (active ? "checked" : "") + ); wprintf("
"); if (i>0) wprintf("" @@ -783,10 +825,9 @@ void display_rules_editor_inner_div(void) { wprintf(""); wprintf("\n"); - wprintf(" \n" - ); + wprintf(" \n"); free(rooms); }