X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=alias.cpkg;h=c4e739e687210c036f4582ffda010c07034d98ac;hp=b6b1dbe809f08beab2935355773370403ff7bbe4;hb=569145d4875fd59719a1a3a7d2c7d64d622eacd1;hpb=2dc50decd320b310ef56c14041b6fa4fefd865ac diff --git a/alias.cpkg b/alias.cpkg index b6b1dbe..c4e739e 100644 --- a/alias.cpkg +++ b/alias.cpkg @@ -38,9 +38,106 @@ #include "sort.h" @import "lib-lua/base.cpkg" -@static_package MAlias { +static rx_t *Alternates = NULL, *UnAlternates = NULL; +rx_t *MailLists = NULL, *UnMailLists = NULL; +rx_t *SubscribedLists = NULL, *UnSubscribedLists = NULL; + +@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"); - path_t alias_file = m_strdup("~/.madmutt/aliases"); + /* + ** .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"); + + /* + ** .pp + ** Specifies the filename of your signature, which is appended to all + ** outgoing messages. If the filename ends with a pipe (``\fT|\fP''), it is + ** assumed that filename is a shell command and input should be read from + ** its stdout. + */ + path_t signature = m_strdup("~/.signature"); + + /* + ** .pp + ** This specifies the file into which your outgoing messages should be + ** appended. (This is meant as the primary method for saving a copy of + ** your messages, but another way to do this is using the ``$my_hdr'' + ** command to create a \fTBcc:\fP header field with your email address in it.) + ** .pp + ** The value of \fI$$record\fP is overridden by the ``$$force_name'' and + ** ``$$save_name'' variables, and the ``$fcc-hook'' command. + */ + path_t record = NULL; + + /* + ** .pp + ** This variable contains a default from address. It + ** can be overridden using my_hdr (including from send-hooks) and + ** ``$$reverse_name''. This variable is ignored if ``$$use_from'' + ** is unset. + ** .pp + ** E.g. you can use + ** \fTsend-hook Madmutt-devel@lists.berlios.de 'my_hdr From: Foo Bar '\fP + ** when replying to the Madmutt developer's mailing list and Madmutt takes this email address. + ** .pp + ** Defaults to the contents of the environment variable \fT$$$EMAIL\fP. + */ + address_t from = rfc822_parse_adrlist(NULL, NONULL(getenv("EMAIL"))); + + 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; @@ -111,10 +208,10 @@ 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))) + || (MAlias.from && !ascii_strcasecmp(MAlias.from->mailbox, addr->mailbox))) { return 1; } @@ -357,7 +454,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)); }