updated on Thu Jan 12 04:00:44 UTC 2012
[aur-mirror.git] / mutt-sendbox / mutt-sendbox.patch
blob60d0e86bfff97f5f6126fb1676f5994996ca8030
1 Add support for sendbox (primary send path)
3 This patch adds support for Courier IMAP's Outbox feature. It adds the setting
4 "sendbox" which specifies a mailbox to which sent messages should be saved,
5 overriding the sendmail and smtp_url settings. This patch only affects the
6 primary send path, bounce is handled in a follow-on patch.
8 Signed-off-by: Aron Griffis <agrif...@n01se.net>
10 diff -r 4119b2394228 -r a1d30c527520 configure.ac
11 --- a/configure.ac Tue Apr 28 11:17:31 2009 -0400
12 +++ b/configure.ac Tue Apr 28 11:17:31 2009 -0400
13 @@ -652,6 +652,11 @@
15 dnl -- end imap dependencies --
17 +AC_ARG_ENABLE(sendbox, AC_HELP_STRING([--enable-sendbox], [Enable support for Courier-style Outbox]),
18 + [if test $enableval = yes; then
19 + AC_DEFINE(USE_SENDBOX, 1, [Define if you want support for Courier-style Outbox])
20 + fi])
22 AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl@<:@=PFX@:>@], [Enable TLS support using OpenSSL]),
23 [ if test "$with_ssl" != "no"
24 then
25 diff -r 4119b2394228 -r a1d30c527520 globals.h
26 --- a/globals.h Tue Apr 28 11:17:31 2009 -0400
27 +++ b/globals.h Tue Apr 28 11:17:31 2009 -0400
28 @@ -114,6 +114,9 @@
29 WHERE char *QueryFormat;
30 WHERE char *Realname;
31 WHERE short SearchContext;
32 +#ifdef USE_SENDBOX
33 +WHERE char *Sendbox;
34 +#endif
35 WHERE char *SendCharset;
36 WHERE char *Sendmail;
37 WHERE char *Shell;
38 diff -r 4119b2394228 -r a1d30c527520 init.h
39 --- a/init.h Tue Apr 28 11:17:31 2009 -0400
40 +++ b/init.h Tue Apr 28 11:17:31 2009 -0400
41 @@ -2464,6 +2464,18 @@
42 ** In case the text cannot be converted into one of these exactly,
43 ** mutt uses $$charset as a fallback.
45 +#ifdef USE_SENDBOX
46 + { "sendbox", DT_PATH, R_NONE, UL &Sendbox, 0 },
47 + /*
48 + ** .pp
49 + ** Specifies a special mailbox that will
50 + ** \fBsend\fP mail when written. When \fIset\fP, this variable overrides
51 + ** \fIsmtp_url\fP and \fIsendmail\fP.
52 + ** To make use of this, you probably want a Courier IMAP server configured for
53 + ** sending, see
54 + ** http://www.inter7.com/courierimap/INSTALL.html#imapsend
55 + */
56 +#endif
57 { "sendmail", DT_PATH, R_NONE, UL &Sendmail, UL SENDMAIL " -oem -oi" },
59 ** .pp
60 diff -r 4119b2394228 -r a1d30c527520 protos.h
61 --- a/protos.h Tue Apr 28 11:17:31 2009 -0400
62 +++ b/protos.h Tue Apr 28 11:17:31 2009 -0400
63 @@ -349,6 +349,9 @@
64 int _mutt_save_message (HEADER *, CONTEXT *, int, int, int);
65 int mutt_save_message (HEADER *, int, int, int, int *);
66 int mutt_search_command (int, int);
67 +#ifdef USE_SENDBOX
68 +int mutt_sendbox_send (HEADER *);
69 +#endif
70 #ifdef USE_SMTP
71 int mutt_smtp_send (const ADDRESS *, const ADDRESS *, const ADDRESS *,
72 const ADDRESS *, const char *, int);
73 diff -r 4119b2394228 -r a1d30c527520 send.c
74 --- a/send.c Tue Apr 28 11:17:31 2009 -0400
75 +++ b/send.c Tue Apr 28 11:17:31 2009 -0400
76 @@ -984,6 +984,15 @@
77 short old_write_bcc;
78 #endif
80 +#ifdef USE_SENDBOX
81 + /* Some imap servers can send mail by saving to a special folder.
82 + * In this case, there's no need for the intermediate tempfile because
83 + * we'll write directly to the folder.
84 + */
85 + if (Sendbox)
86 + return mutt_sendbox_send (msg);
87 +#endif
89 /* Write out the message in MIME form. */
90 mutt_mktemp (tempfile, sizeof (tempfile));
91 if ((tempfp = safe_fopen (tempfile, "w")) == NULL)
92 diff -r 4119b2394228 -r a1d30c527520 sendlib.c
93 --- a/sendlib.c Tue Apr 28 11:17:31 2009 -0400
94 +++ b/sendlib.c Tue Apr 28 11:17:31 2009 -0400
95 @@ -2929,3 +2929,30 @@
96 set_noconv_flags (hdr->content, 0);
97 return ret;
100 +#ifdef USE_SENDBOX
101 +int mutt_sendbox_send (HEADER *hdr)
103 + struct mutt_message_handle *mh;
104 + CONTEXT ctx;
105 + MESSAGE *msg;
106 + short old_write_bcc;
108 + hdr->read = 0; /* make sure to put it in the `new' directory (maildir) */
110 + mh = mutt_start_message (Sendbox, hdr, &ctx, &msg, 0);
111 + if (!mh)
112 + return -1;
114 + /* need to write the bcc in the headers */
115 + old_write_bcc = option (OPTWRITEBCC);
116 + set_option (OPTWRITEBCC);
118 + mutt_write_rfc822_header (msg->fp, hdr->env, hdr->content, 0, 0);
120 + if (!old_write_bcc)
121 + unset_option (OPTWRITEBCC);
123 + return mutt_finish_message (mh, Sendbox, hdr, &ctx, &msg, 1);
125 +#endif