static struct {
unsigned short type;
- void (*opt_to_string) (char* dst, ssize_t dstlen, struct option_t* option);
- int (*opt_from_string) (struct option_t* dst, const char* val,
+ void (*opt_tostr) (char* dst, ssize_t dstlen, struct option_t* option);
+ int (*opt_fromstr) (struct option_t* dst, const char* val,
char* errbuf, ssize_t errlen);
} FuncTable[] = {
{ 0, NULL, NULL }, /* there's no DT_ type with 0 */
return (0);
}
tmp = p_new(char, dstlen+1);
- FuncTable[DTYPE (option->type)].opt_to_string (tmp, dstlen, option);
+ FuncTable[DTYPE(option->type)].opt_tostr (tmp, dstlen, option);
/* as we get things of type $var=value and don't want to bloat the
* above "just" for expansion, we do the stripping here */
return -1;
}
-static int parse_ifdef (BUFFER * tmp, BUFFER * s, unsigned long data,
- BUFFER * err)
-{
- int i, j;
- unsigned long res = 0;
- BUFFER token;
- struct option_t* option = NULL;
-
- p_clear(&token, 1);
- mutt_extract_token (tmp, s, 0);
-
- /* is the item defined as a variable or a function? */
- if ((option = hash_find (ConfigOptions, tmp->data)) != NULL)
- res = 1;
- else {
- for (i = 0; !res && i < MENU_MAX; i++) {
- struct binding_t *b = km_get_table (Menus[i].value);
-
- if (!b)
- continue;
-
- for (j = 0; b[j].name; j++)
- if (!ascii_strncasecmp (tmp->data, b[j].name, m_strlen(tmp->data))
- && (m_strlen(b[j].name) == m_strlen(tmp->data))) {
- res = 1;
- break;
- }
- }
- }
- /* check for feature_* */
- if (!res && ascii_strncasecmp (tmp->data, "feature_", 8) == 0 &&
- (j = m_strlen(tmp->data)) > 8) {
- i = 0;
- while (Features[i]) {
- if (m_strlen(Features[i]) == j-8 &&
- ascii_strncasecmp (Features[i], tmp->data+8, j-8) == 0) {
- res = 1;
- break;
- }
- i++;
- }
- }
-
- if (!MoreArgs (s)) {
- if (data)
- snprintf (err->data, err->dsize, _("ifdef: too few arguments"));
- else
- snprintf (err->data, err->dsize, _("ifndef: too few arguments"));
- return (-1);
- }
-
- mutt_extract_token (tmp, s, M_TOKEN_SPACE);
-
- if (data == res) {
- if (mutt_parse_rc_line (tmp->data, &token, err) == -1) {
- mutt_error ("Error: %s", err->data);
- p_delete(&token.data);
- return (-1);
- }
- p_delete(&token.data);
- }
- return 0;
-}
-
static int parse_unignore (BUFFER * buf, BUFFER * s,
unsigned long data __attribute__ ((unused)),
BUFFER * err __attribute__ ((unused)))
add_to_list (&UnIgnore, buf->data);
remove_from_list (&Ignore, buf->data);
- }
- while (MoreArgs (s));
+ } while (MoreArgs (s));
return 0;
}
mutt_extract_token (buf, s, 0);
remove_from_list (&UnIgnore, buf->data);
add_to_list (&Ignore, buf->data);
- }
- while (MoreArgs (s));
-
+ } while (MoreArgs(s));
return 0;
}
do {
mutt_extract_token (buf, s, 0);
add_to_list ((string_list_t **) data, buf->data);
- }
- while (MoreArgs (s));
-
+ } while (MoreArgs(s));
return 0;
}
return;
ptr = hash_find(ConfigOptions, (const char *)ptr->data);
}
- if (!ptr || *ptr->init || !FuncTable[DTYPE (ptr->type)].opt_from_string)
+ if (!ptr || *ptr->init || !FuncTable[DTYPE (ptr->type)].opt_fromstr)
return;
mutt_option_value(ptr->option, buf, sizeof(buf));
}
if (!ptr)
return;
- if (FuncTable[DTYPE (ptr->type)].opt_from_string) {
+ if (FuncTable[DTYPE (ptr->type)].opt_fromstr) {
init_expand (&init, ptr);
- if (!FuncTable[DTYPE (ptr->type)].opt_from_string (ptr, init, errbuf,
+ if (!FuncTable[DTYPE (ptr->type)].opt_fromstr (ptr, init, errbuf,
sizeof(errbuf))) {
if (!option (OPTNOCURSES))
mutt_endwin (NULL);
set_option (OPTREDRAWTREE);
return (0);
}
- else if (!FuncTable[DTYPE (option->type)].opt_from_string) {
+ else if (!FuncTable[DTYPE (option->type)].opt_fromstr) {
snprintf (err->data, err->dsize, _("$%s is read-only"), option->option);
r = -1;
break;
DTYPE (option->type) == DT_SYS) {
if (unset) {
CHECK_PAGER;
- if (!FuncTable[DTYPE (option->type)].opt_from_string) {
+ if (!FuncTable[DTYPE (option->type)].opt_fromstr) {
snprintf (err->data, err->dsize, _("$%s is read-only"),
option->option);
r = -1;
}
if (query || *s->dptr != '=') {
- FuncTable[DTYPE (option->type)].opt_to_string
+ FuncTable[DTYPE (option->type)].opt_tostr
(err->data, err->dsize, option);
break;
}
/* the $madmutt_ variables are read-only */
- if (!FuncTable[DTYPE (option->type)].opt_from_string) {
+ if (!FuncTable[DTYPE (option->type)].opt_fromstr) {
snprintf (err->data, err->dsize, _("$%s is read-only"),
option->option);
r = -1;
CHECK_PAGER;
s->dptr++;
mutt_extract_token (tmp, s, 0);
- if (!FuncTable[DTYPE (option->type)].opt_from_string
+ if (!FuncTable[DTYPE (option->type)].opt_fromstr
(option, tmp->data, err->data, err->dsize))
r = -1;
}
}
printf("set ");
- FuncTable[DTYPE(option->type)].opt_to_string
- (buf, sizeof(buf), option);
+ FuncTable[DTYPE(option->type)].opt_tostr(buf, sizeof(buf), option);
printf ("%s\n", buf);
}
** will be saved for later references. Also see ``$$record'',
** ``$$save_name'', ``$$force_name'' and ``$fcc-hook''.
*/
-
{"crypt_use_gpgme", DT_BOOL, R_NONE, OPTCRYPTUSEGPGME, "no" },
/*
** .pp
** \fBNote\fP: You need to use this option in your \fT.madmuttrc\fP configuration
** file as it won't have any effect when used interactively.
*/
-
{"crypt_autopgp", DT_BOOL, R_NONE, OPTCRYPTAUTOPGP, "yes" },
/*
** .pp
** checked with the check-traditional-pgp function, Madmutt will automatically
** check the message for traditional pgp.
*/
-
/* XXX Default values! */
{"pgp_decode_command", DT_STR, R_NONE, UL &PgpDecodeCommand, "" },
/*
** regardless of the file's permissions.
*/
{"smtp_envelope", DT_SYN, R_NONE, UL "envelope_from_address", 0 },
-
{"smtp_host", DT_STR, R_NONE, UL &SmtpHost, "" },
/*
** .pp
{ NULL, -1, R_NONE, -1, NULL }
};
-static const char* Features[] = {
-#ifdef NCURSES_VERSION
- "ncurses",
-#endif
-#ifdef USE_SLANG_CURSES
- "slang",
-#endif
-#ifdef _LIBICONV_VERSION
- "iconv",
-#endif
-#ifdef HAVE_LIBIDN
- "idn",
-#endif
-#ifdef USE_NNTP
- "nntp",
-#endif
-#ifdef USE_SSL
- "ssl",
-#endif
-#ifdef USE_GNUTLS
- "gnutls",
-#endif
-#ifdef USE_SASL
- "sasl",
-#endif
-#ifdef USE_LIBESMTP
- "libesmtp",
-#endif
-#ifdef CRYPT_BACKEND_GPGME
- "gpgme",
-#endif
-#ifdef USE_HCACHE
- "header_cache",
-#endif
-#ifdef HAVE_QDBM
- "qdbm",
-#endif
-#ifdef HAVE_GDBM
- "gdbm",
-#endif
-#ifdef HAVE_DB4
- "db4",
-#endif
- /* last */
- NULL
-};
-
const struct mapping_t SortMethods[] = {
- {"date", SORT_DATE},
- {"date-sent", SORT_DATE},
- {"date-received", SORT_RECEIVED},
- {"mailbox-order", SORT_ORDER},
- {"subject", SORT_SUBJECT},
- {"from", SORT_FROM},
- {"size", SORT_SIZE},
- {"threads", SORT_THREADS},
- {"to", SORT_TO},
- {"score", SORT_SCORE},
- {"spam", SORT_SPAM},
- {NULL, 0}
+ {"date", SORT_DATE},
+ {"date-sent", SORT_DATE},
+ {"date-received", SORT_RECEIVED},
+ {"mailbox-order", SORT_ORDER},
+ {"subject", SORT_SUBJECT},
+ {"from", SORT_FROM},
+ {"size", SORT_SIZE},
+ {"threads", SORT_THREADS},
+ {"to", SORT_TO},
+ {"score", SORT_SCORE},
+ {"spam", SORT_SPAM},
+ {NULL, 0}
};
/* same as SortMethods, but with "threads" replaced by "date" */
const struct mapping_t SortAuxMethods[] = {
- {"date", SORT_DATE},
- {"date-sent", SORT_DATE},
- {"date-received", SORT_RECEIVED},
- {"mailbox-order", SORT_ORDER},
- {"subject", SORT_SUBJECT},
- {"from", SORT_FROM},
- {"size", SORT_SIZE},
- {"threads", SORT_DATE}, /* note: sort_aux == threads
- * isn't possible.
- */
- {"to", SORT_TO},
- {"score", SORT_SCORE},
- {"spam", SORT_SPAM},
- {NULL, 0}
+ {"date", SORT_DATE},
+ {"date-sent", SORT_DATE},
+ {"date-received", SORT_RECEIVED},
+ {"mailbox-order", SORT_ORDER},
+ {"subject", SORT_SUBJECT},
+ {"from", SORT_FROM},
+ {"size", SORT_SIZE},
+ {"threads", SORT_DATE}, /* note: sort_aux == threads
+ * isn't possible.
+ */
+ {"to", SORT_TO},
+ {"score", SORT_SCORE},
+ {"spam", SORT_SPAM},
+ {NULL, 0}
};
const struct mapping_t SortBrowserMethods[] = {
- {"alpha", SORT_SUBJECT},
- {"date", SORT_DATE},
- {"size", SORT_SIZE},
- {"unsorted", SORT_ORDER},
- {NULL, 0}
+ {"alpha", SORT_SUBJECT},
+ {"date", SORT_DATE},
+ {"size", SORT_SIZE},
+ {"unsorted", SORT_ORDER},
+ {NULL, 0}
};
const struct mapping_t SortAliasMethods[] = {
- {"alias", SORT_ALIAS},
- {"address", SORT_ADDRESS},
- {"unsorted", SORT_ORDER},
- {NULL, 0}
+ {"alias", SORT_ALIAS},
+ {"address", SORT_ADDRESS},
+ {"unsorted", SORT_ORDER},
+ {NULL, 0}
};
const struct mapping_t SortKeyMethods[] = {
- {"address", SORT_ADDRESS},
- {"date", SORT_DATE},
- {"keyid", SORT_KEYID},
- {"trust", SORT_TRUST},
- {NULL, 0}
+ {"address", SORT_ADDRESS},
+ {"date", SORT_DATE},
+ {"keyid", SORT_KEYID},
+ {"trust", SORT_TRUST},
+ {NULL, 0}
};
static int parse_unlists (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_alias (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_unalias (BUFFER *, BUFFER *, unsigned long, BUFFER *);
-static int parse_ifdef (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_ignore (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_unignore (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_source (BUFFER *, BUFFER *, unsigned long, BUFFER *);
static int parse_unalternates (BUFFER *, BUFFER *, unsigned long, BUFFER *);
struct command_t {
- const char *name;
- int (*func) (BUFFER *, BUFFER *, unsigned long, BUFFER *);
- unsigned long data;
+ const char *name;
+ int (*func) (BUFFER *, BUFFER *, unsigned long, BUFFER *);
+ unsigned long data;
};
struct command_t Commands[] = {
- {"alternates", parse_alternates, 0},
- {"attachments", parse_attachments, 0 },
- {"unattachments",parse_unattachments,0 },
- {"unalternates", parse_unalternates, 0},
- {"account-hook", mutt_parse_hook, M_ACCOUNTHOOK},
- {"alias", parse_alias, 0},
- {"auto_view", parse_list, UL &AutoViewList},
- {"alternative_order", parse_list, UL &AlternativeOrderList},
- {"bind", mutt_parse_bind, 0},
- {"charset-hook", mutt_parse_hook, M_CHARSETHOOK},
- {"color", mutt_parse_color, 0},
- {"uncolor", mutt_parse_uncolor, 0},
- {"exec", mutt_parse_exec, 0},
- {"fcc-hook", mutt_parse_hook, M_FCCHOOK},
- {"fcc-save-hook", mutt_parse_hook, M_FCCHOOK|M_SAVEHOOK},
- {"folder-hook", mutt_parse_hook, M_FOLDERHOOK},
- {"open-hook", mutt_parse_hook, M_OPENHOOK},
- {"close-hook", mutt_parse_hook, M_CLOSEHOOK},
- {"append-hook", mutt_parse_hook, M_APPENDHOOK},
- {"hdr_order", parse_list, UL &HeaderOrderList},
- {"ifdef", parse_ifdef, 1},
- {"ifndef", parse_ifdef, 0},
+ {"account-hook", mutt_parse_hook, M_ACCOUNTHOOK},
+ {"alias", parse_alias, 0},
+ {"alternates", parse_alternates, 0},
+ {"alternative_order", parse_list, UL &AlternativeOrderList},
+ {"append-hook", mutt_parse_hook, M_APPENDHOOK},
+ {"attachments", parse_attachments, 0 },
+ {"auto_view", parse_list, UL &AutoViewList},
+ {"bind", mutt_parse_bind, 0},
+ {"charset-hook", mutt_parse_hook, M_CHARSETHOOK},
+ {"close-hook", mutt_parse_hook, M_CLOSEHOOK},
+ {"color", mutt_parse_color, 0},
+ {"exec", mutt_parse_exec, 0},
+ {"fcc-hook", mutt_parse_hook, M_FCCHOOK},
+ {"fcc-save-hook", mutt_parse_hook, M_FCCHOOK|M_SAVEHOOK},
+ {"folder-hook", mutt_parse_hook, M_FOLDERHOOK},
+ {"hdr_order", parse_list, UL &HeaderOrderList},
+ {"open-hook", mutt_parse_hook, M_OPENHOOK},
+ {"unalternates", parse_unalternates, 0},
+ {"unattachments", parse_unattachments, 0},
+ {"uncolor", mutt_parse_uncolor, 0},
#ifdef HAVE_ICONV
- {"iconv-hook", mutt_parse_hook, M_ICONVHOOK},
+ {"iconv-hook", mutt_parse_hook, M_ICONVHOOK},
#endif
- {"ignore", parse_ignore, 0},
- {"lists", parse_lists, 0},
- {"macro", mutt_parse_macro, 0},
- {"mailboxes", buffy_parse_mailboxes, M_MAILBOXES},
- {"unmailboxes", buffy_parse_mailboxes, M_UNMAILBOXES},
- {"message-hook", mutt_parse_hook, M_MESSAGEHOOK},
- {"mbox-hook", mutt_parse_hook, M_MBOXHOOK},
- {"mime_lookup", parse_list, UL &MimeLookupList},
- {"unmime_lookup", parse_unlist, UL &MimeLookupList},
- {"mono", mutt_parse_mono, 0},
- {"my_hdr", parse_my_hdr, 0},
- {"pgp-hook", mutt_parse_hook, M_CRYPTHOOK},
- {"crypt-hook", mutt_parse_hook, M_CRYPTHOOK},
- {"push", mutt_parse_push, 0},
- {"reply-hook", mutt_parse_hook, M_REPLYHOOK},
- {"reset", parse_set, M_SET_RESET},
- {"save-hook", mutt_parse_hook, M_SAVEHOOK},
- {"score", mutt_parse_score, 0},
- {"send-hook", mutt_parse_hook, M_SENDHOOK},
- {"send2-hook", mutt_parse_hook, M_SEND2HOOK},
- {"set", parse_set, 0},
- {"source", parse_source, 0},
- {"spam", parse_spam_list, M_SPAM},
- {"nospam", parse_spam_list, M_NOSPAM},
- {"subscribe", parse_subscribe, 0},
- {"toggle", parse_set, M_SET_INV},
- {"unalias", parse_unalias, 0},
- {"unalternative_order", parse_unlist, UL &AlternativeOrderList},
- {"unauto_view", parse_unlist, UL &AutoViewList},
- {"unhdr_order", parse_unlist, UL &HeaderOrderList},
- {"unhook", mutt_parse_unhook, 0},
- {"unignore", parse_unignore, 0},
- {"unlists", parse_unlists, 0},
- {"unmono", mutt_parse_unmono, 0},
- {"unmy_hdr", parse_unmy_hdr, 0},
- {"unscore", mutt_parse_unscore, 0},
- {"unset", parse_set, M_SET_UNSET},
- {"unsubscribe", parse_unsubscribe, 0},
- {NULL, NULL, 0}
+ {"crypt-hook", mutt_parse_hook, M_CRYPTHOOK},
+ {"ignore", parse_ignore, 0},
+ {"lists", parse_lists, 0},
+ {"macro", mutt_parse_macro, 0},
+ {"mailboxes", buffy_parse_mailboxes, M_MAILBOXES},
+ {"mbox-hook", mutt_parse_hook, M_MBOXHOOK},
+ {"message-hook", mutt_parse_hook, M_MESSAGEHOOK},
+ {"mime_lookup", parse_list, UL &MimeLookupList},
+ {"mono", mutt_parse_mono, 0},
+ {"my_hdr", parse_my_hdr, 0},
+ {"nospam", parse_spam_list, M_NOSPAM},
+ {"pgp-hook", mutt_parse_hook, M_CRYPTHOOK},
+ {"push", mutt_parse_push, 0},
+ {"reply-hook", mutt_parse_hook, M_REPLYHOOK},
+ {"reset", parse_set, M_SET_RESET},
+ {"save-hook", mutt_parse_hook, M_SAVEHOOK},
+ {"score", mutt_parse_score, 0},
+ {"send2-hook", mutt_parse_hook, M_SEND2HOOK},
+ {"send-hook", mutt_parse_hook, M_SENDHOOK},
+ {"set", parse_set, 0},
+ {"source", parse_source, 0},
+ {"spam", parse_spam_list, M_SPAM},
+ {"subscribe", parse_subscribe, 0},
+ {"toggle", parse_set, M_SET_INV},
+ {"unalias", parse_unalias, 0},
+ {"unalternative_order", parse_unlist, UL &AlternativeOrderList},
+ {"unauto_view", parse_unlist, UL &AutoViewList},
+ {"unhdr_order", parse_unlist, UL &HeaderOrderList},
+ {"unhook", mutt_parse_unhook, 0},
+ {"unignore", parse_unignore, 0},
+ {"unlists", parse_unlists, 0},
+ {"unmailboxes", buffy_parse_mailboxes, M_UNMAILBOXES},
+ {"unmime_lookup", parse_unlist, UL &MimeLookupList},
+ {"unmono", mutt_parse_unmono, 0},
+ {"unmy_hdr", parse_unmy_hdr, 0},
+ {"unscore", mutt_parse_unscore, 0},
+ {"unset", parse_set, M_SET_UNSET},
+ {"unsubscribe", parse_unsubscribe, 0},
+ {NULL, NULL, 0}
};