X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=alias.cpkg;h=d1b536cbdf6d783c060c8930f5f70f70f0f3700d;hp=6e33e2949f5cc0053b46d00e6804d36a01d20a28;hb=c9f72ab0cd65f517a2047feb942ad85025c1b7e8;hpb=8a0902af903a4cac207b842efd548d892f9df0d0 diff --git a/alias.cpkg b/alias.cpkg index 6e33e29..d1b536c 100644 --- a/alias.cpkg +++ b/alias.cpkg @@ -36,36 +36,73 @@ #include "alias.h" #include "mutt_idna.h" #include "sort.h" - -@type bool = { - .kind = 'b'; - .ctype = unsigned : 1; -}; - -@type string_t = { - .kind = 's'; - .ctype = char *; - .dtor = p_delete($$); - .ctor = m_strdup($$); -}; - -@type path_t = { - .kind = 's'; - .ctype = char *; - .dtor = p_delete($$); - .ctor = luaM_pathnew($$); -}; - -@type quadopt_t = { - .kind = 'i'; - .check = luaM_checkquadopt($L, $$); - .ctype = unsigned : 2; -}; - -static @package MAlias { +@import "lib-lua/base.cpkg" + +static rx_t *Alternates = NULL, *UnAlternates = NULL; +rx_t *MailLists = NULL, *UnMailLists = NULL; +rx_t *SubscribedLists = NULL, *UnSubscribedLists = NULL; + +@static_package MAlias { + /* + ** .pp + ** Specifies the format of the data displayed for the ``alias'' menu. The + ** following \fTprintf(3)\fP-style sequences are available: + ** .pp + ** .dl + ** .dt %a .dd alias name + ** .dt %f .dd flags - currently, a "d" for an alias marked for deletion + ** .dt %n .dd index number + ** .dt %r .dd address which alias expands to + ** .dt %t .dd character which indicates if the alias is tagged for inclusion + ** .de + */ string_t alias_format = m_strdup("%4n %2f %t %-10a %r"); + /* + ** .pp + ** The default file in which to save aliases created by the + ** ``$create-alias'' function. + ** .pp + ** \fBNote:\fP Madmutt will not automatically source this file; you must + ** explicitly use the ``$source'' command for it to be executed. + */ path_t alias_file = m_strdup("~/.madmutt/aliases"); -} MAlias; + + void alternates(rx_t rx) { + rx_list_remove(&UnAlternates, rx); + rx_list_add(&Alternates, rx); + RETURN(); + }; + void unalternates(rx_t rx) { + rx_list_remove(&Alternates, rx); + rx_list_add(&UnAlternates, rx); + RETURN(); + }; + + void lists(rx_t rx) { + rx_list_remove(&UnMailLists, rx); + rx_list_add(&MailLists, rx); + RETURN(); + }; + void unlists(rx_t rx) { + rx_list_remove(&MailLists, rx); + rx_list_remove(&SubscribedLists, rx); + rx_list_add(&UnMailLists, rx); + RETURN(); + }; + + void subscribe(rx_t rx) { + rx_list_remove(&UnMailLists, rx); + rx_list_remove(&UnSubscribedLists, rx); + rx_list_add(&MailLists, rx); + rx_list_add(&SubscribedLists, rx_dup(rx)); + RETURN(); + }; + void unsubscribe(rx_t rx) { + rx_list_remove(&SubscribedLists, rx); + rx_list_add(&UnSubscribedLists, rx); + RETURN(); + }; +}; alias_t *Aliases; @@ -135,7 +172,7 @@ int mutt_addr_is_user(address_t *addr) return 0; if (!ascii_strcasecmp(addr->mailbox, MCore.username) - || string_is_address(addr->mailbox, MCore.username, Hostname) + || string_is_address(addr->mailbox, MCore.username, MCore.shorthost) || string_is_address(addr->mailbox, MCore.username, mutt_fqdn(0)) || string_is_address(addr->mailbox, MCore.username, mutt_fqdn(1)) || (From && !ascii_strcasecmp(From->mailbox, addr->mailbox))) @@ -381,7 +418,7 @@ static address_t *mutt_expand_aliases_r(address_t *a, string_list_t **expn) last = address_list_append(last, pop); } - if (option(OPTUSEDOMAIN)) { + if (MCore.use_domain) { /* now qualify all local addresses */ rfc822_qualify(head, mutt_fqdn(1)); }