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

Parse Alternate Commands. More...

#include <stdbool.h>
#include "core/lib.h"
+ Include dependency graph for alternates.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  NotifyAlternates { NT_ALTERN_ADD = 1 , NT_ALTERN_DELETE , NT_ALTERN_DELETE_ALL }
 Alternates command notification types. More...
 

Functions

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.
 
void mutt_alternates_reset (struct MailboxView *mv)
 Clear the recipient valid flag of all emails.
 

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

Enumeration Type Documentation

◆ NotifyAlternates

Alternates command notification types.

Observers of NT_ALTERN will not be passed any Event data.

Note
Notifications are sent after the event.
Enumerator
NT_ALTERN_ADD 

Alternate address has been added.

NT_ALTERN_DELETE 

Alternate address has been deleted.

NT_ALTERN_DELETE_ALL 

All Alternate addresses have been deleted.

Definition at line 41 of file alternates.h.

42{
43 NT_ALTERN_ADD = 1,
46};
@ NT_ALTERN_ADD
Alternate address has been added.
Definition alternates.h:43
@ NT_ALTERN_DELETE
Alternate address has been deleted.
Definition alternates.h:44
@ NT_ALTERN_DELETE_ALL
All Alternate addresses have been deleted.
Definition alternates.h:45

Function Documentation

◆ 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:

◆ 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: