NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
mutt_parse.h File Reference
#include "mutt/lib.h"
#include "email/lib.h"
+ Include dependency graph for mutt_parse.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  AttachMatch
 An attachment matching a regex for attachment counter. More...
 

Functions

int mutt_count_body_parts (struct Mailbox *m, struct Email *e)
 Count the MIME Body parts. More...
 
void mutt_parse_mime_message (struct Mailbox *m, struct Email *e)
 Parse a MIME email. More...
 
void mutt_attachmatch_free (struct AttachMatch **ptr)
 Free an AttachMatch - Implements list_free_t. More...
 

Variables

struct ListHead AttachAllow
 List of attachment types to be counted. More...
 
struct ListHead AttachExclude
 List of attachment types to be ignored. More...
 
struct ListHead InlineAllow
 List of inline types to counted. More...
 
struct ListHead InlineExclude
 List of inline types to ignore. More...
 

Detailed Description

Miscellaneous email parsing routines

Authors
  • Richard Russon

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 mutt_parse.h.

Function Documentation

◆ mutt_count_body_parts()

int mutt_count_body_parts ( struct Mailbox m,
struct Email e 
)

Count the MIME Body parts.

Parameters
mMailbox
eEmail
Return values
numNumber of MIME Body parts

Definition at line 208 of file mutt_parse.c.

209 {
210  bool keep_parts = false;
211 
212  if (e->attach_valid)
213  return e->attach_total;
214 
215  if (e->body->parts)
216  keep_parts = true;
217  else
219 
222  {
224  }
225  else
226  e->attach_total = 0;
227 
228  e->attach_valid = true;
229 
230  if (!keep_parts)
231  mutt_body_free(&e->body->parts);
232 
233  return e->attach_total;
234 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_parse_mime_message()

void mutt_parse_mime_message ( struct Mailbox m,
struct Email e 
)

Parse a MIME email.

Parameters
mMailbox
eEmail

Definition at line 49 of file mutt_parse.c.

50 {
51  do
52  {
53  if ((e->body->type != TYPE_MESSAGE) && (e->body->type != TYPE_MULTIPART))
54  break; /* nothing to do */
55 
56  if (e->body->parts)
57  break; /* The message was parsed earlier. */
58 
59  struct Message *msg = mx_msg_open(m, e->msgno);
60  if (msg)
61  {
62  mutt_parse_part(msg->fp, e->body);
63 
64  if (WithCrypto)
65  e->security = crypt_query(e->body);
66 
67  mx_msg_close(m, &msg);
68  }
69  } while (false);
70 
71  e->attach_valid = false;
72 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ mutt_attachmatch_free()

void mutt_attachmatch_free ( struct AttachMatch **  ptr)

Free an AttachMatch - Implements list_free_t.

Parameters
ptrAttachMatch to free
Note
We don't free minor because it is either a pointer into major, or a static string.

Definition at line 243 of file mutt_parse.c.

244 {
245  if (!ptr || !*ptr)
246  return;
247 
248  struct AttachMatch *am = *ptr;
249  regfree(&am->minor_regex);
250  FREE(&am->major);
251  FREE(ptr);
252 }
+ Here is the caller graph for this function:

Variable Documentation

◆ AttachAllow

struct ListHead AttachAllow

List of attachment types to be counted.

Definition at line 39 of file mutt_parse.c.

◆ AttachExclude

struct ListHead AttachExclude

List of attachment types to be ignored.

Definition at line 40 of file mutt_parse.c.

◆ InlineAllow

struct ListHead InlineAllow

List of inline types to counted.

Definition at line 41 of file mutt_parse.c.

◆ InlineExclude

struct ListHead InlineExclude

List of inline types to ignore.

Definition at line 42 of file mutt_parse.c.

AttachMatch
An attachment matching a regex for attachment counter.
Definition: mutt_parse.h:34
Email::msgno
int msgno
Number displayed to the user.
Definition: email.h:87
InlineAllow
struct ListHead InlineAllow
List of inline types to counted.
Definition: mutt_parse.c:41
mutt_parse_part
void mutt_parse_part(FILE *fp, struct Body *b)
Parse a MIME part.
Definition: parse.c:1659
FREE
#define FREE(x)
Definition: memory.h:40
STAILQ_EMPTY
#define STAILQ_EMPTY(head)
Definition: queue.h:345
mutt_body_free
void mutt_body_free(struct Body **ptr)
Free a Body.
Definition: body.c:57
mutt_parse_mime_message
void mutt_parse_mime_message(struct Mailbox *m, struct Email *e)
Parse a MIME email.
Definition: mutt_parse.c:49
crypt_query
SecurityFlags crypt_query(struct Body *m)
Check out the type of encryption used.
Definition: crypt.c:687
InlineExclude
struct ListHead InlineExclude
List of inline types to ignore.
Definition: mutt_parse.c:42
Body::parts
struct Body * parts
parts of a multipart or message/rfc822
Definition: body.h:54
TYPE_MESSAGE
@ TYPE_MESSAGE
Type: 'message/*'.
Definition: mime.h:35
Email::attach_total
short attach_total
Number of qualifying attachments in message, if attach_valid.
Definition: email.h:97
Message::fp
FILE * fp
pointer to the message data
Definition: mx.h:96
Email::security
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition: email.h:39
WithCrypto
#define WithCrypto
Definition: lib.h:123
Body::type
unsigned int type
content-type primary type, ContentType
Definition: body.h:65
Email::attach_valid
bool attach_valid
true when the attachment count is valid
Definition: email.h:70
AttachMatch::minor_regex
regex_t minor_regex
Definition: mutt_parse.h:39
AttachMatch::major
const char * major
Definition: mutt_parse.h:36
mx_msg_close
int mx_msg_close(struct Mailbox *m, struct Message **msg)
Close a message.
Definition: mx.c:1204
TYPE_MULTIPART
@ TYPE_MULTIPART
Type: 'multipart/*'.
Definition: mime.h:37
count_body_parts
static int count_body_parts(struct Body *body)
Count the MIME Body parts.
Definition: mutt_parse.c:117
AttachAllow
struct ListHead AttachAllow
List of attachment types to be counted.
Definition: mutt_parse.c:39
Message
A local copy of an email.
Definition: mx.h:94
Email::body
struct Body * body
List of MIME parts.
Definition: email.h:91
mx_msg_open
struct Message * mx_msg_open(struct Mailbox *m, int msgno)
return a stream pointer for a message
Definition: mx.c:1158
AttachExclude
struct ListHead AttachExclude
List of attachment types to be ignored.
Definition: mutt_parse.c:40