NeoMutt  2020-11-20
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_NEW = 1, NT_ALIAS_CHANGED, NT_ALIAS_DELETED }
 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.

Enumerator
NT_ALIAS_NEW 

A new Alias has been created.

NT_ALIAS_CHANGED 

An Alias has been changed.

NT_ALIAS_DELETED 

An Alias is about to be deleted.

Definition at line 49 of file alias.h.

50 {
51  NT_ALIAS_NEW = 1,
54 };
An Alias has been changed.
Definition: alias.h:52
A new Alias has been created.
Definition: alias.h:51
An Alias is about to be deleted.
Definition: alias.h:53

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 619 of file alias.c.

620 {
621  if (!ptr || !*ptr)
622  return;
623 
624  struct Alias *alias = *ptr;
625 
626  struct EventAlias ea = { alias };
628 
629  FREE(&alias->name);
630  FREE(&alias->comment);
631  mutt_addrlist_clear(&(alias->addr));
632  FREE(ptr);
633 }
A shortcut for an email address or addresses.
Definition: alias.h:33
char * name
Short name.
Definition: alias.h:35
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition: address.c:1468
Alias has changed, NotifyAlias, EventAlias.
Definition: notify_type.h:44
An alias-change event.
Definition: alias.h:59
Container for Accounts, Notifications.
Definition: neomutt.h:36
char * comment
Free-form comment string.
Definition: alias.h:37
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
An Alias is about to be deleted.
Definition: alias.h:53
#define FREE(x)
Definition: memory.h:40
struct AddressList addr
List of Addresses the Alias expands to.
Definition: alias.h:36
bool notify_send(struct Notify *notify, enum NotifyType event_type, int event_subtype, void *event_data)
Send out a notification message.
Definition: notify.c:152
+ 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 639 of file alias.c.

640 {
641  struct Alias *np = NULL, *tmp = NULL;
642  TAILQ_FOREACH_SAFE(np, al, entries, tmp)
643  {
644  TAILQ_REMOVE(al, np, entries);
645  alias_free(&np);
646  }
647  TAILQ_INIT(al);
648 }
A shortcut for an email address or addresses.
Definition: alias.h:33
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:728
#define TAILQ_INIT(head)
Definition: queue.h:758
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:834
void alias_free(struct Alias **ptr)
Free an Alias.
Definition: alias.c:619
+ 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 608 of file alias.c.

609 {
610  struct Alias *a = mutt_mem_calloc(1, sizeof(struct Alias));
611  TAILQ_INIT(&a->addr);
612  return a;
613 }
A shortcut for an email address or addresses.
Definition: alias.h:33
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
#define TAILQ_INIT(head)
Definition: queue.h:758
struct AddressList addr
List of Addresses the Alias expands to.
Definition: alias.h:36
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ Aliases

struct AliasList Aliases

List of all the user's email aliases.

Definition at line 55 of file alias.c.