X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=compose.c;h=377d60e8ae1a0b18da14468fa657dacb65f9c5b2;hp=cc4346d3b7887a399574eddb31a4e5b1fadedae8;hb=1abd265879dc5db7e9968a3b4ea7e2031e6b953e;hpb=c3e57678c8be193fc137854020f3a90887be97c9 diff --git a/compose.c b/compose.c index cc4346d..377d60e 100644 --- a/compose.c +++ b/compose.c @@ -3,6 +3,9 @@ * Copyright (C) 1996-2000 Michael R. Elkins * Copyright (C) 2004 g10 Code GmbH * + * Parts were written/modified by: + * Nico Golde + * * This file is part of mutt-ng, see http://www.muttng.org/. * It's licensed under the GNU General Public License, * please see the file GPL in the top level source directory. @@ -20,10 +23,11 @@ #include "mime.h" #include "attach.h" #include "mapping.h" -#include "mailbox.h" #include "sort.h" #include "charset.h" #include "mx.h" +#include "buffy.h" +#include "compose.h" #ifdef MIXMASTER #include "remailer.h" @@ -33,6 +37,10 @@ #include "nntp.h" #endif +#include "lib/mem.h" +#include "lib/intl.h" +#include "lib/str.h" + #include #include #include @@ -428,10 +436,6 @@ static unsigned long cum_attachs_size (MUTTMENU * menu) return s; } -/* prototype for use below */ -static void compose_status_line (char *buf, size_t buflen, MUTTMENU * menu, - const char *p); - /* * compose_format_str() * @@ -559,7 +563,7 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ ComposeHelp); if (option (OPTMBOXPANE)) - mutt_buffy_check (1); + buffy_check (1); while (loop) { #ifdef USE_NNTP unset_option (OPTNEWS); /* for any case */ @@ -614,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); - mutt_remove_trailing_ws (buf); - msg->env->newsgroups = safe_strdup (mutt_skip_whitespace (buf)); + str_skip_trailws (buf); + msg->env->newsgroups = safe_strdup (str_skip_initws (buf)); move (HDR_TO, HDR_XOFFSET); clrtoeol (); if (msg->env->newsgroups) @@ -632,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); - mutt_remove_trailing_ws (buf); - msg->env->followup_to = safe_strdup (mutt_skip_whitespace (buf)); + str_skip_trailws (buf); + msg->env->followup_to = safe_strdup (str_skip_initws (buf)); move (HDR_CC, HDR_XOFFSET); clrtoeol (); if (msg->env->followup_to) @@ -665,7 +669,7 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ else buf[0] = 0; if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) { - mutt_str_replace (&msg->env->subject, buf); + str_replace (&msg->env->subject, buf); move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth); clrtoeol (); if (msg->env->subject) @@ -859,13 +863,13 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ #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 - if (!mx_is_pop (fname)) + if (mx_get_magic (fname) != M_POP) #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) { @@ -994,7 +998,7 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ idx[menu->current]->content->description : "", sizeof (buf)); /* header names should not be translated */ if (mutt_get_field ("Description: ", buf, sizeof (buf), 0) == 0) { - mutt_str_replace (&idx[menu->current]->content->description, buf); + str_replace (&idx[menu->current]->content->description, buf); menu->redraw = REDRAW_CURRENT; } mutt_message_hook (NULL, msg, M_SEND2HOOK); @@ -1142,7 +1146,7 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ if (mutt_rename_file (idx[menu->current]->content->filename, fname)) break; - mutt_str_replace (&idx[menu->current]->content->filename, fname); + str_replace (&idx[menu->current]->content->filename, fname); menu->redraw = REDRAW_CURRENT; if (idx[menu->current]->content->stamp >= st.st_mtime) @@ -1204,7 +1208,7 @@ int mutt_compose_menu (HEADER * msg, /* structure for new message */ update_idx (menu, idx, idxlen++); idx[menu->current]->content->type = itype; - mutt_str_replace (&idx[menu->current]->content->subtype, p); + str_replace (&idx[menu->current]->content->subtype, p); idx[menu->current]->content->unlink = 1; menu->redraw |= REDRAW_INDEX | REDRAW_STATUS;