NeoMutt  2025-12-11-980-ge38c27
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 674 of file alias.c.

675{
676 if (!ptr || !*ptr)
677 return;
678
679 struct Alias *alias = *ptr;
680
681 mutt_debug(LL_NOTIFY, "NT_ALIAS_DELETE: %s\n", alias->name);
682 struct EventAlias ev_a = { alias };
684
685 FREE(&alias->name);
686 FREE(&alias->comment);
689
690 FREE(ptr);
691}
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition address.c:1475
#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 662 of file alias.c.

663{
664 struct Alias *a = MUTT_MEM_CALLOC(1, struct Alias);
665 TAILQ_INIT(&a->addr);
666 STAILQ_INIT(&a->tags);
667 return a;
668}
#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 699 of file alias.c.

700{
701 if (!aa)
702 return;
703
704 struct Alias **ap = NULL;
705 ARRAY_FOREACH(ap, aa)
706 {
707 alias_free(ap);
708 }
709 ARRAY_FREE(aa);
710}
void alias_free(struct Alias **ptr)
Free an Alias.
Definition alias.c:674
#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