NeoMutt  2021-02-05-666-ge300cd
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 };
All Aliases are about to be deleted.
Definition: alias.h:56
Alias is about to be deleted.
Definition: alias.h:55
Alias has been added.
Definition: alias.h:54
Alias has been changed.
Definition: alias.h:57

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

630 {
631  if (!ptr || !*ptr)
632  return;
633 
634  struct Alias *alias = *ptr;
635 
636  mutt_debug(LL_NOTIFY, "NT_ALIAS_DELETE: %s\n", alias->name);
637  struct EventAlias ev_a = { alias };
639 
640  FREE(&alias->name);
641  FREE(&alias->comment);
642  mutt_addrlist_clear(&(alias->addr));
643  FREE(ptr);
644 }
A shortcut for an email address or addresses.
Definition: alias.h:33
char * name
Short name.
Definition: alias.h:35
Log of notifications.
Definition: logging.h:45
void mutt_addrlist_clear(struct AddressList *al)
Unlink and free all Address in an AddressList.
Definition: address.c:1470
Alias has changed, NotifyAlias, EventAlias.
Definition: notify_type.h:35
An alias-change event.
Definition: alias.h:63
Container for Accounts, Notifications.
Definition: neomutt.h:36
Alias is about to be deleted.
Definition: alias.h:55
char * comment
Free-form comment string.
Definition: alias.h:37
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
#define mutt_debug(LEVEL,...)
Definition: logging.h:85
#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:171
+ 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 650 of file alias.c.

651 {
652  struct Alias *np = NULL, *tmp = NULL;
653  TAILQ_FOREACH_SAFE(np, al, entries, tmp)
654  {
655  TAILQ_REMOVE(al, np, entries);
656  alias_free(&np);
657  }
658  TAILQ_INIT(al);
659 }
A shortcut for an email address or addresses.
Definition: alias.h:33
#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
void alias_free(struct Alias **ptr)
Free an Alias.
Definition: alias.c:629
+ 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 618 of file alias.c.

619 {
620  struct Alias *a = mutt_mem_calloc(1, sizeof(struct Alias));
621  TAILQ_INIT(&a->addr);
622  return a;
623 }
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:765
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 57 of file alias.c.