]> granicus.if.org Git - neomutt/commitdiff
merge: nntp
authorRichard Russon <rich@flatcap.org>
Mon, 23 May 2016 12:31:45 +0000 (13:31 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 23 May 2016 16:12:42 +0000 (17:12 +0100)
 * feature: nntp
 * add docs
 * add ident to PATCHES
 * doc: check for installed patches

38 files changed:
1  2 
Makefile.am
OPS
PATCHES
browser.c
browser.h
buffy.c
compose.c
configure.ac
curs_main.c
doc/manual.xml.head
functions.h
globals.h
hash.c
hash.h
hcache.c
hdrline.c
headers.c
init.c
init.h
keymap.c
mailbox.h
main.c
mutt.h
muttlib.c
mx.c
mx.h
pager.c
parse.c
pattern.c
po/POTFILES.in
postpone.c
protos.h
send.c
sendlib.c
sort.c
url.c
url.h
version.c

diff --cc Makefile.am
Simple merge
diff --cc OPS
Simple merge
diff --cc PATCHES
index b1b8882981abf5a1c158e7b6ef8ff1a75698d399,93fd79aff8135f19b7aefd9a1a0ea12dd3f53535..e44c30ee9f4338122d36f1fc08bece1f6627d527
+++ b/PATCHES
@@@ -1,16 -1,1 +1,17 @@@
 +patch-quasi-delete-neo-UNKNOWN
 +patch-progress-neo-UNKNOWN
 +patch-status-color-neo-UNKNOWN
 +patch-index-color-neo-UNKNOWN
 +patch-nested-if-neo-UNKNOWN
 +patch-cond-date-neo-UNKNOWN
 +patch-tls-sni-neo-UNKNOWN
 +patch-sidebar-neo-UNKNOWN
 +patch-ifdef-neo-UNKNOWN
 +patch-fmemopen-neo-UNKNOWN
 +patch-initials-neo-UNKNOWN
 +patch-trash-neo-UNKNOWN
 +patch-limit-current-thread-neo-UNKNOWN
 +patch-skip-quoted-neo-UNKNOWN
 +patch-compress-neo-UNKNOWN
 +patch-keywords-neo-UNKNOWN
+ patch-nntp-neo-UNKNOWN
diff --cc browser.c
index 2617c380cf927dc4b79cc8ca902f6ada13cca529,cb5968a2e2955ec0148f06c8fb295209f33d391e..a5ed4ef4244692616ff1d6f3b79a5e02bb32846a
+++ b/browser.c
  #ifdef USE_IMAP
  #include "imap.h"
  #endif
 +#ifdef USE_NOTMUCH
 +#include "mutt_notmuch.h"
 +#endif
+ #ifdef USE_NNTP
+ #include "nntp.h"
+ #endif
  
  #include <stdlib.h>
  #include <dirent.h>
@@@ -152,17 -138,12 +172,21 @@@ static void browser_sort (struct browse
        f = browser_compare_date;
        break;
      case SORT_SIZE:
+ #ifdef USE_NNTP
+       if (option (OPTNEWS))
+       return;
+ #endif
        f = browser_compare_size;
        break;
 +    case SORT_DESC:
 +      f = browser_compare_desc;
 +      break;
 +    case SORT_COUNT:
 +      f = browser_compare_count;
 +      break;
 +    case SORT_COUNT_NEW:
 +      f = browser_compare_count_new;
 +      break;
      case SORT_SUBJECT:
      default:
        f = browser_compare_subject;
@@@ -394,9 -348,112 +418,112 @@@ folder_format_str (char *dest, size_t d
    return (src);
  }
  
+ #ifdef USE_NNTP
+ static const char *
+ newsgroup_format_str (char *dest, size_t destlen, size_t col, char op, const char *src,
+                     const char *fmt, const char *ifstring, const char *elsestring,
+                     unsigned long data, format_flag flags)
+ {
+   char fn[SHORT_STRING], tmp[SHORT_STRING];
+   FOLDER *folder = (FOLDER *) data;
+   switch (op)
+   {
+     case 'C':
+       snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
+       snprintf (dest, destlen, tmp, folder->num + 1);
+       break;
+     case 'f':
+       strncpy (fn, folder->ff->name, sizeof(fn) - 1);
+       snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
+       snprintf (dest, destlen, tmp, fn);
+       break;
+     case 'N':
+       snprintf (tmp, sizeof (tmp), "%%%sc", fmt);
+       if (folder->ff->nd->subscribed)
+       snprintf (dest, destlen, tmp, ' ');
+       else
+       snprintf (dest, destlen, tmp, folder->ff->new ? 'N' : 'u');
+       break;
+     case 'M':
+       snprintf (tmp, sizeof (tmp), "%%%sc", fmt);
+       if (folder->ff->nd->deleted)
+       snprintf (dest, destlen, tmp, 'D');
+       else
+       snprintf (dest, destlen, tmp, folder->ff->nd->allowed ? ' ' : '-');
+       break;
+     case 's':
+       if (flags & M_FORMAT_OPTIONAL)
+       {
+       if (folder->ff->nd->unread != 0)
+         mutt_FormatString (dest, destlen, col, ifstring, newsgroup_format_str,
+               data, flags);
+       else
+         mutt_FormatString (dest, destlen, col, elsestring, newsgroup_format_str,
+               data, flags);
+       }
+       else if (Context && Context->data == folder->ff->nd)
+       {
+       snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
+       snprintf (dest, destlen, tmp, Context->unread);
+       }
+       else
+       {
+       snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
+       snprintf (dest, destlen, tmp, folder->ff->nd->unread);
+       }
+       break;
+     case 'n':
+       if (Context && Context->data == folder->ff->nd)
+       {
+       snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
+       snprintf (dest, destlen, tmp, Context->new);
+       }
+       else if (option (OPTMARKOLD) &&
+               folder->ff->nd->lastCached >= folder->ff->nd->firstMessage &&
+               folder->ff->nd->lastCached <= folder->ff->nd->lastMessage)
+       {
+       snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
+       snprintf (dest, destlen, tmp, folder->ff->nd->lastMessage - folder->ff->nd->lastCached);
+       }
+       else
+       {
+       snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
+       snprintf (dest, destlen, tmp, folder->ff->nd->unread);
+       }
+       break;
+     case 'd':
+       if (folder->ff->nd->desc != NULL)
+       {
+       char *buf = safe_strdup (folder->ff->nd->desc);
+       if (NewsgroupsCharset && *NewsgroupsCharset)
+         mutt_convert_string (&buf, NewsgroupsCharset, Charset, M_ICONV_HOOK_FROM);
+       mutt_filter_unprintable (&buf);
+       snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
+       snprintf (dest, destlen, tmp, buf);
+       FREE (&buf);
+       }
+       else
+       {
+       snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
+       snprintf (dest, destlen, tmp, "");
+       }
+       break;
+   }
+   return (src);
+ }
+ #endif /* USE_NNTP */
  static void add_folder (MUTTMENU *m, struct browser_state *state,
-                       const char *name, const char *desc,
-                       const struct stat *s, unsigned int new, unsigned int all)
 -                      const char *name, const struct stat *s,
 -                      void *data, unsigned int new)
++              const char *name, const char *desc, const struct stat *s,
++              unsigned int new, unsigned int all, void *data)
  {
    if (state->entrylen == state->entrymax)
    {
    }
  
    (state->entry)[state->entrylen].new = new;
 +  (state->entry)[state->entrylen].all = all;
    (state->entry)[state->entrylen].name = safe_strdup (name);
 -  (state->entry)[state->entrylen].desc = safe_strdup (name);
 +  (state->entry)[state->entrylen].desc = safe_strdup(desc ? desc : name);
  #ifdef USE_IMAP
    (state->entry)[state->entrylen].imap = 0;
+ #endif
+ #ifdef USE_NNTP
+   if (option (OPTNEWS))
+     (state->entry)[state->entrylen].nd = (NNTP_DATA *)data;
  #endif
    (state->entrylen)++;
  }
@@@ -444,6 -505,32 +576,31 @@@ static void init_state (struct browser_
  static int examine_directory (MUTTMENU *menu, struct browser_state *state,
                              char *d, const char *prefix)
  {
 -      add_folder (menu, state, nntp_data->group, NULL,
 -                nntp_data, nntp_data->new);
+ #ifdef USE_NNTP
+   if (option (OPTNEWS))
+   {
+     NNTP_SERVER *nserv = CurrentNewsSrv;
+     unsigned int i;
+ /*  mutt_buffy_check (0); */
+     init_state (state, menu);
+     for (i = 0; i < nserv->groups_num; i++)
+     {
+       NNTP_DATA *nntp_data = nserv->groups_list[i];
+       if (!nntp_data)
+       continue;
+       if (prefix && *prefix &&
+         strncmp (prefix, nntp_data->group, strlen (prefix)))
+       continue;
+       if (!((regexec (Mask.rx, nntp_data->group, 0, NULL, 0) == 0) ^ Mask.not))
+       continue;
++      add_folder (menu, state, nntp_data->group, NULL, NULL, nntp_data->new, nntp_data->newsrc_len, nntp_data);
+     }
+   }
+   else
+ #endif /* USE_NNTP */
+   {
    struct stat s;
    DIR *dp;
    struct dirent *de;
      tmp = Incoming;
      while (tmp && mutt_strcmp (buffer, tmp->path))
        tmp = tmp->next;
-     add_folder (menu, state, de->d_name, NULL, &s, (tmp) ? tmp->new : 0, 0);
 -    add_folder (menu, state, de->d_name, &s, NULL, (tmp) ? tmp->new : 0);
++    add_folder (menu, state, de->d_name, NULL, &s, (tmp) ? tmp->new : 0, (tmp) ? tmp->msg_count : 0, NULL);
    }
    closedir (dp);  
+   }
    browser_sort (state);
    return 0;
  }
  
-       add_folder (menu, state, tmp->path, tmp->desc, NULL,
-                     tmp->msg_unread, tmp->msg_count);
 +#ifdef USE_NOTMUCH
 +static int examine_vfolders (MUTTMENU *menu, struct browser_state *state)
 +{
 +  BUFFY *tmp = VirtIncoming;
 +
 +  if (!VirtIncoming)
 +    return (-1);
 +  mutt_buffy_check (0);
 +
 +  init_state (state, menu);
 +
 +  do
 +  {
 +    if (mx_is_notmuch (tmp->path))
 +    {
 +      nm_nonctx_get_count(tmp->path, &tmp->msg_count, &tmp->msg_unread);
++      add_folder (menu, state, tmp->path, tmp->desc, NULL, tmp->msg_unread, tmp->msg_count, NULL);
 +      continue;
 +    }
 +  }
 +  while ((tmp = tmp->next));
 +  browser_sort (state);
 +  return 0;
 +}
 +#endif
 +
+ /* get list of mailboxes/subscribed newsgroups */
  static int examine_mailboxes (MUTTMENU *menu, struct browser_state *state)
  {
    struct stat s;
    char buffer[LONG_STRING];
 -      add_folder (menu, state, nntp_data->group, NULL,
 -                  nntp_data, nntp_data->new);
+ #ifdef USE_NNTP
+   if (option (OPTNEWS))
+   {
+     NNTP_SERVER *nserv = CurrentNewsSrv;
+     unsigned int i;
+ /*  mutt_buffy_check (0); */
+     init_state (state, menu);
+     for (i = 0; i < nserv->groups_num; i++)
+     {
+       NNTP_DATA *nntp_data = nserv->groups_list[i];
+       if (nntp_data && (nntp_data->new || (nntp_data->subscribed &&
+        (nntp_data->unread || !option (OPTSHOWONLYUNREAD)))))
++      add_folder (menu, state, nntp_data->group, NULL, NULL, nntp_data->new, nntp_data->newsrc_len, nntp_data);
+     }
+   }
+   else
+ #endif
+   {
    BUFFY *tmp = Incoming;
  #ifdef USE_IMAP
    struct mailbox_state mbox;
      if (mx_is_imap (tmp->path))
      {
        imap_mailbox_state (tmp->path, &mbox);
-       add_folder (menu, state, tmp->path, NULL, NULL, mbox.new, mbox.messages);
 -      add_folder (menu, state, tmp->path, NULL, NULL, mbox.new);
++      add_folder (menu, state, tmp->path, NULL, NULL, mbox.new, mbox.messages, NULL);
        continue;
      }
  #endif
  #ifdef USE_POP
      if (mx_is_pop (tmp->path))
      {
-       add_folder (menu, state, tmp->path, NULL, NULL, tmp->new, 0);
 -      add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
++      add_folder (menu, state, tmp->path, NULL, NULL, tmp->new, tmp->msg_count, NULL);
+       continue;
+     }
+ #endif
+ #ifdef USE_NNTP
+     if (mx_is_nntp (tmp->path))
+     {
 -      add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
++      add_folder (menu, state, tmp->path, NULL, NULL, tmp->new, tmp->msg_count, NULL);
        continue;
      }
  #endif
      strfcpy (buffer, NONULL(tmp->path), sizeof (buffer));
      mutt_pretty_mailbox (buffer, sizeof (buffer));
  
-     add_folder (menu, state, buffer, NULL, &s, tmp->new, 0);
 -    add_folder (menu, state, buffer, &s, NULL, tmp->new);
++    add_folder (menu, state, buffer, NULL, &s, tmp->new, tmp->msg_count, NULL);
    }
    while ((tmp = tmp->next));
+   }
    browser_sort (state);
    return 0;
  }
@@@ -814,15 -922,10 +1047,18 @@@ void _mutt_select_file (char *f, size_
    if (multiple)
      menu->tag = file_tag;
  
 +#ifdef USE_NOTMUCH
 +  if (flags & M_SEL_VFOLDER) {
 +    menu->make_entry = vfolder_entry;
 +    menu->search = select_vfolder_search;
 +  } else
 +#endif
 +    menu->make_entry = folder_entry;
 +
    menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_FOLDER,
+ #ifdef USE_NNTP
+     option (OPTNEWS) ? FolderNewsHelp :
+ #endif
      FolderHelp);
  
    init_menu (&state, menu, title, sizeof (title), buffy);
          }
          break;
  #endif
 -      
 +
        case OP_CHANGE_DIRECTORY:
  
+ #ifdef USE_NNTP
+       if (option (OPTNEWS))
+         break;
+ #endif
        strfcpy (buf, LastDir, sizeof (buf));
  #ifdef USE_IMAP
        if (!state.imap_browse)
          else
            mutt_error _("Error trying to view file");
        }
 -                add_folder (menu, &state, nntp_data->group, NULL,
 -                            nntp_data, nntp_data->new);
+       break;
+ #ifdef USE_NNTP
+       case OP_CATCHUP:
+       case OP_UNCATCHUP:
+       if (option (OPTNEWS))
+       {
+         struct folder_file *f = &state.entry[menu->current];
+         int rc;
+         NNTP_DATA *nntp_data;
+         rc = nntp_newsrc_parse (CurrentNewsSrv);
+         if (rc < 0)
+           break;
+         if (i == OP_CATCHUP)
+           nntp_data = mutt_newsgroup_catchup (CurrentNewsSrv, f->name);
+         else
+           nntp_data = mutt_newsgroup_uncatchup (CurrentNewsSrv, f->name);
+         if (nntp_data)
+         {
+ /*        FOLDER folder;
+           struct folder_file ff;
+           char buffer[_POSIX_PATH_MAX + SHORT_STRING];
+           folder.ff = &ff;
+           folder.ff->name = f->name;
+           folder.ff->st = NULL;
+           folder.ff->is_new = nntp_data->new;
+           folder.ff->nntp_data = nntp_data;
+           FREE (&f->desc);
+           mutt_FormatString (buffer, sizeof (buffer), 0, NONULL(GroupFormat),
+                 newsgroup_format_str, (unsigned long) &folder,
+                 M_FORMAT_ARROWCURSOR);
+           f->desc = safe_strdup (buffer); */
+           nntp_newsrc_update (CurrentNewsSrv);
+           if (menu->current + 1 < menu->max)
+             menu->current++;
+           menu->redraw = REDRAW_MOTION_RESYNCH;
+         }
+         if (rc)
+           menu->redraw = REDRAW_INDEX;
+         nntp_newsrc_close (CurrentNewsSrv);
+       }
+       break;
+       case OP_LOAD_ACTIVE:
+       if (option (OPTNEWS))
+       {
+         NNTP_SERVER *nserv = CurrentNewsSrv;
+         unsigned int i;
+         if (nntp_newsrc_parse (nserv) < 0)
+           break;
+         for (i = 0; i < nserv->groups_num; i++)
+         {
+           NNTP_DATA *nntp_data = nserv->groups_list[i];
+           if (nntp_data)
+             nntp_data->deleted = 1;
+         }
+         nntp_active_fetch (nserv);
+         nntp_newsrc_update (nserv);
+         nntp_newsrc_close (nserv);
+         destroy_state (&state);
+         if (buffy)
+           examine_mailboxes (menu, &state);
+         else
+           examine_directory (menu, &state, NULL, NULL);
+         init_menu (&state, menu, title, sizeof (title), buffy);
+       }
+       break;
+ #endif /* USE_NNTP */
+ #if defined USE_IMAP || defined USE_NNTP
+       case OP_BROWSER_SUBSCRIBE:
+       case OP_BROWSER_UNSUBSCRIBE:
+ #endif
+ #ifdef USE_NNTP
+       case OP_SUBSCRIBE_PATTERN:
+       case OP_UNSUBSCRIBE_PATTERN:
+       if (option (OPTNEWS))
+       {
+         NNTP_SERVER *nserv = CurrentNewsSrv;
+         NNTP_DATA *nntp_data;
+         regex_t *rx = (regex_t *) safe_malloc (sizeof (regex_t));
+         char *s = buf;
+         int rc, j = menu->current;
+         if (i == OP_SUBSCRIBE_PATTERN || i == OP_UNSUBSCRIBE_PATTERN)
+         {
+           char tmp[STRING];
+           int err;
+           buf[0] = 0;
+           if (i == OP_SUBSCRIBE_PATTERN)
+             snprintf (tmp, sizeof (tmp), _("Subscribe pattern: "));
+           else
+             snprintf (tmp, sizeof (tmp), _("Unsubscribe pattern: "));
+           if (mutt_get_field (tmp, buf, sizeof (buf), 0) != 0 || !buf[0])
+           {
+             FREE (&rx);
+             break;
+           }
+           err = REGCOMP (rx, s, REG_NOSUB);
+           if (err)
+           {
+             regerror (err, rx, buf, sizeof (buf));
+             regfree (rx);
+             FREE (&rx);
+             mutt_error ("%s", buf);
+             break;
+           }
+           menu->redraw = REDRAW_FULL;
+           j = 0;
+         }
+         else if (!state.entrylen)
+         {
+           mutt_error _("No newsgroups match the mask");
+           break;
+         }
+         rc = nntp_newsrc_parse (nserv);
+         if (rc < 0)
+           break;
+         for ( ; j < state.entrylen; j++)
+         {
+           struct folder_file *f = &state.entry[j];
+           if (i == OP_BROWSER_SUBSCRIBE || i == OP_BROWSER_UNSUBSCRIBE ||
+                 regexec (rx, f->name, 0, NULL, 0) == 0)
+           {
+             if (i == OP_BROWSER_SUBSCRIBE || i == OP_SUBSCRIBE_PATTERN)
+               nntp_data = mutt_newsgroup_subscribe (nserv, f->name);
+             else
+               nntp_data = mutt_newsgroup_unsubscribe (nserv, f->name);
+ /*          if (nntp_data)
+             {
+               FOLDER folder;
+               char buffer[_POSIX_PATH_MAX + SHORT_STRING];
+               folder.name = f->name;
+               folder.f = NULL;
+               folder.new = nntp_data->new;
+               folder.nd = nntp_data;
+               FREE (&f->desc);
+               mutt_FormatString (buffer, sizeof (buffer), 0, NONULL(GroupFormat),
+                       newsgroup_format_str, (unsigned long) &folder,
+                       M_FORMAT_ARROWCURSOR);
+               f->desc = safe_strdup (buffer);
+             } */
+           }
+           if (i == OP_BROWSER_SUBSCRIBE || i == OP_BROWSER_UNSUBSCRIBE)
+           {
+             if (menu->current + 1 < menu->max)
+               menu->current++;
+             menu->redraw = REDRAW_MOTION_RESYNCH;
+             break;
+           }
+         }
+         if (i == OP_SUBSCRIBE_PATTERN)
+         {
+           unsigned int i;
+           for (i = 0; nserv && i < nserv->groups_num; i++)
+           {
+             nntp_data = nserv->groups_list[i];
+             if (nntp_data && nntp_data->group && !nntp_data->subscribed)
+             {
+               if (regexec (rx, nntp_data->group, 0, NULL, 0) == 0)
+               {
+                 mutt_newsgroup_subscribe (nserv, nntp_data->group);
++                add_folder (menu, &state, nntp_data->group, NULL, NULL, nntp_data->new, nntp_data->newsrc_len, nntp_data);
+               }
+             }
+           }
+           init_menu (&state, menu, title, sizeof (title), buffy);
+         }
+         if (rc > 0)
+           menu->redraw = REDRAW_FULL;
+         nntp_newsrc_update (nserv);
+         nntp_clear_cache (nserv);
+         nntp_newsrc_close (nserv);
+         if (i != OP_BROWSER_SUBSCRIBE && i != OP_BROWSER_UNSUBSCRIBE)
+           regfree (rx);
+         FREE (&rx);
+       }
+ #ifdef USE_IMAP
+       else
+ #endif /* USE_IMAP && USE_NNTP */
+ #endif /* USE_NNTP */
+ #ifdef USE_IMAP
+       {
+         if (i == OP_BROWSER_SUBSCRIBE)
+           imap_subscribe (state.entry[menu->current].name, 1);
+         else
+           imap_subscribe (state.entry[menu->current].name, 0);
+       }
+ #endif /* USE_IMAP */
      }
    }
    
diff --cc browser.h
Simple merge
diff --cc buffy.c
index a2c7dd84be2d13d85227db74b889d2f2552c8582,3f4e016355a8f14bff6cee83601e7624d0aa2d02..6befe68620d903544f1358251d14d878198d6a5a
+++ b/buffy.c
@@@ -615,10 -441,10 +615,15 @@@ static void buffy_check(BUFFY *tmp, str
        tmp->magic = M_POP;
        else
  #endif
 +#ifdef USE_NOTMUCH
 +      if (mx_is_notmuch (tmp->path))
 +      tmp->magic = M_NOTMUCH;
 +      else
++#endif
+ #ifdef USE_NNTP
+       if ((tmp->magic == M_NNTP) || mx_is_nntp (tmp->path))
+       tmp->magic = M_NNTP;
+       else
  #endif
        if (stat (tmp->path, &sb) != 0 || (S_ISREG(sb.st_mode) && sb.st_size == 0) ||
          (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0))
      /* check to see if the folder is the currently selected folder
       * before polling */
      if (!Context || !Context->path ||
 -      (( tmp->magic == M_IMAP || tmp->magic == M_POP )
+ #ifdef USE_NNTP
+       (( tmp->magic == M_IMAP || tmp->magic == M_POP || tmp->magic == M_NNTP )
+ #else
 +      (( tmp->magic == M_IMAP || tmp->magic == M_POP || tmp->magic == M_NOTMUCH)
+ #endif
            ? mutt_strcmp (tmp->path, Context->path) :
 -            (sb.st_dev != contex_sb.st_dev || sb.st_ino != contex_sb.st_ino)))
 +            (sb.st_dev != contex_sb->st_dev || sb.st_ino != contex_sb->st_ino)))
      {
        switch (tmp->magic)
        {
        tmp->notified = 0;
      else if (!tmp->notified)
        BuffyNotify++;
 +}
 +
 +int mutt_buffy_check (int force)
 +{
 +  BUFFY *tmp;
 +  struct stat contex_sb;
 +  time_t t;
 +
 +  contex_sb.st_dev=0;
 +  contex_sb.st_ino=0;
 +
 +#ifdef USE_IMAP
 +  /* update postponed count as well, on force */
 +  if (force)
 +    mutt_update_num_postponed ();
 +#endif
 +
 +  /* fastest return if there are no mailboxes */
 +#ifdef USE_NOTMUCH
 +  if (!Incoming && !VirtIncoming)
 +    return 0;
 +#else
 +  if (!Incoming)
 +    return 0;
 +#endif
 +  t = time (NULL);
 +  if (!force && (t - BuffyTime < BuffyTimeout))
 +    return BuffyCount;
 +
 +  BuffyTime = t;
 +  BuffyCount = 0;
 +  BuffyNotify = 0;
 +
 +#ifdef USE_IMAP
 +  BuffyCount += imap_buffy_check (force);
 +#endif
 +
 +  /* check device ID and serial number instead of comparing paths */
 +  if (!Context || Context->magic == M_IMAP || Context->magic == M_POP
++#ifdef USE_NNTP
++      || Context->magic == M_NNTP
++#endif
 +      || stat (Context->path, &contex_sb) != 0)
 +  {
 +    contex_sb.st_dev=0;
 +    contex_sb.st_ino=0;
 +  }
 +
 +#ifdef USE_SIDEBAR
 +  if (sb_should_refresh()) {
 +    for (tmp = Incoming; tmp; tmp = tmp->next)
 +      buffy_check(tmp, &contex_sb);
 +    sb_set_update_time();
    }
 +#else
 +  for (tmp = Incoming; tmp; tmp = tmp->next)
 +    buffy_check(tmp, &contex_sb);
 +#endif
 +
 +#ifdef USE_NOTMUCH
 +  for (tmp = VirtIncoming; tmp; tmp = tmp->next)
 +    buffy_check(tmp, &contex_sb);
 +#endif
  
    BuffyDoneTime = BuffyTime;
    return (BuffyCount);
diff --cc compose.c
index 82677e537afb498193b15dc89cd757d1408556e0,0ac05c6300e5a07438a3faa1320c2f9ca4b24923..c510ff5c0a7ae5a362ac0dcac2f656d347ae91b5
+++ b/compose.c
  #include "mailbox.h"
  #include "sort.h"
  #include "charset.h"
 +#ifdef USE_SIDEBAR
 +#include "sidebar.h"
 +#endif
+ #include "mx.h"
  
  #ifdef MIXMASTER
  #include "remailer.h"
@@@ -73,9 -81,9 +84,9 @@@ enu
    HDR_ATTACH  = (HDR_FCC + 5) /* where to start printing the attachments */
  };
  
- #define HDR_XOFFSET 10
- #define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
+ #define HDR_XOFFSET 14
+ #define TITLE_FMT "%14s" /* Used for Prompts, which are ASCII */
 -#define W (COLS - HDR_XOFFSET)
 +#define W (COLS - HDR_XOFFSET - SidebarWidth)
  
  static const char * const Prompts[] =
  {
@@@ -251,17 -290,33 +293,36 @@@ static void draw_envelope_addr (int lin
  
  static void draw_envelope (HEADER *msg, char *fcc)
  {
 +#ifdef USE_SIDEBAR
 +  sb_draw();
 +#endif
    draw_envelope_addr (HDR_FROM, msg->env->from);
+ #ifdef USE_NNTP
+   if (!option (OPTNEWSSEND))
+   {
+ #endif
    draw_envelope_addr (HDR_TO, msg->env->to);
    draw_envelope_addr (HDR_CC, msg->env->cc);
    draw_envelope_addr (HDR_BCC, msg->env->bcc);
 -  mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
+ #ifdef USE_NNTP
+   }
+   else
+   {
+     mvprintw (HDR_TO, 0, TITLE_FMT , Prompts[HDR_NEWSGROUPS - 1]);
+     mutt_paddstr (W, NONULL (msg->env->newsgroups));
+     mvprintw (HDR_CC, 0, TITLE_FMT , Prompts[HDR_FOLLOWUPTO - 1]);
+     mutt_paddstr (W, NONULL (msg->env->followup_to));
+     if (option (OPTXCOMMENTTO))
+     {
+       mvprintw (HDR_BCC, 0, TITLE_FMT , Prompts[HDR_XCOMMENTTO - 1]);
+       mutt_paddstr (W, NONULL (msg->env->x_comment_to));
+     }
+   }
+ #endif
 +  mvprintw (HDR_SUBJECT, SidebarWidth, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
    mutt_paddstr (W, NONULL (msg->env->subject));
    draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
 -  mvprintw (HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]);
 +  mvprintw (HDR_FCC, SidebarWidth, TITLE_FMT, Prompts[HDR_FCC - 1]);
    mutt_paddstr (W, fcc);
  
    if (WithCrypto)
diff --cc configure.ac
Simple merge
diff --cc curs_main.c
index 191668439c922a0607d1104f0adb75ec32504a4d,35f99c63abb0f1178ffdf9fe978cc6509926b532..4c70d55138a28c791341247633247b69d4d9c9cc
  #include "imap_private.h"
  #endif
  
 +#ifdef USE_NOTMUCH
 +#include "mutt_notmuch.h"
 +#endif
 +
  #include "mutt_crypt.h"
  
+ #ifdef USE_NNTP
+ #include "nntp.h"
+ #endif
  
  #include <ctype.h>
  #include <stdlib.h>
@@@ -488,186 -482,6 +493,192 @@@ static void resort_index (MUTTMENU *men
    menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
  }
  
-                         int *oldcount, int *index_hint)
 +/**
 + * mutt_draw_statusline - XXX
 + */
 +void
 +mutt_draw_statusline (int cols, char *inbuf)
 +{
 +      int i          = 0;
 +      int cnt        = 0;
 +      int last_color = 0;
 +      int color      = 0;
 +      int offset     = 0;
 +      int found      = 0;
 +      int null_rx    = 0;
 +      char buf[2048];
 +
 +      struct line_t {
 +              short chunks;
 +              struct syntax_t {
 +                      int color;
 +                      int first;
 +                      int last;
 +              } *syntax;
 +      } lineInfo = { 0, NULL };
 +
 +      mutt_format_string (buf, sizeof (buf), cols, cols, 0, ' ', inbuf, mutt_strlen (inbuf), 0);
 +
 +      lineInfo.syntax = safe_malloc (sizeof (struct syntax_t));
 +      lineInfo.syntax[0].first = -1;
 +      lineInfo.syntax[0].last  = -1;
 +      lineInfo.syntax[0].color = ColorDefs[MT_COLOR_STATUS];
 +      lineInfo.chunks = 1;
 +
 +      do {
 +              found = 0;
 +              null_rx = 0;
 +              COLOR_LINE *color_line = ColorStatusList;
 +
 +              if (!buf[offset])
 +                      break;
 +
 +              while (color_line) {
 +                      regmatch_t pmatch[color_line->match + 1];
 +
 +                      if (regexec (&color_line->rx, buf + offset, color_line->match + 1, pmatch, (offset ? REG_NOTBOL : 0)) == 0) {
 +                              if (pmatch[color_line->match].rm_eo != pmatch[color_line->match].rm_so) {
 +                                      if (!found) {
 +                                              if (++(lineInfo.chunks) > 1) {
 +                                                      safe_realloc (&(lineInfo.syntax), (lineInfo.chunks) * sizeof (struct syntax_t));
 +                                              }
 +                                      }
 +                                      i = lineInfo.chunks - 1;
 +                                      pmatch[color_line->match].rm_so += offset;
 +                                      pmatch[color_line->match].rm_eo += offset;
 +                                      if (!found ||
 +                                              (pmatch[color_line->match].rm_so < (lineInfo.syntax)[i].first) ||
 +                                              ((pmatch[color_line->match].rm_so == (lineInfo.syntax)[i].first) &&
 +                                              (pmatch[color_line->match].rm_eo > (lineInfo.syntax)[i].last))) {
 +                                              (lineInfo.syntax)[i].color = color_line->pair;
 +                                              (lineInfo.syntax)[i].first = pmatch[color_line->match].rm_so;
 +                                              (lineInfo.syntax)[i].last = pmatch[color_line->match].rm_eo;
 +                                      }
 +                                      found = 1;
 +                                      null_rx = 0;
 +                              } else {
 +                                      null_rx = 1; /* empty regexp; don't add it, but keep looking */
 +                              }
 +                      }
 +                      color_line = color_line->next;
 +              }
 +
 +              if (null_rx)
 +                      offset++; /* avoid degenerate cases */
 +              else
 +                      offset = (lineInfo.syntax)[i].last;
 +      } while (found || null_rx);
 +
 +      for (cnt = 0; cnt < mutt_strlen (buf); cnt++) {
 +              color = lineInfo.syntax[0].color;
 +              for (i = 0; i < lineInfo.chunks; i++) {
 +                      /* we assume the chunks are sorted */
 +                      if (cnt > (lineInfo.syntax)[i].last)
 +                              continue;
 +                      if (cnt < (lineInfo.syntax)[i].first)
 +                              break;
 +                      if (cnt != (lineInfo.syntax)[i].last) {
 +                              color = (lineInfo.syntax)[i].color;
 +                              break;
 +                      }
 +                      /* don't break here, as cnt might be in the next chunk as well */
 +              }
 +              if (color != last_color) {
 +                      attrset (color);
 +                      last_color = color;
 +              }
 +              /* XXX more than one char at a time? */
 +              addch ((unsigned char)buf[cnt]);
 +#if 0
 +              waddnstr (stdscr, tgbuf, 10);
 +              SETCOLOR (MT_COLOR_NORMAL);
 +              waddnstr (stdscr, tgbuf + 10, -1);
 +#endif
 +      }
 +
 +      safe_free (&lineInfo.syntax);
 +}
 +
 +static int main_change_folder(MUTTMENU *menu, int op, char *buf, size_t bufsz,
-   if ((Context = mx_open_mailbox (buf,
-               (option (OPTREADONLY) || op == OP_MAIN_CHANGE_FOLDER_READONLY) ?
-               M_READONLY : 0, NULL)) != NULL)
++                        int *oldcount, int *index_hint, int flags)
 +{
++#ifdef USE_NNTP
++  if (option (OPTNEWS))
++  {
++    unset_option (OPTNEWS);
++    nntp_expand_path (buf, bufsz, &CurrentNewsSrv->conn->account);
++  }
++  else
++#endif
 +  mutt_expand_path (buf, bufsz);
 +#ifdef USE_SIDEBAR
 +  sb_set_open_buffy (buf);
 +#endif
 +  if (mx_get_magic (buf) <= 0)
 +  {
 +    mutt_error (_("%s is not a mailbox."), buf);
 +    return -1;
 +  }
 +  mutt_str_replace (&CurrentFolder, buf);
 +
 +  /* keepalive failure in mutt_enter_fname may kill connection. #3028 */
 +  if (Context && !Context->path)
 +    FREE (&Context);
 +
 +  if (Context)
 +  {
 +    int check;
 +
 +#ifdef USE_COMPRESSED
 +        if (Context->compress_info && Context->realpath)
 +          mutt_str_replace (&LastFolder, Context->realpath);
 +        else
 +#endif
 +    mutt_str_replace (&LastFolder, Context->path);
 +    *oldcount = Context ? Context->msgcount : 0;
 +
 +    if ((check = mx_close_mailbox (Context, index_hint)) != 0)
 +    {
 +      if (check == M_NEW_MAIL || check == M_REOPENED)
 +        update_index (menu, Context, check, *oldcount, *index_hint);
 +
 +      set_option (OPTSEARCHINVALID);
 +      menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
 +      return 0;
 +    }
 +    FREE (&Context);
 +  }
 +
 +  if (Labels)
 +    hash_destroy(&Labels, NULL);
 +
 +  mutt_sleep (0);
 +
 +  /* Set CurrentMenu to MENU_MAIN before executing any folder
 +   * hooks so that all the index menu functions are available to
 +   * the exec command.
 +   */
 +
 +  CurrentMenu = MENU_MAIN;
 +  mutt_folder_hook (buf);
 +
++  if ((Context = mx_open_mailbox (buf, flags, NULL)) != NULL)
 +  {
 +    Labels = hash_create(131, 0);
 +    mutt_scan_labels(Context);
 +    menu->current = ci_first_message ();
 +  }
 +  else
 +    menu->current = 0;
 +
 +  mutt_clear_error ();
 +  mutt_buffy_check(1); /* force the buffy check after we have changed the folder */
 +  menu->redraw = REDRAW_FULL;
 +  set_option (OPTSEARCHINVALID);
 +
 +  return 0;
 +}
 +
  static const struct mapping_t IndexHelp[] = {
    { N_("Quit"),  OP_QUIT },
    { N_("Del"),   OP_DELETE },
@@@ -978,11 -782,9 +1008,14 @@@ int mutt_index_menu (void
        mutt_curs_set (1);      /* fallback from the pager */
      }
  
 +#ifdef USE_NOTMUCH
 +    if (Context)
 +      nm_debug_check(Context);
 +#endif
 +
+ #ifdef USE_NNTP
+     unset_option (OPTNEWS);   /* for any case */
+ #endif
      switch (op)
      {
  
        }
          break;
  
 +      case OP_LIMIT_CURRENT_THREAD:
        case OP_MAIN_LIMIT:
+       case OP_TOGGLE_READ:
  
        CHECK_IN_MAILBOX;
        menu->oldcurrent = (Context->vcount && menu->current >= 0 && menu->current < Context->vcount) ?
                CURHDR->index : -1;
 -      if ((op == OP_TOGGLE_READ && mutt_pattern_func (M_LIMIT, NULL) == 0) ||
 -          mutt_pattern_func (M_LIMIT, _("Limit to messages matching: ")) == 0)
+       if (op == OP_TOGGLE_READ)
+       {
+         char buf[LONG_STRING];
+         if (!Context->pattern || strncmp (Context->pattern, "!~R!~D~s", 8) != 0)
+         {
+           snprintf (buf, sizeof (buf), "!~R!~D~s%s",
+                     Context->pattern ? Context->pattern : ".*");
+           set_option (OPTHIDEREAD);
+         }
+         else
+         {
+           strfcpy (buf, Context->pattern + 8, sizeof(buf));
+           if (!*buf || strncmp (buf, ".*", 2) == 0)
+             snprintf (buf, sizeof(buf), "~A");
+           unset_option (OPTHIDEREAD);
+         }
+         FREE (&Context->pattern);
+         Context->pattern = safe_strdup (buf);
+       }
 +      if (((op == OP_LIMIT_CURRENT_THREAD) && mutt_limit_current_thread(CURHDR))
 +          || ((op == OP_MAIN_LIMIT) && (mutt_pattern_func (M_LIMIT, _("Limit to messages matching: ")) == 0)))
        {
          if (menu->oldcurrent >= 0)
          {
          menu->redraw = REDRAW_FULL;
        break;
  
-         main_change_folder(menu, op, buf, sizeof (buf), &oldcount, &index_hint);
 +      case OP_MAIN_QUASI_DELETE:
 +      if (tag) {
 +        for (j = 0; j < Context->vcount; j++) {
 +          if (Context->hdrs[Context->v2r[j]]->tagged) {
 +            Context->hdrs[Context->v2r[j]]->quasi_deleted = TRUE;
 +            Context->changed = TRUE;
 +          }
 +        }
 +      } else {
 +        CURHDR->quasi_deleted = TRUE;
 +        Context->changed = 1;
 +      }
 +      break;
 +
 +#ifdef USE_NOTMUCH
 +      case OP_MAIN_ENTIRE_THREAD:
 +      {
 +      int oldcount  = Context->msgcount;
 +      if (Context->magic != M_NOTMUCH) {
 +        mutt_message _("No virtual folder, aborting.");
 +        break;
 +      }
 +      CHECK_MSGCOUNT;
 +        CHECK_VISIBLE;
 +      if (nm_read_entire_thread(Context, CURHDR) < 0) {
 +         mutt_message _("Failed to read thread, aborting.");
 +         break;
 +      }
 +      if (oldcount < Context->msgcount) {
 +              HEADER *oldcur = CURHDR;
 +
 +              if ((Sort & SORT_MASK) == SORT_THREADS)
 +                      mutt_sort_headers (Context, 0);
 +              menu->current = oldcur->virtual;
 +              menu->redraw = REDRAW_STATUS | REDRAW_INDEX;
 +
 +              if (oldcur->collapsed || Context->collapsed) {
 +                      menu->current = mutt_uncollapse_thread(Context, CURHDR);
 +                      mutt_set_virtual(Context);
 +              }
 +      }
 +      if (menu->menu == MENU_PAGER)
 +      {
 +        op = OP_DISPLAY_MESSAGE;
 +        continue;
 +      }
 +      break;
 +      }
 +
 +      case OP_MAIN_MODIFY_LABELS:
 +      case OP_MAIN_MODIFY_LABELS_THEN_HIDE:
 +      {
 +      if (Context->magic != M_NOTMUCH) {
 +        mutt_message _("No virtual folder, aborting.");
 +        break;
 +      }
 +      CHECK_MSGCOUNT;
 +        CHECK_VISIBLE;
 +      *buf = '\0';
 +      if (mutt_get_field ("Add/remove labels: ", buf, sizeof (buf), M_NM_TAG) || !*buf)
 +      {
 +          mutt_message _("No label specified, aborting.");
 +          break;
 +        }
 +      if (tag)
 +      {
 +        char msgbuf[STRING];
 +        progress_t progress;
 +        int px;
 +
 +        if (!Context->quiet) {
 +          snprintf(msgbuf, sizeof (msgbuf), _("Update labels..."));
 +          mutt_progress_init(&progress, msgbuf, M_PROGRESS_MSG,
 +                                 1, Context->tagged);
 +        }
 +        nm_longrun_init(Context, TRUE);
 +        for (px = 0, j = 0; j < Context->vcount; j++) {
 +          if (Context->hdrs[Context->v2r[j]]->tagged) {
 +            if (!Context->quiet)
 +              mutt_progress_update(&progress, ++px, -1);
 +            nm_modify_message_tags(Context, Context->hdrs[Context->v2r[j]], buf);
 +            if (op == OP_MAIN_MODIFY_LABELS_THEN_HIDE)
 +            {
 +              Context->hdrs[Context->v2r[j]]->quasi_deleted = TRUE;
 +              Context->changed = TRUE;
 +            }
 +          }
 +        }
 +        nm_longrun_done(Context);
 +        menu->redraw = REDRAW_STATUS | REDRAW_INDEX;
 +      }
 +      else
 +      {
 +        if (nm_modify_message_tags(Context, CURHDR, buf)) {
 +          mutt_message _("Failed to modify labels, aborting.");
 +          break;
 +        }
 +        if (op == OP_MAIN_MODIFY_LABELS_THEN_HIDE)
 +        {
 +          CURHDR->quasi_deleted = TRUE;
 +          Context->changed = TRUE;
 +        }
 +        if (menu->menu == MENU_PAGER)
 +        {
 +          op = OP_DISPLAY_MESSAGE;
 +          continue;
 +        }
 +        if (option (OPTRESOLVE))
 +        {
 +          if ((menu->current = ci_next_undeleted (menu->current)) == -1)
 +          {
 +            menu->current = menu->oldcurrent;
 +            menu->redraw = REDRAW_CURRENT;
 +          }
 +          else
 +            menu->redraw = REDRAW_MOTION_RESYNCH;
 +        }
 +        else
 +          menu->redraw = REDRAW_CURRENT;
 +      }
 +      menu->redraw |= REDRAW_STATUS;
 +      break;
 +      }
 +
 +      case OP_MAIN_VFOLDER_FROM_QUERY:
 +      buf[0] = '\0';
 +        if (mutt_get_field ("Query: ", buf, sizeof (buf), M_NM_QUERY) != 0 || !buf[0])
 +        {
 +          mutt_message _("No query, aborting.");
 +          break;
 +        }
 +      if (!nm_uri_from_query(Context, buf, sizeof (buf)))
 +        mutt_message _("Failed to create query, aborting.");
 +      else
++        main_change_folder(menu, op, buf, sizeof (buf), &oldcount, &index_hint, 0);
 +      break;
 +
 +      case OP_MAIN_CHANGE_VFOLDER:
 +#endif
 +#ifdef USE_SIDEBAR
 +      case OP_SIDEBAR_OPEN:
 +#endif
        case OP_MAIN_CHANGE_FOLDER:
        case OP_MAIN_NEXT_UNREAD_MAILBOX:
-       if (attach_msg)
-         op = OP_MAIN_CHANGE_FOLDER_READONLY;
-       /* fallback to the readonly case */
        case OP_MAIN_CHANGE_FOLDER_READONLY:
+ #ifdef USE_NNTP
+       case OP_MAIN_CHANGE_GROUP:
+       case OP_MAIN_CHANGE_GROUP_READONLY:
+       unset_option (OPTNEWS);
+ #endif
+       if (attach_msg || option (OPTREADONLY) ||
+ #ifdef USE_NNTP
+           op == OP_MAIN_CHANGE_GROUP_READONLY ||
+ #endif
+           op == OP_MAIN_CHANGE_FOLDER_READONLY)
+         flags = M_READONLY;
+       else
+         flags = 0;
  
-         if ((op == OP_MAIN_CHANGE_FOLDER_READONLY) || option (OPTREADONLY))
+       if (flags)
            cp = _("Open mailbox in read-only mode");
 -        else
 +#ifdef USE_NOTMUCH
 +        else if (op == OP_MAIN_CHANGE_VFOLDER)
 +        cp = _("Open virtual folder");
 +#endif
 +      else
            cp = _("Open mailbox");
  
        buf[0] = '\0';
            break;
          }
        }
 +#ifdef USE_NOTMUCH
 +      else if (op == OP_MAIN_CHANGE_VFOLDER) {
 +        if (Context->magic == M_NOTMUCH) {
 +                strfcpy(buf, Context->path, sizeof (buf));
 +                mutt_buffy_vfolder (buf, sizeof (buf));
 +        }
 +        mutt_enter_vfolder (cp, buf, sizeof (buf), &menu->redraw, 1);
 +        if (!buf[0])
 +        {
 +          CLEARLINE (LINES-1);
 +          break;
 +        }
 +      }
 +#endif
        else
        {
+ #ifdef USE_NNTP
+         if (op == OP_MAIN_CHANGE_GROUP ||
+             op == OP_MAIN_CHANGE_GROUP_READONLY)
+         {
+           set_option (OPTNEWS);
+           CurrentNewsSrv = nntp_select_server (NewsServer, 0);
+           if (!CurrentNewsSrv)
+             break;
+           if (flags)
+             cp = _("Open newsgroup in read-only mode");
+           else
+             cp = _("Open newsgroup");
+           nntp_buffy (buf, sizeof (buf));
+         }
+         else
+ #endif
          mutt_buffy (buf, sizeof (buf));
  
 +#ifdef USE_SIDEBAR
 +        if (op == OP_SIDEBAR_OPEN) {
 +          const char *path = sb_get_highlight();
 +          if (!path)
 +            break;
 +          strncpy (buf, path, sizeof (buf));
 +        } else
 +#endif
          if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
          {
            if (menu->menu == MENU_PAGER)
          }
        }
  
-       main_change_folder(menu, op, buf, sizeof (buf), &oldcount, &index_hint);
 -#ifdef USE_NNTP
 -      if (option (OPTNEWS))
 -      {
 -        unset_option (OPTNEWS);
 -        nntp_expand_path (buf, sizeof (buf), &CurrentNewsSrv->conn->account);
 -      }
 -      else
 -#endif
 -      mutt_expand_path (buf, sizeof (buf));
 -      if (mx_get_magic (buf) <= 0)
 -      {
 -        mutt_error (_("%s is not a mailbox."), buf);
 -        break;
 -      }
 -      mutt_str_replace (&CurrentFolder, buf);
 -
 -      /* keepalive failure in mutt_enter_fname may kill connection. #3028 */
 -      if (Context && !Context->path)
 -        FREE (&Context);
 -
 -        if (Context)
 -        {
 -        int check;
 -
 -        mutt_str_replace (&LastFolder, Context->path);
 -        oldcount = Context ? Context->msgcount : 0;
 -
 -        if ((check = mx_close_mailbox (Context, &index_hint)) != 0)
 -        {
 -          if (check == M_NEW_MAIL || check == M_REOPENED)
 -            update_index (menu, Context, check, oldcount, index_hint);
 -
 -          set_option (OPTSEARCHINVALID);
 -          menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
 -          break;
 -        }
 -        FREE (&Context);
 -      }
 -
 -        mutt_sleep (0);
 -
 -      /* Set CurrentMenu to MENU_MAIN before executing any folder
 -       * hooks so that all the index menu functions are available to
 -       * the exec command.
 -       */
 -
 -      CurrentMenu = MENU_MAIN;
 -      mutt_folder_hook (buf);
 -
 -      if ((Context = mx_open_mailbox (buf, flags, NULL)) != NULL)
 -      {
 -        menu->current = ci_first_message ();
 -      }
 -      else
 -        menu->current = 0;
 -
++      main_change_folder(menu, op, buf, sizeof (buf), &oldcount, &index_hint, flags);
+ #ifdef USE_NNTP
+       /* mutt_buffy_check() must be done with mail-reader mode! */
+       menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN,
+         (Context && (Context->magic == M_NNTP)) ? IndexNewsHelp : IndexHelp);
+ #endif
 -      mutt_clear_error ();
 -      mutt_buffy_check(1); /* force the buffy check after we have changed
 -                            the folder */
 -      menu->redraw = REDRAW_FULL;
 -      set_option (OPTSEARCHINVALID);
        break;
  
        case OP_DISPLAY_MESSAGE:
index 9d227b98754924fdbec7cb30eb618d8136e05574,ab55b8219d9d699f8ed70de0d386d38b99d133ab..e76b9d4ad7e4992daa6b62de7e049c390f3006ac
@@@ -8914,3234 -8497,233 +9306,3475 @@@ please have a look at the mixmaster doc
                </para>
  
                <itemizedlist>
 -                      <title>Patch Dependencies:</title>
 -                      <listitem><para>mutt-1.5.24</para></listitem>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.6.1</para></listitem>
                </itemizedlist>
  
 -              <para>This patch is part of the <link linkend="neomutt">NeoMutt project</link>.</para>
 +              <para>This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.</para>
        </sect2>
  
 -      <sect2 id="nntp-intro">
 +      <sect2 id="quasi-delete-intro">
                <title>Introduction</title>
 +
 +        <para>
 +              The <quote>quasi-delete</quote> function marks an email that should be
 +              hidden from the index, but NOT deleted.
 +        </para>
 +
 +        <para>
 +              On its own, this patch isn't very useful.  It forms a useful part of
 +              the notmuch plugin.
 +        </para>
        </sect2>
  
 -      <sect2 id="nntp-variables">
 +<!--
 +      <sect2 id="quasi-delete-variables">
 +              <title>Variables</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="quasi-delete-functions">
 +              <title>Functions</title>
 +              <table id="table-quasi-delete-functions">
 +                      <title>Quasi-Delete Functions</title>
 +                      <tgroup cols="4">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Menus</entry>
 +                                              <entry>Default Key</entry>
 +                                              <entry>Function</entry>
 +                                              <entry>Description</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry>index,pager</entry>
 +                                              <entry>(none)</entry>
 +                                              <entry><literal>&lt;quasi-delete&gt;</literal></entry>
 +                                              <entry>delete from mutt, don't touch on disk</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="quasi-delete-commands">
 +              <title>Commands</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="quasi-delete-colors">
 +              <title>Colors</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="quasi-delete-sort">
 +              <title>Sort</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="quasi-delete-muttrc">
 +              <title>Muttrc</title>
 +<screen>
 +<emphasis role="comment"># Example Mutt config file for the 'quasi-delete' feature.
 + 
 +# The 'quasi-delete' function marks an email that should be hidden
 +# from the index, but NOT deleted.</emphasis>
 +bind index,pager Q quasi-delete
 + 
 +<emphasis role="comment"># vim: syntax=muttrc</emphasis>
 +</screen>
 +      </sect2>
 +
 +      <sect2 id="quasi-delete-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><ulink url="http://www.neomutt.org/">NeoMutt Project</ulink></para></listitem>
 +                      <listitem><para><link linkend="notmuch">notmuch patch</link></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="quasi-delete-known-bugs">
 +              <title>Known Bugs</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="quasi-delete-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>Karel Zak <email>kzak@redhat.com</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
 +<sect1 id="progress">
 +      <title>Progress Bar Patch</title>
 +      <subtitle>Show a visual progress bar on slow operations</subtitle>
 +
 +      <sect2 id="progress-patch">
 +              <title>Patch</title>
 +
 +              <para>
 +                      To check if Mutt supports <quote>Progress Bar</quote>, look for
 +                      <quote>patch-progress</quote> in the mutt version.
 +                      See: <xref linkend="mutt-patches"/>.
 +              </para>
 +
 +              <itemizedlist>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.6.1</para></listitem>
 +              </itemizedlist>
 +
 +              <para>This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.</para>
 +      </sect2>
 +
 +      <sect2 id="progress-intro">
 +              <title>Introduction</title>
 +
 +        <para>
 +              The <quote>progress</quote> patch shows a visual progress bar on slow
 +              tasks, such as indexing a large folder over the net.
 +        </para>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="progress-variables">
 +              <title>Variables</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="progress-functions">
 +              <title>Functions</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="progress-commands">
 +              <title>Commands</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="progress-colors">
 +              <title>Colors</title>
 +              <table id="table-progress-colors">
 +                      <title>Progress Colors</title>
 +                      <tgroup cols="3">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Name</entry>
 +                                              <entry>Default Color</entry>
 +                                              <entry>Description</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry><literal>progress</literal></entry>
 +                                              <entry>default</entry>
 +                                              <entry>Visual progress bar</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="progress-sort">
 +              <title>Sort</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="progress-muttrc">
 +              <title>Muttrc</title>
 +<screen>
 +<emphasis role="comment"># Example Mutt config file for the 'progress' patch.
 + 
 +# The 'progress' patch provides clear visual feedback for
 +# slow tasks, such as indexing a large folder over the net.
 + 
 +# Set the color of the progress bar
 +# White text on a red background</emphasis>
 +color progress white red
 + 
 +<emphasis role="comment"># vim: syntax=muttrc</emphasis>
 +</screen>
 +      </sect2>
 +
 +      <sect2 id="progress-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><ulink url="http://www.neomutt.org/">NeoMutt Project</ulink></para></listitem>
 +                      <listitem><para><link linkend="color">Color command</link></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="progress-known-bugs">
 +              <title>Known Bugs</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="progress-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>Rocco Rutte <email>pdmef@gmx.net</email></para></listitem>
 +              <listitem><para>Vincent Lefevre <email>vincent@vinc17.org</email></para></listitem>
 +              <listitem><para>Stefan Kuhn <email>wuodan@hispeed.ch</email></para></listitem>
 +              <listitem><para>Karel Zak <email>kzak@redhat.com</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
 +<sect1 id="status-color">
 +      <title>Status Color Patch</title>
 +      <subtitle>Custom rules for theming the status bar</subtitle>
 +
 +      <sect2 id="status-color-patch">
 +              <title>Patch</title>
 +
 +              <para>
 +                      To check if Mutt supports <quote>Status Color</quote>, look for
 +                      <quote>patch-status-color</quote> in the mutt version.
 +                      See: <xref linkend="mutt-patches"/>.
 +              </para>
 +
 +              <itemizedlist>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.6.1</para></listitem>
 +              </itemizedlist>
 +
 +              <para>This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.</para>
 +      </sect2>
 +
 +      <sect2 id="status-color-intro">
 +              <title>Introduction</title>
 +
 +        <para>
 +              The <quote>status-color</quote> patch allows you to theme different
 +              parts of the status bar (also when it's used by the index).
 +        </para>
 +
 +        <para>
 +              Unlike normal color commands, <literal>color status</literal> can now
 +              take up to 2 extra parameters (regex, num).
 +        </para>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="status-color-variables">
 +              <title>Variables</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="status-color-functions">
 +              <title>Functions</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="status-color-commands">
 +              <title>Commands</title>
 +              <cmdsynopsis>
 +                      <command>color</command>
 +                      <arg choice="plain">
 +                              <option>status</option>
 +                      </arg>
 +                      <arg choice="plain">
 +                              <replaceable class="parameter">foreground</replaceable>
 +                      </arg>
 +                      <arg choice="plain">
 +                              <replaceable class="parameter">background</replaceable>
 +                      </arg>
 +                      <group choice="opt">
 +                              <arg choice="plain">
 +                                      <replaceable class="parameter">regex</replaceable>
 +                              </arg>
 +                              <group choice="opt">
 +                                      <arg choice="plain">
 +                                              <replaceable class="parameter">num</replaceable>
 +                                      </arg>
 +                              </group>
 +                      </group>
 +              </cmdsynopsis>
 +
 +              <para>
 +                      With zero parameters, Mutt will set the default color for the entire
 +                      status bar.
 +              </para>
 +
 +              <para>
 +                      With one parameter, Mutt will only color the parts matching the
 +                      regex.
 +              </para>
 +
 +              <para>
 +                      With two parameters, Mutt will only color the num'th sub-match of
 +                      the regex.
 +              </para>
 +      </sect2>
 +
 +      <sect2 id="status-color-colors">
 +              <title>Colors</title>
 +
 +              <table id="table-status-color-colors">
 +                      <title>Status Colors</title>
 +                      <tgroup cols="3">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Name</entry>
 +                                              <entry>Default Color</entry>
 +                                              <entry>Description</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry>status</entry>
 +                                              <entry><literal>reverse</literal></entry>
 +                                              <entry>Status bar</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="status-color-sort">
 +              <title>Sort</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="status-color-muttrc">
 +              <title>Muttrc</title>
 +<screen>
 +<emphasis role="comment"># Example Mutt config file for the 'status-color' patch.
 + 
 +# The 'status-color' patch allows you to theme different parts of
 +# the status bar (also when it's used by the index).
 + 
 +# For the examples below, set some defaults</emphasis>
 +set status_format='-%r-Mutt: %f [Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]---(%s/%S)-%&gt;-(%P)---'
 +set index_format='%4C %Z %{%b %d} %-15.15L (%?l?%4l&amp;%4c?) %s'
 +set sort=threads
 +set sort_aux=last-date-received
 + 
 +<emphasis role="comment"># 'status color' can take up to 2 extra parameters
 + 
 +# color status foreground background [ regex [ num ]]
 + 
 +# 0 extra parameters
 +# Set the default color for the entire status line</emphasis>
 +color status blue white
 + 
 +<emphasis role="comment"># 1 extra parameter
 +# Set the color for a matching pattern
 +# color status foreground background regexp
 + 
 +# Highlight New, Deleted, or Flagged emails</emphasis>
 +color status brightred white '(New|Del|Flag):[0-9]+'
 + 
 +<emphasis role="comment"># Highlight mailbox ordering if it's different from the default
 +# First, highlight anything (*/*)</emphasis>
 +color status brightred default '\([^)]+/[^)]+\)'
 + 
 +<emphasis role="comment"># Then override the color for one specfic case</emphasis>
 +color status default   default '\(threads/last-date-received\)'
 + 
 +<emphasis role="comment"># 2 extra parameters
 +# Set the color for the nth submatch of a pattern
 +# color status foreground background regexp num
 + 
 +# Highlight the contents of the []s but not the [] themselves</emphasis>
 +color status red default '\[([^]]+)\]' 1
 + 
 +<emphasis role="comment"># The '1' refers to the first regex submatch, which is the inner
 +# part in ()s
 + 
 +# Highlight the mailbox</emphasis>
 +color status brightwhite default 'Mutt: ([^ ]+)' 1
 + 
 +<emphasis role="comment"># Search for 'Mutt: ' but only highlight what comes after it
 + 
 +# vim: syntax=muttrc</emphasis>
 +</screen>
 +      </sect2>
 +
 +      <sect2 id="status-color-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><ulink url="http://www.neomutt.org/">NeoMutt Project</ulink></para></listitem>
 +                      <listitem><para><link linkend="compile-time-features">Compile-Time Features</link></para></listitem>
 +                      <listitem><para><link linkend="regexp">Regular Expressions</link></para></listitem>
 +                      <listitem><para><link linkend="patterns">Patterns</link></para></listitem>
 +                      <listitem><para><link linkend="index-color">index-color patch</link></para></listitem>
 +                      <listitem><para><link linkend="color">Color command</link></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="status-color-known-bugs">
 +              <title>Known Bugs</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="status-color-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>David Sterba <email>dsterba@suse.cz</email></para></listitem>
 +              <listitem><para>Thomas Glanzmann <email>thomas@glanzmann.de</email></para></listitem>
 +              <listitem><para>Kirill A. Shutemov <email>kirill@shutemov.name</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
 +<sect1 id="index-color">
 +      <title>Index Color Patch</title>
 +      <subtitle>Custom rules for theming the email index</subtitle>
 +
 +      <sect2 id="index-color-patch">
 +              <title>Patch</title>
 +
 +              <para>
 +                      To check if Mutt supports <quote>Index Color</quote>, look for
 +                      <quote>patch-index-color</quote> in the mutt version.
 +                      See: <xref linkend="mutt-patches"/>.
 +              </para>
 +
 +              <itemizedlist>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.6.1</para></listitem>
 +                      <listitem><para><link linkend="status-color">status-color patch</link></para></listitem>
 +              </itemizedlist>
 +
 +              <para>This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.</para>
 +      </sect2>
 +
 +      <sect2 id="index-color-intro">
 +              <title>Introduction</title>
 +
 +        <para>
 +              The <quote>index-color</quote> patch allows you to specify colors for
 +              individual parts of the email index. e.g. Subject, Author, Flags.
 +        </para>
 +
 +        <para>
 +              First choose which part of the index you'd like to color.
 +              Then, if needed, pick a pattern to match.
 +        </para>
 +
 +              <para>
 +              Note: The pattern does not have to refer to the object you wish to
 +              color.  e.g.
 +              </para>
 +
 +<screen>
 +color index_author red default &quot;~smutt&quot;
 +</screen>
 +
 +        <para>
 +              The author appears red when the subject (~s) contains <quote>mutt</quote>.
 +        </para>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="index-color-variables">
 +              <title>Variables</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="index-color-functions">
 +              <title>Functions</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="index-color-commands">
 +              <title>Commands</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="index-color-colors">
 +              <title>Colors</title>
 +
 +        <para>
 +              All the colors default to <literal>default</literal>, i.e. unset.
 +        </para>
 +
 +        <para>
 +              The index objects can be themed using the <literal>color</literal> command.
 +              Some objects require a pattern.
 +        </para>
 +
 +<screen>
 +color index-object foreground background
 +color index-object foreground background pattern
 +</screen>
 +
 +              <table id="table-index-color-colors">
 +                      <title>Index Colors</title>
 +                      <tgroup cols="3">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Object</entry>
 +                                              <entry>Pattern</entry>
 +                                              <entry>Highlights</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry><literal>index</literal></entry>
 +                                              <entry>yes</entry>
 +                                              <entry>Entire index line</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>index_author</literal></entry>
 +                                              <entry>yes</entry>
 +                                              <entry>Author name, %A %a %F %L %n</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>index_collapsed</literal></entry>
 +                                              <entry>no</entry>
 +                                              <entry>Number of messages in a collapsed thread, %M</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>index_date</literal></entry>
 +                                              <entry>no</entry>
 +                                              <entry>Date field</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>index_flags</literal></entry>
 +                                              <entry>yes</entry>
 +                                              <entry>Message flags, %S %Z</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>index_label</literal></entry>
 +                                              <entry>no</entry>
 +                                              <entry>Message label, %y %Y</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>index_number</literal></entry>
 +                                              <entry>no</entry>
 +                                              <entry>Message number, %C</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>index_size</literal></entry>
 +                                              <entry>no</entry>
 +                                              <entry>Message size, %c %l</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>index_subject</literal></entry>
 +                                              <entry>yes</entry>
 +                                              <entry>Subject, %s</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="index-color-sort">
 +              <title>Sort</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="index-color-muttrc">
 +              <title>Muttrc</title>
 +<screen>
 +<emphasis role="comment"># Example Mutt config file for the 'index-color' feature.
 + 
 +# Entire index line</emphasis>
 +color index white black '.*'
 + 
 +<emphasis role="comment"># Author name, %A %a %F %L %n
 + 
 +# Give the author column a dark grey background</emphasis>
 +color index_author default color234 '.*'
 + 
 +<emphasis role="comment"># Highlight a particular from (~f)</emphasis>
 +color index_author brightyellow color234 '~fRay Charles'
 + 
 +<emphasis role="comment"># Message flags, %S %Z
 +# Highlight the flags for flagged (~F) emails</emphasis>
 +color index_flags default red '~F'
 + 
 +<emphasis role="comment"># Subject, %s
 +# Look for a particular subject (~s)</emphasis>
 +color index_subject brightcyan default '~s\(closes #[0-9]+\)'
 + 
 +<emphasis role="comment"># Number of messages in a collapsed thread, %M</emphasis>
 +color index_collapsed default brightblue
 + 
 +<emphasis role="comment"># Date field</emphasis>
 +color index_date green default
 + 
 +<emphasis role="comment"># Message label, %y %Y</emphasis>
 +color index_label default brightgreen
 + 
 +<emphasis role="comment"># Message number, %C</emphasis>
 +color index_number red default
 + 
 +<emphasis role="comment"># Message size, %c %l</emphasis>
 +color index_size cyan default
 + 
 +<emphasis role="comment"># vim: syntax=muttrc</emphasis>
 +</screen>
 +      </sect2>
 +
 +      <sect2 id="index-color-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><ulink url="http://www.neomutt.org/">NeoMutt Project</ulink></para></listitem>
 +                      <listitem><para><link linkend="regexp">Regular Expressions</link></para></listitem>
 +                      <listitem><para><link linkend="patterns">Patterns</link></para></listitem>
 +                      <listitem><para><link linkend="index-format">$index_format</link></para></listitem>
 +                      <listitem><para><link linkend="color">Color command</link></para></listitem>
 +                      <listitem><para><link linkend="status-color">Status-Color patch</link></para></listitem>
 +                      <listitem><para><link linkend="keywords">Keywords patch</link></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="index-color-known-bugs">
 +              <title>Known Bugs</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="index-color-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>Christian Aichinger <email>Greek0@gmx.net</email></para></listitem>
 +              <listitem><para>Christoph <quote>Myon</quote> Berg <email>myon@debian.org</email></para></listitem>
 +              <listitem><para>Elimar Riesebieter <email>riesebie@lxtec.de</email></para></listitem>
 +              <listitem><para>Eric Davis <email>edavis@insanum.com</email></para></listitem>
 +              <listitem><para>Vladimir Marek <email>Vladimir.Marek@oracle.com</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
 +<sect1 id="nested-if">
 +      <title>Nested If Patch</title>
 +      <subtitle>Allow complex nested conditions in format strings</subtitle>
 +
 +      <sect2 id="nested-if-patch">
 +              <title>Patch</title>
 +
 +              <para>
 +                      To check if Mutt supports <quote>Nested If</quote>, look for
 +                      <quote>patch-nested-if</quote> in the mutt version.
 +                      See: <xref linkend="mutt-patches"/>.
 +              </para>
 +
 +              <itemizedlist>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.6.1</para></listitem>
 +              </itemizedlist>
 +
 +              <para>This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.</para>
 +      </sect2>
 +
 +      <sect2 id="nested-if-intro">
 +              <title>Introduction</title>
 +
 +              <para>
 +                      Mutt's format strings can contain embedded if-then-else conditions.
 +                      They are of the form:
 +              </para>
 +
 +<screen>
 +%?VAR?TRUE&amp;FALSE?
 +</screen>
 +
 +              <para>
 +                      If the variable <quote>VAR</quote> has a value greater than zero,
 +                      print the <quote>TRUE</quote> string, otherwise print the
 +                      <quote>FALSE</quote> string.
 +              </para>
 +
 +              <para>
 +                      e.g.  <literal>%?S?Size: %S&amp;Empty?</literal>
 +              </para>
 +
 +              <para>Which can be read as:</para>
 +
 +              <literallayout>
 +                  if (%S &gt; 0) {
 +                      print &quot;Size: %S&quot;
 +                  } else {
 +                      print &quot;Empty&quot;
 +                  }
 +              </literallayout>
 +
 +              <para>
 +                      These conditions are useful, but in Mutt they cannot be nested
 +                      within one another.  This patch uses the notation
 +                      <literal>%&lt;VAR?TRUE&amp;FALSE&gt;</literal> and allows them to be nested.
 +              </para>
 +
 +              <para>
 +                      The <literal>%&lt;...&gt;</literal> notation was used to format the
 +                      current local time.  but that's not really very useful since mutt
 +                      has no means of refreshing the screen periodically.
 +              </para>
 +
 +              <para>
 +                      A simple nested condition might be:
 +                      (Some whitespace has been introduced for clarity)
 +              </para>
 +
 +              <literallayout>
 +                  %&lt;x? %&lt;y? XY &amp; X &gt; &amp; %&lt;y? Y &amp; NONE &gt; &gt;  Conditions
 +                       %&lt;y? XY &amp; X &gt;                      x&gt;0
 +                            XY                            x&gt;0,y&gt;0
 +                                 X                        x&gt;0,y=0
 +              </literallayout>
 +
 +              <literallayout>
 +                  %&lt;x? %&lt;y? XY &amp; X &gt; &amp; %&lt;y? Y &amp; NONE &gt; &gt;  Conditions
 +                                       %&lt;y? Y &amp; NONE &gt;    x=0
 +                                            Y             x=0,y&gt;0
 +                                                NONE      x=0,y=0
 +              </literallayout>
 +
 +              <para>Equivalent to:</para>
 +
 +              <literallayout>
 +                  if (x &gt; 0) {
 +                      if (y &gt; 0) {
 +                          print 'XY'
 +                      } else {
 +                          print 'X'
 +                      }
 +                  } else {
 +                      if (y &gt; 0) {
 +                          print 'Y'
 +                      } else {
 +                          print 'NONE'
 +                      }
 +                  }
 +              </literallayout>
 +
 +              <para>Examples:</para>
 +
 +<screen>
 +set index_format='%4C %Z %{%b %d} %-25.25n %s%&gt; %&lt;M?%M Msgs &amp;%&lt;l?%l Lines&amp;%c Bytes&gt;&gt;'
 +</screen>
 +
 +              <literallayout>
 +                  if a thread is folded
 +                      display the number of messages (%M)
 +                  else if we know how many lines in the message
 +                      display lines in message (%l)
 +                  else
 +                      display the size of the message in bytes (%c)
 +              </literallayout>
 +
 +<screen>
 +set index_format='%4C %Z %{%b %d} %-25.25n %&lt;M?[%M] %s&amp;%s%* %&lt;l?%l&amp;%c&gt;&gt;'
 +</screen>
 +
 +              <literallayout>
 +                  if a thread is folded
 +                      display the number of messages (%M)
 +                      display the subject (%s)
 +                  else if we know how many lines in the message
 +                      display lines in message (%l)
 +                  else
 +                      display the size of the message in bytes (%c)
 +              </literallayout>
 +
 +      </sect2>
 +
 +      <sect2 id="nested-if-variables">
 +              <title>Variables</title>
 +              The <quote>nested-if</quote> patch doesn't have any config of its own.
 +              It modifies the behavior of the format strings.
 +      </sect2>
 +
 +<!--
 +      <sect2 id="nested-if-functions">
 +              <title>Functions</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="nested-if-commands">
 +              <title>Commands</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="nested-if-colors">
 +              <title>Colors</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="nested-if-sort">
 +              <title>Sort</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="nested-if-muttrc">
 +              <title>Muttrc</title>
 +<screen>
 +<emphasis role="comment"># Example Mutt config file for the 'nested-if' feature.
 + 
 +# This patch uses the format: '%&lt;VAR?TRUE&amp;FALSE&gt;' for conditional
 +# format strings that can be nested.
 + 
 +# Example 1
 +# if a thread is folded
 +#       display the number of messages (%M)
 +# else if we know how many lines in the message
 +#       display lines in message (%l)
 +# else display the size of the message in bytes (%c)</emphasis>
 +set index_format='%4C %Z %{%b %d} %-25.25n %s%&gt; %&lt;M?%M Msgs &amp;%&lt;l?%l Lines&amp;%c Bytes&gt;&gt;'
 + 
 +<emphasis role="comment"># Example 2
 +# if a thread is folded
 +#       display the number of messages (%M)
 +#       display the subject (%s)
 +# else if we know how many lines in the message
 +#       display lines in message (%l)
 +# else
 +#       display the size of the message in bytes (%c)</emphasis>
 +set index_format='%4C %Z %{%b %d} %-25.25n %&lt;M?[%M] %s&amp;%s%* %&lt;l?%l&amp;%c&gt;&gt;'
 + 
 +<emphasis role="comment"># vim: syntax=muttrc</emphasis>
 +</screen>
 +      </sect2>
 +
 +      <sect2 id="nested-if-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><ulink url="http://www.neomutt.org/">NeoMutt Project</ulink></para></listitem>
 +                      <listitem><para><link linkend="cond-date">cond-date patch</link></para></listitem>
 +                      <listitem><para><link linkend="index-format">$index_format</link></para></listitem>
 +                      <listitem><para><link linkend="status-format">$status_format</link></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="nested-if-known-bugs">
 +              <title>Known Bugs</title>
 +              Patch overwrites $&lt;fmt&gt; handler in <literal>$index_format</literal>
 +      </sect2>
 +
 +      <sect2 id="nested-if-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>David Champion <email>dgc@uchicago.edu</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
 +<sect1 id="cond-date">
 +      <title>Conditional Dates Patch</title>
 +      <subtitle>Use rules to choose date format</subtitle>
 +
 +      <sect2 id="cond-date-patch">
 +              <title>Patch</title>
 +
 +              <para>
 +                      To check if Mutt supports <quote>Conditional Dates</quote>, look for
 +                      <quote>patch-cond-date</quote> in the mutt version.
 +                      See: <xref linkend="mutt-patches"/>.
 +              </para>
 +
 +              <itemizedlist>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.6.1</para></listitem>
 +                      <listitem><para><link linkend="nested-if">nested-if patch</link></para></listitem>
 +              </itemizedlist>
 +
 +              <para>
 +                      This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.
 +              </para>
 +      </sect2>
 +
 +      <sect2 id="cond-date-intro">
 +              <title>Introduction</title>
 +
 +              <para>
 +              The <quote>cond-date</quote> patch allows you to construct
 +              <link linkend="index-format">$index_format</link> expressions based on the age of the email.
 +              </para>
 +
 +              <para>
 +              Mutt's default <literal>$index_format</literal> displays email dates in the
 +              form: abbreviated-month day-of-month &mdash; <quote>Jan 14</quote>.
 +              </para>
 +
 +              <para>
 +              The format is configurable but only per-mailbox.  This patch allows you
 +              to configure the display depending on the age of the email.
 +              </para>
 +
 +              <table id="table-cond-date-scheme">
 +                      <title>Potential Formatting Scheme</title>
 +                      <tgroup cols="3">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Email Sent</entry>
 +                                              <entry>Format</entry>
 +                                              <entry>Example</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry>Today</entry>
 +                                              <entry><literal>%H:%M</literal></entry>
 +                                              <entry>13:23</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>This Month</entry>
 +                                              <entry><literal>%a %d</literal></entry>
 +                                              <entry>Thu 17</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>This Year</entry>
 +                                              <entry><literal>%b %d</literal></entry>
 +                                              <entry>Dec 10</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>Older than 1 Year</entry>
 +                                              <entry><literal>%m/%y</literal></entry>
 +                                              <entry>06/14</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +
 +              <para>
 +        For an explanation of the date formatting strings, see
 +        <literal>strftime(3).</literal>
 +              </para>
 +
 +              <para>
 +        By carefully picking your formats, the dates can remain
 +        unambiguous and compact.
 +              </para>
 +
 +              <para>
 +              Mutt's conditional format strings have the form:
 +              (whitespace introduced for clarity)
 +              </para>
 +
 +              <screen>%? TEST ? TRUE &amp; FALSE ?</screen>
 +
 +              <para>
 +              The examples below use the test <quote>%[</quote> &mdash; the date
 +              of the message in the local timezone.  They will also work with
 +              <quote>%(</quote> &mdash; the local time that the message arrived.
 +              </para>
 +
 +              <para>
 +              The date tests are of the form:
 +              </para>
 +
 +              <screen>%[nX? TRUE &amp; FALSE ?</screen>
 +
 +              <itemizedlist>
 +              <listitem><para><quote>n</quote> is an optional count (defaults to 1 if missing)</para></listitem>
 +              <listitem><para><quote>X</quote> is the time period</para></listitem>
 +              </itemizedlist>
 +
 +              <table id="table-cond-date-format-codes">
 +                      <title>Date Formatting Codes</title>
 +                      <tgroup cols="2">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Letter</entry>
 +                                              <entry>Time Period</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry>y</entry>
 +                                              <entry>Years</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>m</entry>
 +                                              <entry>Months</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>w</entry>
 +                                              <entry>Weeks</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>d</entry>
 +                                              <entry>Days</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>H</entry>
 +                                              <entry>Hours</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>M</entry>
 +                                              <entry>Minutes</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +
 +              <table id="table-cond-date-example-tests">
 +                      <title>Example Date Tests</title>
 +                      <tgroup cols="2">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Test</entry>
 +                                              <entry>Meaning</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry><literal>%[y</literal></entry>
 +                                              <entry>This year</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>%[1y</literal></entry>
 +                                              <entry>This year</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>%[6m</literal></entry>
 +                                              <entry>In the last 6 months</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>%[w</literal></entry>
 +                                              <entry>This week</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>%[d</literal></entry>
 +                                              <entry>Today</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>%[4H</literal></entry>
 +                                              <entry>In the last 4 hours</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +
 +              <sect3 id="cond-date-example1">
 +                      <title>Example 1</title>
 +
 +                      <para>We start with a one-condition test.</para>
 +
 +                      <table id="table-cond-date-example1">
 +                              <title>Example 1</title>
 +                              <tgroup cols="4">
 +                                      <thead>
 +                                              <row>
 +                                                      <entry>Test</entry>
 +                                                      <entry>Date Range</entry>
 +                                                      <entry>Format String</entry>
 +                                                      <entry>Example</entry>
 +                                              </row>
 +                                      </thead>
 +                                      <tbody>
 +                                              <row>
 +                                                      <entry><literal>%[1m</literal></entry>
 +                                                      <entry>This month</entry>
 +                                                      <entry><literal>%[%b %d]</literal></entry>
 +                                                      <entry>Dec 10</entry>
 +                                              </row>
 +                                              <row>
 +                                                      <entry></entry>
 +                                                      <entry>Older</entry>
 +                                                      <entry><literal>%[%Y-%m-%d]</literal></entry>
 +                                                      <entry>2015-04-23</entry>
 +                                              </row>
 +                                      </tbody>
 +                              </tgroup>
 +                      </table>
 +
 +                      <para>The $index_format string would contain:</para>
 +<screen>
 +%?[1m?%[%b %d]&amp;%[%Y-%m-%d]?
 +</screen>
 + 
 +                      <para>
 +                              Reparsed a little, for clarity, you can see the
 +                              test condition and the two format strings.
 +                      </para>
 +
 +<screen>
 +%?[1m?        &amp;           ?
 +      %[%b %d] %[%Y-%m-%d]
 +</screen>
 +
 +              </sect3>
 +
 +              <sect3 id="cond-date-example2">
 +                      <title>Example 2</title>
 +
 +                      <para>
 +                      This example contains three test conditions and four date formats.
 +                      </para>
 +
 +                      <table id="table-cond-date-example2">
 +                              <title>Example 2</title>
 +                              <tgroup cols="4">
 +                                      <thead>
 +                                              <row>
 +                                                      <entry>Test</entry>
 +                                                      <entry>Date Range</entry>
 +                                                      <entry>Format String</entry>
 +                                                      <entry>Example</entry>
 +                                              </row>
 +                                      </thead>
 +                                      <tbody>
 +                                              <row>
 +                                                      <entry><literal>%[d</literal></entry>
 +                                                      <entry>Today</entry>
 +                                                      <entry><literal>%[%H:%M ] </literal></entry>
 +                                                      <entry>12:34</entry>
 +                                              </row>
 +                                              <row>
 +                                                      <entry><literal>%[m</literal></entry>
 +                                                      <entry>This month</entry>
 +                                                      <entry><literal>%[%a %d]</literal></entry>
 +                                                      <entry>Thu 12</entry>
 +                                              </row>
 +                                              <row>
 +                                                      <entry><literal>%[y</literal></entry>
 +                                                      <entry>This year</entry>
 +                                                      <entry><literal>%[%b %d]</literal></entry>
 +                                                      <entry>Dec 10</entry>
 +                                              </row>
 +                                              <row>
 +                                                      <entry></entry>
 +                                                      <entry>Older</entry>
 +                                                      <entry><literal>%[%m/%y ]</literal></entry>
 +                                                      <entry>06/15</entry>
 +                                              </row>
 +                                      </tbody>
 +                              </tgroup>
 +                      </table>
 +
 +                      <para>The $index_format string would contain:</para>
 + 
 +<screen>
 +%&lt;[y?%&lt;[m?%&lt;[d?%[%H:%M ]&amp;%[%a %d]&gt;&amp;%[%b %d]&gt;&amp;%[%m/%y ]&gt;
 +</screen>
 +
 +                      <para>
 +                              Reparsed a little, for clarity, you can see the
 +                              test conditions and the four format strings.
 +                      </para>
 +
 +<screen>
 +%&lt;[y?                                       &amp;%[%m/%y ]&gt;  Older
 +     %&lt;[m?                        &amp;%[%b %d]&gt;             This year
 +          %&lt;[d?         &amp;%[%a %d]&gt;                       This month
 +               %[%H:%M ]                                 Today
 +</screen>
 +
 +                      <para>
 +                      This a another view of the same example, with some whitespace
 +                      for clarity.
 +                      </para>
 +
 +<screen>
 +%&lt;[y? %&lt;[m? %&lt;[d? AAA &amp; BBB &gt; &amp; CCC &gt; &amp; DDD &gt;
 +</screen>
 +
 +                      <literallayout>
 +AAA = %[%H:%M ]
 +BBB = %[%a %d]
 +CCC = %[%b %d]
 +DDD = %[%m/%y ]
 +                      </literallayout>
 +              </sect3>
 +      </sect2>
 +
 +      <sect2 id="cond-date-variables">
 +              <title>Variables</title>
 +
 +        <para>
 +              The <quote>cond-date</quote> patch doesn't have any config of its own.
 +              It modifies the behavior of the format strings.
 +        </para>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="cond-date-functions">
 +              <title>Functions</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="cond-date-commands">
 +              <title>Commands</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="cond-date-colors">
 +              <title>Colors</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="cond-date-sort">
 +              <title>Sort</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="cond-date-muttrc">
 +              <title>Muttrc</title>
 +<screen>
 +<emphasis role="comment"># Example Mutt config file for the 'index-color' feature.
 +#
 +# The default index_format is:
 +#       '%4C %Z %{%b %d} %-15.15L (%?l?%4l&amp;%4c?) %s'
 +#
 +# We replace the date field '%{%b %d}', giving:</emphasis>
 +set index_format='%4C %Z %&lt;[y?%&lt;[m?%&lt;[d?%[%H:%M ]&amp;%[%a %d]&gt;&amp;%[%b %d]&gt;&amp;%[%m/%y ]&gt; %-15.15L (%?l?%4l&amp;%4c?) %s'
 + 
 +<emphasis role="comment"># Test  Date Range  Format String  Example
 +# --------------------------------------------
 +# %[d   Today       %[%H:%M ]      12:34
 +# %[m   This month  %[%a %d]       Thu 12
 +# %[y   This year   %[%b %d]       Dec 10
 +# -     Older       %[%m/%y ]      06/15
 + 
 +# vim: syntax=muttrc</emphasis>
 +</screen>
 +      </sect2>
 +
 +      <sect2 id="cond-date-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><ulink url="http://www.neomutt.org/">NeoMutt Project</ulink></para></listitem>
 +                      <listitem><para><link linkend="index-format">$index_format</link></para></listitem>
 +                      <listitem><para><link linkend="nested-if">nested-if patch</link></para></listitem>
 +                      <listitem><para><literal>strftime(3)</literal></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="cond-date-known-bugs">
 +              <title>Known Bugs</title>
 +
 +              <para>
 +                      Date parsing doesn't quite do what you expect.
 +                      <quote>1w</quote> doesn't mean the <quote>in the last 7 days</quote>, but
 +                      <quote><emphasis>this</emphasis> week</quote>.  This doesn't match
 +                      the normal Mutt behaviour: for example <literal>~d>1w</literal>
 +                      means emails dated in the last 7 days.
 +              </para>
 +
 +      </sect2>
 +
 +      <sect2 id="cond-date-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>Aaron Schrab <email>aaron@schrab.com</email></para></listitem>
 +              <listitem><para>Eric Davis <email>edavis@insanum.com</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
 +<sect1 id="tls-sni">
 +      <title>TLS-SNI Patch</title>
 +      <subtitle>Negotiate with a server for a TSL/SSL certificate</subtitle>
 +
 +      <sect2 id="tls-sni-patch">
 +              <title>Patch</title>
 +
 +              <para>
 +                      To check if Mutt supports <quote>TLS-SNI</quote>, look for
 +                      <quote>patch-tls-sni</quote> in the mutt version.
 +                      See: <xref linkend="mutt-patches"/>.
 +              </para>
 +
 +              <itemizedlist>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.6.1</para></listitem>
 +                      <listitem><para>OpenSSL</para></listitem>
 +              </itemizedlist>
 +
 +              <para>This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.</para>
 +      </sect2>
 +
 +      <sect2 id="tls-sni-intro">
 +              <title>Introduction</title>
 +
 +              <para>
 +              The <quote>TLS-SNI</quote> patch adds support for TLS virtual hosting.
 +              If your mail server doesn't support this everything will still work
 +              normally.
 +              </para>
 +
 +              <para>
 +              TLS supports sending the expected server hostname during the
 +              handshake, via the SNI extension.  This can be used to select a
 +              server certificate to issue to the client, permitting
 +              virtual-hosting without requiring multiple IP addresses.
 +              </para>
 +
 +              <para>
 +              This has been tested against Exim 4.80, which optionally logs SNI
 +              and can perform vhosting.
 +              </para>
 +
 +        <para>
 +              To verify TLS SNI support by a server, you can use:
 +        </para>
 +
 +<screen>
 +openssl s_client -host &lt;imap server&gt; -port &lt;port&gt; -tls1 -servername &lt;imap server&gt;
 +</screen>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="tls-sni-variables">
 +              <title>Variables</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="tls-sni-functions">
 +              <title>Functions</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="tls-sni-commands">
 +              <title>Commands</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="tls-sni-colors">
 +              <title>Colors</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="tls-sni-sort">
 +              <title>Sort</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="tls-sni-muttrc">
 +              <title>Muttrc</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="tls-sni-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><ulink url="http://www.neomutt.org/">NeoMutt Project</ulink></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="tls-sni-known-bugs">
 +              <title>Known Bugs</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="tls-sni-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>Jeremy Katz <email>katzj@linuxpower.org</email></para></listitem>
 +              <listitem><para>Phil Pennock <email>mutt-dev@spodhuis.demon.nl</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
 +<sect1 id="sidebar">
 +      <title>Sidebar Patch</title>
 +      <subtitle>Overview of mailboxes</subtitle>
 +
 +      <sect2 id="sidebar-patch">
 +              <title>Patch</title>
 +
 +              <para>
 +                      To check if Mutt supports <quote>Sidebar</quote>, look for
 +                      <quote>+USE_SIDEBAR</quote> in the mutt version.
 +                      See: <xref linkend="compile-time-features"/>.
 +              </para>
 +
 +              <itemizedlist>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.6.1</para></listitem>
 +              </itemizedlist>
 +
 +              <para>This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.</para>
 +      </sect2>
 +
 +      <sect2 id="sidebar-intro">
 +              <title>Introduction</title>
 +
 +              <para>
 +                      The Sidebar shows a list of all your mailboxes.  The list can be
 +                      turned on and off, it can be themed and the list style can be
 +                      configured.
 +              </para>
 +
 +              <para>
 +                      This part of the manual is a reference guide.
 +                      If you want a simple introduction with examples see the
 +                      <link linkend="intro-sidebar">Sidebar Howto</link>.
 +                      If you just want to get started, you could use the sample
 +                      <link linkend="sidebar-muttrc">Sidebar muttrc</link>.
 +              </para>
 +
 +              <para>
 +                      This version of Sidebar is based on Terry Chan's
 +                      <ulink url="http://www.lunar-linux.org/mutt-sidebar/">2015-11-11 release</ulink>.
 +                      It contains many
 +                      <emphasis role="bold"><link linkend="intro-sidebar-features">new features</link></emphasis>,
 +                      lots of
 +                      <emphasis role="bold"><link linkend="intro-sidebar-bugfixes">bugfixes</link></emphasis>.
 +              </para>
 +      </sect2>
 +
 +      <sect2 id="sidebar-variables">
 +              <title>Variables</title>
 +
 +              <table id="table-sidebar-variables">
 +                      <title>Sidebar Variables</title>
 +                      <tgroup cols="3">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Name</entry>
 +                                              <entry>Type</entry>
 +                                              <entry>Default</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry><literal>sidebar_delim_chars</literal></entry>
 +                                              <entry>string</entry>
 +                                              <entry><literal>/.</literal></entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_divider_char</literal></entry>
 +                                              <entry>string</entry>
 +                                              <entry><literal>|</literal></entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_folder_indent</literal></entry>
 +                                              <entry>boolean</entry>
 +                                              <entry><literal>no</literal></entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_format</literal></entry>
 +                                              <entry>string</entry>
 +                                              <entry><literal>%B%?F? [%F]?%* %?N?%N/?%S</literal></entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_indent_string</literal></entry>
 +                                              <entry>string</entry>
 +                                              <entry><literal>&nbsp;&nbsp;</literal> (two spaces)</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_new_mail_only</literal></entry>
 +                                              <entry>boolean</entry>
 +                                              <entry><literal>no</literal></entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_next_new_wrap</literal></entry>
 +                                              <entry>boolean</entry>
 +                                              <entry><literal>no</literal></entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_refresh_time</literal></entry>
 +                                              <entry>number</entry>
 +                                              <entry><literal>60</literal></entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_short_path</literal></entry>
 +                                              <entry>boolean</entry>
 +                                              <entry><literal>no</literal></entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_sort_method</literal></entry>
 +                                              <entry>enum</entry>
 +                                              <entry><literal>SORT_ORDER</literal></entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_visible</literal></entry>
 +                                              <entry>boolean</entry>
 +                                              <entry><literal>no</literal></entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_whitelist</literal></entry>
 +                                              <entry>list</entry>
 +                                              <entry>(empty)</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_width</literal></entry>
 +                                              <entry>number</entry>
 +                                              <entry><literal>20</literal></entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +      </sect2>
 +
 +      <sect2 id="sidebar-functions">
 +              <title>Functions</title>
 +
 +              <para>
 +                      Sidebar adds the following functions to Mutt.
 +                      By default, none of them are bound to keys.
 +              </para>
 +
 +              <table id="table-sidebar-functions">
 +                      <title>Sidebar Functions</title>
 +                      <tgroup cols="3">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Menus</entry>
 +                                              <entry>Function</entry>
 +                                              <entry>Description</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry>index,pager</entry>
 +                                              <entry><literal>&lt;sidebar-next&gt;</literal></entry>
 +                                              <entry>Move the highlight to next mailbox</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>index,pager</entry>
 +                                              <entry><literal>&lt;sidebar-next-new&gt;</literal></entry>
 +                                              <entry>Move the highlight to next mailbox with new mail</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>index,pager</entry>
 +                                              <entry><literal>&lt;sidebar-open&gt;</literal></entry>
 +                                              <entry>Open highlighted mailbox</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>index,pager</entry>
 +                                              <entry><literal>&lt;sidebar-page-down&gt;</literal></entry>
 +                                              <entry>Scroll the Sidebar down 1 page</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>index,pager</entry>
 +                                              <entry><literal>&lt;sidebar-page-up&gt;</literal></entry>
 +                                              <entry>Scroll the Sidebar up 1 page</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>index,pager</entry>
 +                                              <entry><literal>&lt;sidebar-prev&gt;</literal></entry>
 +                                              <entry>Move the highlight to previous mailbox</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>index,pager</entry>
 +                                              <entry><literal>&lt;sidebar-prev-new&gt;</literal></entry>
 +                                              <entry>Move the highlight to previous mailbox with new mail</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>index,pager</entry>
 +                                              <entry><literal>&lt;sidebar-toggle-visible&gt;</literal></entry>
 +                                              <entry>Make the Sidebar (in)visible</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +      </sect2>
 +
 +      <sect2 id="sidebar-commands">
 +              <title>Commands</title>
 +              <cmdsynopsis>
 +                      <command>sidebar_whitelist</command>
 +                      <arg choice="plain">
 +                              <replaceable class="parameter">mailbox</replaceable>
 +                      </arg>
 +                      <arg choice="opt" rep="repeat">
 +                              <replaceable class="parameter">mailbox</replaceable>
 +                      </arg>
 +              </cmdsynopsis>
 +      </sect2>
 +
 +      <sect2 id="sidebar-colors">
 +              <title>Colors</title>
 +
 +              <table id="table-sidebar-colors">
 +                      <title>Sidebar Colors</title>
 +                      <tgroup cols="3">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Name</entry>
 +                                              <entry>Default Color</entry>
 +                                              <entry>Description</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry><literal>sidebar_divider</literal></entry>
 +                                              <entry>default</entry>
 +                                              <entry>The dividing line between the Sidebar and the Index/Pager panels</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_flagged</literal></entry>
 +                                              <entry>default</entry>
 +                                              <entry>Mailboxes containing flagged mail</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_highlight</literal></entry>
 +                                              <entry>underline</entry>
 +                                              <entry>Cursor to select a mailbox</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_indicator</literal></entry>
 +                                              <entry>mutt <literal>indicator</literal></entry>
 +                                              <entry>The mailbox open in the Index panel</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_new</literal></entry>
 +                                              <entry>default</entry>
 +                                              <entry>Mailboxes containing new mail</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>sidebar_spoolfile</literal></entry>
 +                                              <entry>default</entry>
 +                                              <entry>Mailbox that receives incoming mail</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +
 +              If the <literal>sidebar_indicator</literal> color isn't set, then the default Mutt
 +              indicator color will be used (the color used in the index panel).
 +      </sect2>
 +
 +      <sect2 id="sidebar-sort">
 +              <title>Sort</title>
 +
 +              <table id="table-sidebar-sort">
 +                      <title>Sidebar Sort</title>
 +                      <tgroup cols="2">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Sort</entry>
 +                                              <entry>Description</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry><literal>alpha</literal></entry>
 +                                              <entry>Alphabetically by path</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>count</literal></entry>
 +                                              <entry>Total number of messages</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>flagged</literal></entry>
 +                                              <entry>Number of flagged messages</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>name</literal></entry>
 +                                              <entry>Alphabetically by path</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>new</literal></entry>
 +                                              <entry>Number of new messages</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>path</literal></entry>
 +                                              <entry>Alphabetically by path</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>unsorted</literal></entry>
 +                                              <entry>Do not resort the paths</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +      </sect2>
 +
 +      <sect2 id="sidebar-muttrc">
 +              <title>Muttrc</title>
 +<screen>
 +<emphasis role="comment"># This is a complete list of sidebar-related configuration.
 + 
 +# --------------------------------------------------------------------------
 +# VARIABLES - shown with their default values
 +# --------------------------------------------------------------------------
 + 
 +# Should the Sidebar be shown?</emphasis>
 +set sidebar_visible = no
 + 
 +<emphasis role="comment"># How wide should the Sidebar be in screen columns?
 +# Note: Some characters, e.g. Chinese, take up two columns each.</emphasis>
 +set sidebar_width = 20
 + 
 +<emphasis role="comment"># Should the mailbox paths be abbreviated?</emphasis>
 +set sidebar_short_path = no
 + 
 +<emphasis role="comment"># When abbreviating mailbox path names, use any of these characters as path
 +# separators.  Only the part after the last separators will be shown.
 +# For file folders '/' is good.  For IMAP folders, often '.' is useful.</emphasis>
 +set sidebar_delim_chars = '/.'
 + 
 +<emphasis role="comment"># If the mailbox path is abbreviated, should it be indented?</emphasis>
 +set sidebar_folder_indent = no
 + 
 +<emphasis role="comment"># Indent mailbox paths with this string.</emphasis>
 +set sidebar_indent_string = '  '
 + 
 +<emphasis role="comment"># Make the Sidebar only display mailboxes that contain new, or flagged,
 +# mail.</emphasis>
 +set sidebar_new_mail_only = no
 + 
 +<emphasis role="comment"># Any mailboxes that are whitelisted will always be visible, even if the
 +# sidebar_new_mail_only option is enabled.</emphasis>
 +sidebar_whitelist '/home/user/mailbox1'
 +sidebar_whitelist '/home/user/mailbox2'
 + 
 +<emphasis role="comment"># When searching for mailboxes containing new mail, should the search wrap
 +# around when it reaches the end of the list?</emphasis>
 +set sidebar_next_new_wrap = no
 + 
 +<emphasis role="comment"># The character to use as the divider between the Sidebar and the other Mutt
 +# panels.
 +# Note: Only the first character of this string is used.</emphasis>
 +set sidebar_divider_char = '|'
 + 
 +<emphasis role="comment"># Display the Sidebar mailboxes using this format string.</emphasis>
 +set sidebar_format = '%B%?F? [%F]?%* %?N?%N/?%S'
 + 
 +<emphasis role="comment"># Sidebar will not refresh its list of mailboxes any more frequently than
 +# this number of seconds.  This will help reduce disk/network traffic.</emphasis>
 +set sidebar_refresh_time = 60
 + 
 +<emphasis role="comment"># Sort the mailboxes in the Sidebar using this method:
 +#       count    - total number of messages
 +#       flagged  - number of flagged messages
 +#       new      - number of new messages
 +#       path     - mailbox path
 +#       unsorted - do not sort the mailboxes</emphasis>
 +set sidebar_sort_method = 'unsorted'
 + 
 +<emphasis role="comment"># --------------------------------------------------------------------------
 +# FUNCTIONS - shown with an example mapping
 +# --------------------------------------------------------------------------
 + 
 +# Move the highlight to the previous mailbox</emphasis>
 +bind index,pager \Cp sidebar-prev
 + 
 +<emphasis role="comment"># Move the highlight to the next mailbox</emphasis>
 +bind index,pager \Cn sidebar-next
 + 
 +<emphasis role="comment"># Open the highlighted mailbox</emphasis>
 +bind index,pager \Co sidebar-open
 + 
 +<emphasis role="comment"># Move the highlight to the previous page
 +# This is useful if you have a LOT of mailboxes.</emphasis>
 +bind index,pager &lt;F3&gt; sidebar-page-up
 + 
 +<emphasis role="comment"># Move the highlight to the next page
 +# This is useful if you have a LOT of mailboxes.</emphasis>
 +bind index,pager &lt;F4&gt; sidebar-page-down
 + 
 +<emphasis role="comment"># Move the highlight to the previous mailbox containing new, or flagged,
 +# mail.</emphasis>
 +bind index,pager &lt;F5&gt; sidebar-prev-new
 + 
 +<emphasis role="comment"># Move the highlight to the next mailbox containing new, or flagged, mail.</emphasis>
 +bind index,pager &lt;F6&gt; sidebar-next-new
 + 
 +<emphasis role="comment"># Toggle the visibility of the Sidebar.</emphasis>
 +bind index,pager B sidebar-toggle-visible
 + 
 +<emphasis role="comment"># --------------------------------------------------------------------------
 +# COLORS - some unpleasant examples are given
 +# --------------------------------------------------------------------------
 +# Note: All color operations are of the form:
 +#       color OBJECT FOREGROUND BACKGROUND
 + 
 +# Color of the current, open, mailbox
 +# Note: This is a general Mutt option which colors all selected items.</emphasis>
 +color indicator cyan black
 + 
 +<emphasis role="comment"># Color of the highlighted, but not open, mailbox.</emphasis>
 +color sidebar_highlight black color8
 + 
 +<emphasis role="comment"># Color of the divider separating the Sidebar from Mutt panels</emphasis>
 +color sidebar_divider color8 black
 + 
 +<emphasis role="comment"># Color to give mailboxes containing flagged mail</emphasis>
 +color sidebar_flagged red black
 + 
 +<emphasis role="comment"># Color to give mailboxes containing new mail</emphasis>
 +color sidebar_new green black
 + 
 +<emphasis role="comment"># --------------------------------------------------------------------------
 + 
 +# vim: syntax=muttrc</emphasis>
 +</screen>
 +      </sect2>
 +
 +      <sect2 id="sidebar-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><link linkend="regexp">Regular Expressions</link></para></listitem>
 +                      <listitem><para><link linkend="patterns">Patterns</link></para></listitem>
 +                      <listitem><para><link linkend="color">Color command</link></para></listitem>
 +                      <listitem><para><link linkend="notmuch">notmuch patch</link></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="sidebar-known-bugs">
 +              <title>Known Bugs</title>
 +              Unsorted isn't
 +      </sect2>
 +
 +      <sect2 id="sidebar-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>Justin Hibbits <email>jrh29@po.cwru.edu</email></para></listitem>
 +              <listitem><para>Thomer M. Gil <email>mutt@thomer.com</email></para></listitem>
 +              <listitem><para>David Sterba <email>dsterba@suse.cz</email></para></listitem>
 +              <listitem><para>Evgeni Golov <email>evgeni@debian.org</email></para></listitem>
 +              <listitem><para>Fabian Groffen <email>grobian@gentoo.org</email></para></listitem>
 +              <listitem><para>Jason DeTiberus <email>jdetiber@redhat.com</email></para></listitem>
 +              <listitem><para>Stefan Assmann <email>sassmann@kpanic.de</email></para></listitem>
 +              <listitem><para>Steve Kemp <email>steve@steve.org.uk</email></para></listitem>
 +              <listitem><para>Terry Chan <email>tchan@lunar-linux.org</email></para></listitem>
 +              <listitem><para>Tyler Earnest <email>tylere@rne.st</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
 +<sect1 id="ifdef">
 +      <title>Ifdef Patch</title>
 +      <subtitle>Conditional config options</subtitle>
 +
 +      <sect2 id="ifdef-patch">
 +              <title>Patch</title>
 +
 +              <para>
 +                      To check if Mutt supports <quote>ifdef</quote>, look for
 +                      <quote>patch-ifdef</quote> in the mutt version.
 +                      See: <xref linkend="mutt-patches"/>.
 +              </para>
 +
 +              <itemizedlist>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.6.1</para></listitem>
 +              </itemizedlist>
 +
 +              <para>This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.</para>
 +      </sect2>
 +
 +      <sect2 id="ifdef-intro">
 +              <title>Introduction</title>
 +
 +              <para>
 +                      The <quote>ifdef</quote> patch introduces three new commands to
 +                      Mutt and allow you to share one config file between versions of Mutt
 +                      that may have different features compiled in.
 +              </para>
 +
 +<screen>
 +ifdef  symbol config-command [args...]  <emphasis role="comment"># If a symbol is defined</emphasis>
 +ifndef symbol config-command [args...]  <emphasis role="comment"># If a symbol is not defined</emphasis>
 +finish                                  <emphasis role="comment"># Finish reading the current file</emphasis>
 +</screen>
 +
 +              <para>
 +                      Here a symbol can be a <link linkend="variables">$variable</link>,
 +                      <link linkend="functions">&lt;function&gt;</link>,
 +                      <link linkend="commands">command</link> or compile-time symbol, such
 +                      as <quote>USE_IMAP</quote>.
 +              </para>
 +
 +        <para>
 +            <literal>finish</literal> is particularly useful when combined with
 +            <literal>ifndef</literal>. e.g.
 +        </para>
 +
 +<screen>
 +<emphasis role="comment"># Sidebar config file</emphasis>
 +ifndef USE_SIDEBAR finish
 +</screen>
 +
 +      </sect2>
 +
 +<!--
 +      <sect2 id="ifdef-variables">
 +              <title>Variables</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="ifdef-functions">
 +              <title>Functions</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="ifdef-commands">
 +              <title>Commands</title>
 +              <cmdsynopsis>
 +                      <command>ifdef</command>
 +                      <arg choice="plain">
 +                              <replaceable class="parameter">symbol</replaceable>
 +                      </arg>
 +                      <arg choice="plain">
 +                              <replaceable class="parameter">"config-command [args]"</replaceable>
 +                      </arg>
 +                      <command>ifndef</command>
 +                      <arg choice="plain">
 +                              <replaceable class="parameter">symbol</replaceable>
 +                      </arg>
 +                      <arg choice="plain">
 +                              <replaceable class="parameter">"config-command [args]"</replaceable>
 +                      </arg>
 +                      <command>finish</command>
 +              </cmdsynopsis>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="ifdef-colors">
 +              <title>Colors</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="ifdef-sort">
 +              <title>Sort</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="ifdef-muttrc">
 +              <title>Muttrc</title>
 +<screen>
 +<emphasis role="comment"># Example Mutt config file for the 'ifdef' feature.
 + 
 +# This feature introduces three useful commands which allow you to share
 +# one config file between versions of Mutt that may have different
 +# features compiled in.
 + 
 +#     ifdef  symbol config-command [args...]
 +#     ifndef symbol config-command [args...]
 +#     finish                                
 + 
 +# The 'ifdef' command tests whether Mutt understands the name of
 +# a variable, function, command or compile-time symbol.
 +# If it does, then it executes a config command.
 + 
 +# The 'ifndef' command tests whether a symbol does NOT exist.
 + 
 +# The 'finish' command tells Mutt to stop reading current config file.
 + 
 +# If the 'trash' variable exists, set it.</emphasis>
 +ifdef trash 'set trash=~/Mail/trash'
 + 
 +<emphasis role="comment"># If the 'tag-pattern' function exists, bind a key to it.</emphasis>
 +ifdef tag-pattern 'bind index &lt;F6&gt; tag-pattern'
 + 
 +<emphasis role="comment"># If the 'imap-fetch-mail' command exists, read my IMAP config.</emphasis>
 +ifdef imap-fetch-mail 'source ~/.mutt/imap.rc'
 + 
 +<emphasis role="comment"># If the compile-time symbol 'USE_SIDEBAR' does not exist, then
 +# stop reading the current config file.</emphasis>
 +ifndef USE_SIDEBAR finish
 + 
 +<emphasis role="comment"># vim: syntax=muttrc</emphasis>
 +</screen>
 +      </sect2>
 +
 +      <sect2 id="ifdef-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><ulink url="http://www.neomutt.org/">NeoMutt Project</ulink></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="ifdef-known-bugs">
 +              <title>Known Bugs</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="ifdef-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>Cedric Duval <email>cedricduval@free.fr</email></para></listitem>
 +              <listitem><para>Matteo F. Vescovi <email>mfvescovi@gmail.com</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
 +<sect1 id="fmemopen">
 +      <title>Fmemopen Patch</title>
 +      <subtitle>Replace some temporary files with memory buffers</subtitle>
 +
 +      <sect2 id="fmemopen-patch">
 +              <title>Patch</title>
 +
 +              <para>
 +                      To check if Mutt supports <quote>fmemopen</quote>, look for
 +                      <quote>patch-fmemopen</quote> in the mutt version.
 +                      See: <xref linkend="mutt-patches"/>.
 +              </para>
 +
 +              <itemizedlist>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.6.1</para></listitem>
 +                      <listitem><para><literal>open_memstream()</literal>, <literal>fmemopen()</literal> from glibc</para></listitem>
 +              </itemizedlist>
 +
 +              <para>This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.</para>
 +      </sect2>
 +
 +      <sect2 id="fmemopen-intro">
 +              <title>Introduction</title>
 +
 +        <para>
 +              The <quote>fmemopen</quote> patch speeds up some searches.
 +        </para>
 +
 +        <para>
 +              This patch changes a few places where Mutt creates temporary files.
 +              It replaces them with in-memory buffers.  This should improve the
 +              performance when searching the header or body using the
 +              <link linkend="thorough-search">$thorough_search</link> option.
 +        </para>
 +
 +        <para>
 +              There are no user-configurable parts.
 +        </para>
 +
 +        <para>
 +              This patch depends on <literal>open_memstream()</literal> and
 +              <literal>fmemopen()</literal>.  They are provided by glibc.  Without
 +              them, Mutt will simply create temporary files.
 +        </para>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="fmemopen-variables">
 +              <title>Variables</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="fmemopen-functions">
 +              <title>Functions</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="fmemopen-commands">
 +              <title>Commands</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="fmemopen-colors">
 +              <title>Colors</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="fmemopen-sort">
 +              <title>Sort</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="fmemopen-muttrc">
 +              <title>Muttrc</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="fmemopen-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><ulink url="http://www.neomutt.org/">NeoMutt Project</ulink></para></listitem>
 +                      <listitem><para><link linkend="compile-time-features">Compile-Time Features</link></para></listitem>
 +                      <listitem><para><literal>fmemopen(3)</literal></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="fmemopen-known-bugs">
 +              <title>Known Bugs</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="fmemopen-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>Julius Plenz <email>plenz@cis.fu-berlin.de</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
 +<sect1 id="initials">
 +      <title>Initials Expando Patch</title>
 +      <subtitle>Expando for author's initials</subtitle>
 +
 +      <sect2 id="initials-patch">
 +              <title>Patch</title>
 +
 +              <para>
 +                      To check if Mutt supports <quote>Initials</quote>, look for
 +                      <quote>patch-initials</quote> in the mutt version.
 +                      See: <xref linkend="mutt-patches"/>.
 +              </para>
 +
 +              <itemizedlist>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.6.1</para></listitem>
 +              </itemizedlist>
 +
 +              <para>This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.</para>
 +      </sect2>
 +
 +      <sect2 id="initials-intro">
 +              <title>Introduction</title>
 +
 +        <para>
 +              The <quote>initials</quote> patch adds an expando (%I) for an author's
 +              initials.
 +        </para>
 +
 +              <para>
 +              The index panel displays a list of emails.  Its layout is controlled by
 +              the <link linkend="index-format">$index_format</link> variable.  Using
 +              this expando saves space in the index panel.  This can be useful if you
 +              are regularly working with a small set of people.
 +              </para>
 +      </sect2>
 +
 +      <sect2 id="initials-variables">
 +              <title>Variables</title>
 +
 +        <para>
 +        This patch has no config of its own.  It adds an expando which can be
 +              used in the <link linkend="index-format">$index_format</link> variable.
 +        </para>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="initials-functions">
 +              <title>Functions</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="initials-commands">
 +              <title>Commands</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="initials-colors">
 +              <title>Colors</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="initials-sort">
 +              <title>Sort</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="initials-muttrc">
 +              <title>Muttrc</title>
 +<screen>
 +<emphasis role="comment"># Example Mutt config file for the 'initials' patch.
 + 
 +# The 'initials' patch has no config of its own.
 +# It adds an expando for an author's initials,
 +# which can be used in the 'index_format' variable.
 + 
 +# The default 'index_format' is:</emphasis>
 +set index_format='%4C %Z %{%b %d} %-15.15L (%?l?%4l&amp;%4c?) %s'
 + 
 +<emphasis role="comment"># Where %L represents the author/recipient
 + 
 +# This might look like:
 +#       1   + Nov 17 David Bowie   Changesbowie    ( 689)
 +#       2   ! Nov 17 Stevie Nicks  Rumours         ( 555)
 +#       3   + Nov 16 Jimi Hendrix  Voodoo Child    ( 263)
 +#       4   + Nov 16 Debbie Harry  Parallel Lines  ( 540)
 + 
 +# Using the %I expando:</emphasis>
 +set index_format='%4C %Z %{%b %d} %I (%?l?%4l&amp;%4c?) %s'
 + 
 +<emphasis role="comment"># This might look like:
 +#       1   + Nov 17 DB Changesbowie    ( 689)
 +#       2   ! Nov 17 SN Rumours         ( 555)
 +#       3   + Nov 16 JH Voodoo Child    ( 263)
 +#       4   + Nov 16 DH Parallel Lines  ( 540)
 + 
 +# vim: syntax=muttrc</emphasis>
 +</screen>
 +      </sect2>
 +
 +      <sect2 id="initials-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><ulink url="http://www.neomutt.org/">NeoMutt Project</ulink></para></listitem>
 +                      <listitem><para><link linkend="index-format">$index_format</link></para></listitem>
 +                      <listitem><para><link linkend="index-color">index-color patch</link></para></listitem>
 +                      <listitem><para><link linkend="folder-hook">folder-hook</link></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="initials-known-bugs">
 +              <title>Known Bugs</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="initials-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>Vsevolod Volkov <email>vvv@mutt.org.ua</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
 +<sect1 id="trash-folder">
 +      <title>Trash Folder Patch</title>
 +      <subtitle>Automatically move "deleted" emails to a trash bin</subtitle>
 +
 +      <sect2 id="trash-folder-patch">
 +              <title>Patch</title>
 +
 +              <para>
 +                      To check if Mutt supports <quote>Trash Folder</quote>, look for
 +                      <quote>patch-trash</quote> in the mutt version.
 +                      See: <xref linkend="mutt-patches"/>.
 +              </para>
 +
 +              If IMAP is enabled, this patch will use it
 +
 +              <itemizedlist>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.6.1</para></listitem>
 +                      <listitem><para>IMAP support</para></listitem>
 +              </itemizedlist>
 +
 +              <para>This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.</para>
 +      </sect2>
 +
 +      <sect2 id="trash-folder-intro">
 +              <title>Introduction</title>
 +
 +              <para>
 +              In Mutt, when you <quote>delete</quote> an email it is first marked
 +              deleted.  The email isn't really gone until
 +              <link linkend="index-map">&lt;sync-mailbox&gt;</link> is called.
 +              This happens when the user leaves the folder, or the function is called
 +              manually.
 +              </para>
 +
 +              <para>
 +              After <literal>&lt;sync-mailbox&gt;</literal> has been called the email is gone forever.
 +              </para>
 +
 +              <para>
 +              The <link linkend="trash">$trash</link> variable defines a folder in
 +              which to keep old emails.  As before, first you mark emails for
 +              deletion.  When &lt;sync-mailbox&gt; is called the emails are moved to
 +              the trash folder.
 +              </para>
 +
 +              <para>
 +              The <literal>$trash</literal> path can be either a full directory,
 +              or be relative to the <link linkend="folder">$folder</link>
 +              variable, like the <literal>mailboxes</literal> command.
 +              </para>
 +
 +              <note>
 +              Emails deleted from the trash folder are gone forever.
 +              </note>
 +      </sect2>
 +
 +      <sect2 id="trash-folder-variables">
 +              <title>Variables</title>
 +              <table id="table-trash-variables">
 +                      <title>Trash Variables</title>
 +                      <tgroup cols="3">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Name</entry>
 +                                              <entry>Type</entry>
 +                                              <entry>Default</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry>trash</entry>
 +                                              <entry>string</entry>
 +                                              <entry>(none)</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +      </sect2>
 +
 +      <sect2 id="trash-folder-functions">
 +              <title>Functions</title>
 +              <table id="table-trash-functions">
 +                      <title>Trash Functions</title>
 +                      <tgroup cols="4">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Menus</entry>
 +                                              <entry>Default Key</entry>
 +                                              <entry>Function</entry>
 +                                              <entry>Description</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry>index,pager</entry>
 +                                              <entry>(none)</entry>
 +                                              <entry><literal>&lt;purge-message&gt;</literal></entry>
 +                                              <entry>really delete the current entry, bypassing the trash folder</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="trash-folder-commands">
 +              <title>Commands</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="trash-folder-colors">
 +              <title>Colors</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="trash-folder-sort">
 +              <title>Sort</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="trash-folder-muttrc">
 +              <title>Muttrc</title>
 +<screen>
 +<emphasis role="comment"># Example Mutt config file for the 'trash' feature.
 + 
 +# This feature defines a new 'trash' folder.
 +# When mail is deleted it will be moved to this folder.
 + 
 +# Folder in which to put deleted emails</emphasis>
 +set trash='+Trash'
 +set trash='/home/flatcap/Mail/Trash'
 + 
 +<emphasis role="comment"># The default delete key 'd' will move an email to the 'trash' folder
 +# Bind 'D' to REALLY delete an email</emphasis>
 +bind index D purge-message
 + 
 +<emphasis role="comment"># Note: Deleting emails from the 'trash' folder will REALLY delete them.
 + 
 +# vim: syntax=muttrc</emphasis>
 +</screen>
 +      </sect2>
 +
 +      <sect2 id="trash-folder-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><ulink url="http://www.neomutt.org/">NeoMutt Project</ulink></para></listitem>
 +                      <listitem><para><link linkend="folder-hook">folder-hook</link></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="trash-folder-known-bugs">
 +              <title>Known Bugs</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="trash-folder-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>Cedric Duval <email>cedricduval@free.fr</email></para></listitem>
 +              <listitem><para>Benjamin Kuperman <email>kuperman@acm.org</email></para></listitem>
 +              <listitem><para>Paul Miller <email>paul@voltar.org</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
 +<sect1 id="limit-current-thread">
 +      <title>Limit-Current-Thread Patch</title>
 +      <subtitle>Focus on one Email Thread</subtitle>
 +
 +      <sect2 id="limit-current-thread-patch">
 +              <title>Patch</title>
 +
 +              <para>
 +                      To check if Mutt supports <quote>limit-current-thread</quote>, look for
 +                      <quote>patch-limit-current-thread</quote> in the mutt version.
 +                      See: <xref linkend="mutt-patches"/>.
 +              </para>
 +
 +              <itemizedlist>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.6.1</para></listitem>
 +              </itemizedlist>
 +
 +              <para>This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.</para>
 +      </sect2>
 +
 +      <sect2 id="limit-current-thread-intro">
 +              <title>Introduction</title>
 +
 +              <para>
 +                      This patch adds a new way of using the
 +                      <link linkend="tuning-search">Limit Command</link>.
 +                        The <literal>&lt;limit-current-thread&gt;</literal>
 +                        function restricts the view to just the current thread.
 +                        Setting the limit (the <literal>l</literal> key) to
 +                        <quote>all</quote> will restore the full email list.
 +              </para>
 +
 +      </sect2>
 +
 +<!--
 +      <sect2 id="limit-current-thread-variables">
 +              <title>Variables</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +      <sect2 id="limit-current-thread-functions">
 +              <title>Functions</title>
 +
 +              <table id="table-limit-current-thread-functions">
 +                      <title>Limit-Current-Thread Functions</title>
 +                      <tgroup cols="4">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Menus</entry>
 +                                              <entry>Default Key</entry>
 +                                              <entry>Function</entry>
 +                                              <entry>Description</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry>index</entry>
 +                                                <entry><literal>&lt;Esc&gt; L</literal></entry>
 +                                              <entry><literal>&lt;limit-current-thread&gt;</literal></entry>
 +                                              <entry>Limit view to current thread</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +
 +      </sect2>
 +<!--
 +      <sect2 id="limit-current-thread-commands">
 +              <title>Commands</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="limit-current-thread-colors">
 +              <title>Colors</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="limit-current-thread-sort">
 +              <title>Sort</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="limit-current-thread-muttrc">
 +              <title>Muttrc</title>
 +
 +<screen>
 +<emphasis role="comment"># Example Mutt config file for the 'limit-current-thread' patch.
 + 
 +# Limit view to current thread</emphasis>
 +bind index &lt;esc&gt;L limit-current-thread
 + 
 +<emphasis role="comment"># vim: syntax=muttrc</emphasis>
 +</screen>
 +      </sect2>
 +
 +      <sect2 id="limit-current-thread-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><ulink url="http://www.neomutt.org/">NeoMutt Project</ulink></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="limit-current-thread-known-bugs">
 +              <title>Known Bugs</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="limit-current-thread-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>David Sterba <email>dsterba@suse.cz</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
 +<sect1 id="skip-quoted-patch">
 +      <title>Skip-Quoted Patch</title>
 +      <subtitle>Leave some context visible</subtitle>
 +
 +      <sect2 id="skip-quoted-patch2">
 +              <title>Patch</title>
 +
 +              <para>
 +                      To check if Mutt supports <quote>skip-quoted</quote>, look for
 +                      <quote>patch-skip-quoted</quote> in the mutt version.
 +                      See: <xref linkend="mutt-patches"/>.
 +              </para>
 +
 +              <itemizedlist>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.6.1</para></listitem>
 +              </itemizedlist>
 +
 +              <para>This patch is part of the <ulink url="http://www.neomutt.org/">NeoMutt Project</ulink>.</para>
 +      </sect2>
 +
 +      <sect2 id="skip-quoted-intro">
 +              <title>Introduction</title>
 +
 +              <para>
 +                      When viewing an email, the
 +                      <literal>&lt;skip-to-quoted&gt;</literal> function (by default the
 +                      <literal>S</literal> key) will scroll past any quoted text.
 +                      Sometimes, a little context is useful.
 +              </para>
 +
 +              <para>
 +                      By setting the <literal>$skip_quoted_offset</literal> variable, you
 +                      can select how much of the quoted text is left visible.
 +              </para>
 +      </sect2>
 +
 +      <sect2 id="skip-quoted-variables">
 +              <title>Variables</title>
 +              <table id="table-skip-quoted-variables">
 +                      <title>Skip-Quoted Variables</title>
 +                      <tgroup cols="3">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Name</entry>
 +                                              <entry>Type</entry>
 +                                              <entry>Default</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry><literal>skip_quoted_offset</literal></entry>
 +                                              <entry>number</entry>
 +                                              <entry>0</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="skip-quoted-functions">
 +              <title>Functions</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="skip-quoted-commands">
 +              <title>Commands</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="skip-quoted-colors">
 +              <title>Colors</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="skip-quoted-sort">
 +              <title>Sort</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="skip-quoted-muttrc">
 +              <title>Muttrc</title>
 +
 +<screen>
 +<emphasis role="comment"># Example Mutt config file for the 'skip-quoted' patch.
 + 
 +# The 'S' (skip-quoted) command scrolls the pager past the quoted text (usually
 +# indented with '&gt; '.  Setting 'skip_quoted_offset' leaves some lines of quoted
 +# text on screen for context.
 + 
 +# Show three quoted lines before the reply</emphasis>
 +set skip_quoted_offset = 3
 + 
 +<emphasis role="comment"># vim: syntax=muttrc</emphasis>
 +</screen>
 +      </sect2>
 +
 +      <sect2 id="skip-quoted-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><ulink url="http://www.neomutt.org/">NeoMutt Project</ulink></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="skip-quoted-known-bugs">
 +              <title>Known Bugs</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="skip-quoted-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>David Sterba <email>dsterba@suse.cz</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
 +<sect1 id="compress">
 +      <title>Compressed Folders Patch</title>
 +      <subtitle>Read from/write to compressed mailboxes</subtitle>
 +
 +      <sect2 id="compress-patch">
 +              <title>Patch</title>
 +
 +              <para>
 +                      To check if Mutt supports <quote>Compress Folders</quote>, look for
 +                      <quote>+USE_COMPRESSED</quote> in the mutt version.
 +                      See: <xref linkend="compile-time-features"/>.
 +              </para>
 +
 +              <itemizedlist>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.5.24</para></listitem>
 +              </itemizedlist>
 +
 +              <para>This patch is part of the <ulink url="https://github.com/neomutt/neomutt/wiki">NeoMutt Project</ulink>.</para>
 +      </sect2>
 +
 +      <sect2 id="compress-intro">
 +              <title>Introduction</title>
 +
 +              <para>
 +                      The Compressed Folder patch allows Mutt to read mailbox files that are
 +                      compressed.  But it isn't limited to compressed files.  It works well
 +                      with encrypted files, too.  In fact, if you can create a program/script
 +                      to convert to and from your format, then Mutt can read it.
 +              </para>
 +
 +              <para>
 +                      The patch adds three hooks to Mutt: <literal>open-hook</literal>,
 +                      <literal>close-hook</literal> and <literal>append-hook</literal>.  They
 +                      define commands to: uncompress a file; compress a file; append
 +                      messages to an already compressed file.
 +              </para>
 +
 +              <para>
 +                      There are some examples of both compressed and encrypted files,
 +                      later.  For now, the documentation will just concentrate on
 +                      compressed files.
 +              </para>
 +
 +      </sect2>
 +
 +<!--
 +      <sect2 id="compress-variables">
 +              <title>Variables</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="compress-functions">
 +              <title>Functions</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="compress-commands">
 +              <title>Commands</title>
 +              <cmdsynopsis>
 +                      <command>open-hook</command>
 +                      <arg choice="plain">
 +                              <replaceable class="parameter">pattern</replaceable>
 +                      </arg>
 +                      <arg choice="plain">
 +                              <replaceable class="parameter">shell-command</replaceable>
 +                      </arg>
 +                      <command>close-hook</command>
 +                      <arg choice="plain">
 +                              <replaceable class="parameter">pattern</replaceable>
 +                      </arg>
 +                      <arg choice="plain">
 +                              <replaceable class="parameter">shell-command</replaceable>
 +                      </arg>
 +                      <command>append-hook</command>
 +                      <arg choice="plain">
 +                              <replaceable class="parameter">pattern</replaceable>
 +                      </arg>
 +                      <arg choice="plain">
 +                              <replaceable class="parameter">shell-command</replaceable>
 +                      </arg>
 +              </cmdsynopsis>
 +
 +              <para>
 +                      The shell-command must contain two placeholders for filenames:
 +                      <literal>%f</literal> and <literal>%t</literal>.  These represent
 +                      <quote>from</quote> and <quote>to</quote> filenames.  It's a good idea to
 +                      put quotes around these placeholders.
 +              </para>
 +
 +              <para>
 +                      If you need the exact string <quote>%f</quote> or <quote>%t</quote> in your
 +                      command, simply double up the <quote>%</quote> character, e.g.
 +                      <quote>%%f</quote> or <quote>%%t</quote>.
 +              </para>
 +
 +              <table id="table-compress-optional">
 +                      <title>Not all Hooks are Required</title>
 +                      <tgroup cols="5">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Open</entry>
 +                                              <entry>Close</entry>
 +                                              <entry>Append</entry>
 +                                              <entry>Effect</entry>
 +                                              <entry>Useful if</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry>Open</entry>
 +                                              <entry>-</entry>
 +                                              <entry>-</entry>
 +                                              <entry>Folder is readonly</entry>
 +                                              <entry>The folder is just a backup</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>Open</entry>
 +                                              <entry>Close</entry>
 +                                              <entry>-</entry>
 +                                              <entry>Folder is read/write, but the entire folder must be
 +                                                      written if anything is changed</entry>
 +                                              <entry>Your compression format doesn't support appending</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>Open</entry>
 +                                              <entry>Close</entry>
 +                                              <entry>Append</entry>
 +                                              <entry>Folder is read/write and emails can be efficiently added
 +                                                      to the end</entry>
 +                                              <entry>Your compression format supports appending</entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry>Open</entry>
 +                                              <entry>-</entry>
 +                                              <entry>Append</entry>
 +                                              <entry>Folder is readonly, but can be appended to</entry>
 +                                              <entry>You want to store emails, but never change them</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +
 +              <note>
 +                      The command:
 +                      <itemizedlist>
 +                              <listitem><para>should return a non-zero exit status on failure</para></listitem>
 +                              <listitem><para>should not delete any files</para></listitem>
 +                      </itemizedlist>
 +              </note>
 +
 +              <sect3 id="open-hook">
 +                      <title>Read from compressed mailbox</title>
 +
 +                      <screen>open-hook regexp shell-command</screen>
 +
 +                      <para>
 +                              If Mutt is unable to open a file, it then looks for
 +                              <literal>open-hook</literal> that matches the filename.
 +                      </para>
 +
 +                      <para>
 +                              If your compression program doesn't have a well-defined extension,
 +                              then you can use <literal>.</literal> as the regexp.
 +                      </para>
 +
 +                      <sect4 id="compress-open-hook-example">
 +                              <title>Example of open-hook</title>
 +
 +                              <screen>open-hook '\.gz$' &quot;gzip -cd '%f' &gt; '%t'&quot;</screen>
 +
 +                              <itemizedlist>
 +                                      <listitem><para>Mutt finds a file, <quote>example.gz</quote>,
 +                                                      that it can't read</para></listitem>
 +                                      <listitem><para>Mutt has an <literal>open-hook</literal>
 +                                                      whose regexp matches the filename:
 +                                                      <literal>\.gz$</literal></para></listitem>
 +                                      <listitem><para>Mutt uses the command <literal>gzip -cd</literal>
 +                                                      to create a temporary file that it <emphasis>can</emphasis>
 +                                                      read</para></listitem>
 +                              </itemizedlist>
 +                      </sect4>
 +              </sect3>
 +
 +              <sect3 id="close-hook">
 +                      <title>Write to a compressed mailbox</title>
 +
 +                      <screen>close-hook regexp shell-command</screen>
 +
 +                      <para>
 +                              When Mutt has finished with a compressed mail folder, it will look
 +                              for a matching <literal>close-hook</literal> to recompress the file.
 +                              This hook is <link linkend="table-compress-optional">optional</link>.
 +                      </para>
 +
 +                      <note>
 +                              If the folder has not been modifed, the
 +                              <literal>close-hook</literal> will not be called.
 +                      </note>
 +
 +                      <sect4 id="compress-close-hook-example">
 +                              <title>Example of close-hook</title>
 +
 +                              <screen>close-hook '\.gz$' &quot;gzip -c '%t' &gt; '%f'&quot;</screen>
 +
 +                              <itemizedlist>
 +                                      <listitem><para>Mutt has finished with a folder, <quote>example.gz</quote>,
 +                                                      that it opened with <literal>open-hook</literal></para></listitem>
 +                                      <listitem><para>The folder has been modified</para></listitem>
 +                                      <listitem><para>Mutt has a <literal>close-hook</literal> whose regexp
 +                                                      matches the filename: <literal>\.gz$</literal></para></listitem>
 +                                      <listitem><para>Mutt uses the command <literal>gzip -c</literal>
 +                                                      to create a new compressed file</para></listitem>
 +                              </itemizedlist>
 +                      </sect4>
 +              </sect3>
 +
 +              <sect3 id="append-hook">
 +                      <title>Append to a compressed mailbox</title>
 +
 +                      <screen>append-hook regexp shell-command</screen>
 +
 +                      <para>
 +                              When Mutt wants to append an email to a compressed mail folder, it
 +                              will look for a matching <literal>append-hook</literal>.
 +                              This hook is <link linkend="table-compress-optional">optional</link>.
 +                      </para>
 +
 +                      <para>
 +                              Using the <literal>append-hook</literal> will save time, but
 +                              Mutt won't be able to determine the type of the mail folder
 +                              inside the compressed file.
 +                      </para>
 +
 +                      <para>
 +                              Mutt will <emphasis>assume</emphasis> the type to be that of
 +                              the <literal>$mbox_type</literal> variable.  Mutt also uses
 +                              this type for temporary files.
 +                      </para>
 +
 +                      <para>
 +                              Mutt will only use the <literal>append-hook</literal> for existing files.
 +                              The <literal>close-hook</literal> will be used for empty, or missing files.
 +                      </para>
 +
 +                      <sect4 id="compress-append-hook-example">
 +                              <title>Example of append-hook</title>
 +
 +                              <screen>append-hook '\.gz$' &quot;gzip -c '%t' &gt;&gt; '%f'&quot;</screen>
 +
 +                              <itemizedlist>
 +                                      <listitem><para>Mutt wants to append an email to a folder, <quote>example.gz</quote>,
 +                                                      that it opened with <literal>open-hook</literal></para></listitem>
 +                                      <listitem><para>Mutt has an <literal>append-hook</literal> whose regexp matches
 +                                                      the filename: <literal>\.gz$</literal></para></listitem>
 +                                      <listitem><para>Mutt knows the mailbox type from the <literal>$mbox</literal>
 +                                                      variable</para></listitem>
 +                                      <listitem><para>Mutt uses the command <literal>gzip -c</literal>
 +                                                      to append to an existing compressed file</para></listitem>
 +                              </itemizedlist>
 +                      </sect4>
 +
 +              </sect3>
 +
 +              <sect3 id="compress-empty">
 +                      <title>Empty Files</title>
 +
 +                      <para>
 +                              Mutt assumes that an empty file is not compressed.  In this
 +                              situation, unset <link linkend="save-empty">$save_empty</link>, so
 +                              that the compressed file will be removed if you delete all of the
 +                              messages.
 +                      </para>
 +              </sect3>
 +
 +              <sect3 id="compress-security">
 +                      <title>Security</title>
 +
 +                      <para>
 +                              Encrypted files are decrypted into temporary files which are
 +                              stored in the <link linkend="tmpdir">$tmpdir</link> directory.
 +                              This could be a security risk.
 +                      </para>
 +              </sect3>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="compress-colors">
 +              <title>Colors</title>
 +              <para>None</para>
 +      </sect2>
 +
 +      <sect2 id="compress-sort">
 +              <title>Sort</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="compress-muttrc">
 +              <title>Muttrc</title>
 +<screen>
 +<emphasis role="comment"># Example Mutt config file for the 'compressed folders' feature.
 + 
 +# This feature adds three hooks to Mutt which allow it to
 +# work with compressed, or encrypted, mailboxes.
 + 
 +# The hooks are of the form:
 +#       open-hook   regexp &quot;shell-command&quot;
 +#       close-hook  regexp &quot;shell-command&quot;
 +#       append-hook regexp &quot;shell-command&quot;
 + 
 +# The 'append-hook' is optional.
 + 
 +# Hander for gzip compressed mailboxes</emphasis>
 +open-hook   '\.gz$'  &quot;gzip -cd  '%f' &gt;  '%t'&quot;
 +close-hook  '\.gz$'  &quot;gzip -c   '%t' &gt;  '%f'&quot;
 +append-hook '\.gz$'  &quot;gzip -c   '%t' &gt;&gt; '%f'&quot;
 + 
 +<emphasis role="comment"># Hander for bzip2 compressed mailboxes</emphasis>
 +open-hook   '\.bz2$' &quot;bzip2 -cd '%f' &gt;  '%t'&quot;
 +close-hook  '\.bz2$' &quot;bzip2 -c  '%t' &gt;  '%f'&quot;
 +append-hook '\.bz2$' &quot;bzip2 -c  '%t' &gt;&gt; '%f'&quot;
 + 
 +<emphasis role="comment"># Hander for xz compressed mailboxes</emphasis>
 +open-hook   '\.xz$'  &quot;xz    -cd '%f' &gt;  '%t'&quot;
 +close-hook  '\.xz$'  &quot;xz    -c  '%t' &gt;  '%f'&quot;
 +append-hook '\.xz$'  &quot;xz    -c  '%t' &gt;&gt; '%f'&quot;
 + 
 +<emphasis role="comment"># Hander for pgp encrypted mailboxes
 +# PGP does not support appending to an encrypted file</emphasis>
 +open-hook   '\.pgp$' &quot;pgp -f &lt; '%f' &gt; '%t'&quot;
 +close-hook  '\.pgp$' &quot;pgp -fe YourPgpUserIdOrKeyId &lt; '%t' &gt; '%f'&quot;
 + 
 +<emphasis role="comment"># Hander for gpg encrypted mailboxes
 +# gpg does not support appending to an encrypted file</emphasis>
 +open-hook   '\.gpg$' &quot;gpg --decrypt &lt; '%f' &gt; '%t'&quot;
 +close-hook  '\.gpg$' &quot;gpg --encrypt --recipient YourGpgUserIdOrKeyId &lt; '%t' &gt; '%f'&quot;
 + 
 +<emphasis role="comment"># vim: syntax=muttrc</emphasis>
 +</screen>
 +      </sect2>
 +
 +      <sect2 id="compress-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><ulink url="https://github.com/neomutt/neomutt/wiki">NeoMutt Project</ulink></para></listitem>
 +                      <listitem><para><link linkend="compile-time-features">Compile-Time Features</link></para></listitem>
 +                      <listitem><para><link linkend="regexp">Regular Expressions</link></para></listitem>
 +                      <listitem><para><link linkend="tmpdir">$tmpdir</link></para></listitem>
 +                      <listitem><para><link linkend="mbox-type">$mbox_type</link></para></listitem>
 +                      <listitem><para><link linkend="save-empty">$save_empty</link></para></listitem>
 +                      <listitem><para><link linkend="folder-hook">folder-hook</link></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="compress-known-bugs">
 +              <title>Known Bugs</title>
 +
 +              <itemizedlist>
 +                      <listitem><para>The Compressed Folder hooks cannot deal with filenames that contains quotes/apostrophes.</para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="compress-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>Roland Rosenfeld <email>roland@spinnaker.de</email></para></listitem>
 +              <listitem><para>Alain Penders <email>Alain@Finale-Dev.com</email></para></listitem>
 +              <listitem><para>Christoph <quote>Myon</quote> Berg <email>myon@debian.org</email></para></listitem>
 +              <listitem><para>Evgeni Golov <email>evgeni@debian.org</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
 +<sect1 id="keywords">
 +      <title>Keywords Patch</title>
 +      <subtitle>Labels/Tagging for emails</subtitle>
 +
 +      <sect2 id="keywords-patch">
 +              <title>Patch</title>
 +
 +              <para>
 +                      To check if Mutt supports <quote>Keywords</quote>, look for
 +                      <quote>patch-keywords</quote> in the mutt version.
 +                      See: <xref linkend="mutt-patches"/>.
 +              </para>
 +
 +              <itemizedlist>
 +                      <title>Dependencies:</title>
 +                      <listitem><para>mutt-1.5.24</para></listitem>
 +              </itemizedlist>
 +
 +              <para>This patch is part of the <ulink url="https://github.com/neomutt/neomutt/wiki">NeoMutt Project</ulink>.</para>
 +      </sect2>
 +
 +      <sect2 id="keywords-intro">
 +              <title>Introduction</title>
 +
 +              <para>
 +              Unify label/keyword handling.
 +              </para>
 +
 +              <para>
 +              Since x-labels were added to mutt in 2000, a number of other approaches
 +              to what we now call <quote>tagging</quote> have also emerged.
 +              One of them was even made standard in RFC 2822.
 +              This update unifies the handling of all these strategies.
 +              </para>
 +
 +              <para>
 +              We start by changing mutt's internal keyword storage from a single
 +              string which may contain whitespace to a list of discrete keywords.
 +              This has advantages for keyword completion as well as for portabilty
 +              among varying "standards" for keyword storage.  This may represent
 +              a significant change for existing mutt users who have set x-labels
 +              containing spaces, and should be regarded with suspicion.  The
 +              advantages are significant, though.
 +              </para>
 +
 +              <para>
 +              Next we allow mutt to parse keywords into this internal list from
 +              any of the following headers: X-Label (freeform), X-Keywords
 +              (space-delimited), X-Mozilla-Keys (space-delimited), and Keywords (RFC
 +              2822, comma-space-delimited).  Mutt remembers which headers it sourced
 +              keywords from, and can rewrite those headers when saving messages for
 +              compatibility with the mailer of origin.
 +              </para>
 +
 +              <para>
 +              (X-Label was specified as freeform text by mutt, its only known
 +              implementation.  X-Labels have been used both as a
 +              <quote>tagging</quote> device, probably with space delimiting, and as a
 +              <quote>memo</quote> field, where space-delimited parsing would ruin the
 +              semantics of the memo.  By default mutt will not split X-Labels at all.
 +              Set $xlabel_delimiter if your needs vary.)
 +              </para>
 +
 +              <para>
 +              Finally we add two booleans: $keywords_legacy=true and
 +              $keywords_standard=FALSE.  When $keywords_legacy is true, mutt will
 +              always save keyword to whatever original header it came from.  When
 +              $keywords_standard=true, mutt will save to the Keywords: header.  If
 +              both are true mutt saves to both; if neither is true, mutt saves only
 +              to legacy headers to avoid complete loss of keywords.
 +              </para>
 +
 +              <para>
 +              Overall this represents convergence path for all competing
 +              labelling/tagging/keywording systems toward one that is specified by
 +              RFC.
 +              </para>
 +
 +              <para>
 +              You can change or delete the X-Label: field within
 +              Mutt using the edit-label command, bound to the
 +              y key by default.  This works for tagged messages, too.
 +              </para>
 +      </sect2>
 +
 +      <sect2 id="keywords-variables">
 +              <title>Variables</title>
 +
 +              <table id="table-keywords-variables">
 +                      <title>Keywords Variables</title>
 +                      <tgroup cols="3">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Name</entry>
 +                                              <entry>Type</entry>
 +                                              <entry>Default</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry><literal>keywords_legacy</literal></entry>
 +                                              <entry>boolean</entry>
 +                                              <entry><literal>yes</literal></entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>keywords_standard</literal></entry>
 +                                              <entry>boolean</entry>
 +                                              <entry><literal>no</literal></entry>
 +                                      </row>
 +                                      <row>
 +                                              <entry><literal>xlabel_delimiter</literal></entry>
 +                                              <entry>string</entry>
 +                                              <entry>(empty)</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +      </sect2>
 +
 +      <sect2 id="keywords-functions">
 +              <title>Functions</title>
 +
 +              <table id="table-keywords-funcions">
 +                      <title>Keyword Functions</title>
 +                      <tgroup cols="4">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Menus</entry>
 +                                              <entry>Default Key</entry>
 +                                              <entry>Function</entry>
 +                                              <entry>Description</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry>index,pager</entry>
 +                                              <entry>y</entry>
 +                                              <entry><literal>&lt;edit-label&gt;</literal></entry>
 +                                              <entry>add, change, or delete a message's label</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +      </sect2>
 +
 +<!--
 +      <sect2 id="keywords-commands">
 +              <title>Commands</title>
 +      </sect2>
 +
 +      <sect2 id="keywords-colors">
 +              <title>Colors</title>
 +              <para>None</para>
 +      </sect2>
 +-->
 +
 +      <sect2 id="keywords-sort">
 +              <title>Sort</title>
 +              <table id="table-keywords-sort">
 +                      <title>Keywords Sort</title>
 +                      <tgroup cols="2">
 +                              <thead>
 +                                      <row>
 +                                              <entry>Sort</entry>
 +                                              <entry>Description</entry>
 +                                      </row>
 +                              </thead>
 +                              <tbody>
 +                                      <row>
 +                                              <entry><literal>label</literal></entry>
 +                                              <entry>Sort by label</entry>
 +                                      </row>
 +                              </tbody>
 +                      </tgroup>
 +              </table>
 +      </sect2>
 +
 +      <sect2 id="keywords-muttrc">
 +              <title>Muttrc</title>
 +      </sect2>
 +
 +      <sect2 id="keywords-see-also">
 +              <title>See Also</title>
 +
 +              <itemizedlist>
 +                      <listitem><para><ulink url="https://github.com/neomutt/neomutt/wiki">NeoMutt Project</ulink></para></listitem>
 +                      <listitem><para><link linkend="index-format">$index_format</link></para></listitem>
 +                      <listitem><para><link linkend="index-color">index-color patch</link></para></listitem>
 +                      <listitem><para><link linkend="folder-hook">folder-hook</link></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +
 +      <sect2 id="keywords-known-bugs">
 +              <title>Known Bugs</title>
 +      </sect2>
 +
 +      <sect2 id="keywords-credits">
 +              <title>Credits</title>
 +              <itemizedlist>
 +              <listitem><para>David Champion <email>dgc@uchicago.edu</email></para></listitem>
 +              <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
 +              </itemizedlist>
 +      </sect2>
 +</sect1>
 +
++<sect1 id="nntp">
++      <title>NNTP Patch</title>
++      <subtitle>Talk to a Usenet news server</subtitle>
++
++      <sect2 id="nntp-patch">
++              <title>Patch</title>
++
++              <para>
++                      To check if Mutt supports <quote>NNTP</quote>, look for
++                      <quote>+USE_NNTP</quote> in the mutt version.
++                      See: <xref linkend="compile-time-features"/>.
++              </para>
++
++              <itemizedlist>
++                      <title>Patch Dependencies:</title>
++                      <listitem><para>mutt-1.5.24</para></listitem>
++              </itemizedlist>
++
++              <para>This patch is part of the <link linkend="neomutt">NeoMutt project</link>.</para>
++      </sect2>
++
++      <sect2 id="nntp-intro">
++              <title>Introduction</title>
++      </sect2>
++
++      <sect2 id="nntp-variables">
+               <title>Variables</title>
+       </sect2>
+       <sect2 id="nntp-functions">
+               <title>Functions</title>
+               <table id="table-nntp-functions">
+                       <title>NNTP Functions</title>
+                       <tgroup cols="4">
+                               <thead>
+                                       <row>
+                                               <entry>Menus</entry>
+                                               <entry>Default Key</entry>
+                                               <entry>Function</entry>
+                                               <entry>Description</entry>
+                                       </row>
+                               </thead>
+                               <tbody>
+                                       <row>
+                                               <entry>browser,index</entry>
+                                               <entry>y</entry>
+                                               <entry><literal>&lt;catchup&gt;</literal></entry>
+                                               <entry>mark all articles in newsgroup as read</entry>
+                                       </row>
+                                       <row>
+                                               <entry>index,pager</entry>
+                                               <entry>i</entry>
+                                               <entry><literal>&lt;change-newsgroup&gt;</literal></entry>
+                                               <entry>open a different newsgroup</entry>
+                                       </row>
+                                       <row>
+                                               <entry>pager</entry>
+                                               <entry>X</entry>
+                                               <entry><literal>&lt;change-vfolder&gt;</literal></entry>
+                                               <entry>open a different virtual folder</entry>
+                                       </row>
+                                       <row>
+                                               <entry>compose</entry>
+                                               <entry>o</entry>
+                                               <entry><literal>&lt;edit-followup-to&gt;</literal></entry>
+                                               <entry>edit the Followup-To field</entry>
+                                       </row>
+                                       <row>
+                                               <entry>compose</entry>
+                                               <entry>N</entry>
+                                               <entry><literal>&lt;edit-newsgroups&gt;</literal></entry>
+                                               <entry>edit the newsgroups list</entry>
+                                       </row>
+                                       <row>
+                                               <entry>compose</entry>
+                                               <entry>x</entry>
+                                               <entry><literal>&lt;edit-x-comment-to&gt;</literal></entry>
+                                               <entry>edit the X-Comment-To field</entry>
+                                       </row>
+                                       <row>
+                                               <entry>pager</entry>
+                                               <entry>+</entry>
+                                               <entry><literal>&lt;entire-thread&gt;</literal></entry>
+                                               <entry>read entire thread of the current message</entry>
+                                       </row>
+                                       <row>
+                                               <entry>attachment,index,pager</entry>
+                                               <entry>F</entry>
+                                               <entry><literal>&lt;followup-message&gt;</literal></entry>
+                                               <entry>followup to newsgroup</entry>
+                                       </row>
+                                       <row>
+                                               <entry>pager</entry>
+                                               <entry>`</entry>
+                                               <entry><literal>&lt;modify-labels&gt;</literal></entry>
+                                               <entry>modify (notmuch) tags</entry>
+                                       </row>
+                                       <row>
+                                               <entry>index,pager</entry>
+                                               <entry>P</entry>
+                                               <entry><literal>&lt;post-message&gt;</literal></entry>
+                                               <entry>post message to newsgroup</entry>
+                                       </row>
+                                       <row>
+                                               <entry>browser</entry>
+                                               <entry>g</entry>
+                                               <entry><literal>&lt;reload-active&gt;</literal></entry>
+                                               <entry>load list of all newsgroups from NNTP server</entry>
+                                       </row>
+                                       <row>
+                                               <entry>browser</entry>
+                                               <entry>s</entry>
+                                               <entry><literal>&lt;subscribe&gt;</literal></entry>
+                                               <entry>subscribe to current mbox (IMAP/NNTP only)</entry>
+                                       </row>
+                                       <row>
+                                               <entry>browser</entry>
+                                               <entry>S</entry>
+                                               <entry><literal>&lt;subscribe-pattern&gt;</literal></entry>
+                                               <entry>subscribe to newsgroups matching a pattern</entry>
+                                       </row>
+                                       <row>
+                                               <entry>browser</entry>
+                                               <entry>Y</entry>
+                                               <entry><literal>&lt;uncatchup&gt;</literal></entry>
+                                               <entry>mark all articles in newsgroup as unread</entry>
+                                       </row>
+                                       <row>
+                                               <entry>browser</entry>
+                                               <entry>u</entry>
+                                               <entry><literal>&lt;unsubscribe&gt;</literal></entry>
+                                               <entry>unsubscribe from current mbox (IMAP/NNTP only)</entry>
+                                       </row>
+                                       <row>
+                                               <entry>browser</entry>
+                                               <entry>U</entry>
+                                               <entry><literal>&lt;unsubscribe-pattern&gt;</literal></entry>
+                                               <entry>unsubscribe from newsgroups matching a pattern</entry>
+                                       </row>
+                                       <row>
+                                               <entry>index,pager</entry>
+                                               <entry>Alt-i</entry>
+                                               <entry><literal>&lt;change-newsgroup-readonly&gt;</literal></entry>
+                                               <entry>open a different newsgroup in read only mode</entry>
+                                       </row>
+                                       <row>
+                                               <entry>attachment,index,pager</entry>
+                                               <entry>Alt-F</entry>
+                                               <entry><literal>&lt;forward-to-group&gt;</literal></entry>
+                                               <entry>forward to newsgroup</entry>
+                                       </row>
+                                       <row>
+                                               <entry>index</entry>
+                                               <entry>(none)</entry>
+                                               <entry><literal>&lt;get-children&gt;</literal></entry>
+                                               <entry>get all children of the current message</entry>
+                                       </row>
+                                       <row>
+                                               <entry>index</entry>
+                                               <entry>Alt-G</entry>
+                                               <entry><literal>&lt;get-parent&gt;</literal></entry>
+                                               <entry>get parent of the current message</entry>
+                                       </row>
+                                       <row>
+                                               <entry>index,pager</entry>
+                                               <entry>(none)</entry>
+                                               <entry><literal>&lt;imap-fetch-mail&gt;</literal></entry>
+                                               <entry>force retrieval of mail from IMAP server</entry>
+                                       </row>
+                                       <row>
+                                               <entry>index,pager</entry>
+                                               <entry>(none)</entry>
+                                               <entry><literal>&lt;imap-logout-all&gt;</literal></entry>
+                                               <entry>logout from all IMAP servers</entry>
+                                       </row>
+                                       <row>
+                                               <entry>pager</entry>
+                                               <entry>(none)</entry>
+                                               <entry><literal>&lt;modify-labels-then-hide&gt;</literal></entry>
+                                               <entry>modify labeld and then hide message</entry>
+                                       </row>
+                                       <row>
+                                               <entry>index</entry>
+                                               <entry>(none)</entry>
+                                               <entry><literal>&lt;reconstruct-thread&gt;</literal></entry>
+                                               <entry>reconstruct thread containing current message</entry>
+                                       </row>
+                                       <row>
+                                               <entry>pager</entry>
+                                               <entry>Alt-X</entry>
+                                               <entry><literal>&lt;vfolder-from-query&gt;</literal></entry>
+                                               <entry>generate virtual folder from query</entry>
+                                       </row>
+                                       <row>
+                                               <entry>index</entry>
+                                               <entry>Ctrl-G</entry>
+                                               <entry><literal>&lt;get-message&gt;</literal></entry>
+                                               <entry>get message with Message-Id</entry>
+                                       </row>
+                               </tbody>
+                       </tgroup>
+               </table>
+       </sect2>
+       <sect2 id="nntp-commands">
+               <title>Commands</title>
+       </sect2>
+       <sect2 id="nntp-colors">
+               <title>Colors</title>
+               <para>None</para>
+       </sect2>
+       <sect2 id="nntp-sort">
+               <title>Sort</title>
+               <para>None</para>
+       </sect2>
+       <sect2 id="nntp-muttrc">
+               <title>Muttrc</title>
+       </sect2>
+       <sect2 id="nntp-see-also">
+               <title>See Also</title>
+       </sect2>
+       <sect2 id="nntp-known-bugs">
+               <title>Known Bugs</title>
+       </sect2>
+       <sect2 id="nntp-credits">
+               <title>Credits</title>
+               <itemizedlist>
+               <listitem><para>Vsevolod Volkov <email>vvv@mutt.org.ua</email></para></listitem>
+               <listitem><para>Felix von Leitner <email>leitner@fefe.de</email></para></listitem>
+               <listitem><para>Richard Russon <email>rich@flatcap.org</email></para></listitem>
+               </itemizedlist>
+       </sect2>
+ </sect1>
  </chapter>
  
  <chapter id="security">
diff --cc functions.h
index 506cad8447f742e68c1f0b8764c3d58aebb71068,22c0de79734544b977f868584f30b07a5a2e0f89..5747425022fc7ab5288eea746205326c744f2dac
@@@ -99,10 -103,17 +103,18 @@@ const struct binding_t OpMain[] = { /* 
    { "delete-thread",          OP_DELETE_THREAD,               "\004" },
    { "delete-subthread",               OP_DELETE_SUBTHREAD,            "\033d" },
    { "edit",                   OP_EDIT_MESSAGE,                "e" },
 +  { "edit-label",             OP_EDIT_LABEL,                  "y" },
    { "edit-type",              OP_EDIT_TYPE,                   "\005" },
    { "forward-message",                OP_FORWARD_MESSAGE,             "f" },
-   { "flag-message",           OP_FLAG_MESSAGE,                "F" },
+ #ifdef USE_NNTP
+   { "forward-to-group",               OP_FORWARD_TO_GROUP,            "\033F" },
+   { "followup-message",               OP_FOLLOWUP,                    "F" },
+   { "get-children",           OP_GET_CHILDREN,                NULL },
+   { "get-message",            OP_GET_MESSAGE,                 "\007" },
+   { "get-parent",             OP_GET_PARENT,                  "\033G" },
+   { "reconstruct-thread",     OP_RECONSTRUCT_THREAD,          NULL },
+ #endif
+   { "flag-message",           OP_FLAG_MESSAGE,                "\033f" },
    { "group-reply",            OP_GROUP_REPLY,                 "g" },
  #ifdef USE_POP
    { "fetch-mail",             OP_MAIN_FETCH_MAIL,             "G" },
@@@ -209,10 -210,13 +232,14 @@@ const struct binding_t OpPager[] = { /
    { "set-flag",       OP_MAIN_SET_FLAG,               "w" },
    { "clear-flag",       OP_MAIN_CLEAR_FLAG,           "W" },
    { "edit",           OP_EDIT_MESSAGE,                "e" },
 +  { "edit-label",     OP_EDIT_LABEL,                  "y" },
    { "edit-type",      OP_EDIT_TYPE,                   "\005" },
+ #ifdef USE_NNTP
+   { "followup-message",       OP_FOLLOWUP,                    "F" },
+   { "forward-to-group",       OP_FORWARD_TO_GROUP,            "\033F" },
+ #endif
    { "forward-message",        OP_FORWARD_MESSAGE,             "f" },
-   { "flag-message",   OP_FLAG_MESSAGE,                "F" },
+   { "flag-message",   OP_FLAG_MESSAGE,                "\033f" },
    { "group-reply",    OP_GROUP_REPLY,                 "g" },
  #ifdef USE_IMAP
    { "imap-fetch-mail",  OP_MAIN_IMAP_FETCH,           NULL },
    { "sort-mailbox",   OP_SORT,                        "o" },
    { "sort-reverse",   OP_SORT_REVERSE,                "O" },
    { "print-message",  OP_PRINT,                       "p" },
+ #ifdef USE_NNTP
+   { "post-message",   OP_POST,                        "P" },
+ #endif
    { "previous-thread",        OP_MAIN_PREV_THREAD,            "\020" },
    { "previous-subthread",OP_MAIN_PREV_SUBTHREAD,      "\033p" },
 +  { "purge-message",  OP_PURGE_MESSAGE,               NULL },
    { "quit",           OP_QUIT,                        "Q" },
    { "exit",           OP_EXIT,                        "q" },
    { "reply",          OP_REPLY,                       "r" },
diff --cc globals.h
Simple merge
diff --cc hash.c
Simple merge
diff --cc hash.h
Simple merge
diff --cc hcache.c
index d91b9c6453909a7a320429533d15e82784554c82,0299850ad326c154f548aebfcd184a882c7410fc..2f4b71d0b0c592fa2a4bb8bbe5268c3948aec97f
+++ b/hcache.c
@@@ -445,8 -446,13 +445,14 @@@ dump_envelope(ENVELOPE * e, unsigned ch
    d = dump_list(e->references, d, off, 0);
    d = dump_list(e->in_reply_to, d, off, 0);
    d = dump_list(e->userhdrs, d, off, convert);
 +  d = dump_list(e->labels, d, off, convert);
  
+ #ifdef USE_NNTP
+   d = dump_char(e->xref, d, off, 0);
+   d = dump_char(e->followup_to, d, off, 0);
+   d = dump_char(e->x_comment_to, d, off, convert);
+ #endif
    return d;
  }
  
@@@ -482,7 -489,12 +488,13 @@@ restore_envelope(ENVELOPE * e, const un
    restore_list(&e->references, d, off, 0);
    restore_list(&e->in_reply_to, d, off, 0);
    restore_list(&e->userhdrs, d, off, convert);
 +  restore_list(&e->labels, d, off, convert);
+ #ifdef USE_NNTP
+   restore_char(&e->xref, d, off, 0);
+   restore_char(&e->followup_to, d, off, 0);
+   restore_char(&e->x_comment_to, d, off, convert);
+ #endif
  }
  
  static int
diff --cc hdrline.c
index ffa99b7575870bd7272041b2ea9c10582e56cc25,9bd90d704dd9ea966fd17153f9aa02e2853643bd..e8aeba6003bd60218b2f111ab7304bde6075520e
+++ b/hdrline.c
@@@ -247,9 -211,8 +247,10 @@@ int mutt_user_is_recipient (HEADER *h
   * %E = number of messages in current thread
   * %f = entire from line
   * %F = like %n, unless from self
 + * %g = message labels (e.g. notmuch tags)
+  * %g = newsgroup name (if compiled with NNTP support)
   * %i = message-id
 + * %I = initials of author
   * %l = number of lines in the message
   * %L = like %F, except `lists' are displayed first
   * %m = number of messages in the mailbox
@@@ -616,6 -462,12 +619,12 @@@ hdr_format_str (char *dest
  
        break;
  
 -    case 'g':
+ #ifdef USE_NNTP
++    case 'q':
+       mutt_format_s (dest, destlen, prefix, hdr->env->newsgroups ? hdr->env->newsgroups : "");
+       break;
+ #endif
      case 'i':
        mutt_format_s (dest, destlen, prefix, hdr->env->message_id ? hdr->env->message_id : "<no.id>");
        break;
diff --cc headers.c
Simple merge
diff --cc init.c
Simple merge
diff --cc init.h
index 25b127c18eacf615eb28b255baa25e89278f8326,f258844724f7e43a88a46f78b6e8b2c0ee529f45..94f2128a01a6fff2b2ee15c479b530b4e30aa9b0
--- 1/init.h
--- 2/init.h
+++ b/init.h
@@@ -1316,7 -1367,7 +1368,8 @@@ struct option_t MuttVars[] = 
    ** .dt %E .dd number of messages in current thread
    ** .dt %f .dd sender (address + real name), either From: or Return-Path:
    ** .dt %F .dd author name, or recipient name if the message is from you
 +  ** .dt %g .dd message labels (e.g. notmuch tags)
+   ** .dt %g .dd newsgroup name (if compiled with NNTP support)
    ** .dt %H .dd spam attribute(s) of this message
    ** .dt %i .dd message-id of the current message
    ** .dt %l .dd number of lines in the message (does not work with maildir,
     ** See also $$read_inc, $$write_inc and $$net_inc.
     */
  #endif
+ #ifdef USE_NNTP
+   { "news_cache_dir", DT_PATH, R_NONE, UL &NewsCacheDir, UL "~/.mutt" },
+   /*
+   ** .pp
+   ** This variable pointing to directory where Mutt will save cached news
+   ** articles and headers in. If \fIunset\fP, articles and headers will not be
+   ** saved at all and will be reloaded from the server each time.
+   */
+   { "news_server",    DT_STR, R_NONE, UL &NewsServer, 0 },
+   /*
+   ** .pp
+   ** This variable specifies domain name or address of NNTP server. It
+   ** defaults to the news server specified in the environment variable
+   ** $$$NNTPSERVER or contained in the file /etc/nntpserver.  You can also
+   ** specify username and an alternative port for each news server, ie:
+   ** .pp
+   ** [[s]news://][username[:password]@]server[:port]
+   */
+   { "newsgroups_charset", DT_STR, R_NONE, UL &NewsgroupsCharset, UL "utf-8" },
+   /*
+   ** .pp
+   ** Character set of newsgroups descriptions.
+   */
+   { "newsrc",         DT_PATH, R_NONE, UL &NewsRc, UL "~/.newsrc" },
+   /*
+   ** .pp
+   ** The file, containing info about subscribed newsgroups - names and
+   ** indexes of read articles.  The following printf-style sequence
+   ** is understood:
+   ** .dl
+   ** .dt %a .dd account url
+   ** .dt %p .dd port
+   ** .dt %P .dd port if specified
+   ** .dt %s .dd news server name
+   ** .dt %S .dd url schema
+   ** .dt %u .dd username
+   ** .de
+   */
+   { "nntp_authenticators", DT_STR, R_NONE, UL &NntpAuthenticators, UL 0 },
+   /*
+   ** .pp
+   ** This is a colon-delimited list of authentication methods mutt may
+   ** attempt to use to log in to a news server, in the order mutt should
+   ** try them.  Authentication methods are either ``user'' or any
+   ** SASL mechanism, e.g. ``digest-md5'', ``gssapi'' or ``cram-md5''.
+   ** This option is case-insensitive.  If it's \fIunset\fP (the default)
+   ** mutt will try all available methods, in order from most-secure to
+   ** least-secure.
+   ** .pp
+   ** Example:
+   ** .ts
+   ** set nntp_authenticators="digest-md5:user"
+   ** .te
+   ** .pp
+   ** \fBNote:\fP Mutt will only fall back to other authentication methods if
+   ** the previous methods are unavailable. If a method is available but
+   ** authentication fails, mutt will not connect to the IMAP server.
+   */
+   { "nntp_context",   DT_NUM, R_NONE, UL &NntpContext, 1000 },
+   /*
+   ** .pp
+   ** This variable defines number of articles which will be in index when
+   ** newsgroup entered.  If active newsgroup have more articles than this
+   ** number, oldest articles will be ignored.  Also controls how many
+   ** articles headers will be saved in cache when you quit newsgroup.
+   */
+   { "nntp_listgroup", DT_BOOL, R_NONE, OPTLISTGROUP, 1 },
+   /*
+   ** .pp
+   ** This variable controls whether or not existence of each article is
+   ** checked when newsgroup is entered.
+   */
+   { "nntp_load_description", DT_BOOL, R_NONE, OPTLOADDESC, 1 },
+   /*
+   ** .pp
+   ** This variable controls whether or not descriptions for each newsgroup
+   ** must be loaded when newsgroup is added to list (first time list
+   ** loading or new newsgroup adding).
+   */
+   { "nntp_user",      DT_STR, R_NONE, UL &NntpUser, UL "" },
+   /*
+   ** .pp
+   ** Your login name on the NNTP server.  If \fIunset\fP and NNTP server requires
+   ** authentification, Mutt will prompt you for your account name when you
+   ** connect to news server.
+   */
+   { "nntp_pass",      DT_STR, R_NONE, UL &NntpPass, UL "" },
+   /*
+   ** .pp
+   ** Your password for NNTP account.
+   */
+   { "nntp_poll",      DT_NUM, R_NONE, UL &NewsPollTimeout, 60 },
+   /*
+   ** .pp
+   ** The time in seconds until any operations on newsgroup except post new
+   ** article will cause recheck for new news.  If set to 0, Mutt will
+   ** recheck newsgroup on each operation in index (stepping, read article,
+   ** etc.).
+   */
++#endif
 +#ifdef USE_NOTMUCH
 +  { "nm_open_timeout", DT_NUM, R_NONE, UL &NotmuchOpenTimeout, 5 },
 +  /*
 +   ** .pp
 +   ** This variable specifies the timeout for database open in seconds.
 +   */
 +
 +  { "nm_default_uri", DT_STR, R_NONE, UL &NotmuchDefaultUri, 0 },
 +  /*
 +   ** .pp
 +   ** This variable specifies the default Notmuch database in format
 +   ** notmuch://<absolute path>.
 +   */
 +
 +  { "nm_hidden_tags", DT_STR, R_NONE, UL &NotmuchHiddenTags, UL "unread,draft,flagged,passed,replied,attachment,signed,encrypted" },
 +  /*
 +   ** .pp
 +   ** This variable specifies private notmuch tags which should not be printed
 +   ** on screen.
 +   */
 +  { "nm_exclude_tags", DT_STR,  R_NONE, UL &NotmuchExcludeTags, 0 },
 +  /*
 +   ** .pp
 +   ** The messages tagged with these tags are excluded and not loaded
 +   ** from notmuch DB to mutt unless specified explicitly.
 +   */
 +  { "nm_unread_tag", DT_STR, R_NONE, UL &NotmuchUnreadTag, UL "unread" },
 +  /*
 +   ** .pp
 +   ** This variable specifies notmuch tag which is used for unread messages. The
 +   ** variable is used to count unread messages in DB only. All other mutt commands
 +   ** use standard (e.g. maildir) flags.
 +   */
 +  { "nm_db_limit", DT_NUM, R_NONE, UL &NotmuchDBLimit, 0 },
 +  /*
 +   ** .pp
 +   ** This variable specifies the default limit used in notmuch queries.
 +   */
 +  { "nm_query_type", DT_STR, R_NONE, UL &NotmuchQueryType, UL "messages" },
 +  /*
 +   ** .pp
 +   ** This variable specifies the default query type (threads or messages) used in notmuch queries.
 +   */
 +  { "nm_record", DT_BOOL, R_NONE, OPTNOTMUCHRECORD, 0 },
 +  /*
 +   ** .pp
 +   ** This variable specifies if the mutt record should indexed by notmuch.
 +   */
 +  { "nm_record_tags", DT_STR, R_NONE, UL &NotmuchRecordTags, 0 },
 +  /*
 +   ** .pp
 +   ** This variable specifies the default tags applied to messages stored to the mutt record.
 +   */
  #endif
    { "pager",          DT_PATH, R_NONE, UL &Pager, UL "builtin" },
    /*
    ** Command to use when spawning a subshell.  By default, the user's login
    ** shell from \fC/etc/passwd\fP is used.
    */
+ #ifdef USE_NNTP
+   { "save_unsubscribed", DT_BOOL, R_NONE, OPTSAVEUNSUB, 0 },
+   /*
+   ** .pp
+   ** When \fIset\fP, info about unsubscribed newsgroups will be saved into
+   ** ``newsrc'' file and into cache.
+   */
+   { "show_new_news",  DT_BOOL, R_NONE, OPTSHOWNEWNEWS, 1 },
+   /*
+   ** .pp
+   ** If \fIset\fP, news server will be asked for new newsgroups on entering
+   ** the browser.  Otherwise, it will be done only once for a news server.
+   ** Also controls whether or not number of new articles of subscribed
+   ** newsgroups will be then checked.
+   */
+   { "show_only_unread",       DT_BOOL, R_NONE, OPTSHOWONLYUNREAD, 0 },
+   /*
+   ** .pp
+   ** If \fIset\fP, only subscribed newsgroups that contain unread articles
+   ** will be displayed in browser.
+   */
++#endif
 +#ifdef USE_SIDEBAR
 +  { "sidebar_divider_char", DT_STR, R_BOTH, UL &SidebarDividerChar, UL "|" },
 +  /*
 +  ** .pp
 +  ** This specifies the characters to be drawn between the sidebar (when
 +  ** visible) and the other Mutt panels. ASCII and Unicode line-drawing
 +  ** characters are supported.
 +  */
 +  { "sidebar_delim_chars", DT_STR, R_NONE, UL &SidebarDelimChars, UL "/." },
 +  /*
 +  ** .pp
 +  ** This contains the list of characters which you would like to treat
 +  ** as folder separators for displaying paths in the sidebar.
 +  ** .pp
 +  ** Local mail is often arranged in directories: `dir1/dir2/mailbox'.
 +  ** .ts
 +  ** set sidebar_delim_chars='/'
 +  ** .te
 +  ** IMAP mailboxes are often named: `folder1.folder2.mailbox'.
 +  ** .ts
 +  ** set sidebar_delim_chars='.'
 +  ** .te
 +  ** .pp
 +  ** \fBSee also:\fP $$sidebar_short_path, $$sidebar_folder_indent, $$sidebar_indent_string.
 +  */
 +  { "sidebar_folder_indent", DT_BOOL, R_BOTH, OPTSIDEBARFOLDERINDENT, 0 },
 +  /*
 +  ** .pp
 +  ** Set this to indent mailboxes in the sidebar.
 +  ** .pp
 +  ** \fBSee also:\fP $$sidebar_short_path, $$sidebar_indent_string, $$sidebar_delim_chars.
 +  */
 +  { "sidebar_format", DT_STR, R_NONE, UL &SidebarFormat, UL "%B%?F? [%F]?%* %?N?%N/?%S" },
 +  /*
 +  ** .pp
 +  ** This variable allows you to customize the sidebar display. This string is
 +  ** similar to $$index_format, but has its own set of \fCprintf(3)\fP-like
 +  ** sequences:
 +  ** .dl
 +  ** .dt %B  .dd Name of the mailbox
 +  ** .dt %S  .dd * Size of mailbox (total number of messages)
 +  ** .dt %N  .dd * Number of New messages in the mailbox
 +  ** .dt %F  .dd * Number of Flagged messages in the mailbox
 +  ** .dt %!  .dd ``!'' : one flagged message;
 +  **             ``!!'' : two flagged messages;
 +  **             ``n!'' : n flagged messages (for n > 2).
 +  **             Otherwise prints nothing.
 +  ** .dt %d  .dd * @ Number of deleted messages
 +  ** .dt %L  .dd * @ Number of messages after limiting
 +  ** .dt %t  .dd * @ Number of tagged messages
 +  ** .dt %>X .dd right justify the rest of the string and pad with ``X''
 +  ** .dt %|X .dd pad to the end of the line with ``X''
 +  ** .dt %*X .dd soft-fill with character ``X'' as pad
 +  ** .de
 +  ** .pp
 +  ** * = Can be optionally printed if nonzero
 +  ** @ = Only applicable to the current folder
 +  */
 +  { "sidebar_indent_string", DT_STR, R_BOTH, UL &SidebarIndentString, UL "  " },
 +  /*
 +  ** .pp
 +  ** This specifies the string that is used to indent mailboxes in the sidebar.
 +  ** It defaults to two spaces.
 +  ** .pp
 +  ** \fBSee also:\fP $$sidebar_short_path, $$sidebar_folder_indent, $$sidebar_delim_chars.
 +  */
 +  { "sidebar_new_mail_only", DT_BOOL, R_BOTH, OPTSIDEBARNEWMAILONLY, 0 },
 +  /*
 +  ** .pp
 +  ** When set, the sidebar will only display mailboxes containing new, or
 +  ** flagged, mail.
 +  ** .pp
 +  ** \fBSee also:\fP $sidebar_whitelist.
 +  */
 +  { "sidebar_next_new_wrap", DT_BOOL, R_BOTH, UL OPTSIDEBARNEXTNEWWRAP, 0 },
 +  /*
 +  ** .pp
 +  ** When set, the \fC<sidebar-next-new>\fP command will not stop and the end of
 +  ** the list of mailboxes, but wrap around to the beginning. The
 +  ** \fC<sidebar-prev-new>\fP command is similarly affected, wrapping around to
 +  ** the end of the list.
 +  */
 +  { "sidebar_refresh_time", DT_NUM, R_BOTH, UL &SidebarRefreshTime, 60 },
 +  /*
 +  ** .pp
 +  ** Set sidebar_refresh_time to the minimum number of seconds between refreshes.
 +  ** This will reduced network traffic.
 +  ** .pp
 +  ** \fBNote:\fP Set to 0 to disable refreshing.
 +  */
 +  { "sidebar_short_path", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 0 },
 +  /*
 +  ** .pp
 +  ** By default the sidebar will show the mailbox's path, relative to the
 +  ** $$folder variable. Setting \fCsidebar_shortpath=yes\fP will shorten the
 +  ** names relative to the previous name. Here's an example:
 +  ** .dl
 +  ** .dt \fBshortpath=no\fP .dd \fBshortpath=yes\fP .dd \fBshortpath=yes, folderindent=yes, indentstr=".."\fP
 +  ** .dt \fCfruit\fP        .dd \fCfruit\fP         .dd \fCfruit\fP
 +  ** .dt \fCfruit.apple\fP  .dd \fCapple\fP         .dd \fC..apple\fP
 +  ** .dt \fCfruit.banana\fP .dd \fCbanana\fP        .dd \fC..banana\fP
 +  ** .dt \fCfruit.cherry\fP .dd \fCcherry\fP        .dd \fC..cherry\fP
 +  ** .de
 +  ** .pp
 +  ** \fBSee also:\fP $$sidebar_delim_chars, $$sidebar_folder_indent, $$sidebar_indent_string.
 +  */
 +  { "sidebar_sort_method", DT_SORT|DT_SORT_SIDEBAR, R_NONE, UL &SidebarSortMethod, SORT_ORDER },
 +  /*
 +  ** .pp
 +  ** Specifies how to sort entries in the file browser.  By default, the
 +  ** entries are sorted alphabetically.  Valid values:
 +  ** .il
 +  ** .dd alpha (alphabetically)
 +  ** .dd count (all message count)
 +  ** .dd date
 +  ** .dd desc (description)
 +  ** .dd new (new message count)
 +  ** .dd size
 +  ** .dd unsorted
 +  ** .ie
 +  ** .pp
 +  ** You may optionally use the ``reverse-'' prefix to specify reverse sorting
 +  ** order (example: ``\fCset sort_browser=reverse-date\fP'').
 +  */
 +  { "sidebar_visible", DT_BOOL, R_BOTH, OPTSIDEBAR, 0 },
 +  /*
 +  ** .pp
 +  ** This specifies whether or not to show sidebar. The sidebar shows a list of
 +  ** all your mailboxes.
 +  ** .pp
 +  ** \fBSee also:\fP $$sidebar_format, $$sidebar_width
 +  */
 +  { "sidebar_width", DT_NUM, R_BOTH, UL &SidebarWidth, 0 },
 +  /*
 +  ** .pp
 +  ** This controls the width of the sidebar.  It is measured in screen columns.
 +  ** For example: sidebar_width=20 could display 20 ASCII characters, or 10
 +  ** Chinese characters.
 +  */
  #endif
    { "sig_dashes",     DT_BOOL, R_NONE, OPTSIGDASHES, 1 },
    /*
    {"xterm_set_titles",        DT_SYN,  R_NONE, UL "ts_enabled", 0 },
    /*
    */
 +  { "xlabel_delimiter", DT_STR, R_NONE, UL &XlabelDelim, UL "" },
 +  /*
 +  ** .pp
 +  ** The character used to delimit distinct keywords in X-Label headers.
 +  ** X-Label is primarily a Mutt artifact, and the semantics of the field
 +  ** were never defined: it is free-form text.  However interaction with
 +  ** X-Keywords:, X-Mozilla-Keys:, and Keywords: requires that we adopt
 +  ** some means of identifying separate keywords within the field.  Set
 +  ** this to your personal convention.
 +  ** .pp
 +  ** This affect both parsing existing X-Label headers and writing new
 +  ** X-Label headers.  You can modify this variable in runtime to accomplish
 +  ** various kinds of conversion.
 +  */
+ #ifdef USE_NNTP
+   { "x_comment_to",   DT_BOOL, R_NONE, OPTXCOMMENTTO, 0 },
+   /*
+   ** .pp
+   ** If \fIset\fP, Mutt will add ``X-Comment-To:'' field (that contains full
+   ** name of original article author) to article that followuped to newsgroup.
+   */
+ #endif
    /*--*/
    { NULL, 0, 0, 0, 0 }
  };
diff --cc keymap.c
Simple merge
diff --cc mailbox.h
Simple merge
diff --cc main.c
index 561e892e492a440650a34290ce86fedab9c3728d,3182c1b0e73649306c1807c4529e73c69e222500..5a019706e3f00de9e0a9523f4ec7a411d62ef777
--- 1/main.c
--- 2/main.c
+++ b/main.c
  #include <idn/stringprep.h>
  #endif
  
 -static const char *ReachingUs = N_("\
 -To contact the developers, please mail to <mutt-dev@mutt.org>.\n\
 -To report a bug, please visit http://bugs.mutt.org/.\n");
 -
 -static const char *Notice = N_("\
 -Copyright (C) 1996-2016 Michael R. Elkins and others.\n\
 -Mutt comes with ABSOLUTELY NO WARRANTY; for details type `mutt -vv'.\n\
 -Mutt is free software, and you are welcome to redistribute it\n\
 -under certain conditions; type `mutt -vv' for details.\n");
 -
 -static const char *Copyright = N_("\
 -Copyright (C) 1996-2014 Michael R. Elkins <me@mutt.org>\n\
 -Copyright (C) 1996-2002 Brandon Long <blong@fiction.net>\n\
 -Copyright (C) 1997-2009 Thomas Roessler <roessler@does-not-exist.org>\n\
 -Copyright (C) 1998-2005 Werner Koch <wk@isil.d.shuttle.de>\n\
 -Copyright (C) 1999-2014 Brendan Cully <brendan@kublai.com>\n\
 -Copyright (C) 1999-2002 Tommi Komulainen <Tommi.Komulainen@iki.fi>\n\
 -Copyright (C) 2000-2004 Edmund Grimley Evans <edmundo@rano.org>\n\
 -Copyright (C) 2006-2009 Rocco Rutte <pdmef@gmx.net>\n\
 -Copyright (C) 2014-2015 Kevin J. McCarthy <kevin@8t8.us>\n\
 -\n\
 -Many others not mentioned here contributed code, fixes,\n\
 -and suggestions.\n");
 -
 -static const char *Licence = N_("\
 -    This program is free software; you can redistribute it and/or modify\n\
 -    it under the terms of the GNU General Public License as published by\n\
 -    the Free Software Foundation; either version 2 of the License, or\n\
 -    (at your option) any later version.\n\
 -\n\
 -    This program is distributed in the hope that it will be useful,\n\
 -    but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
 -    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n\
 -    GNU General Public License for more details.\n");
 -static const char *Obtaining = N_("\
 -    You should have received a copy of the GNU General Public License\n\
 -    along with this program; if not, write to the Free Software\n\
 -    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n\
 -");
 -
+ #ifdef USE_NNTP
+ #include "nntp.h"
+ #endif
  void mutt_exit (int code)
  {
    mutt_endwin (NULL);
@@@ -797,17 -1227,17 +836,26 @@@ int main (int argc, char **argv
  
      if (!folder[0])
        strfcpy (folder, NONULL(Spoolfile), sizeof (folder));
+ #ifdef USE_NNTP
+     if (option (OPTNEWS))
+     {
+       unset_option (OPTNEWS);
+       nntp_expand_path (folder, sizeof (folder), &CurrentNewsSrv->conn->account);
+     }
+     else
+ #endif
      mutt_expand_path (folder, sizeof (folder));
  
 +#ifdef USE_SIDEBAR
 +    {
 +      char tmpfolder[PATH_MAX] = "";
 +      strfcpy (tmpfolder, folder, sizeof (tmpfolder));
 +      if (!realpath (tmpfolder, folder))
 +        strfcpy (folder, tmpfolder, sizeof (tmpfolder));
 +    }
 +#endif
 +
      mutt_str_replace (&CurrentFolder, folder);
      mutt_str_replace (&LastFolder, folder);
  
diff --cc mutt.h
index bdef33f547d991c9d6524cc7d303964eab8da408,fb2ac1ac3210d000bd37ab558059f3bb8b31d2c6..405cb06190721ee01e9f19e7b52c6c98b5dd7d47
--- 1/mutt.h
--- 2/mutt.h
+++ b/mutt.h
@@@ -250,10 -223,10 +250,13 @@@ enu
    M_CRYPT_ENCRYPT,
    M_PGP_KEY,
    M_XLABEL,
 +#ifdef USE_NOTMUCH
 +  M_NOTMUCH_LABEL,
 +#endif
    M_MIMEATTACH,
+ #ifdef USE_NNTP
+   M_NEWSGROUPS,
+ #endif
    
    /* Options for Mailcap lookup */
    M_EDIT,
@@@ -567,10 -547,10 +593,14 @@@ enu
    OPTDONTHANDLEPGPKEYS,       /* (pseudo) used to extract PGP keys */
    OPTIGNOREMACROEVENTS, /* (pseudo) don't process macro/push/exec events while set */
  
 +#ifdef USE_NOTMUCH
 +  OPTVIRTSPOOLFILE,
 +  OPTNOTMUCHRECORD,
 +#endif
+ #ifdef USE_NNTP
+   OPTNEWS,            /* (pseudo) used to change reader mode */
+   OPTNEWSSEND,                /* (pseudo) used to change behavior when posting */
+ #endif
  
    OPTMAX
  };
@@@ -840,9 -822,8 +878,9 @@@ typedef struct heade
    int refno;                  /* message number on server */
  #endif
  
- #if defined USE_POP || defined USE_IMAP || defined USE_NOTMUCH
 -#if defined USE_POP || defined USE_IMAP || defined USE_NNTP
++#if defined USE_POP || defined USE_IMAP || defined USE_NOTMUCH || defined USE_NNTP
    void *data;                 /* driver-specific data */
 +  void (*free_cb)(struct header *); /* driver-specific data free function */
  #endif
    
    char *maildir_flags;                /* unknown maildir flags */
diff --cc muttlib.c
index 5b4f4dde36d64fb71bd624f8548436c508204485,3b17b490d9ebec546462e823e14183d5b48ba8ae..5457f2b4681d513053a5dc6936e1a3739093c677
+++ b/muttlib.c
@@@ -336,9 -329,7 +336,9 @@@ void mutt_free_header (HEADER **h
  #ifdef MIXMASTER
    mutt_free_list (&(*h)->chain);
  #endif
- #if defined USE_POP || defined USE_IMAP || defined USE_NOTMUCH
 -#if defined USE_POP || defined USE_IMAP || defined USE_NNTP
++#if defined USE_POP || defined USE_IMAP || defined USE_NOTMUCH || defined USE_NNTP
 +  if ((*h)->free_cb)
 +    (*h)->free_cb(*h);
    FREE (&(*h)->data);
  #endif
    FREE (h);           /* __FREE_CHECKED__ */
diff --cc mx.c
index 9a76313f3584c62f3e5db39bcb63e71c42ec0eb3,3fee78c64f1ec17c64aa1b5e346d92c286e415c4..c063904491f20b43e3951d13d91ae03eb728742c
--- 1/mx.c
--- 2/mx.c
+++ b/mx.c
  #include "pop.h"
  #endif
  
 +#ifdef USE_NOTMUCH
 +#include "mutt_notmuch.h"
 +#endif
 +
+ #ifdef USE_NNTP
+ #include "nntp.h"
+ #endif
  #include "buffy.h"
  
  #ifdef USE_DOTLOCK
@@@ -358,24 -347,22 +362,40 @@@ int mx_is_pop (const char *p
  }
  #endif
  
+ #ifdef USE_NNTP
+ int mx_is_nntp (const char *p)
+ {
+   url_scheme_t scheme;
+   if (!p)
+     return 0;
+   scheme = url_check_scheme (p);
+   if (scheme == U_NNTP || scheme == U_NNTPS)
+     return 1;
+   return 0;
+ }
+ #endif
 +#ifdef USE_NOTMUCH
 +
 +int mx_is_notmuch(const char *p)
 +{
 +  url_scheme_t scheme;
 +
 +  if (!p)
 +    return 0;
 +
 +  scheme = url_check_scheme (p);
 +  if (scheme == U_NOTMUCH)
 +    return 1;
 +
 +  return 0;
 +}
 +
 +#endif
 +
  int mx_get_magic (const char *path)
  {
    struct stat st;
      return M_POP;
  #endif /* USE_POP */
  
 +#ifdef USE_NOTMUCH
 +  if (mx_is_notmuch(path))
 +    return M_NOTMUCH;
 +#endif
 +
+ #ifdef USE_NNTP
+   if (mx_is_nntp (path))
+     return M_NNTP;
+ #endif /* USE_NNTP */
    if (stat (path, &st) == -1)
    {
      dprint (1, (debugfile, "mx_get_magic(): unable to stat %s: %s (errno %d).\n",
@@@ -727,12 -693,12 +752,18 @@@ CONTEXT *mx_open_mailbox (const char *p
        break;
  #endif /* USE_POP */
  
 +#ifdef USE_NOTMUCH
 +    case M_NOTMUCH:
 +      rc = nm_read_query (ctx);
 +      break;
 +#endif /* USE_IMAP */
 +
+ #ifdef USE_NNTP
+     case M_NNTP:
+       rc = nntp_open_mailbox (ctx);
+       break;
+ #endif /* USE_NNTP */
      default:
        rc = -1;
        break;
@@@ -851,12 -796,11 +882,17 @@@ static int sync_mailbox (CONTEXT *ctx, 
        break;
  #endif /* USE_POP */
  
 +#ifdef USE_NOTMUCH
 +    case M_NOTMUCH:
 +      rc = nm_sync (ctx, index_hint);
 +      break;
 +#endif /* USE_NOTMUCH */
 +
+ #ifdef USE_NNTP
+     case M_NNTP:
+       rc = nntp_sync_mailbox (ctx);
+       break;
+ #endif /* USE_NNTP */
    }
  
  #if 0
@@@ -967,14 -868,14 +1022,20 @@@ int mx_close_mailbox (CONTEXT *ctx, in
      if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->read 
          && !(ctx->hdrs[i]->flagged && option (OPTKEEPFLAGGED)))
        read_msgs++;
 +#ifdef USE_SIDEBAR
 +    if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->read)
 +      ctx->unread--;
 +    if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->flagged)
 +      ctx->flagged--;
 +#endif
    }
  
+ #ifdef USE_NNTP
+   /* don't need to move articles from newsgroup */
+   if (ctx->magic == M_NNTP)
+     read_msgs = 0;
+ #endif
    if (read_msgs && quadoption (OPT_MOVE) != M_NO)
    {
      char *p;
@@@ -1537,10 -1412,10 +1598,15 @@@ int mx_check_mailbox (CONTEXT *ctx, in
        return (pop_check_mailbox (ctx, index_hint));
  #endif /* USE_POP */
  
 +#ifdef USE_NOTMUCH
 +      case M_NOTMUCH:
 +      return nm_check_database(ctx, index_hint);
 +#endif
++
+ #ifdef USE_NNTP
+       case M_NNTP:
+       return (nntp_check_mailbox (ctx, 0));
+ #endif /* USE_NNTP */
      }
    }
  
@@@ -1689,8 -1560,10 +1764,11 @@@ int mx_close_message (MESSAGE **msg
    int r = 0;
  
    if ((*msg)->magic == M_MH || (*msg)->magic == M_MAILDIR
-       || (*msg)->magic == M_IMAP || (*msg)->magic == M_POP
-       || (*msg)->magic == M_NOTMUCH)
+ #ifdef USE_NNTP
+       || (*msg)->magic == M_NNTP
+ #endif
++      || (*msg)->magic == M_NOTMUCH
+       || (*msg)->magic == M_IMAP || (*msg)->magic == M_POP)
    {
      r = safe_fclose (&(*msg)->fp);
    }
diff --cc mx.h
index 2920dc2fd66d84d9eb7ef8009482f35230db6067,75be3f3a12bbc54a7c9fd9bd520eae359bd184fd..a0275e08d35deb9b54b5d1a826e75b22de8f69c7
--- 1/mx.h
--- 2/mx.h
+++ b/mx.h
@@@ -35,12 -34,11 +35,15 @@@ enu
    M_MMDF,
    M_MH,
    M_MAILDIR,
+ #ifdef USE_NNTP
+   M_NNTP,
+ #endif
    M_IMAP,
 +  M_NOTMUCH,
    M_POP
 +#ifdef USE_COMPRESSED
 +  , M_COMPRESSED
 +#endif
  };
  
  WHERE short DefaultMagic INITVAL (M_MBOX);
diff --cc pager.c
Simple merge
diff --cc parse.c
index b02a044bbe3c2ff9129ad0465c9bd18760c44678,cb3ea306580575ded2d9cca5cea0d4fe0e0f13ec..afee665c608f7e025637e20584bb6d79e7846ff1
+++ b/parse.c
@@@ -1275,17 -1299,25 +1307,31 @@@ int mutt_parse_rfc822_line (ENVELOPE *e
      }
      else if (ascii_strcasecmp (line+1, "-label") == 0)
      {
 -      FREE(&e->x_label);
 -      e->x_label = safe_strdup(p);
 -      matched = 1;
 +      kwtype = M_X_LABEL;
 +    }
 +    else if (!ascii_strcasecmp (line+1, "-keywords"))
 +    {
 +      kwtype = M_X_KEYWORDS;
 +    }
 +    else if (!ascii_strcasecmp (line+1, "-mozilla-keys"))
 +    {
 +      kwtype = M_X_MOZILLA_KEYS;
      }
 -    
+ #ifdef USE_NNTP
+     else if (!mutt_strcasecmp (line + 1, "-comment-to"))
+     {
+       if (!e->x_comment_to)
+       e->x_comment_to = safe_strdup (p);
+       matched = 1;
+     }
+     else if (!mutt_strcasecmp (line + 1, "ref"))
+     {
+       if (!e->xref)
+       e->xref = safe_strdup (p);
+       matched = 1;
+     }
+ #endif
 +
      default:
      break;
    }
diff --cc pattern.c
Simple merge
diff --cc po/POTFILES.in
Simple merge
diff --cc postpone.c
Simple merge
diff --cc protos.h
Simple merge
diff --cc send.c
index 3cbf81b693d5d7dbbc4c5331dfc6eb0ef47fb3a9,48c6f982b64363947981eb5bae824bea9bb9767f..a00ccb4f3b0f5eae943f493980818775cd32395c
--- 1/send.c
--- 2/send.c
+++ b/send.c
@@@ -1906,13 -2037,13 +2044,18 @@@ full_fcc
        goto cleanup;
      }
    }
 -  else if (!option (OPTNOCURSES) && ! (flags & SENDMAILX))
 +  else if (!option (OPTNOCURSES) && ! (flags & SENDMAILX)) {
-     mutt_message (i == 0 ? _("Mail sent.") : _("Sending in background."));
+     mutt_message (i != 0 ? _("Sending in background.") :
+ #ifdef USE_NNTP
+                 (flags & SENDNEWS) ? _("Article posted.") : _("Mail sent."));
+ #else
+                 _("Mail sent."));
+ #endif
 +#ifdef USE_NOTMUCH
 +    if (option(OPTNOTMUCHRECORD))
 +      nm_record_message(ctx, finalpath, cur);
 +#endif
 +  }
  
    if (WithCrypto && (msg->security & ENCRYPT))
      FREE (&pgpkeylist);
diff --cc sendlib.c
index 5cf9e57502d168ea974a46e629bb2c10671e6f09,66922979a59f2d1f55ad945b85ded6b5ee101c0f..ccaea8ac0ccc1ac4af0f4e1fcd38578a97e88702
+++ b/sendlib.c
@@@ -2483,8 -2556,12 +2550,11 @@@ void mutt_prepare_envelope (ENVELOPE *e
    rfc2047_encode_adrlist (env->from, "From");
    rfc2047_encode_adrlist (env->mail_followup_to, "Mail-Followup-To");
    rfc2047_encode_adrlist (env->reply_to, "Reply-To");
 -  rfc2047_encode_string (&env->x_label);
  
    if (env->subject)
+ #ifdef USE_NNTP
+   if (!option (OPTNEWSSEND) || option (OPTMIMESUBJECT))
+ #endif
    {
      rfc2047_encode_string (&env->subject);
    }
diff --cc sort.c
Simple merge
diff --cc url.c
index 51b1949fde2e8eed03e5d5559075b5fefe989477,799e95619256518d268b158ef8d71b24d3748dfd..d11b8d73ac40873e1033a6d0252b42a0e7ecc93b
--- 1/url.c
--- 2/url.c
+++ b/url.c
@@@ -39,10 -39,9 +39,12 @@@ static const struct mapping_t UrlMap[] 
    { "imaps",  U_IMAPS },
    { "pop",    U_POP },
    { "pops",   U_POPS },
+   { "news",   U_NNTP },
+   { "snews",  U_NNTPS },
    { "mailto", U_MAILTO },
 +#ifdef USE_NOTMUCH
 +  { "notmuch",  U_NOTMUCH },
 +#endif
    { "smtp",     U_SMTP },
    { "smtps",    U_SMTPS },
    { NULL,     U_UNKNOWN }
diff --cc url.h
Simple merge
diff --cc version.c
index c6cdce3fdfb09f4c7b1a420ab17680c99dceab90,0000000000000000000000000000000000000000..bc3546fbb0dba53a56501f00e3b9707b450013b9
mode 100644,000000..100644
--- /dev/null
+++ b/version.c
@@@ -1,511 -1,0 +1,516 @@@
 +/**
 + * Copyright (C) 1996-2007 Michael R. Elkins <me@mutt.org>
 + * Copyright (C) 1999-2007 Thomas Roessler <roessler@does-not-exist.org>
 + * Copyright (C) 2016 Richard Russon
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + *
 + * This program is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 + * GNU General Public License for more details.
 + *
 + * You should have received a copy of the GNU General Public License
 + * along with this program; if not, write to the Free Software
 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 + */
 +
 +#if HAVE_CONFIG_H
 +#include "config.h"
 +#endif
 +
 +#include <stdio.h>
 +#include <string.h>
 +#include <sys/utsname.h>
 +
 +#ifdef HAVE_STRINGPREP_H
 +#include <stringprep.h>
 +#elif defined (HAVE_IDN_STRINGPREP_H)
 +#include <idn/stringprep.h>
 +#endif
 +#ifdef USE_SLANG_CURSES
 +#include "slang.h"
 +#endif
 +
 +#include "lib.h"
 +
 +// #include "protos.h"
 +const char * mutt_make_version (void);
 +void mutt_print_patchlist (void);
 +
 +// #include "hcache.h"
 +const char * mutt_hcache_backend (void);
 +
 +const int SCREEN_WIDTH = 80;
 +
 +extern const char cc_version[];
 +extern const char cc_cflags[];
 +extern const char configure_options[];
 +
 +static const char *Copyright = N_(
 +      "Copyright (C) 1996-2014 Michael R. Elkins <me@mutt.org>\n"
 +      "Copyright (C) 1996-2002 Brandon Long <blong@fiction.net>\n"
 +      "Copyright (C) 1997-2009 Thomas Roessler <roessler@does-not-exist.org>\n"
 +      "Copyright (C) 1998-2005 Werner Koch <wk@isil.d.shuttle.de>\n"
 +      "Copyright (C) 1999-2014 Brendan Cully <brendan@kublai.com>\n"
 +      "Copyright (C) 1999-2002 Tommi Komulainen <Tommi.Komulainen@iki.fi>\n"
 +      "Copyright (C) 2000-2004 Edmund Grimley Evans <edmundo@rano.org>\n"
 +      "Copyright (C) 2006-2009 Rocco Rutte <pdmef@gmx.net>\n"
 +      "Copyright (C) 2014-2015 Kevin J. McCarthy <kevin@8t8.us>\n"
 +      "\n"
 +      "Many others not mentioned here contributed code, fixes,\n"
 +      "and suggestions.\n"
 +);
 +
 +static const char *License = N_(
 +      "    This program is free software; you can redistribute it and/or modify\n"
 +      "    it under the terms of the GNU General Public License as published by\n"
 +      "    the Free Software Foundation; either version 2 of the License, or\n"
 +      "    (at your option) any later version.\n"
 +      "\n"
 +      "    This program is distributed in the hope that it will be useful,\n"
 +      "    but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
 +      "    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
 +      "    GNU General Public License for more details.\n"
 +);
 +
 +static const char *Obtaining = N_(
 +      "    You should have received a copy of the GNU General Public License\n"
 +      "    along with this program; if not, write to the Free Software\n"
 +      "    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n"
 +);
 +
 +static const char *ReachingUs = N_(
 +      "To learn more about NeoMutt, visit: http://www.neomutt.org/\n"
 +      "If you find a bug in NeoMutt, please raise an issue at:\n"
 +      "    https://github.com/neomutt/neomutt/issues\n"
 +      "or contact the lead developer: Richard Russon <rich@flatcap.org>\n"
 +);
 +
 +static const char *Notice = N_(
 +      "Copyright (C) 1996-2016 Michael R. Elkins and others.\n"
 +      "Mutt comes with ABSOLUTELY NO WARRANTY; for details type `mutt -vv'.\n"
 +      "Mutt is free software, and you are welcome to redistribute it\n"
 +      "under certain conditions; type `mutt -vv' for details.\n"
 +);
 +
 +struct compile_options {
 +      const char *name;
 +      int enabled;
 +};
 +
 +static struct compile_options comp_opts[] = {
 +#ifdef CRYPT_BACKEND_CLASSIC_PGP
 +      { "CRYPT_BACKEND_CLASSIC_PGP", 1 },
 +#else
 +      { "CRYPT_BACKEND_CLASSIC_PGP", 0 },
 +#endif
 +#ifdef CRYPT_BACKEND_CLASSIC_SMIME
 +      { "CRYPT_BACKEND_CLASSIC_SMIME", 1 },
 +#else
 +      { "CRYPT_BACKEND_CLASSIC_SMIME", 0 },
 +#endif
 +#ifdef CRYPT_BACKEND_GPGME
 +      { "CRYPT_BACKEND_GPGME", 1 },
 +#else
 +      { "CRYPT_BACKEND_GPGME", 0 },
 +#endif
 +#ifdef DEBUG
 +      { "DEBUG", 1 },
 +#else
 +      { "DEBUG", 0 },
 +#endif
 +#ifdef DL_STANDALONE
 +      { "DL_STANDALONE", 1 },
 +#else
 +      { "DL_STANDALONE", 0 },
 +#endif
 +#ifdef ENABLE_NLS
 +      { "ENABLE_NLS", 1 },
 +#else
 +      { "ENABLE_NLS", 0 },
 +#endif
 +#ifdef EXACT_ADDRESS
 +      { "EXACT_ADDRESS", 1 },
 +#else
 +      { "EXACT_ADDRESS", 0 },
 +#endif
 +#ifdef HOMESPOOL
 +      { "HOMESPOOL", 1 },
 +#else
 +      { "HOMESPOOL", 0 },
 +#endif
 +#ifdef LOCALES_HACK
 +      { "LOCALES_HACK", 1 },
 +#else
 +      { "LOCALES_HACK", 0 },
 +#endif
 +#ifdef SUN_ATTACHMENT
 +      { "SUN_ATTACHMENT", 1 },
 +#else
 +      { "SUN_ATTACHMENT", 0 },
 +#endif
 +#ifdef HAVE_BKGDSET
 +      { "HAVE_BKGDSET", 1 },
 +#else
 +      { "HAVE_BKGDSET", 0 },
 +#endif
 +#ifdef HAVE_COLOR
 +      { "HAVE_COLOR", 1 },
 +#else
 +      { "HAVE_COLOR", 0 },
 +#endif
 +#ifdef HAVE_CURS_SET
 +      { "HAVE_CURS_SET", 1 },
 +#else
 +      { "HAVE_CURS_SET", 0 },
 +#endif
 +#ifdef HAVE_GETADDRINFO
 +      { "HAVE_GETADDRINFO", 1 },
 +#else
 +      { "HAVE_GETADDRINFO", 0 },
 +#endif
 +#ifdef HAVE_GETSID
 +      { "HAVE_GETSID", 1 },
 +#else
 +      { "HAVE_GETSID", 0 },
 +#endif
 +#ifdef HAVE_ICONV
 +      { "HAVE_ICONV", 1 },
 +#else
 +      { "HAVE_ICONV", 0 },
 +#endif
 +#ifdef HAVE_LANGINFO_CODESET
 +      { "HAVE_LANGINFO_CODESET", 1 },
 +#else
 +      { "HAVE_LANGINFO_CODESET", 0 },
 +#endif
 +#ifdef HAVE_LANGINFO_YESEXPR
 +      { "HAVE_LANGINFO_YESEXPR", 1 },
 +#else
 +      { "HAVE_LANGINFO_YESEXPR", 0 },
 +#endif
 +#ifdef HAVE_LIBIDN
 +      { "HAVE_LIBIDN", 1 },
 +#else
 +      { "HAVE_LIBIDN", 0 },
 +#endif
 +#ifdef HAVE_META
 +      { "HAVE_META", 1 },
 +#else
 +      { "HAVE_META", 0 },
 +#endif
 +#ifdef HAVE_REGCOMP
 +      { "HAVE_REGCOMP", 1 },
 +#else
 +      { "HAVE_REGCOMP", 0 },
 +#endif
 +#ifdef HAVE_RESIZETERM
 +      { "HAVE_RESIZETERM", 1 },
 +#else
 +      { "HAVE_RESIZETERM", 0 },
 +#endif
 +#ifdef HAVE_START_COLOR
 +      { "HAVE_START_COLOR", 1 },
 +#else
 +      { "HAVE_START_COLOR", 0 },
 +#endif
 +#ifdef HAVE_TYPEAHEAD
 +      { "HAVE_TYPEAHEAD", 1 },
 +#else
 +      { "HAVE_TYPEAHEAD", 0 },
 +#endif
 +#ifdef HAVE_WC_FUNCS
 +      { "HAVE_WC_FUNCS", 1 },
 +#else
 +      { "HAVE_WC_FUNCS", 0 },
 +#endif
 +#ifdef ICONV_NONTRANS
 +      { "ICONV_NONTRANS", 1 },
 +#else
 +      { "ICONV_NONTRANS", 0 },
 +#endif
 +#ifdef USE_COMPRESSED
 +      { "USE_COMPRESSED", 1 },
 +#else
 +      { "USE_COMPRESSED", 0 },
 +#endif
 +#ifdef USE_DOTLOCK
 +      { "USE_DOTLOCK", 1 },
 +#else
 +      { "USE_DOTLOCK", 0 },
 +#endif
 +#ifdef USE_FCNTL
 +      { "USE_FCNTL", 1 },
 +#else
 +      { "USE_FCNTL", 0 },
 +#endif
 +#ifdef USE_FLOCK
 +      { "USE_FLOCK", 1 },
 +#else
 +      { "USE_FLOCK", 0 },
 +#endif
 +#ifdef USE_GNU_REGEX
 +      { "USE_GNU_REGEX", 1 },
 +#else
 +      { "USE_GNU_REGEX", 0 },
 +#endif
 +#ifdef USE_GSS
 +      { "USE_GSS", 1 },
 +#else
 +      { "USE_GSS", 0 },
 +#endif
 +#ifdef USE_HCACHE
 +      { "USE_HCACHE", 1 },
 +#else
 +      { "USE_HCACHE", 0 },
 +#endif
 +#ifdef USE_IMAP
 +      { "USE_IMAP", 1 },
 +#else
 +      { "USE_IMAP", 0 },
 +#endif
 +#ifdef USE_NOTMUCH
 +      { "USE_NOTMUCH", 1 },
 +#else
 +      { "USE_NOTMUCH", 0 },
 +#endif
++#ifdef USE_NNTP
++      { "USE_NNTP", 1 },
++#else
++      { "USE_NNTP", 0 },
++#endif
 +#ifdef USE_POP
 +      { "USE_POP", 1 },
 +#else
 +      { "USE_POP", 0 },
 +#endif
 +#ifdef USE_SASL
 +      { "USE_SASL", 1 },
 +#else
 +      { "USE_SASL", 0 },
 +#endif
 +#ifdef USE_SETGID
 +      { "USE_SETGID", 1 },
 +#else
 +      { "USE_SETGID", 0 },
 +#endif
 +#ifdef USE_SIDEBAR
 +      { "USE_SIDEBAR", 1 },
 +#else
 +      { "USE_SIDEBAR", 0 },
 +#endif
 +#ifdef USE_SMTP
 +      { "USE_SMTP", 1 },
 +#else
 +      { "USE_SMTP", 0 },
 +#endif
 +#ifdef USE_SSL_GNUTLS
 +      { "USE_SSL_GNUTLS", 1 },
 +#else
 +      { "USE_SSL_GNUTLS", 0 },
 +#endif
 +#ifdef USE_SSL_OPENSSL
 +      { "USE_SSL_OPENSSL", 1 },
 +#else
 +      { "USE_SSL_OPENSSL", 0 },
 +#endif
 +      { NULL, 0 }
 +};
 +
 +/**
 + * print_compile_options - Print a list of enabled/disabled features
 + *
 + * The configure script lets uses enable/disable features.
 + * This shows the Mutt user which features are/aren't available.
 + *
 + * The output is of the form: "+ENABLED_FEATURE -DISABLED_FEATURE" and is
 + * wrapped to SCREEN_WIDTH characters.
 + */
 +static void
 +print_compile_options (void)
 +{
 +      int i;
 +      char c;
 +      int len;
 +      int used = 0;
 +
 +      for (i = 0; comp_opts[i].name; i++) {
 +              len = strlen (comp_opts[i].name) + 2;   /* +/- and a space */
 +              if ((used + len) > SCREEN_WIDTH) {
 +                      used = 0;
 +                      puts ("");
 +              }
 +              used += len;
 +              c = comp_opts[i].enabled ? '+' : '-';
 +              printf ("%c%s ", c, comp_opts[i].name);
 +      }
 +      puts ("");
 +}
 +
 +/**
 + * rstrip_in_place - Strip a trailing carriage return
 + * @s:  String to be modified
 + *
 + * The string has its last carriage return set to NUL.
 + * Returns:
 + *    The modified string
 + */
 +static char *
 +rstrip_in_place (char *s)
 +{
 +      if (!s)
 +              return NULL;
 +
 +      char *p;
 +
 +      p = &s[strlen (s)];
 +      if (p == s)
 +              return s;
 +      p--;
 +      while ((p >= s) && ((*p == '\n') || (*p == '\r')))
 +              *p-- = '\0';
 +      return s;
 +}
 +
 +/**
 + * print_version - Print system and compile info
 + *
 + * Print information about the current system Mutt is running on.
 + * Also print a list of all the compile-time information.
 + */
 +void
 +print_version (void)
 +{
 +      struct utsname uts;
 +
 +      puts (mutt_make_version());
 +      puts (_(Notice));
 +
 +      uname (&uts);
 +
 +#ifdef _AIX
 +      printf ("System: %s %s.%s", uts.sysname, uts.version, uts.release);
 +#elif defined (SCO)
 +      printf ("System: SCO %s", uts.release);
 +#else
 +      printf ("System: %s %s", uts.sysname, uts.release);
 +#endif
 +
 +      printf (" (%s)", uts.machine);
 +
 +#ifdef NCURSES_VERSION
 +      printf ("\nncurses: %s (compiled with %s)", curses_version(), NCURSES_VERSION);
 +#elif defined (USE_SLANG_CURSES)
 +      printf ("\nslang: %d", SLANG_VERSION);
 +#endif
 +
 +#ifdef _LIBICONV_VERSION
 +      printf ("\nlibiconv: %d.%d", _LIBICONV_VERSION >> 8,
 +              _LIBICONV_VERSION & 0xff);
 +#endif
 +
 +#ifdef HAVE_LIBIDN
 +      printf ("\nlibidn: %s (compiled with %s)", stringprep_check_version (NULL),
 +              STRINGPREP_VERSION);
 +#endif
 +
 +#ifdef USE_HCACHE
 +      printf ("\nhcache backend: %s", mutt_hcache_backend());
 +#endif
 +
 +      puts ("\n\nCompiler:");
 +      rstrip_in_place ((char *) cc_version);
 +      puts (cc_version);
 +
 +      rstrip_in_place ((char *) configure_options);
 +      printf ("\nConfigure options: %s\n", configure_options);
 +
 +      rstrip_in_place ((char *) cc_cflags);
 +      printf ("\nCompilation CFLAGS: %s\n", cc_cflags);
 +
 +      puts (_("\nCompile options:"));
 +      print_compile_options();
 +
 +#ifdef DOMAIN
 +      printf ("DOMAIN=\"%s\"\n", DOMAIN);
 +#else
 +      puts ("-DOMAIN");
 +#endif
 +
 +#ifdef MIXMASTER
 +      printf ("MIXMASTER=\"%s\"\n", MIXMASTER);
 +#else
 +      puts ("-MIXMASTER");
 +#endif
 +
 +#ifdef ISPELL
 +      printf ("ISPELL=\"%s\"\n", ISPELL);
 +#else
 +      puts ("-ISPELL");
 +#endif
 +
 +      printf ("SENDMAIL=\"%s\"\n", SENDMAIL);
 +      printf ("MAILPATH=\"%s\"\n", MAILPATH);
 +      printf ("PKGDATADIR=\"%s\"\n", PKGDATADIR);
 +      printf ("SYSCONFDIR=\"%s\"\n", SYSCONFDIR);
 +      printf ("EXECSHELL=\"%s\"\n", EXECSHELL);
 +
 +      puts ("");
 +      mutt_print_patchlist();
 +
 +      puts ("");
 +      puts (_(ReachingUs));
 +}
 +
 +/**
 + * print_copyright - Print copyright message
 + *
 + * Print the authors' copyright messages, the GPL license and some contact
 + * information for the Mutt project.
 + */
 +void
 +print_copyright (void)
 +{
 +      puts (mutt_make_version());
 +      puts (_(Copyright));
 +      puts (_(License));
 +      puts (_(Obtaining));
 +      puts (_(ReachingUs));
 +}
 +
 +/**
 + * feature_enabled - Test is a compile-time feature is enabled
 + * @name:  Compile-time symbol of the feature
 + *
 + * Many of the larger features of mutt can be disabled at compile time.
 + * They define a symbol and use #ifdef's around their code.
 + * The symbols are mirrored in "struct compile_options comp_opts[]" in this
 + * file.
 + *
 + * This function checks if one of these symbols is present in the code.
 + *
 + * These symbols are also seen in the output of "mutt -v".
 + *
 + * Returns:
 + *    1: Feature enables
 + *    0: Feature not enabled, or not compiled in
 + */
 +int
 +feature_enabled (const char *name)
 +{
 +      if (!name)
 +              return 0;
 +
 +      int i;
 +      for (i = 0; comp_opts[i].name; i++) {
 +              if (mutt_strcmp (name, comp_opts[i].name) == 0) {
 +                      return 1;
 +              }
 +      }
 +      return 0;
 +}
 +