From c3ba6c2aeda4ec0d55795ba564dfd21ba493630e Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 1 Nov 2006 04:22:02 +0000 Subject: [PATCH] worked on sieve panel --- webcit/sieve.c | 136 +++++++++++++++++++++++++++++++++++++++++++++--- webcit/webcit.c | 2 + webcit/webcit.h | 1 + 3 files changed, 132 insertions(+), 7 deletions(-) diff --git a/webcit/sieve.c b/webcit/sieve.c index 4c900c090..3fdb54f25 100644 --- a/webcit/sieve.c +++ b/webcit/sieve.c @@ -8,15 +8,40 @@ /*@{*/ #include "webcit.h" +#define MAX_SCRIPTS 100 /** * \brief view/edit sieve config */ void display_sieve(void) { + char script_names[MAX_SCRIPTS][64]; + int num_scripts = 0; + int active_script = (-1); + char buf[256]; + int i; + + + memset(script_names, 0, sizeof script_names); + + serv_puts("MSIV listscripts"); + serv_getln(buf, sizeof(buf)); + if (buf[0] == '1') while (serv_getln(buf, sizeof(buf)), strcmp(buf, "000")) { + if (num_scripts < MAX_SCRIPTS) { + extract_token(script_names[num_scripts], buf, 0, '|', 64); + if (extract_int(buf, 1) > 0) { + active_script = num_scripts; + } + ++num_scripts; + } + } + output_headers(1, 1, 2, 0, 0, 0); wprintf(" \n" ); @@ -49,7 +84,7 @@ void display_sieve(void) wprintf(_("When new mail arrives: ")); wprintf("\n"); + for (i=0; i%s\n", + ((active_script == i) ? "selected" : ""), + script_names[i], + script_names[i] + ); + } + wprintf("\n"); + } + + if (num_scripts > 0) { + for (i=0; i\n", script_names[i]); + wprintf("\n"); + wprintf("\n"); + } + } + + wprintf(" \n" + ); + + wprintf("\n"); /* The rest of this is common for all panels... */ wprintf("

"); - wprintf("", _("Save changes")); + wprintf("", _("Save changes")); wprintf(" "); wprintf("\n", _("Cancel")); wprintf("
\n"); @@ -112,6 +176,64 @@ void display_sieve(void) } +/** + * \brief save sieve config + */ +void save_sieve(void) { + int bigaction; + char script_names[MAX_SCRIPTS][64]; + int num_scripts = 0; + int active_script = (-1); + int i; + char this_name[64]; + char buf[256]; + + if (strlen(bstr("save_button")) == 0) { + strcpy(WC->ImportantMessage, + _("Cancelled. Changes were not saved.")); + display_main_menu(); + return; + } + + serv_puts("MSIV listscripts"); + serv_getln(buf, sizeof(buf)); + if (buf[0] == '1') while (serv_getln(buf, sizeof(buf)), strcmp(buf, "000")) { + if (num_scripts < MAX_SCRIPTS) { + extract_token(script_names[num_scripts], buf, 0, '|', 64); + if (extract_int(buf, 1) > 0) { + active_script = num_scripts; + } + ++num_scripts; + } + } + + bigaction = atoi(bstr("bigaction")); + + if (bigaction == 0) { + lprintf(9, "MSIV setactive||"); + } + + else if (bigaction == 2) { + lprintf(9, "MSIV setactive|%s|", bstr("active_script")); + } + + if (num_scripts > 0) { + for (i=0; iImportantMessage, "FIXME"); + display_main_menu(); + return; +} /*@}*/ diff --git a/webcit/webcit.c b/webcit/webcit.c index 3b9b9fe1f..dfffc7bc6 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -1624,6 +1624,8 @@ void session_loop(struct httprequest *req) display_smtpqueue_inner_div(); } else if (!strcasecmp(action, "display_sieve")) { display_sieve(); + } else if (!strcasecmp(action, "save_sieve")) { + save_sieve(); } else if (!strcasecmp(action, "setup_wizard")) { do_setup_wizard(); } else if (!strcasecmp(action, "display_preferences")) { diff --git a/webcit/webcit.h b/webcit/webcit.h index aef0b6dc6..46720bb45 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -626,6 +626,7 @@ void save_inetconf(void); void display_smtpqueue(void); void display_smtpqueue_inner_div(void); void display_sieve(void); +void save_sieve(void); void generate_uuid(char *); void CtdlMakeTempFileName(char *, int); void display_preferences(void); -- 2.30.2