NeoMutt  2025-12-11-435-g4ac674
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
maillist.c File Reference

Handle mailing lists. More...

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include "mutt/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "maillist.h"
#include "address.h"
#include "muttlib.h"
+ Include dependency graph for maillist.c:

Go to the source code of this file.

Functions

bool mutt_is_mail_list (const struct Address *addr)
 Is this the email address of a mailing list?
 
bool mutt_is_subscribed_list (const struct Address *addr)
 Is this the email address of a user-subscribed 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.
 
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 (struct AddressList *al, struct Buffer *buf)
 Get the first mailing list in the list of addresses.
 

Detailed Description

Handle mailing lists.

Authors
  • Richard Russon
  • Anna Figueiredo Gomes

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.c.

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 85 of file maillist.c.

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}
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_subscribed_list(const struct Address *addr)
Is this the email address of a user-subscribed mailing list?
Definition maillist.c:60
#define TAILQ_FOREACH(var, head, field)
Definition queue.h:782
An email address.
Definition address.h:35
+ 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 109 of file maillist.c.

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

◆ first_mailing_list()

bool first_mailing_list ( struct AddressList * al,
struct Buffer * buf )

Get the first mailing list in the list of addresses.

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

Definition at line 130 of file maillist.c.

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}
void generate_save_path(struct Buffer *dest, const struct Address *a)
Make a safe filename from an email address.
Definition muttlib.c:607
+ Here is the call graph for this function:
+ Here is the caller graph for this function: