NeoMutt  2024-04-16-36-g75b6fb
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
alternates.h File Reference

Alternate address handling. More...

#include <stdbool.h>
#include <stdint.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

void alternates_init (void)
 Set up the alternates lists.
 
void alternates_cleanup (void)
 Free the alternates lists.
 
enum CommandResult parse_alternates (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 Parse the 'alternates' command - Implements Command::parse() -.
 
enum CommandResult parse_unalternates (struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
 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

Alternate address handling.

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 40 of file alternates.h.

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

Function Documentation

◆ alternates_init()

void alternates_init ( void  )

Set up the alternates lists.

Definition at line 60 of file alternates.c.

61{
63 return;
64
67}
static struct Notify * AlternatesNotify
Notifications: NotifyAlternates.
Definition: alternates.c:44
struct Notify * notify_new(void)
Create a new notifications handler.
Definition: notify.c:62
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition: notify.c:95
Container for Accounts, Notifications.
Definition: neomutt.h:41
struct Notify * notify
Notifications handler.
Definition: neomutt.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alternates_cleanup()

void alternates_cleanup ( void  )

Free the alternates lists.

Definition at line 49 of file alternates.c.

50{
52
55}
static struct RegexList Alternates
List of regexes to match the user's alternate email addresses.
Definition: alternates.c:42
static struct RegexList UnAlternates
List of regexes to exclude false matches in Alternates.
Definition: alternates.c:43
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition: notify.c:75
void mutt_regexlist_free(struct RegexList *rl)
Free a RegexList object.
Definition: regex.c:179
+ Here is the call graph for this function:
+ 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 155 of file alternates.c.

156{
157 if (!addr)
158 return false;
159
161 {
162 mutt_debug(LL_DEBUG5, "yes, %s matched by alternates\n", addr);
164 mutt_debug(LL_DEBUG5, "but, %s matched by unalternates\n", addr);
165 else
166 return true;
167 }
168
169 return false;
170}
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
@ LL_DEBUG5
Log at debug level 5.
Definition: logging2.h:47
bool mutt_regexlist_match(struct RegexList *rl, const char *str)
Does a string match any Regex in the list?
Definition: regex.c:200
+ 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 73 of file alternates.c.

74{
75 if (!mv || !mv->mailbox)
76 return;
77
78 struct Mailbox *m = mv->mailbox;
79
80 for (int i = 0; i < m->msg_count; i++)
81 {
82 struct Email *e = m->emails[i];
83 if (!e)
84 break;
85 e->recip_valid = false;
86 }
87}
The envelope/body of an email.
Definition: email.h:39
bool recip_valid
Is_recipient is valid.
Definition: email.h:107
struct Mailbox * mailbox
Current Mailbox.
Definition: mview.h:51
A mailbox.
Definition: mailbox.h:79
int msg_count
Total number of messages.
Definition: mailbox.h:88
struct Email ** emails
Array of Emails.
Definition: mailbox.h:96
+ Here is the caller graph for this function: