1. 09 May, 2016 1 commit
    • Derek Martin's avatar
      Change M_* symbols to MUTT_* · 9cafb05c
      Derek Martin authored
      Changeset 23334e967dd7 created a workaround for a namespace conflict
      with Solaris and derivatives.  After some discussion, the team decided
      it would be best to move away from using the "M_" prefix for macros.
      
      This patch was automatically generated by running:
        perl -wpi -e 's/\bM_(\w+)\b/MUTT_$1/g' `find . -name '*.[ch]' -print`
      with the exception that sys_socket.h was exempted.  (That file will
      be backed out subsequent to this commit.)
      
      Thanks to Andras Salamon for supplying the perl script used to make
      this change.
      9cafb05c
  2. 03 May, 2016 2 commits
  3. 30 Apr, 2016 7 commits
  4. 28 Apr, 2016 11 commits
    • Kevin J. McCarthy's avatar
      Add cols parameter to mutt_FormatString() · c9223a12
      Kevin J. McCarthy authored
      Continuing with the conversion to using windows for screen drawing,
      mutt_FormatString() was directly using COLS for right justification
      and similar formatting.  Instead pass in a parameter, cols.
      
      This change involved seeding the parameter through callback functions
      too, as many of them call mutt_FormatString() back.
      c9223a12
    • Kevin J. McCarthy's avatar
      Fix remaining direct usages of COLS/LINES to use mutt window functions. · c8bd1537
      Kevin J. McCarthy authored
      Most of these were just message update/clearing.
      c8bd1537
    • Kevin J. McCarthy's avatar
      Change remailer to use mutt windows. · af5fc526
      Kevin J. McCarthy authored
      af5fc526
    • Kevin J. McCarthy's avatar
      Modify the built-in editor to use windows. · 47d8372d
      Kevin J. McCarthy authored
      This only involved changing to use the MuttMessageWindow.
      47d8372d
    • Kevin J. McCarthy's avatar
      Modify the compose screen to use windows. · c119acb2
      Kevin J. McCarthy authored
      The header field positions enum is now started at 0: the windows
      compute the relative positioning as needed.  A small improvement from
      this is that the headers now align with the top: there isn't a gap if
      $help is turned off.
      c119acb2
    • Kevin J. McCarthy's avatar
      Modify the pager to use windows. · 746bc982
      Kevin J. McCarthy authored
      The pager view is somewhat complex, due to the "mini-index" and the
      positioning of the index_status vs pager_status changes depending on
      $status_on_top as well as $pager_index_lines and $help.
      
      To make things simpler, it creates four "pager windows":
      index_status_window, index_window, pager_status_window, pager_window.
      
      mutt_term_width() is renamed to mutt_window_wrap_cols() and a
      mutt_window_t parameter passed in.
      
      Also, the pager drawing loop calling display_line() has a
      mutt_window_move() added to move to the beginning of the next line
      each time.  This is in case the pager_window isn't flush with the left
      side of the terminal.
      746bc982
    • Kevin J. McCarthy's avatar
      Modify the index to use windows. · f6aa2e79
      Kevin J. McCarthy authored
      Change the index screen to use MuttIndexWindow and MuttStatusWindow.
      f6aa2e79
    • Kevin J. McCarthy's avatar
      Modify enter.c routines to use windows. · f9410a05
      Kevin J. McCarthy authored
      This modifies the mutt_enter_string() functions to use MuttMessageWindow.
      
      Thanks to Richard Russon for pointing out slang doesn't support getcurx.
      f9410a05
    • Kevin J. McCarthy's avatar
      Modify the curs_lib.c to use windows. · fc903027
      Kevin J. McCarthy authored
      This changes some of the "prompting" routines to use the MuttMessageWindow.
      fc903027
    • Kevin J. McCarthy's avatar
      Modify the menu code to use windows. · 26b9d967
      Kevin J. McCarthy authored
      Change menu.c to use the mutt_window_t structures and functions.  The
      index/stats/help/message window pointers are stored inside the menu_t.
      This is useful for the pager, where the "index" we want to use is a
      mini-index.
      26b9d967
    • Kevin J. McCarthy's avatar
      Add window structures to use for screen layout. · 79728dfe
      Kevin J. McCarthy authored
      This is a series of 11 patches, centralizing Mutt screen drawing
      inside windows (mutt_window_t structures).
      
      Currently, the screen drawing and cursor positioning logic is
      distributed all over the code, resulting in many files having the same
      logic of where the help, status, message windows are.  Additionally,
      the code directly uses move and mvadd*/mvprint* functions, which means
      if the layouts are changed, the row/column computation logic needs to
      be changed all over the place.
      
      The patch creates a (very simple) mutt_window_t structure and
      functions for moving, addch/str/printw, along with clearing the line.
      The windows keep track of where they are on the screen, allowing the
      Mutt code to simply position elements relative to the window.
      
      During curses initalization, and when the window is resized, the
      window sizes and positions and recomputed.  Also, a new option flags,
      R_REFLOW is added for options that need to force a reflow when they are changed.
      
      Thanks to Richard Russon for pointing out the slang compilation issue.
      79728dfe
  5. 27 Apr, 2016 2 commits
    • Kevin J. McCarthy's avatar
      merge stable · 1f27a844
      Kevin J. McCarthy authored
      1f27a844
    • Kevin J. McCarthy's avatar
      Create a wrapper sys_socket.h to work around Solaris namespace issues. (closes #3833) · de228267
      Kevin J. McCarthy authored
      Solaris includes "sys/stream.h" inside their "sys/socket.h".  This
      include file adds many non-reserved macros to Mutt's namespace, two of
      which conflict with existing Mutt macros.
      
      The simplest fix would be to rename those macros in Mutt, however this
      will cause difficulty with out-of-tree patches.  This fix creates a
      wrapper include file that preserves those existing macros and prevents
      the Solaris values from entering Mutt's namespace.
      de228267
  6. 14 Apr, 2016 4 commits
    • Kevin J. McCarthy's avatar
      Fix soft-padding available columns computation. · 152046db
      Kevin J. McCarthy authored
      If arrow_cursor is set, it's possible that COLS < offset.  Compute
      avail_cols, floored at 0, and use that instead.
      152046db
    • Kevin J. McCarthy's avatar
      Fix right justify buffer-truncated pad calculation in mutt_FormatString() · b55540e6
      Kevin J. McCarthy authored
      Vincent Lefèvre noted that the computation had implementation defined
      behavior and was potentially incorrect.
      
      Change to make sure the subtraction won't lead to a wrap-around, and
      set pad to 0 in that case.
      b55540e6
    • Kevin J. McCarthy's avatar
      Pre-space softfill multi-column padding. · 88a81b94
      Kevin J. McCarthy authored
      Similar to the previous patch, this deals with multi-column padding
      characters and soft-fill.  This will add spacing so the padding and
      content after padding aligns with the right side.
      
      You can see the effect by setting
        set index_format="%s %*我[ooooo]"
      and resizing the terminal.  The right hand side will be jagged without
      the patch.
      88a81b94
    • Kevin J. McCarthy's avatar
      Add spacing to truncated multi-column characters when using soft-fill. · 34e53f8b
      Kevin J. McCarthy authored
      First, fix the left-hand side column truncation calculation:
        "col + pad*pw -offset"
      pad = (COLS - col - wid) / pw, so this becomes
        "col + COLS - col - wid - offset" =>
        "COLS - wid - offset"
      
      The problem is that pad was calculated *before* the right side was
      mutt_wstr_trunc() truncated, which may adjust wid!  We want that
      calculation, with correct values, so instead just use the final
      reduction directly.  (Note, the reduction ignores integer truncation,
      but pad shouldn't be used here in any case, because it's negative:
      there is no padding occuring).
      
      Second, when the left-hand side is truncated, multi-column characters
      may get chopped in the middle.  Truncated characters are not included
      in the wlen and col values returned.  Add spaces until the number of
      columns lines up (checking to make sure we don't run out of space
      too).
      34e53f8b
  7. 11 Apr, 2016 6 commits
  8. 10 Apr, 2016 2 commits
    • Kevin J. McCarthy's avatar
      Fix mutt_protect() when INLINE is set. (closes #3828) · 80e314f2
      Kevin J. McCarthy authored
      The oppenc changes allow security bits to be set even when not
      encrypting or signing (for instance, OPPENCRYPT and INLINE).
      
      mutt_protect() assumed that if INLINE is set, then either ENCRYPT or
      SIGN must also be set.  Specifically, it would end up inline-signing
      the message even though neither was set.
      
      Ensure mutt_protect() is a noop if neither SIGN or ENCRYPT are set.
      
      In ci_send_message(), check for sign or encrypt before calling the
      crypt_get_keys() / mutt_protect() block, and also in the fcc section
      (since clear_content would be NULL if not).
      
      The second change to the fcc part is somewhat redundant, but better to
      be explicit and avoid the case where the subtype is somehow
      "encrypted" or "signed" even though msg->security wasn't set thus.
      80e314f2
    • Kevin J. McCarthy's avatar
      Add error message string for imap_mailbox_rename() on root folder. · 51b9b00d
      Kevin J. McCarthy authored
      This was fixed just before 1.6.0, but due to the string freeze, could
      not add an error message.
      51b9b00d
  9. 09 Apr, 2016 1 commit
    • Kevin J. McCarthy's avatar
      Fix potential memory leak in rfc2047_encode. (closes #3825) · e7fbb182
      Kevin J. McCarthy authored
      If convert_string() has nonreversible characters, the allocated output
      buffer would be overwritten (and not freed) in rfc2047_encode().
      
      Thanks to Richard Russon for the bug report and initial patch, and to
      TAKAHASHI Tamotsu for the analysis and revised fix suggestion.
      e7fbb182
  10. 08 Apr, 2016 2 commits
    • Kevin J. McCarthy's avatar
      Fix pager.c format_line() to use size_t for mbrtowc() retvals. · b5989ae0
      Kevin J. McCarthy authored
      While fixing up the error checking for mbrtowc(), I noticed the uses
      in pager.c format_line() were assigning the retval to an int.
      
      The cleanup for this was a little tricky, because it was making use of
      possible negative values for (k1 - k).  The backspace detection loop
      condition was a bit heavy, so this patch first pulled the
      initialization and first call above, and put the second call inside
      the loop.
      
      Note that k1 previously included k, but this patch changes it to be
      just the retval of mbrtowc.  This means the second mbrtowc() arguments
      are changed to include k, as is the ch increment at the bottom of the
      loop.
      b5989ae0
    • Kevin J. McCarthy's avatar
      Reset mbstate for other mbrtowc() calls returning -1 · a9596d5c
      Kevin J. McCarthy authored
      Continue the cleanup started in changesets c8c76a6a1e61 and
      a3450fd50d11.  In those changesets, a bug was occurring due to the
      mbstate not being reset when mbrtowc() returned -1.
      
      This patch fixes other callers of mbrtowc() to reset mbstate when it
      returns -1.
      a9596d5c
  11. 06 Apr, 2016 1 commit
  12. 05 Apr, 2016 1 commit
    • Kevin J. McCarthy's avatar
      Fix IDNA functions for systems without iconv. · 1cabc070
      Kevin J. McCarthy authored
      The IDNA changes for SMTPUTF8 support introduced a bug for systems
      without iconv.  For those systems, the local<->intl functions would
      return an error due to the charset conversion failing.
      
      Change mutt_idna.c back to being conditionally compiled, but this time
      based on HAVE_ICONV.  If there is no iconv, stub out the functions in
      mutt_idna.h.
      1cabc070