]> code.citadel.org Git - citadel.git/blobdiff - webcit/sieve.c
Initialize variables in GetSieveRules() , thanks projectgus
[citadel.git] / webcit / sieve.c
index dd4e3e93a866f608a35c93307c46952e72896ec7..dd049cf82a81ea894a682a1da77ae0c428a74cc6 100644 (file)
@@ -374,14 +374,13 @@ void save_sieve(void) {
        int bigaction;
        char script_names[MAX_SCRIPTS][64];
        int num_scripts = 0;
-       int active_script = (-1);
+       int active_script = (-1);       /* this throws a 'set but not used' warning , check this ! */
        int i;
        char this_name[64];
        char buf[256];
 
        if (!havebstr("save_button")) {
-               strcpy(WC->ImportantMessage,
-                       _("Cancelled.  Changes were not saved."));
+               AppendImportantMessage(_("Cancelled.  Changes were not saved."), -1);
                display_main_menu();
                return;
        }
@@ -437,7 +436,7 @@ void save_sieve(void) {
                }
        }
 
-       strcpy(WC->ImportantMessage, _("Your changes have been saved."));
+       AppendImportantMessage(_("Your changes have been saved."), -1);
        display_main_menu();
        return;
 }
@@ -1523,22 +1522,21 @@ void FreeSieveRule(void *vRule)
 #define WC_RULE_HEADER "# WEBCIT_RULE|"
 HashList *GetSieveRules(StrBuf *Target, WCTemplputParams *TP)
 {
-       StrBuf *Line;
-       StrBuf *EncodedRule;
-       int n;
-       const char *pch;
+       StrBuf *Line = NULL;
+       StrBuf *EncodedRule = NULL;
+       int n = 0;
+       const char *pch = NULL;
        HashList *SieveRules = NULL;
        int Done = 0;
-       SieveRule *Rule;
+       SieveRule *Rule = NULL;
 
+       SieveRules = NewHash(1, Flathash);
        serv_printf("MSIV getscript|"RULES_SCRIPT);
        Line = NewStrBuf();
        EncodedRule = NewStrBuf();
        StrBuf_ServGetln(Line);
        if (GetServerStatus(Line, NULL) == 1) 
        {
-               SieveRules = NewHash(1, Flathash);
-
                while(!Done && (StrBuf_ServGetln(Line) >= 0) )
                        if ( (StrLength(Line)==3) && 
                             !strcmp(ChrPtr(Line), "000"))