NeoMutt  2025-12-11-435-g4ac674
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
maillist.c
Go to the documentation of this file.
1
23
29
30#include "config.h"
31#include <stdbool.h>
32#include <stdio.h>
33#include "mutt/lib.h"
34#include "email/lib.h"
35#include "core/lib.h"
36#include "maillist.h"
37#include "address.h"
38#include "muttlib.h"
39
45bool mutt_is_mail_list(const struct Address *addr)
46{
48 ASSERT(md);
49
51 return mutt_regexlist_match(&md->mail, buf_string(addr->mailbox));
52 return false;
53}
54
60bool mutt_is_subscribed_list(const struct Address *addr)
61{
63 ASSERT(md);
64
65 if (!mutt_regexlist_match(&md->unmail, buf_string(addr->mailbox)) &&
67 {
69 }
70 return false;
71}
72
85bool check_for_mailing_list(struct AddressList *al, const char *pfx, char *buf, int buflen)
86{
87 struct Address *a = NULL;
88 TAILQ_FOREACH(a, al, entries)
89 {
91 {
92 if (pfx && buf && buflen)
93 snprintf(buf, buflen, "%s%s", pfx, mutt_get_name(a));
94 return true;
95 }
96 }
97 return false;
98}
99
109bool check_for_mailing_list_addr(struct AddressList *al, char *buf, int buflen)
110{
111 struct Address *a = NULL;
112 TAILQ_FOREACH(a, al, entries)
113 {
115 {
116 if (buf && buflen)
117 snprintf(buf, buflen, "%s", buf_string(a->mailbox));
118 return true;
119 }
120 }
121 return false;
122}
123
130bool first_mailing_list(struct AddressList *al, struct Buffer *buf)
131{
132 struct Address *a = NULL;
133 TAILQ_FOREACH(a, al, entries)
134 {
136 {
137 generate_save_path(buf, a);
138 return true;
139 }
140 }
141 return false;
142}
Representation of an email address.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
Convenience wrapper for the core headers.
Structs that make up an email.
const char * mutt_get_name(const struct Address *a)
Pick the best name to display from an address.
Definition sort.c:138
bool mutt_is_mail_list(const struct Address *addr)
Is this the email address of a mailing list?
Definition maillist.c:45
bool mutt_is_subscribed_list(const struct Address *addr)
Is this the email address of a user-subscribed mailing list?
Definition maillist.c:60
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:85
bool check_for_mailing_list_addr(struct AddressList *al, char *buf, int buflen)
Check an address list for a mailing list.
Definition maillist.c:109
bool first_mailing_list(struct AddressList *al, struct Buffer *buf)
Get the first mailing list in the list of addresses.
Definition maillist.c:130
Handle mailing lists.
@ MODULE_ID_EMAIL
ModuleEmail, Email code
Definition module_api.h:64
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:200
void generate_save_path(struct Buffer *dest, const struct Address *a)
Make a safe filename from an email address.
Definition muttlib.c:607
Some miscellaneous functions.
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:585
#define TAILQ_FOREACH(var, head, field)
Definition queue.h:782
#define ASSERT(COND)
Definition signal2.h:59
An email address.
Definition address.h:35
struct Buffer * mailbox
Mailbox and host address.
Definition address.h:37
String manipulation buffer.
Definition buffer.h:36
Email private Module data.
Definition module_data.h:32
struct RegexList unsubscribed
Regexes to exclude false matches in subscribed.
Definition module_data.h:47
struct RegexList subscribed
Regexes to match subscribed mailing lists.
Definition module_data.h:42
struct RegexList unmail
Regexes to exclude false matches in mail.
Definition module_data.h:46
struct RegexList mail
Regexes to match mailing lists.
Definition module_data.h:38
Container for Accounts, Notifications.
Definition neomutt.h:41