X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=compose.c;h=f2afd32f58d81f5f43764bfb0024842bfa3d08b6;hb=a8477ebaa09990b3688164cbe5cf661c4189541d;hp=9dc603d36d27aba25b7b3a2b4eac75fd8c739446;hpb=93f817273e1c70071cd5471594600bc70f12f0ff;p=apps%2Fmadmutt.git diff --git a/compose.c b/compose.c index 9dc603d..f2afd32 100644 --- a/compose.c +++ b/compose.c @@ -221,14 +221,14 @@ static void redraw_mix_line (LIST * chain) if (t && t[0] == '0' && t[1] == '\0') t = ""; - if (c + safe_strlen (t) + 2 >= COLS - SidebarWidth) + if (c + str_len (t) + 2 >= COLS - SidebarWidth) break; addstr (NONULL (t)); if (chain->next) addstr (", "); - c += safe_strlen (t) + 2; + c += str_len (t) + 2; } } #endif /* MIXMASTER */ @@ -619,7 +619,7 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ && buf[0]) { FREE (&msg->env->newsgroups); str_skip_trailws (buf); - msg->env->newsgroups = safe_strdup (str_skip_initws (buf)); + msg->env->newsgroups = str_dup (str_skip_initws (buf)); move (HDR_TO, HDR_XOFFSET); clrtoeol (); if (msg->env->newsgroups) @@ -637,7 +637,7 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ && buf[0]) { FREE (&msg->env->followup_to); str_skip_trailws (buf); - msg->env->followup_to = safe_strdup (str_skip_initws (buf)); + msg->env->followup_to = str_dup (str_skip_initws (buf)); 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); - msg->env->x_comment_to = safe_strdup (buf); + msg->env->x_comment_to = str_dup (buf); 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: - if (Editor && (safe_strcmp ("builtin", Editor) != 0) + if (Editor && (str_cmp ("builtin", Editor) != 0) && !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: - if (safe_strcmp ("builtin", Editor) != 0 && + if (str_cmp ("builtin", Editor) != 0 && (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)); + idx[idxlen]->unowned = 1; idx[idxlen]->content = mutt_make_file_attach (att); if (idx[idxlen]->content != NULL) update_idx (menu, idx, idxlen++); @@ -954,6 +955,8 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ 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); @@ -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; + if (idx[idxlen]->unowned) + idx[idxlen]->content->unlink = 0; mutt_free_body (&idx[idxlen]->content); FREE (&idx[idxlen]->tree); FREE (&idx[idxlen]);