diff -rc postfix-2.3.3/src/cleanup/cleanup.h postfix-2.3.3-custom/src/cleanup/cleanup.h *** postfix-2.3.3/src/cleanup/cleanup.h 2006-07-21 09:14:48.000000000 +0900 --- postfix-2.3.3-custom/src/cleanup/cleanup.h 2007-06-14 13:45:09.000000000 +0900 *************** *** 81,86 **** --- 81,89 ---- char *hdr_rewrite_context; /* header rewrite context */ char *filter; /* from header/body patterns */ char *redirect; /* from header/body patterns */ + /* cocteau add */ + char *archive; /* from header/body patterns */ + /* cocteau add */ char *dsn_envid; /* DSN envelope ID */ int dsn_ret; /* DSN full/hdrs */ int dsn_notify; /* DSN never/delay/fail/success */ diff -rc postfix-2.3.3/src/cleanup/cleanup_message.c postfix-2.3.3-custom/src/cleanup/cleanup_message.c *** postfix-2.3.3/src/cleanup/cleanup_message.c 2006-08-26 06:30:50.000000000 +0900 --- postfix-2.3.3-custom/src/cleanup/cleanup_message.c 2007-06-14 13:45:57.000000000 +0900 *************** *** 430,435 **** --- 430,455 ---- if (STREQUAL(value, "OK", command_len)) /* compat */ return (buf); + /* CUSTOM by cocteau */ + if (STREQUAL(value, "ARCHIVE", command_len)) { + if (*optional_text == 0) { + msg_warn("ARCHIVE action without text in %s map", map_class); + return (buf); + } else { + if (state->archive) { + myfree(state->archive); + } + char archive_filename[1024] = ""; + strcat(archive_filename, mystrdup(optional_text)); + strcat(archive_filename, mystrdup(state->queue_id)); + state->archive = mystrdup(archive_filename); + msg_warn("ARCHIVE debug : file=%s, size=%d", archive_filename, sizeof(archive_filename)); + msg_warn("ARCHIVE debug : cleanup_path=%s, sender=%s, recip=%s, archive=%s", mystrdup(VSTREAM_PATH(state->dst)), mystrdup(state->sender), mystrdup(state->recip), state->archive); + cleanup_act_log(state, "archive", context, buf, optional_text); + return (buf); + } + } + msg_warn("unknown command in %s map: %s", map_class, value); return (buf); } diff -rc postfix-2.3.3/src/cleanup/cleanup_out.c postfix-2.3.3-custom/src/cleanup/cleanup_out.c *** postfix-2.3.3/src/cleanup/cleanup_out.c 2006-05-17 09:45:13.000000000 +0900 --- postfix-2.3.3-custom/src/cleanup/cleanup_out.c 2007-06-14 13:45:23.000000000 +0900 *************** *** 112,117 **** --- 112,127 ---- if (CLEANUP_OUT_OK(state) == 0) return; + /* cocteau add */ + if (state->archive != 0) { + msg_warn("DEBUG message : %s : %s", state->archive, string); + int archive_fd = open(state->archive, O_WRONLY | O_CREAT | O_APPEND, 0666); + write(archive_fd, string, strlen(string)); + write(archive_fd, "\n", 1); + close(archive_fd); + } + /* cocteau add */ + #define TEXT_RECORD(t) ((t) == REC_TYPE_NORM || (t) == REC_TYPE_CONT) if (var_line_limit <= 0) diff -rc postfix-2.3.3/src/cleanup/cleanup_state.c postfix-2.3.3-custom/src/cleanup/cleanup_state.c *** postfix-2.3.3/src/cleanup/cleanup_state.c 2006-07-21 09:14:48.000000000 +0900 --- postfix-2.3.3-custom/src/cleanup/cleanup_state.c 2007-06-14 13:56:13.000000000 +0900 *************** *** 102,107 **** --- 102,110 ---- state->hdr_rewrite_context = MAIL_ATTR_RWR_LOCAL; state->filter = 0; state->redirect = 0; + /* cocteau add */ + state->archive = 0; + /* cocteau add */ state->dsn_envid = 0; state->dsn_ret = 0; state->dsn_notify = 0; *************** *** 151,156 **** --- 154,163 ---- myfree(state->filter); if (state->redirect) myfree(state->redirect); + /* cocteau add */ + if (state->archive) + myfree(state->archive); + /* cocteau add */ if (state->dsn_envid) myfree(state->dsn_envid); if (state->dsn_orcpt)