NeoMutt  2025-12-11-911-gd8d604
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 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:663
#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:

◆ 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:81
int msg_count
Total number of messages.
Definition mailbox.h:90
struct Email ** emails
Array of Emails.
Definition mailbox.h:98
+ Here is the caller graph for this function: