Let ncurses deal with that properly.
[apps/madmutt.git] / remailer.c
index bfb66b1..137e5a4 100644 (file)
@@ -340,17 +340,13 @@ static const char *mix_format_caps (remailer_t * r)
  * %a  address
  *
  */
-static const char *mix_entry_fmt (char *dest,
-                                  ssize_t destlen,
-                                  char op,
-                                  const char *src,
-                                  const char *prefix,
-                                  const char *ifstring,
-                                  const char *elsestring,
-                                  unsigned long data, format_flag flags)
+static const char *
+mix_entry_fmt (char *dest, ssize_t destlen, char op, const char *src,
+               const char *prefix, const char *ifstr,
+               const char *elstr, anytype data, format_flag flags)
 {
     char fmt[16];
-    remailer_t *remailer = (remailer_t *) data;
+    remailer_t *remailer = data.ptr;
     int optional = (flags & M_FORMAT_OPTIONAL);
 
     switch (op) {
@@ -387,10 +383,9 @@ static const char *mix_entry_fmt (char *dest,
         *dest = '\0';
     }
 
-    if (optional)
-        m_strformat (dest, destlen, ifstring, mutt_attach_fmt, data, 0);
-    else if (flags & M_FORMAT_OPTIONAL)
-        m_strformat (dest, destlen, elsestring, mutt_attach_fmt, data, 0);
+    if (flags & M_FORMAT_OPTIONAL)
+        m_strformat(dest, destlen, 0, optional ? ifstr : elstr,
+                    mutt_attach_fmt, data, 0);
     return (src);
 }
 
@@ -399,11 +394,9 @@ static const char *mix_entry_fmt (char *dest,
 static void mix_entry (char *b, ssize_t blen, MUTTMENU * menu, int num)
 {
     remailer_t **type2_list = (remailer_t **) menu->data;
-    int w = (COLS-SW) > blen ? blen : (COLS-SW);
 
-    m_strformat(b, w, NONULL (MixEntryFormat), mix_entry_fmt,
-                (unsigned long) type2_list[num],
-                option(OPTARROWCURSOR) ? M_FORMAT_ARROWCURSOR : 0);
+    m_strformat(b, blen, COLS - SW, MixEntryFormat, mix_entry_fmt,
+                type2_list[num], 0);
 }
 
 static int mix_chain_add (mixchain_t * chain, const char *s,
@@ -434,16 +427,6 @@ static int mix_chain_add (mixchain_t * chain, const char *s,
     return 0;
 }
 
-static struct mapping_t RemailerHelp[] = {
-    {N_("Append"), OP_MIX_APPEND},
-    {N_("Insert"), OP_MIX_INSERT},
-    {N_("Delete"), OP_MIX_DELETE},
-    {N_("Abort"), OP_EXIT},
-    {N_("OK"), OP_MIX_USE},
-    {NULL, OP_NULL}
-};
-
-
 void mix_make_chain (string_list_t ** chainp, int *redraw)
 {
     string_list_t *p;
@@ -458,7 +441,6 @@ void mix_make_chain (string_list_t ** chainp, int *redraw)
     struct coord *coords = NULL;
 
     MUTTMENU *menu;
-    char helpstr[STRING];
     short loop = 1;
     int op;
 
@@ -494,8 +476,6 @@ void mix_make_chain (string_list_t ** chainp, int *redraw)
     menu->tag = NULL;
     menu->title = _("Select a remailer chain.");
     menu->data = type2_list;
-    menu->help =
-        mutt_compile_help (helpstr, sizeof (helpstr), MENU_MIX, RemailerHelp);
 
     m_len = menu->pagelen = MIX_VOFFSET - menu->offset - 1;