]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/sieve/serv_sieve.c
Fix to speed up Sieve processing, taking relatively a lot of time that
[citadel.git] / citadel / modules / sieve / serv_sieve.c
index 508f8d2188ce71ecf06889f181de4704f235b7db..010e76b43de4a8936bcfeca943173f4fb1b6d684 100644 (file)
@@ -230,7 +230,7 @@ int ctdl_reject(sieve2_context_t *s, void *my)
        lprintf(CTDL_DEBUG, "Action is REJECT\n");
 
        /* If we don't know who sent the message, do a DISCARD instead. */
-       if (strlen(cs->sender) == 0) {
+       if (IsEmptyStr(cs->sender)) {
                lprintf(CTDL_INFO, "Unknown sender.  Doing DISCARD instead of REJECT.\n");
                return ctdl_discard(s, my);
        }
@@ -769,19 +769,23 @@ void rewrite_ctdl_sieve_config(struct sdm_userdata *u, int yes_write_to_disk) {
                sprintf(&text[strlen(text)], CTDLSIEVECONFIGSEPARATOR);
        }
 
-       /* Save the config */
-       quickie_message("Citadel", NULL, NULL, u->config_roomname,
-                       text,
-                       4,
-                       "Sieve configuration"
-       );
-       
-       free (text);
-       /* And delete the old one */
-       if (u->config_msgnum > 0) {
-               CtdlDeleteMessages(u->config_roomname, &u->config_msgnum, 1, "");
+       if (yes_write_to_disk)
+       {
+               /* Save the config */
+               quickie_message("Citadel", NULL, NULL, u->config_roomname,
+                               text,
+                               4,
+                               "Sieve configuration"
+               );
+               
+               /* And delete the old one */
+               if (u->config_msgnum > 0) {
+                       CtdlDeleteMessages(u->config_roomname, &u->config_msgnum, 1, "");
+               }
        }
 
+       free (text);
+
 }
 
 
@@ -969,7 +973,7 @@ int msiv_setactive(struct sdm_userdata *u, char *script_name) {
 
        /* First see if the supplied value is ok */
 
-       if (strlen(script_name) == 0) {
+       if (IsEmptyStr(script_name)) {
                ok = 1;
        }
        else {
@@ -1108,7 +1112,7 @@ void cmd_msiv(char *argbuf) {
 
        if (!strcasecmp(subcmd, "putscript")) {
                extract_token(script_name, argbuf, 1, '|', sizeof script_name);
-               if (strlen(script_name) > 0) {
+               if (!IsEmptyStr(script_name)) {
                        cprintf("%d Transmit script now\n", SEND_LISTING);
                        script_content = CtdlReadMessageBody("000", config.c_maxmsglen, NULL, 0);
                        msiv_putscript(&u, script_name, script_content);