if (err) {
mutt_error(_("error creating gpgme context: %s\n"),
gpgme_strerror(err));
- sleep(2);
+ mutt_sleep(2);
mutt_exit(1);
}
if (!for_smime)
err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_CMS);
if (err) {
mutt_error(_("error enabling CMS protocol: %s\n"), gpgme_strerror(err));
- sleep(2);
+ mutt_sleep(2);
mutt_exit(1);
}
return ctx;
if (err) {
mutt_error(_("error creating gpgme data object: %s\n"),
gpgme_strerror(err));
- sleep(2);
+ mutt_sleep(2);
mutt_exit(1);
}
return data;
}
}
+static char *crypt_hook(address_t *adr)
+{
+ char *res = NULL;
+ lua_State *L = luaM_getruntime();
+ lua_getglobal(L, "mod_core"); /* push mod_core 1 */
+ lua_getfield(L, -1, "crypt_hook"); /* push folder_hook() 2 */
+ if (lua_isfunction(L, -1)) {
+ lua_pushstring(L, adr->mailbox);
+ if (!lua_pcall(L, 1, 1, 0)) {
+ res = m_strdup(lua_tostring(L, -1));
+ }
+ lua_pop(L, 1);
+ }
+ lua_pop(L, 2);
+ return res;
+}
+
/* This routine attempts to find the keyids of the recipients of a
message. It returns NULL if any of the keys can not be found. */
static char *find_keys(ENVELOPE *env, unsigned int app)
while ((addr = address_list_pop(&lst))) {
char buf[STRING];
int forced_valid = 0;
- const char *keyID;
+ char *keyID;
cryptkey_t *key = NULL;
- if ((keyID = mutt_crypt_hook(addr))) {
+ if ((keyID = crypt_hook(addr))) {
int r;
snprintf(buf, sizeof(buf), _("Use keyID = \"%s\" for %s?"), keyID,
address_list_wipe(&lst);
address_list_wipe(&addr);
buffer_delete(&keylist);
+ p_delete(&keyID);
return NULL;
}
}
}
}
+ p_delete(&keyID);
if (!key) {
key = crypt_getkeybyaddr(addr, KEYFLAG_CANENCRYPT, app, &forced_valid);
prev_sb = sb;
mutt_message (_("Waiting for fcntl lock... %d"), ++attempt);
- sleep (1);
+ mutt_sleep (1);
}
#endif /* USE_FCNTL */
prev_sb = sb;
mutt_message (_("Waiting for flock attempt... %d"), ++attempt);
- sleep (1);
+ mutt_sleep (1);
}
#endif /* USE_FLOCK */
if (read_msgs && quadoption (OPT_MOVE) != M_NO) {
char *p;
- if ((p = mutt_find_hook (M_MBOXHOOK, ctx->path))) {
- isSpool = 1;
- m_strcpy(mbox, sizeof(mbox), p);
- }
- else {
- m_strcpy(mbox, sizeof(mbox), NONULL(Inbox));
- isSpool = mutt_is_spool (ctx->path) && !mutt_is_spool (mbox);
- }
+ m_strcpy(mbox, sizeof(mbox), NONULL(Inbox));
+ isSpool = mutt_is_spool (ctx->path) && !mutt_is_spool (mbox);
mutt_expand_path (mbox, sizeof (mbox));
if (isSpool) {
* please see the file GPL in the top level source directory.
*/
+ extern const char *madmutt_version;
/* use the m_temp{fd,file} functions instead */
void mutt_adv_mktemp (const char*, char*, ssize_t) __attribute__((deprecated));
ssize_t _mutt_expand_path(char *, ssize_t, const char *, int);
#define mutt_expand_path(s, n) _mutt_expand_path((s), (n), (s), 0)
-char *mutt_find_hook (int, const char *);
char *mutt_get_body_charset (char *, ssize_t, BODY *);
const char *mutt_get_name (address_t *);
-const char *mutt_crypt_hook (address_t *);
char *mutt_make_date (char *, ssize_t);
- const char *mutt_make_version(void);
-
const char *mutt_fqdn (short);
void mutt_add_to_reference_headers (ENVELOPE * env, ENVELOPE * curenv,
void mutt_print_message (HEADER *);
void mutt_safe_path (char *s, ssize_t l, address_t * a);
void mutt_save_path (char *s, ssize_t l, address_t * a);
-void mutt_select_fcc (char *, ssize_t, HEADER *);
void mutt_message_hook (CONTEXT *, HEADER *, int);
void _mutt_set_flag (CONTEXT *, HEADER *, int, int, int);
void mutt_stamp_attachment (BODY * a);
void mutt_tag_set_flag (int, int);
void mutt_update_encoding (BODY * a);
- void mutt_version (void);
void mutt_write_references (string_list_t *, FILE *);
void mutt_write_address_list (address_t * adr, FILE * fp, int linelen,
int display);
int mutt_prepare_template (FILE *, CONTEXT *, HEADER *, HEADER *, short);
int mutt_resend_message (FILE *, CONTEXT *, HEADER *);
-int mutt_get_hook_type (const char *);
int mutt_get_postponed (CONTEXT *, HEADER *, HEADER **, char *, ssize_t);
int mutt_invoke_mta (address_t *, address_t *, address_t *, address_t *, const char *,
int);
int mutt_num_postponed (int);
int mutt_parse_bind (BUFFER *, BUFFER *, unsigned long, BUFFER *);
int mutt_parse_exec (BUFFER *, BUFFER *, unsigned long, BUFFER *);
-int mutt_parse_hook (BUFFER *, BUFFER *, unsigned long, BUFFER *);
int mutt_parse_macro (BUFFER *, BUFFER *, unsigned long, BUFFER *);
int mutt_parse_push (BUFFER *, BUFFER *, unsigned long, BUFFER *);
int mutt_parse_rc_line (const char *, BUFFER *, BUFFER *);
-int mutt_parse_unhook (BUFFER *, BUFFER *, unsigned long, BUFFER *);
int _mutt_save_message (HEADER *, CONTEXT *, int, int, int);
int mutt_save_message (HEADER *, int, int, int, int *);
int mutt_search_command (int, int);
}
else {
mutt_error (_("Ignoring $strip_was: Subject would be empty."));
- sleep (2);
+ mutt_sleep (2);
}
}
if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) != 0 || (!buf[0]
killfrom = 1; /* no need to check $use_from because if the user specified
a from address it would have already been set by now */
}
- mutt_select_fcc (fcc, sizeof (fcc), msg);
+ m_strcpy(fcc, sizeof(fcc), NONULL(MAlias.record));
+ mutt_pretty_mailbox(fcc);
if (killfrom) {
address_list_wipe(&msg->env->from);
killfrom = 0;
if (quadoption (OPT_ATTACH) == M_YES) {
mutt_message _("No attachments made but indicator found in text. "
"Abort sending.");
- sleep (2);
+ mutt_sleep (2);
}
mutt_message (_("Mail not sent."));
goto main_loop;