NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
DOXYGEN
alias.h File Reference
#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 };

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

629 {
630  if (!ptr || !*ptr)
631  return;
632 
633  struct Alias *alias = *ptr;
634 
635  struct EventAlias ea = { alias };
637 
638  FREE(&alias->name);
639  FREE(&alias->comment);
641  FREE(ptr);
642 }
+ 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 648 of file alias.c.

649 {
650  struct Alias *np = NULL, *tmp = NULL;
651  TAILQ_FOREACH_SAFE(np, al, entries, tmp)
652  {
653  TAILQ_REMOVE(al, np, entries);
654  alias_free(&np);
655  }
656  TAILQ_INIT(al);
657 }
+ 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 617 of file alias.c.

618 {
619  struct Alias *a = mutt_mem_calloc(1, sizeof(struct Alias));
620  TAILQ_INIT(&a->addr);
621  return a;
622 }
+ 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.

TAILQ_INIT
#define TAILQ_INIT(head)
Definition: queue.h:758
mutt_mem_calloc
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
Alias::addr
struct AddressList addr
List of Addresses the Alias expands to.
Definition: alias.h:36
NeoMutt::notify
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
FREE
#define FREE(x)
Definition: memory.h:40
alias_free
void alias_free(struct Alias **ptr)
Free an Alias.
Definition: alias.c:628
NT_ALIAS_CHANGED
@ NT_ALIAS_CHANGED
An Alias has been changed.
Definition: alias.h:52
EventAlias
An alias-change event.
Definition: alias.h:59
notify_send
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
TAILQ_REMOVE
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:834
mutt_addrlist_clear
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition: address.c:1468
TAILQ_FOREACH_SAFE
#define TAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:728
Alias::name
char * name
Short name.
Definition: alias.h:35
NT_ALIAS_NEW
@ NT_ALIAS_NEW
A new Alias has been created.
Definition: alias.h:51
EventAlias::alias
struct Alias * alias
Definition: alias.h:61
NT_ALIAS_DELETED
@ NT_ALIAS_DELETED
An Alias is about to be deleted.
Definition: alias.h:53
Alias::comment
char * comment
Free-form comment string.
Definition: alias.h:37
NeoMutt
Container for Accounts, Notifications.
Definition: neomutt.h:36
NT_ALIAS
@ NT_ALIAS
Alias has changed, NotifyAlias, EventAlias.
Definition: notify_type.h:44
Alias
A shortcut for an email address or addresses.
Definition: alias.h:33