NeoMutt  2024-12-12-19-ge4b57e
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
maillist.h File Reference

Handle mailing lists. More...

#include <stdbool.h>
#include <stddef.h>
+ Include dependency graph for maillist.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool check_for_mailing_list (struct AddressList *al, const char *pfx, char *buf, int buflen)
 Search list of addresses for a mailing list.
 
bool check_for_mailing_list_addr (struct AddressList *al, char *buf, int buflen)
 Check an address list for a mailing list.
 
bool first_mailing_list (char *buf, size_t buflen, struct AddressList *al)
 Get the first mailing list in the list of addresses.
 
bool mutt_is_mail_list (const struct Address *addr)
 Is this the email address of a mailing list? - Implements addr_predicate_t -.
 
bool mutt_is_subscribed_list (const struct Address *addr)
 Is this the email address of a user-subscribed mailing list? - Implements addr_predicate_t -.
 

Detailed Description

Handle mailing lists.

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

Function Documentation

◆ check_for_mailing_list()

bool check_for_mailing_list ( struct AddressList *  al,
const char *  pfx,
char *  buf,
int  buflen 
)

Search list of addresses for a mailing list.

Parameters
alAddressList to search
pfxPrefix string
bufBuffer to store results
buflenBuffer length
Return values
1Mailing list found
0No list found

Search for a mailing list in the list of addresses pointed to by addr. If one is found, print pfx and the name of the list into buf.

Definition at line 78 of file maillist.c.

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}
const char * mutt_get_name(const struct Address *a)
Pick the best name to display from an address.
Definition: sort.c:139
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
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:743
An email address.
Definition: address.h:36
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ check_for_mailing_list_addr()

bool check_for_mailing_list_addr ( struct AddressList *  al,
char *  buf,
int  buflen 
)

Check an address list for a mailing list.

Parameters
alAddressList
bufBuffer for the result
buflenLength of buffer
Return values
trueMailing list found

If one is found, print the address of the list into buf.

Definition at line 102 of file maillist.c.

103{
104 struct Address *a = NULL;
105 TAILQ_FOREACH(a, al, entries)
106 {
108 {
109 if (buf && buflen)
110 snprintf(buf, buflen, "%s", buf_string(a->mailbox));
111 return true;
112 }
113 }
114 return false;
115}
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:96
struct Buffer * mailbox
Mailbox and host address.
Definition: address.h:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ first_mailing_list()

bool first_mailing_list ( char *  buf,
size_t  buflen,
struct AddressList *  al 
)

Get the first mailing list in the list of addresses.

Parameters
bufBuffer for the result
buflenLength of buffer
alAddressList
Return values
trueA mailing list was found

Definition at line 124 of file maillist.c.

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}
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:628
+ Here is the call graph for this function:
+ Here is the caller graph for this function: