aboutsummaryrefslogtreecommitdiff
path: root/mfd
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2008-11-25 09:15:36 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2008-11-25 09:15:36 +0000
commitf3373b03784ab08ab74a1bac5c18440fbc9a815f (patch)
tree1ee2305a509c1b38eba8fc4307598191e0078ac2 /mfd
parentfafdee6c1352c62eca3a8a1281ee07e5bd2f16f2 (diff)
downloadmailfromd-f3373b03784ab08ab74a1bac5c18440fbc9a815f.tar.gz
mailfromd-f3373b03784ab08ab74a1bac5c18440fbc9a815f.tar.bz2
Initial implementation of body replacement.
* mfd/engine.c (run_msgmod): Handle body_repl * mfd/gram.y (msgmod_opcode_str): Likewise. * mfd/mailfromd.h (enum msgmod_opcode): New constant body_repl. * mfd/bi_body.m4 (replbody): New function (proof-of-concept). * pmult/pmult.c (struct pmult_priv_data): New fields body_off, body_chunks. (pmult_append_body_chunk): New function. (cb_reply): Handle SMFIR_REPLBODY (pmult_std_reply): Likewise. (pmult_clear): Destroy body_chunks (pmult_eom): Request body replacement if body_chunks is not NULL. (pmult_msg_rplc,pmult_msg_rplc_stat): New functions. (pmilter): Register pmult_msg_rplc and pmult_msg_rplc_stat. git-svn-id: file:///svnroot/mailfromd/trunk@1761 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (limited to 'mfd')
-rw-r--r--mfd/bi_body.m47
-rw-r--r--mfd/engine.c3
-rw-r--r--mfd/gram.y3
-rw-r--r--mfd/mailfromd.h1
4 files changed, 14 insertions, 0 deletions
diff --git a/mfd/bi_body.m4 b/mfd/bi_body.m4
index 7c13ff96..aa0bfabc 100644
--- a/mfd/bi_body.m4
+++ b/mfd/bi_body.m4
@@ -52,4 +52,11 @@ MF_DEFUN(current_message, NUMBER)
}
END
+MF_STATE(eom)
+MF_DEFUN(replbody, VOID, STRING text)
+{
+ env_msgmod(env, body_repl, "BODY", text, 0);
+}
+END
+
MF_INIT
diff --git a/mfd/engine.c b/mfd/engine.c
index 80c9b788..741c74d1 100644
--- a/mfd/engine.c
+++ b/mfd/engine.c
@@ -1173,6 +1173,9 @@ run_msgmod(void *item, void *data)
case quarantine:
gacopyz_quarantine(ctx, hdr->name);
break;
+
+ case body_repl:
+ gacopyz_replace_body(ctx, hdr->value, strlen(hdr->value));
}
return 0;
}
diff --git a/mfd/gram.y b/mfd/gram.y
index 049df063..553dfab3 100644
--- a/mfd/gram.y
+++ b/mfd/gram.y
@@ -3061,6 +3061,9 @@ msgmod_opcode_str(enum msgmod_opcode opcode)
case quarantine:
return "QUARANTINE";
+
+ case body_repl:
+ return "REPLACE BODY";
}
return "UNKNOWN HEADER COMMAND";
}
diff --git a/mfd/mailfromd.h b/mfd/mailfromd.h
index 9155f16d..a5dd7075 100644
--- a/mfd/mailfromd.h
+++ b/mfd/mailfromd.h
@@ -320,6 +320,7 @@ enum msgmod_opcode { /* Message modification operation */
rcpt_add, /* Add a recipient */
rcpt_delete, /* Delete a recipient */
quarantine, /* Quarantine a message */
+ body_repl, /* Replace message body */
};
struct msgmod_closure {

Return to:

Send suggestions and report system problems to the System administrator.