projects
/
apps
/
madmutt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Rocco Rutte:
[apps/madmutt.git]
/
compose.c
diff --git
a/compose.c
b/compose.c
index
a511eb4
..
f2afd32
100644
(file)
--- a/
compose.c
+++ b/
compose.c
@@
-23,10
+23,10
@@
#include "mime.h"
#include "attach.h"
#include "mapping.h"
#include "mime.h"
#include "attach.h"
#include "mapping.h"
-#include "mailbox.h"
#include "sort.h"
#include "charset.h"
#include "mx.h"
#include "sort.h"
#include "charset.h"
#include "mx.h"
+#include "buffy.h"
#include "compose.h"
#ifdef MIXMASTER
#include "compose.h"
#ifdef MIXMASTER
@@
-221,14
+221,14
@@
static void redraw_mix_line (LIST * chain)
if (t && t[0] == '0' && t[1] == '\0')
t = "<random>";
if (t && t[0] == '0' && t[1] == '\0')
t = "<random>";
- if (c + s
afe_str
len (t) + 2 >= COLS - SidebarWidth)
+ if (c + s
tr_
len (t) + 2 >= COLS - SidebarWidth)
break;
addstr (NONULL (t));
if (chain->next)
addstr (", ");
break;
addstr (NONULL (t));
if (chain->next)
addstr (", ");
- c += s
afe_str
len (t) + 2;
+ c += s
tr_
len (t) + 2;
}
}
#endif /* MIXMASTER */
}
}
#endif /* MIXMASTER */
@@
-563,7
+563,7
@@
int mutt_compose_menu (HEADER * msg, /* structure for new message */
ComposeHelp);
if (option (OPTMBOXPANE))
ComposeHelp);
if (option (OPTMBOXPANE))
-
mutt_
buffy_check (1);
+ buffy_check (1);
while (loop) {
#ifdef USE_NNTP
unset_option (OPTNEWS); /* for any case */
while (loop) {
#ifdef USE_NNTP
unset_option (OPTNEWS); /* for any case */
@@
-618,8
+618,8
@@
int mutt_compose_menu (HEADER * msg, /* structure for new message */
if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) == 0
&& buf[0]) {
FREE (&msg->env->newsgroups);
if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) == 0
&& buf[0]) {
FREE (&msg->env->newsgroups);
-
mutt_remove_trailing_
ws (buf);
- msg->env->newsgroups = s
afe_strdup (mutt_skip_whitespace
(buf));
+
str_skip_trail
ws (buf);
+ msg->env->newsgroups = s
tr_dup (str_skip_initws
(buf));
move (HDR_TO, HDR_XOFFSET);
clrtoeol ();
if (msg->env->newsgroups)
move (HDR_TO, HDR_XOFFSET);
clrtoeol ();
if (msg->env->newsgroups)
@@
-636,8
+636,8
@@
int mutt_compose_menu (HEADER * msg, /* structure for new message */
if (mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) == 0
&& buf[0]) {
FREE (&msg->env->followup_to);
if (mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) == 0
&& buf[0]) {
FREE (&msg->env->followup_to);
-
mutt_remove_trailing_
ws (buf);
- msg->env->followup_to = s
afe_strdup (mutt_skip_whitespace
(buf));
+
str_skip_trail
ws (buf);
+ msg->env->followup_to = s
tr_dup (str_skip_initws
(buf));
move (HDR_CC, HDR_XOFFSET);
clrtoeol ();
if (msg->env->followup_to)
move (HDR_CC, HDR_XOFFSET);
clrtoeol ();
if (msg->env->followup_to)
@@
-654,7
+654,7
@@
int mutt_compose_menu (HEADER * msg, /* structure for new message */
if (mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) == 0
&& buf[0]) {
FREE (&msg->env->x_comment_to);
if (mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) == 0
&& buf[0]) {
FREE (&msg->env->x_comment_to);
- msg->env->x_comment_to = s
afe_str
dup (buf);
+ msg->env->x_comment_to = s
tr_
dup (buf);
move (HDR_BCC, HDR_XOFFSET);
clrtoeol ();
if (msg->env->x_comment_to)
move (HDR_BCC, HDR_XOFFSET);
clrtoeol ();
if (msg->env->x_comment_to)
@@
-694,7
+694,7
@@
int mutt_compose_menu (HEADER * msg, /* structure for new message */
mutt_message_hook (NULL, msg, M_SEND2HOOK);
break;
case OP_COMPOSE_EDIT_MESSAGE:
mutt_message_hook (NULL, msg, M_SEND2HOOK);
break;
case OP_COMPOSE_EDIT_MESSAGE:
- if (Editor && (s
afe_str
cmp ("builtin", Editor) != 0)
+ if (Editor && (s
tr_
cmp ("builtin", Editor) != 0)
&& !option (OPTEDITHDRS)) {
mutt_edit_file (Editor, msg->content->filename);
mutt_update_encoding (msg->content);
&& !option (OPTEDITHDRS)) {
mutt_edit_file (Editor, msg->content->filename);
mutt_update_encoding (msg->content);
@@
-704,7
+704,7
@@
int mutt_compose_menu (HEADER * msg, /* structure for new message */
}
/* fall through */
case OP_COMPOSE_EDIT_HEADERS:
}
/* fall through */
case OP_COMPOSE_EDIT_HEADERS:
- if (s
afe_str
cmp ("builtin", Editor) != 0 &&
+ if (s
tr_
cmp ("builtin", Editor) != 0 &&
(op == OP_COMPOSE_EDIT_HEADERS ||
(op == OP_COMPOSE_EDIT_MESSAGE && option (OPTEDITHDRS)))) {
char *tag = NULL, *err = NULL;
(op == OP_COMPOSE_EDIT_HEADERS ||
(op == OP_COMPOSE_EDIT_MESSAGE && option (OPTEDITHDRS)))) {
char *tag = NULL, *err = NULL;
@@
-801,6
+801,7
@@
int mutt_compose_menu (HEADER * msg, /* structure for new message */
char *att = files[i];
idx[idxlen] = (ATTACHPTR *) safe_calloc (1, sizeof (ATTACHPTR));
char *att = files[i];
idx[idxlen] = (ATTACHPTR *) safe_calloc (1, sizeof (ATTACHPTR));
+ idx[idxlen]->unowned = 1;
idx[idxlen]->content = mutt_make_file_attach (att);
if (idx[idxlen]->content != NULL)
update_idx (menu, idx, idxlen++);
idx[idxlen]->content = mutt_make_file_attach (att);
if (idx[idxlen]->content != NULL)
update_idx (menu, idx, idxlen++);
@@
-863,13
+864,13
@@
int mutt_compose_menu (HEADER * msg, /* structure for new message */
#endif
mutt_expand_path (fname, sizeof (fname));
#ifdef USE_IMAP
#endif
mutt_expand_path (fname, sizeof (fname));
#ifdef USE_IMAP
- if (
!mx_is_imap (fname)
)
+ if (
mx_get_magic (fname) != M_IMAP
)
#endif
#ifdef USE_POP
#endif
#ifdef USE_POP
- if (
!mx_is_pop (fname)
)
+ if (
mx_get_magic (fname) != M_POP
)
#endif
#ifdef USE_NNTP
#endif
#ifdef USE_NNTP
- if (
!mx_is_nntp (fname)
&& !option (OPTNEWS))
+ if (
mx_get_magic (fname) != M_NNTP
&& !option (OPTNEWS))
#endif
/* check to make sure the file exists and is readable */
if (access (fname, R_OK) == -1) {
#endif
/* check to make sure the file exists and is readable */
if (access (fname, R_OK) == -1) {
@@
-954,6
+955,8
@@
int mutt_compose_menu (HEADER * msg, /* structure for new message */
case OP_DELETE:
CHECK_COUNT;
case OP_DELETE:
CHECK_COUNT;
+ if (idx[menu->current]->unowned)
+ idx[menu->current]->content->unlink = 0;
if (delete_attachment (menu, &idxlen, menu->current) == -1)
break;
mutt_update_tree (idx, idxlen);
if (delete_attachment (menu, &idxlen, menu->current) == -1)
break;
mutt_update_tree (idx, idxlen);
@@
-1278,6
+1281,8
@@
int mutt_compose_menu (HEADER * msg, /* structure for new message */
/* avoid freeing other attachments */
idx[idxlen]->content->next = NULL;
idx[idxlen]->content->parts = NULL;
/* avoid freeing other attachments */
idx[idxlen]->content->next = NULL;
idx[idxlen]->content->parts = NULL;
+ if (idx[idxlen]->unowned)
+ idx[idxlen]->content->unlink = 0;
mutt_free_body (&idx[idxlen]->content);
FREE (&idx[idxlen]->tree);
FREE (&idx[idxlen]);
mutt_free_body (&idx[idxlen]->content);
FREE (&idx[idxlen]->tree);
FREE (&idx[idxlen]);