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

Parse Alternate Commands. More...

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include "mutt/lib.h"
#include "address/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "alternates.h"
#include "parse/lib.h"
#include "module_data.h"
+ Include dependency graph for alternates.c:

Go to the source code of this file.

Functions

void mutt_alternates_reset (struct MailboxView *mv)
 Clear the recipient valid flag of all emails.
 
enum CommandResult parse_alternates (const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
 Parse the 'alternates' command - Implements Command::parse() -.
 
enum CommandResult parse_unalternates (const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
 Parse the 'unalternates' command - Implements Command::parse() -.
 
bool mutt_alternates_match (const char *addr)
 Compare an Address to the un/alternates lists.
 

Detailed Description

Parse Alternate Commands.

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

Function Documentation

◆ mutt_alternates_reset()

void mutt_alternates_reset ( struct MailboxView * mv)

Clear the recipient valid flag of all emails.

Parameters
mvMailbox view

Definition at line 45 of file alternates.c.

46{
47 if (!mv || !mv->mailbox)
48 return;
49
50 struct Mailbox *m = mv->mailbox;
51
52 for (int i = 0; i < m->msg_count; i++)
53 {
54 struct Email *e = m->emails[i];
55 if (!e)
56 break;
57 e->recip_valid = false;
58 }
59}
The envelope/body of an email.
Definition email.h:39
bool recip_valid
Is_recipient is valid.
Definition email.h:104
struct Mailbox * mailbox
Current Mailbox.
Definition mview.h:51
A mailbox.
Definition mailbox.h:78
int msg_count
Total number of messages.
Definition mailbox.h:87
struct Email ** emails
Array of Emails.
Definition mailbox.h:95
+ Here is the caller graph for this function:

◆ mutt_alternates_match()

bool mutt_alternates_match ( const char * addr)

Compare an Address to the un/alternates lists.

Parameters
addrAddress to check
Return values
trueAddress matches

Definition at line 163 of file alternates.c.

164{
165 if (!addr)
166 return false;
167
169 ASSERT(md);
170
171 if (mutt_regexlist_match(&md->alternates, addr))
172 {
173 mutt_debug(LL_DEBUG5, "yes, %s matched by alternates\n", addr);
174 if (mutt_regexlist_match(&md->unalternates, addr))
175 mutt_debug(LL_DEBUG5, "but, %s matched by unalternates\n", addr);
176 else
177 return true;
178 }
179
180 return false;
181}
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
@ LL_DEBUG5
Log at debug level 5.
Definition logging2.h:49
@ MODULE_ID_ALIAS
ModuleAlias, Alias
Definition module_api.h:48
bool mutt_regexlist_match(struct RegexList *rl, const char *str)
Does a string match any Regex in the list?
Definition regex.c:200
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:585
#define ASSERT(COND)
Definition signal2.h:59
Alias private Module data.
Definition module_data.h:33
struct RegexList unalternates
Regexes to exclude false matches in alternates.
Definition module_data.h:38
struct RegexList alternates
Regexes to match the user's alternate email addresses.
Definition module_data.h:37
Container for Accounts, Notifications.
Definition neomutt.h:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function: