Send/reply with an attachment. More...
#include "config.h"
#include <locale.h>
#include <stdbool.h>
#include <stdio.h>
#include "mutt/lib.h"
#include "address/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "alias/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "recvcmd.h"
#include "attach/lib.h"
#include "editor/lib.h"
#include "expando/lib.h"
#include "history/lib.h"
#include "question/lib.h"
#include "send/lib.h"
#include "copy.h"
#include "globals.h"
#include "handler.h"
#include "hdrline.h"
#include "mutt_body.h"
#include "mutt_logging.h"
#include "protos.h"
#include <libintl.h>
Go to the source code of this file.
Functions | |
static bool | check_msg (struct Body *b, bool err) |
Are we working with an RFC822 message. | |
static bool | check_all_msg (struct AttachCtx *actx, struct Body *b, bool err) |
Are all the Attachments RFC822 messages? | |
static bool | check_can_decode (struct AttachCtx *actx, struct Body *b) |
Can we decode all tagged attachments? | |
static short | count_tagged (struct AttachCtx *actx) |
Count the number of tagged attachments. | |
static short | count_tagged_children (struct AttachCtx *actx, short i) |
Tagged children below a multipart/message attachment. | |
void | attach_bounce_message (struct Mailbox *m, FILE *fp, struct AttachCtx *actx, struct Body *b) |
Bounce function, from the attachment menu. | |
void | mutt_attach_resend (FILE *fp, struct Mailbox *m, struct AttachCtx *actx, struct Body *b) |
Resend-message, from the attachment menu. | |
static struct AttachPtr * | find_common_parent (struct AttachCtx *actx, short nattach) |
Find a common parent message for the tagged attachments. | |
static int | is_parent (short i, struct AttachCtx *actx, const struct Body *b) |
Check whether one attachment is the parent of another. | |
static struct AttachPtr * | find_parent (struct AttachCtx *actx, struct Body *b, short nattach) |
Find the parent of an Attachment. | |
static void | include_header (bool quote, FILE *fp_in, struct Email *e, FILE *fp_out, const char *prefix) |
Write an email header to a file, optionally quoting it. | |
static struct Body ** | copy_problematic_attachments (struct Body **last, struct AttachCtx *actx, bool force) |
Attach the body parts which can't be decoded. | |
static void | attach_forward_bodies (FILE *fp, struct Email *e, struct AttachCtx *actx, struct Body *b, short nattach) |
Forward one or several MIME bodies. | |
static void | attach_forward_msgs (FILE *fp, struct AttachCtx *actx, struct Body *b, SendFlags flags) |
Forward one or several message-type attachments. | |
void | mutt_attach_forward (FILE *fp, struct Email *e, struct AttachCtx *actx, struct Body *b, SendFlags flags) |
Forward an Attachment. | |
static int | attach_reply_envelope_defaults (struct Envelope *env, struct AttachCtx *actx, struct Email *parent, SendFlags flags) |
Create the envelope defaults for a reply. | |
static void | attach_include_reply (FILE *fp, FILE *fp_tmp, struct Email *e) |
This is very similar to send.c's include_reply() | |
void | mutt_attach_reply (FILE *fp, struct Mailbox *m, struct Email *e, struct AttachCtx *actx, struct Body *b, SendFlags flags) |
Attach a reply. | |
void | mutt_attach_mail_sender (struct AttachCtx *actx, struct Body *b) |
Compose an email to the sender in the email attachment. | |
Send/reply with an attachment.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file recvcmd.c.
|
static |
Are we working with an RFC822 message.
b | Body of email |
err | If true, display a message if this isn't an RFC822 message |
true | This is an RFC822 message |
some helper functions to verify that we are exclusively operating on message/rfc822 attachments
Definition at line 72 of file recvcmd.c.
Are all the Attachments RFC822 messages?
actx | Attachment context |
b | Current message |
err | If true, report errors |
true | All parts are RFC822 messages |
Definition at line 90 of file recvcmd.c.
Can we decode all tagged attachments?
actx | Attachment context |
b | Body of email |
true | All tagged attachments are decodable |
Definition at line 114 of file recvcmd.c.
|
static |
|
static |
Tagged children below a multipart/message attachment.
actx | Attachment context |
i | Index of first attachment |
num | Number of tagged attachments |
Definition at line 147 of file recvcmd.c.
void attach_bounce_message | ( | struct Mailbox * | m, |
FILE * | fp, | ||
struct AttachCtx * | actx, | ||
struct Body * | b | ||
) |
Bounce function, from the attachment menu.
Definition at line 166 of file recvcmd.c.
Resend-message, from the attachment menu.
fp | File containing email |
m | Current mailbox |
actx | Attachment context |
b | Attachment |
Definition at line 290 of file recvcmd.c.
Find a common parent message for the tagged attachments.
actx | Attachment context |
nattach | Number of tagged attachments |
ptr | Parent attachment |
NULL | Failure, no common parent |
Definition at line 319 of file recvcmd.c.
Check whether one attachment is the parent of another.
i | Index of parent Attachment |
actx | Attachment context |
b | Potential child Attachment |
true | Attachment |
check whether attachment i is a parent of the attachment pointed to by b
Definition at line 353 of file recvcmd.c.
|
static |
Find the parent of an Attachment.
actx | Attachment context |
b | Attachment (OPTIONAL) |
nattach | Use the nth attachment |
ptr | Parent attachment |
NULL | No parent exists |
Definition at line 374 of file recvcmd.c.
|
static |
Write an email header to a file, optionally quoting it.
quote | If true, prefix the lines |
fp_in | File to read from |
e | |
fp_out | File to write to |
prefix | Prefix for each line (OPTIONAL) |
Definition at line 407 of file recvcmd.c.
|
static |
Attach the body parts which can't be decoded.
[out] | last | Body pointer to update |
[in] | actx | Attachment context |
[in] | force | If true, attach parts that can't be decoded |
ptr | Pointer to last Body part |
This code is shared by forwarding and replying.
Definition at line 453 of file recvcmd.c.
|
static |
Forward one or several MIME bodies.
fp | File to read from |
e | |
actx | Attachment Context |
b | Body of email |
nattach | Number of tagged attachments |
(non-message types)
Definition at line 478 of file recvcmd.c.
|
static |
Forward one or several message-type attachments.
fp | File handle to attachment |
actx | Attachment Context |
b | Attachment to forward (OPTIONAL) |
flags | Send mode, see SendFlags |
This is different from the previous function since we want to mimic the index menu's behavior.
Code reuse from mutt_send_message() is not possible here. It relies on a context structure to find messages, while, on the attachment menu, messages are referenced through the attachment index.
Definition at line 662 of file recvcmd.c.
void mutt_attach_forward | ( | FILE * | fp, |
struct Email * | e, | ||
struct AttachCtx * | actx, | ||
struct Body * | b, | ||
SendFlags | flags | ||
) |
Forward an Attachment.
fp | Handle to the attachment |
e | |
actx | Attachment Context |
b | Current message |
flags | Send mode, see SendFlags |
Definition at line 793 of file recvcmd.c.
|
static |
Create the envelope defaults for a reply.
env | Envelope to fill in |
actx | Attachment Context |
parent | Parent Email |
flags | Flags, see SendFlags |
0 | Success |
-1 | Error |
This function can be invoked in two ways.
Either, parent is NULL. In this case, all tagged bodies are of a message type, and the header information is fetched from them.
Or, parent is non-NULL. In this case, cur is the common parent of all the tagged attachments.
Note that this code is horribly similar to envelope_defaults() from send.c.
Definition at line 826 of file recvcmd.c.
|
static |
This is very similar to send.c's include_reply()
fp | File handle to attachment |
fp_tmp | File handle to temporary file |
e |
Definition at line 919 of file recvcmd.c.
void mutt_attach_reply | ( | FILE * | fp, |
struct Mailbox * | m, | ||
struct Email * | e, | ||
struct AttachCtx * | actx, | ||
struct Body * | b, | ||
SendFlags | flags | ||
) |
Attach a reply.
fp | File handle to reply |
m | Mailbox |
e | |
actx | Attachment Context |
b | Current message |
flags | Send mode, see SendFlags |
Definition at line 949 of file recvcmd.c.
Compose an email to the sender in the email attachment.
actx | Attachment Context |
b | Current attachment |
Definition at line 1127 of file recvcmd.c.