X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=alias.cpkg;h=bab4a4993cbbe201750dd32ef36db0742bfdaa3d;hp=424adda4794bacd8a8a0baec6ea114f90c078792;hb=b6980caf7b13994c57957872876cdecc21e54a82;hpb=1410cfc03a04ccce7aac48a62f9d465ab341cef1 diff --git a/alias.cpkg b/alias.cpkg index 424adda..bab4a49 100644 --- a/alias.cpkg +++ b/alias.cpkg @@ -36,40 +36,35 @@ #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 = { - .push = luaM_path_post($$); - .kind = 's'; - .ctype = char *; - .dtor = p_delete($$); - .ctor = m_strdup($$); -}; - -@type quadopt_t = { - .kind = 'i'; - .check = luaM_checkquadopt($L, $$); - .ctype = unsigned : 2; +@import "lib-lua/base.cpkg" + +@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"); }; -static @package MAlias { - path_t alias_format = m_strdup("%4n %2f %t %-10a %r"); -} MAlias; - -char *AliasFile; alias_t *Aliases; -rx_t GecosMask; #define RSORT(x) (SortAlias & SORT_REVERSE) ? -x : x @@ -137,7 +132,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))) @@ -311,7 +306,7 @@ void mutt_create_alias(ENVELOPE *cur, address_t *iadr) alias_list_push(&Aliases, new); - m_strcpy(buf, sizeof(buf), NONULL(AliasFile)); + m_strcpy(buf, sizeof(buf), NONULL(MAlias.alias_file)); if (mutt_get_field(_("Save to file: "), buf, sizeof(buf), M_FILE)) { return; } @@ -374,7 +369,7 @@ static address_t *mutt_expand_aliases_r(address_t *a, string_list_t **expn) if (pw) { char namebuf[STRING]; - mutt_gecos_name(namebuf, sizeof(namebuf), pw, GecosMask.rx); + mutt_gecos_name(namebuf, sizeof(namebuf), pw, MCore.gecos_mask); m_strreplace(&pop->personal, namebuf); } } @@ -383,7 +378,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)); }