NeoMutt  2023-03-22-27-g3cb248
Teaching an old dog new tricks
DOXYGEN
alias.h File Reference

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

#include "mutt/lib.h"
#include "address/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

 TAILQ_HEAD (AliasList, Alias)
 
void alias_free (struct Alias **ptr)
 Free an Alias. More...
 
void aliaslist_free (struct AliasList *al)
 Free a List of Aliases. More...
 
struct Aliasalias_new (void)
 Create a new Alias. More...
 

Variables

struct AliasList Aliases
 List of all the user's email aliases. More...
 

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 52 of file alias.h.

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

Function Documentation

◆ TAILQ_HEAD()

TAILQ_HEAD ( AliasList  ,
Alias   
)

◆ alias_free()

void alias_free ( struct Alias **  ptr)

Free an Alias.

Parameters
[out]ptrAlias to free

Definition at line 641 of file alias.c.

642{
643 if (!ptr || !*ptr)
644 return;
645
646 struct Alias *alias = *ptr;
647
648 mutt_debug(LL_NOTIFY, "NT_ALIAS_DELETE: %s\n", alias->name);
649 struct EventAlias ev_a = { alias };
651
652 FREE(&alias->name);
653 FREE(&alias->comment);
655 FREE(ptr);
656}
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition: address.c:1443
#define mutt_debug(LEVEL,...)
Definition: logging.h:84
@ LL_NOTIFY
Log of notifications.
Definition: logging.h:45
#define FREE(x)
Definition: memory.h:43
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:171
@ NT_ALIAS
Alias has changed, NotifyAlias, EventAlias.
Definition: notify_type.h:37
A shortcut for an email address or addresses.
Definition: alias.h:34
char * comment
Free-form comment string.
Definition: alias.h:37
char * name
Short name.
Definition: alias.h:35
struct AddressList addr
List of Addresses the Alias expands to.
Definition: alias.h:36
An alias-change event.
Definition: alias.h:64
struct Alias * alias
Alias that changed.
Definition: alias.h:65
Container for Accounts, Notifications.
Definition: neomutt.h:37
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ aliaslist_free()

void aliaslist_free ( struct AliasList *  al)

Free a List of Aliases.

Parameters
alAliasList to free

Definition at line 662 of file alias.c.

663{
664 if (!al)
665 return;
666
667 struct Alias *np = NULL, *tmp = NULL;
668 TAILQ_FOREACH_SAFE(np, al, entries, tmp)
669 {
670 TAILQ_REMOVE(al, np, entries);
671 alias_free(&np);
672 }
673 TAILQ_INIT(al);
674}
void alias_free(struct Alias **ptr)
Free an Alias.
Definition: alias.c:641
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:735
#define TAILQ_INIT(head)
Definition: queue.h:765
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:841
+ 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 630 of file alias.c.

631{
632 struct Alias *a = mutt_mem_calloc(1, sizeof(struct Alias));
633 TAILQ_INIT(&a->addr);
634 return a;
635}
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ Aliases

struct AliasList Aliases
extern

List of all the user's email aliases.

Definition at line 58 of file alias.c.