NeoMutt  2025-12-11-769-g906513
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 "group.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 46 of file alternates.c.

47{
48 if (!mv || !mv->mailbox)
49 return;
50
51 struct Mailbox *m = mv->mailbox;
52
53 for (int i = 0; i < m->msg_count; i++)
54 {
55 struct Email *e = m->emails[i];
56 if (!e)
57 break;
58 e->recip_valid = false;
59 }
60}
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 164 of file alternates.c.

165{
166 if (!addr)
167 return false;
168
170 ASSERT(mod_data);
171
172 if (mutt_regexlist_match(&mod_data->alternates, addr))
173 {
174 mutt_debug(LL_DEBUG5, "yes, %s matched by alternates\n", addr);
175 if (mutt_regexlist_match(&mod_data->unalternates, addr))
176 mutt_debug(LL_DEBUG5, "but, %s matched by unalternates\n", addr);
177 else
178 return true;
179 }
180
181 return false;
182}
#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:665
#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:39
struct RegexList alternates
Regexes to match the user's alternate email addresses.
Definition module_data.h:38
Container for Accounts, Notifications.
Definition neomutt.h:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function: