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

Representation of a single alias to an email address. More...

#include "mutt/lib.h"
#include "address/lib.h"
#include "email/lib.h"
+ Include dependency graph for alias.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Alias
 A shortcut for an email address or addresses. More...
 
struct  EventAlias
 An alias-change event. More...
 

Enumerations

enum  NotifyAlias { NT_ALIAS_ADD = 1 , NT_ALIAS_DELETE , NT_ALIAS_DELETE_ALL , NT_ALIAS_CHANGE }
 Alias notification types. More...
 

Functions

 ARRAY_HEAD (AliasArray, struct Alias *)
 
void alias_free (struct Alias **ptr)
 Free an Alias.
 
struct Aliasalias_new (void)
 Create a new Alias.
 
void aliaslist_clear (struct AliasArray *aa)
 Empty a List of Aliases.
 

Variables

struct AliasArray Aliases
 

Detailed Description

Representation of a single alias to an email address.

Authors
  • Richard Russon
  • Pietro Cerutti

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

Enumeration Type Documentation

◆ NotifyAlias

Alias notification types.

Observers of NT_ALIAS will be passed an EventAlias.

Note
Delete notifications are sent before the object is deleted.
Other notifications are sent after the event.
Enumerator
NT_ALIAS_ADD 

Alias has been added.

NT_ALIAS_DELETE 

Alias is about to be deleted.

NT_ALIAS_DELETE_ALL 

All Aliases are about to be deleted.

NT_ALIAS_CHANGE 

Alias has been changed.

Definition at line 53 of file alias.h.

54{
55 NT_ALIAS_ADD = 1,
59};
@ NT_ALIAS_DELETE_ALL
All Aliases are about to be deleted.
Definition alias.h:57
@ NT_ALIAS_ADD
Alias has been added.
Definition alias.h:55
@ NT_ALIAS_CHANGE
Alias has been changed.
Definition alias.h:58
@ NT_ALIAS_DELETE
Alias is about to be deleted.
Definition alias.h:56

Function Documentation

◆ ARRAY_HEAD()

ARRAY_HEAD ( AliasArray ,
struct Alias *  )

◆ alias_free()

void alias_free ( struct Alias ** ptr)

Free an Alias.

Parameters
[out]ptrAlias to free

Definition at line 673 of file alias.c.

674{
675 if (!ptr || !*ptr)
676 return;
677
678 struct Alias *alias = *ptr;
679
680 mutt_debug(LL_NOTIFY, "NT_ALIAS_DELETE: %s\n", alias->name);
681 struct EventAlias ev_a = { alias };
683
684 FREE(&alias->name);
685 FREE(&alias->comment);
688
689 FREE(ptr);
690}
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition address.c:1464
#define mutt_debug(LEVEL,...)
Definition logging2.h:91
@ LL_NOTIFY
Log of notifications.
Definition logging2.h:50
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition notify.c:173
@ NT_ALIAS
Alias has changed, NotifyAlias, EventAlias.
Definition notify_type.h:37
A shortcut for an email address or addresses.
Definition alias.h:35
struct TagList tags
Tags.
Definition alias.h:39
char * comment
Free-form comment string.
Definition alias.h:38
char * name
Short name.
Definition alias.h:36
struct AddressList addr
List of Addresses the Alias expands to.
Definition alias.h:37
An alias-change event.
Definition alias.h:65
struct Alias * alias
Alias that changed.
Definition alias.h:66
Container for Accounts, Notifications.
Definition neomutt.h:41
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
void driver_tags_free(struct TagList *tl)
Free tags from a header.
Definition tags.c:132
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ alias_new()

struct Alias * alias_new ( void )

Create a new Alias.

Return values
ptrNewly allocated Alias

Free the result with alias_free()

Definition at line 661 of file alias.c.

662{
663 struct Alias *a = MUTT_MEM_CALLOC(1, struct Alias);
664 TAILQ_INIT(&a->addr);
665 STAILQ_INIT(&a->tags);
666 return a;
667}
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
#define STAILQ_INIT(head)
Definition queue.h:410
#define TAILQ_INIT(head)
Definition queue.h:822
+ Here is the caller graph for this function:

◆ aliaslist_clear()

void aliaslist_clear ( struct AliasArray * aa)

Empty a List of Aliases.

Parameters
aaAliasArray to empty

Each Alias will be freed and the AliasArray will be left empty.

Definition at line 698 of file alias.c.

699{
700 if (!aa)
701 return;
702
703 struct Alias **ap = NULL;
704 ARRAY_FOREACH(ap, aa)
705 {
706 alias_free(ap);
707 }
708 ARRAY_FREE(aa);
709}
void alias_free(struct Alias **ptr)
Free an Alias.
Definition alias.c:673
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition array.h:223
#define ARRAY_FREE(head)
Release all memory.
Definition array.h:209
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ Aliases

struct AliasArray Aliases
extern