NeoMutt  2021-10-29-33-g41675a
Teaching an old dog new tricks
DOXYGEN
maillist.c
Go to the documentation of this file.
1 
29 #include "config.h"
30 #include <stdbool.h>
31 #include <stdio.h>
32 #include "mutt/lib.h"
33 #include "address/lib.h"
34 #include "email/lib.h"
35 #include "maillist.h"
36 #include "muttlib.h"
37 #include "sort.h"
38 
44 bool mutt_is_mail_list(const struct Address *addr)
45 {
47  return mutt_regexlist_match(&MailLists, addr->mailbox);
48  return false;
49 }
50 
56 bool mutt_is_subscribed_list(const struct Address *addr)
57 {
60  {
62  }
63  return false;
64 }
65 
78 bool check_for_mailing_list(struct AddressList *al, const char *pfx, char *buf, int buflen)
79 {
80  struct Address *a = NULL;
81  TAILQ_FOREACH(a, al, entries)
82  {
84  {
85  if (pfx && buf && buflen)
86  snprintf(buf, buflen, "%s%s", pfx, mutt_get_name(a));
87  return true;
88  }
89  }
90  return false;
91 }
92 
102 bool check_for_mailing_list_addr(struct AddressList *al, char *buf, int buflen)
103 {
104  struct Address *a = NULL;
105  TAILQ_FOREACH(a, al, entries)
106  {
108  {
109  if (buf && buflen)
110  snprintf(buf, buflen, "%s", a->mailbox);
111  return true;
112  }
113  }
114  return false;
115 }
116 
124 bool first_mailing_list(char *buf, size_t buflen, struct AddressList *al)
125 {
126  struct Address *a = NULL;
127  TAILQ_FOREACH(a, al, entries)
128  {
130  {
131  mutt_save_path(buf, buflen, a);
132  return true;
133  }
134  }
135  return false;
136 }
Email Address Handling.
Structs that make up an email.
struct RegexList SubscribedLists
List of regexes to match subscribed mailing lists.
Definition: globals.c:43
struct RegexList UnSubscribedLists
List of regexes to blacklist false matches in SubscribedLists.
Definition: globals.c:40
struct RegexList UnMailLists
List of regexes to blacklist false matches in MailLists.
Definition: globals.c:42
struct RegexList MailLists
List of regexes to match mailing lists.
Definition: globals.c:41
bool mutt_is_mail_list(const struct Address *addr)
Is this the email address of a mailing list? - Implements addr_predicate_t -.
Definition: maillist.c:44
bool mutt_is_subscribed_list(const struct Address *addr)
Is this the email address of a user-subscribed mailing list? - Implements addr_predicate_t -.
Definition: maillist.c:56
bool check_for_mailing_list(struct AddressList *al, const char *pfx, char *buf, int buflen)
Search list of addresses for a mailing list.
Definition: maillist.c:78
bool check_for_mailing_list_addr(struct AddressList *al, char *buf, int buflen)
Check an address list for a mailing list.
Definition: maillist.c:102
bool first_mailing_list(char *buf, size_t buflen, struct AddressList *al)
Get the first mailing list in the list of addresses.
Definition: maillist.c:124
Handle mailing lists.
Convenience wrapper for the library headers.
bool mutt_regexlist_match(struct RegexList *rl, const char *str)
Does a string match any Regex in the list?
Definition: regex.c:194
void mutt_save_path(char *buf, size_t buflen, const struct Address *addr)
Turn an email address into a filename (for saving)
Definition: muttlib.c:710
Some miscellaneous functions.
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:725
const char * mutt_get_name(const struct Address *a)
Pick the best name to display from an address.
Definition: sort.c:136
Assorted sorting methods.
An email address.
Definition: address.h:36
char * mailbox
Mailbox and host address.
Definition: address.h:38