[packages/mutt] - raw from https://mutt.org.ua/download/mutt-1.10.0/patch-1.10.0.vvv.nntp.gz
adamg
adamg at pld-linux.org
Sun Dec 2 09:22:17 CET 2018
commit c02f3a2cecad0445210992226125fcc4ed675c7c
Author: Adam Gołębiowski <adamg at pld-linux.org>
Date: Sun Dec 2 09:11:05 2018 +0100
- raw from https://mutt.org.ua/download/mutt-1.10.0/patch-1.10.0.vvv.nntp.gz
mutt-vvv.nntp.patch | 7883 +++++++++++++++++++++++++++++----------------------
1 file changed, 4487 insertions(+), 3396 deletions(-)
---
diff --git a/mutt-vvv.nntp.patch b/mutt-vvv.nntp.patch
index 1bf1d38..997bdfa 100644
--- a/mutt-vvv.nntp.patch
+++ b/mutt-vvv.nntp.patch
@@ -9,10 +9,83 @@ autoconf
Vsevolod Volkov <vvv at mutt.org.ua>
-diff -udprP mutt-1.5.21.orig/ChangeLog.nntp mutt-1.5.21/ChangeLog.nntp
---- mutt-1.5.21.orig/ChangeLog.nntp 1970-01-01 03:00:00.000000000 +0300
-+++ mutt-1.5.21/ChangeLog.nntp 2010-09-16 13:14:39.000000000 +0300
-@@ -0,0 +1,375 @@
+diff -udprP mutt-1.10.0.orig/ChangeLog.nntp mutt-1.10.0/ChangeLog.nntp
+--- mutt-1.10.0.orig/ChangeLog.nntp 1970-01-01 03:00:00.000000000 +0300
++++ mutt-1.10.0/ChangeLog.nntp 2018-06-16 17:38:41.196958026 +0300
+@@ -0,0 +1,448 @@
++* Sat Jun 16 2018 Vsevolod Volkov <vvv at mutt.org.ua>
++- update to 1.10.0
++
++* Thu Apr 19 2018 Vsevolod Volkov <vvv at mutt.org.ua>
++- update to 1.9.5
++
++* Sat Sep 9 2017 Vsevolod Volkov <vvv at mutt.org.ua>
++- update to 1.9.0
++
++* Sun Feb 26 2017 Vsevolod Volkov <vvv at mutt.org.ua>
++- update to 1.8.0
++
++* Sun Dec 18 2016 Vsevolod Volkov <vvv at mutt.org.ua>
++- update to 1.7.2
++
++* Sun Oct 9 2016 Vsevolod Volkov <vvv at mutt.org.ua>
++- update to 1.7.1
++
++* Wed Aug 31 2016 Vsevolod Volkov <vvv at mutt.org.ua>
++- newsgroups aren't marked as new on first load
++
++* Wed Aug 24 2016 Vsevolod Volkov <vvv at mutt.org.ua>
++- update to 1.7.0
++- fixed new groups marking
++- fixed unread messages counter update
++
++* Sat Aug 6 2016 Vsevolod Volkov <vvv at mutt.org.ua>
++- update to 1.6.2
++
++* Sat Aug 6 2016 Vsevolod Volkov <vvv at mutt.org.ua>
++- update to 1.6.1
++
++* Wed Apr 6 2016 Vsevolod Volkov <vvv at mutt.org.ua>
++- update to 1.6.0
++- %R changed to %x in format strings
++
++* Wed Nov 25 2015 Vsevolod Volkov <vvv at mutt.org.ua>
++- fixed memory leaks
++- fixed SIGSEGV when reading hcache in some cases
++
++* Tue Nov 10 2015 Vsevolod Volkov <vvv at mutt.org.ua>
++- fixed error compiling with nntp and without imap or pop3
++- fixed error loading articles after <change-newsgroup> and <quit>
++
++* Wed Sep 2 2015 Vsevolod Volkov <vvv at mutt.org.ua>
++- update to 1.5.24
++- new option nntp_listgroup
++- use range in LISTGROUP command if possible
++
++* Thu Mar 13 2014 Vsevolod Volkov <vvv at mutt.org.ua>
++- update to 1.5.23
++
++* Tue Oct 29 2013 Vsevolod Volkov <vvv at mutt.org.ua>
++- minor bug fixed while removing new articles
++
++* Fri Oct 18 2013 Vsevolod Volkov <vvv at mutt.org.ua>
++- update to 1.5.22
++
++* Tue Nov 27 2012 Vsevolod Volkov <vvv at mutt.org.ua>
++- SASL authentication
++- new option nntp_authenticators
++
++* Fri Nov 16 2012 Vsevolod Volkov <vvv at mutt.org.ua>
++- support of NNTP commands: CAPABILITIES, STARTTLS, LIST NEWSGROUPS,
++ LIST OVERVIEW.FMT, OVER, DATE
++- added bcache support
++- newss URI scheme renamed to snews
++- removed option nntp_reconnect
++
++* Sun Sep 16 2012 Vsevolod Volkov <vvv at mutt.org.ua>
++- internal header caching replaced with hcache
++- new option newsgroups_charset
++
+* Wed Sep 16 2010 Vsevolod Volkov <vvv at mutt.org.ua>
+- update to 1.5.21
+
@@ -101,7 +174,7 @@ diff -udprP mutt-1.5.21.orig/ChangeLog.nntp mutt-1.5.21/ChangeLog.nntp
+- added space after newsgroup name in .newsrc file
+
+* Sun May 18 2003 Vsevolod Volkov <vvv at mutt.org.ua>
-+- nntp patch: fixed SIGSEGV when posting article
++- fixed SIGSEGV when posting article
+
+* Sat Mar 22 2003 Vsevolod Volkov <vvv at mutt.org.ua>
+- update to 1.5.4
@@ -297,7 +370,7 @@ diff -udprP mutt-1.5.21.orig/ChangeLog.nntp mutt-1.5.21/ChangeLog.nntp
+- add -G option
+
+* Tue Apr 4 2000 Vsevolod Volkov <vvv at mutt.kiev.ua>
-+- get default newsserver name from file /etc/nntpserver
++- get default news server name from file /etc/nntpserver
+- use case insensitive server names
+- add print-style sequence %s to $newsrc
+- add -g option
@@ -388,9 +461,9 @@ diff -udprP mutt-1.5.21.orig/ChangeLog.nntp mutt-1.5.21/ChangeLog.nntp
+
+* Fri Jan 28 2000 Vsevolod Volkov <vvv at mutt.kiev.ua>
+- update to 1.1.2
-diff -udprP mutt-1.5.21.orig/OPS mutt-1.5.21/OPS
---- mutt-1.5.21.orig/OPS 2010-03-01 19:56:19.000000000 +0200
-+++ mutt-1.5.21/OPS 2010-09-16 13:14:39.000000000 +0300
+diff -udprP mutt-1.10.0.orig/OPS mutt-1.10.0/OPS
+--- mutt-1.10.0.orig/OPS 2018-05-15 00:51:53.000000000 +0300
++++ mutt-1.10.0/OPS 2018-06-16 17:22:30.190469794 +0300
@@ -8,14 +8,16 @@ OP_BOUNCE_MESSAGE "remail a message to a
OP_BROWSER_NEW_FILE "select a new file in this directory"
OP_BROWSER_VIEW_FILE "view file"
@@ -406,7 +479,7 @@ diff -udprP mutt-1.5.21.orig/OPS mutt-1.5.21/OPS
OP_CHECK_NEW "check mailboxes for new mail"
OP_COMPOSE_ATTACH_FILE "attach file(s) to this message"
OP_COMPOSE_ATTACH_MESSAGE "attach message(s) to this message"
-+OP_COMPOSE_ATTACH_NEWS_MESSAGE "attach newsmessage(s) to this message"
++OP_COMPOSE_ATTACH_NEWS_MESSAGE "attach news article(s) to this message"
OP_COMPOSE_EDIT_BCC "edit the BCC list"
OP_COMPOSE_EDIT_CC "edit the CC list"
OP_COMPOSE_EDIT_DESCRIPTION "edit attachment description"
@@ -421,7 +494,7 @@ diff -udprP mutt-1.5.21.orig/OPS mutt-1.5.21/OPS
OP_COMPOSE_EDIT_SUBJECT "edit the subject of this message"
OP_COMPOSE_EDIT_TO "edit the TO list"
OP_CREATE_MAILBOX "create a new mailbox (IMAP only)"
-@@ -85,8 +90,13 @@ OP_EXIT "exit this menu"
+@@ -89,8 +94,13 @@ OP_EXIT "exit this menu"
OP_FILTER "filter attachment through a shell command"
OP_FIRST_ENTRY "move to the first entry"
OP_FLAG_MESSAGE "toggle a message's 'important' flag"
@@ -435,11 +508,11 @@ diff -udprP mutt-1.5.21.orig/OPS mutt-1.5.21/OPS
OP_GROUP_REPLY "reply to all recipients"
OP_HALF_DOWN "scroll down 1/2 page"
OP_HALF_UP "scroll up 1/2 page"
-@@ -94,11 +104,14 @@ OP_HELP "this screen"
+@@ -98,11 +108,14 @@ OP_HELP "this screen"
OP_JUMP "jump to an index number"
OP_LAST_ENTRY "move to the last entry"
OP_LIST_REPLY "reply to specified mailing list"
-+OP_LOAD_ACTIVE "load active file from NNTP server"
++OP_LOAD_ACTIVE "load list of all newsgroups from NNTP server"
OP_MACRO "execute a macro"
OP_MAIL "compose a new mail message"
OP_MAIN_BREAK_THREAD "break the thread in two"
@@ -450,7 +523,7 @@ diff -udprP mutt-1.5.21.orig/OPS mutt-1.5.21/OPS
OP_MAIN_CLEAR_FLAG "clear a status flag from a message"
OP_MAIN_DELETE_PATTERN "delete messages matching a pattern"
OP_MAIN_IMAP_FETCH "force retrieval of mail from IMAP server"
-@@ -138,6 +151,7 @@ OP_PAGER_HIDE_QUOTED "toggle display of
+@@ -142,6 +155,7 @@ OP_PAGER_HIDE_QUOTED "toggle display of
OP_PAGER_SKIP_QUOTED "skip beyond quoted text"
OP_PAGER_TOP "jump to the top of the message"
OP_PIPE "pipe message/attachment to a shell command"
@@ -458,7 +531,7 @@ diff -udprP mutt-1.5.21.orig/OPS mutt-1.5.21/OPS
OP_PREV_ENTRY "move to the previous entry"
OP_PREV_LINE "scroll up one line"
OP_PREV_PAGE "move to the previous page"
-@@ -146,6 +160,7 @@ OP_QUERY "query external program for add
+@@ -151,6 +165,7 @@ OP_QUERY "query external program for add
OP_QUERY_APPEND "append new query results to current results"
OP_QUIT "save changes to mailbox and quit"
OP_RECALL_MESSAGE "recall a postponed message"
@@ -466,7 +539,7 @@ diff -udprP mutt-1.5.21.orig/OPS mutt-1.5.21/OPS
OP_REDRAW "clear and redraw the screen"
OP_REFORMAT_WINCH "{internal}"
OP_RENAME_MAILBOX "rename the current mailbox (IMAP only)"
-@@ -160,18 +175,22 @@ OP_SEARCH_TOGGLE "toggle search pattern
+@@ -165,18 +180,22 @@ OP_SEARCH_TOGGLE "toggle search pattern
OP_SHELL_ESCAPE "invoke a command in a subshell"
OP_SORT "sort messages"
OP_SORT_REVERSE "sort messages in reverse order"
@@ -489,34 +562,40 @@ diff -udprP mutt-1.5.21.orig/OPS mutt-1.5.21/OPS
OP_VERSION "show the Mutt version number and date"
OP_VIEW_ATTACH "view attachment using mailcap entry if necessary"
OP_VIEW_ATTACHMENTS "show MIME attachments"
-diff -udprP mutt-1.5.21.orig/PATCHES mutt-1.5.21/PATCHES
---- mutt-1.5.21.orig/PATCHES 2008-03-19 22:07:06.000000000 +0200
-+++ mutt-1.5.21/PATCHES 2010-09-16 13:14:39.000000000 +0300
+diff -udprP mutt-1.10.0.orig/PATCHES mutt-1.10.0/PATCHES
+--- mutt-1.10.0.orig/PATCHES 2017-12-03 05:10:17.000000000 +0200
++++ mutt-1.10.0/PATCHES 2018-06-16 17:22:30.190469794 +0300
@@ -0,0 +1 @@
+vvv.nntp
-diff -udprP mutt-1.5.21.orig/account.c mutt-1.5.21/account.c
---- mutt-1.5.21.orig/account.c 2009-08-25 22:08:52.000000000 +0300
-+++ mutt-1.5.21/account.c 2010-09-16 13:14:39.000000000 +0300
-@@ -51,6 +51,11 @@ int mutt_account_match (const ACCOUNT* a
+diff -udprP mutt-1.10.0.orig/account.c mutt-1.10.0/account.c
+--- mutt-1.10.0.orig/account.c 2017-12-18 22:27:19.000000000 +0200
++++ mutt-1.10.0/account.c 2018-06-16 17:22:30.191469778 +0300
+@@ -51,8 +51,17 @@ int mutt_account_match (const ACCOUNT* a
user = PopUser;
#endif
+#ifdef USE_NNTP
-+ if (a1->type == M_ACCT_TYPE_NNTP && NntpUser)
++ if (a1->type == MUTT_ACCT_TYPE_NNTP && NntpUser)
+ user = NntpUser;
+#endif
+
- if (a1->flags & a2->flags & M_ACCT_USER)
+ if (a1->flags & a2->flags & MUTT_ACCT_USER)
return (!strcmp (a1->user, a2->user));
- if (a1->flags & M_ACCT_USER)
-@@ -130,6 +135,16 @@ void mutt_account_tourl (ACCOUNT* accoun
++#ifdef USE_NNTP
++ if (a1->type == MUTT_ACCT_TYPE_NNTP)
++ return a1->flags & MUTT_ACCT_USER && a1->user[0] ? 0 : 1;
++#endif
+ if (a1->flags & MUTT_ACCT_USER)
+ return (!strcmp (a1->user, user));
+ if (a2->flags & MUTT_ACCT_USER)
+@@ -130,6 +139,16 @@ void mutt_account_tourl (ACCOUNT* accoun
}
#endif
+#ifdef USE_NNTP
-+ if (account->type == M_ACCT_TYPE_NNTP)
++ if (account->type == MUTT_ACCT_TYPE_NNTP)
+ {
-+ if (account->flags & M_ACCT_SSL)
++ if (account->flags & MUTT_ACCT_SSL)
+ url->scheme = U_NNTPS;
+ else
+ url->scheme = U_NNTP;
@@ -524,58 +603,58 @@ diff -udprP mutt-1.5.21.orig/account.c mutt-1.5.21/account.c
+#endif
+
url->host = account->host;
- if (account->flags & M_ACCT_PORT)
+ if (account->flags & MUTT_ACCT_PORT)
url->port = account->port;
-@@ -155,6 +170,10 @@ int mutt_account_getuser (ACCOUNT* accou
- else if ((account->type == M_ACCT_TYPE_POP) && PopUser)
+@@ -155,6 +174,10 @@ int mutt_account_getuser (ACCOUNT* accou
+ else if ((account->type == MUTT_ACCT_TYPE_POP) && PopUser)
strfcpy (account->user, PopUser, sizeof (account->user));
#endif
+#ifdef USE_NNTP
-+ else if ((account->type == M_ACCT_TYPE_NNTP) && NntpUser)
++ else if ((account->type == MUTT_ACCT_TYPE_NNTP) && NntpUser)
+ strfcpy (account->user, NntpUser, sizeof (account->user));
+#endif
else if (option (OPTNOCURSES))
return -1;
/* prompt (defaults to unix username), copy into account->user */
-@@ -217,6 +236,10 @@ int mutt_account_getpass (ACCOUNT* accou
- else if ((account->type == M_ACCT_TYPE_SMTP) && SmtpPass)
+@@ -217,6 +240,10 @@ int mutt_account_getpass (ACCOUNT* accou
+ else if ((account->type == MUTT_ACCT_TYPE_SMTP) && SmtpPass)
strfcpy (account->pass, SmtpPass, sizeof (account->pass));
#endif
+#ifdef USE_NNTP
-+ else if ((account->type == M_ACCT_TYPE_NNTP) && NntpPass)
++ else if ((account->type == MUTT_ACCT_TYPE_NNTP) && NntpPass)
+ strfcpy (account->pass, NntpPass, sizeof (account->pass));
+#endif
else if (option (OPTNOCURSES))
return -1;
else
-diff -udprP mutt-1.5.21.orig/account.h mutt-1.5.21/account.h
---- mutt-1.5.21.orig/account.h 2008-03-19 22:07:06.000000000 +0200
-+++ mutt-1.5.21/account.h 2010-09-16 13:14:39.000000000 +0300
+diff -udprP mutt-1.10.0.orig/account.h mutt-1.10.0/account.h
+--- mutt-1.10.0.orig/account.h 2018-05-15 00:51:53.000000000 +0300
++++ mutt-1.10.0/account.h 2018-06-16 17:22:30.191469778 +0300
@@ -29,7 +29,8 @@ enum
- M_ACCT_TYPE_NONE = 0,
- M_ACCT_TYPE_IMAP,
- M_ACCT_TYPE_POP,
-- M_ACCT_TYPE_SMTP
-+ M_ACCT_TYPE_SMTP,
-+ M_ACCT_TYPE_NNTP
+ MUTT_ACCT_TYPE_NONE = 0,
+ MUTT_ACCT_TYPE_IMAP,
+ MUTT_ACCT_TYPE_POP,
+- MUTT_ACCT_TYPE_SMTP
++ MUTT_ACCT_TYPE_SMTP,
++ MUTT_ACCT_TYPE_NNTP
};
/* account flags */
-diff -udprP mutt-1.5.21.orig/attach.h mutt-1.5.21/attach.h
---- mutt-1.5.21.orig/attach.h 2008-03-19 22:07:06.000000000 +0200
-+++ mutt-1.5.21/attach.h 2010-09-16 13:14:39.000000000 +0300
-@@ -50,7 +50,7 @@ void mutt_print_attachment_list (FILE *f
-
- void mutt_attach_bounce (FILE *, HEADER *, ATTACHPTR **, short, BODY *);
- void mutt_attach_resend (FILE *, HEADER *, ATTACHPTR **, short, BODY *);
--void mutt_attach_forward (FILE *, HEADER *, ATTACHPTR **, short, BODY *);
-+void mutt_attach_forward (FILE *, HEADER *, ATTACHPTR **, short, BODY *, int);
- void mutt_attach_reply (FILE *, HEADER *, ATTACHPTR **, short, BODY *, int);
-
- #endif /* _ATTACH_H_ */
-diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
---- mutt-1.5.21.orig/browser.c 2010-08-25 19:31:40.000000000 +0300
-+++ mutt-1.5.21/browser.c 2010-09-16 13:14:39.000000000 +0300
+diff -udprP mutt-1.10.0.orig/attach.h mutt-1.10.0/attach.h
+--- mutt-1.10.0.orig/attach.h 2017-12-18 22:31:37.000000000 +0200
++++ mutt-1.10.0/attach.h 2018-06-16 17:22:30.191469778 +0300
+@@ -71,7 +71,7 @@ void mutt_print_attachment_list (ATTACH_
+
+ void mutt_attach_bounce (FILE *, HEADER *, ATTACH_CONTEXT *, BODY *);
+ void mutt_attach_resend (FILE *, HEADER *, ATTACH_CONTEXT *, BODY *);
+-void mutt_attach_forward (FILE *, HEADER *, ATTACH_CONTEXT *, BODY *);
++void mutt_attach_forward (FILE *, HEADER *, ATTACH_CONTEXT *, BODY *, int);
+ void mutt_attach_reply (FILE *, HEADER *, ATTACH_CONTEXT *, BODY *, int);
+
+ void mutt_actx_add_attach (ATTACH_CONTEXT *actx, ATTACHPTR *attach);
+diff -udprP mutt-1.10.0.orig/browser.c mutt-1.10.0/browser.c
+--- mutt-1.10.0.orig/browser.c 2018-05-15 00:51:53.000000000 +0300
++++ mutt-1.10.0/browser.c 2018-06-16 17:22:30.192469762 +0300
@@ -32,6 +32,9 @@
#ifdef USE_IMAP
#include "imap.h"
@@ -586,7 +665,7 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
#include <stdlib.h>
#include <dirent.h>
-@@ -50,6 +53,19 @@ static struct mapping_t FolderHelp[] = {
+@@ -50,6 +53,19 @@ static const struct mapping_t FolderHelp
{ NULL, 0 }
};
@@ -599,14 +678,14 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+ { N_("Catchup"), OP_CATCHUP },
+ { N_("Mask"), OP_ENTER_MASK },
+ { N_("Help"), OP_HELP },
-+ { NULL }
++ { NULL, 0 }
+};
+#endif
+
typedef struct folder_t
{
struct folder_file *ff;
-@@ -115,9 +131,17 @@ static void browser_sort (struct browser
+@@ -134,9 +150,17 @@ static void browser_sort (struct browser
case SORT_ORDER:
return;
case SORT_DATE:
@@ -623,16 +702,16 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+#endif
f = browser_compare_size;
break;
- case SORT_SUBJECT:
-@@ -324,8 +348,106 @@ folder_format_str (char *dest, size_t de
+ case SORT_COUNT:
+@@ -367,8 +391,112 @@ folder_format_str (char *dest, size_t de
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)
++newsgroup_format_str (char *dest, size_t destlen, size_t col, int cols, 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;
@@ -643,7 +722,7 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.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);
@@ -655,7 +734,7 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+ if (folder->ff->nd->subscribed)
+ snprintf (dest, destlen, tmp, ' ');
+ else
-+ snprintf (dest, destlen, tmp, folder->ff->new ? 'N' : 'u');
++ snprintf (dest, destlen, tmp, folder->ff->nd->new ? 'N' : 'u');
+ break;
+
+ case 'M':
@@ -667,14 +746,14 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+ break;
+
+ case 's':
-+ if (flags & M_FORMAT_OPTIONAL)
++ if (flags & MUTT_FORMAT_OPTIONAL)
+ {
+ if (folder->ff->nd->unread != 0)
-+ mutt_FormatString (dest, destlen, col, ifstring, newsgroup_format_str,
-+ data, flags);
++ mutt_FormatString (dest, destlen, col, cols, ifstring,
++ newsgroup_format_str, data, flags);
+ else
-+ mutt_FormatString (dest, destlen, col, elsestring, newsgroup_format_str,
-+ data, flags);
++ mutt_FormatString (dest, destlen, col, cols, elsestring,
++ newsgroup_format_str, data, flags);
+ }
+ else if (Context && Context->data == folder->ff->nd)
+ {
@@ -711,8 +790,14 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+ 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, MUTT_ICONV_HOOK_FROM);
++ mutt_filter_unprintable (&buf);
++
+ snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
-+ snprintf (dest, destlen, tmp, folder->ff->nd->desc);
++ snprintf (dest, destlen, tmp, buf);
++ FREE (&buf);
+ }
+ else
+ {
@@ -726,24 +811,24 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+#endif /* USE_NNTP */
+
static void add_folder (MUTTMENU *m, struct browser_state *state,
-- const char *name, const struct stat *s, int new)
-+ const char *name, const struct stat *s,
-+ void *data, int new)
+- const char *name, const struct stat *s, BUFFY *b)
++ const char *name, const struct stat *s, BUFFY *b,
++ void *data)
{
if (state->entrylen == state->entrymax)
{
-@@ -354,6 +476,10 @@ static void add_folder (MUTTMENU *m, str
+@@ -406,6 +534,10 @@ static void add_folder (MUTTMENU *m, str
#ifdef USE_IMAP
(state->entry)[state->entrylen].imap = 0;
#endif
+#ifdef USE_NNTP
+ if (option (OPTNEWS))
-+ (state->entry)[state->entrylen].nd = (NNTP_DATA *) data;
++ (state->entry)[state->entrylen].nd = (NNTP_DATA *)data;
+#endif
(state->entrylen)++;
}
-@@ -369,9 +495,35 @@ static void init_state (struct browser_s
+@@ -421,9 +553,35 @@ static void init_state (struct browser_s
menu->data = state->entry;
}
@@ -754,23 +839,23 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+#ifdef USE_NNTP
+ if (option (OPTNEWS))
+ {
-+ LIST *tmp;
-+ NNTP_DATA *data;
-+ NNTP_SERVER *news = CurrentNewsSrv;
++ NNTP_SERVER *nserv = CurrentNewsSrv;
++ unsigned int i;
+
+/* mutt_buffy_check (0); */
+ init_state (state, menu);
+
-+ for (tmp = news->list; tmp; tmp = tmp->next)
++ for (i = 0; i < nserv->groups_num; i++)
+ {
-+ if (!(data = (NNTP_DATA *)tmp->data))
++ NNTP_DATA *nntp_data = nserv->groups_list[i];
++ if (!nntp_data)
+ continue;
-+ if (prefix && *prefix && strncmp (prefix, data->group,
-+ strlen (prefix)) != 0)
++ if (prefix && *prefix &&
++ strncmp (prefix, nntp_data->group, strlen (prefix)))
+ continue;
-+ if (!((regexec (Mask.rx, data->group, 0, NULL, 0) == 0) ^ Mask.not))
++ if (!((regexec (Mask.rx, nntp_data->group, 0, NULL, 0) == 0) ^ Mask.not))
+ continue;
-+ add_folder (menu, state, data->group, NULL, data, data->new);
++ add_folder (menu, state, nntp_data->group, NULL, NULL, nntp_data);
+ }
+ }
+ else
@@ -779,16 +864,15 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
struct stat s;
DIR *dp;
struct dirent *de;
-@@ -432,17 +584,40 @@ static int examine_directory (MUTTMENU *
- tmp = Incoming;
- while (tmp && mutt_strcmp (buffer, tmp->path))
- tmp = tmp->next;
-- add_folder (menu, state, de->d_name, &s, (tmp) ? tmp->new : 0);
-+ add_folder (menu, state, de->d_name, &s, NULL, (tmp) ? tmp->new : 0);
-+ }
-+ closedir (dp);
+@@ -492,17 +650,40 @@ static int examine_directory (MUTTMENU *
+ tmp->msg_count = Context->msgcount;
+ tmp->msg_unread = Context->unread;
+ }
+- add_folder (menu, state, de->d_name, &s, tmp);
++ add_folder (menu, state, de->d_name, &s, tmp, NULL);
}
-- closedir (dp);
+ closedir (dp);
++ }
browser_sort (state);
return 0;
}
@@ -802,56 +886,56 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+#ifdef USE_NNTP
+ if (option (OPTNEWS))
+ {
-+ LIST *tmp;
-+ NNTP_DATA *data;
-+ NNTP_SERVER *news = CurrentNewsSrv;
++ NNTP_SERVER *nserv = CurrentNewsSrv;
++ unsigned int i;
+
+/* mutt_buffy_check (0); */
+ init_state (state, menu);
+
-+ for (tmp = news->list; tmp; tmp = tmp->next)
++ for (i = 0; i < nserv->groups_num; i++)
+ {
-+ if ((data = (NNTP_DATA *) tmp->data) != NULL && (data->new ||
-+ (data->subscribed && (!option (OPTSHOWONLYUNREAD) || data->unread))))
-+ add_folder (menu, state, data->group, NULL, data, data->new);
++ 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);
+ }
+ }
+ else
+#endif
+ {
BUFFY *tmp = Incoming;
+
+ if (!Incoming)
+@@ -527,14 +708,21 @@ static int examine_mailboxes (MUTTMENU *
#ifdef USE_IMAP
- struct mailbox_state mbox;
-@@ -460,14 +635,21 @@ static int examine_mailboxes (MUTTMENU *
if (mx_is_imap (tmp->path))
{
- imap_mailbox_state (tmp->path, &mbox);
-- add_folder (menu, state, tmp->path, NULL, mbox.new);
-+ add_folder (menu, state, tmp->path, NULL, NULL, mbox.new);
+- add_folder (menu, state, buffer, NULL, tmp);
++ add_folder (menu, state, buffer, NULL, tmp, NULL);
continue;
}
#endif
#ifdef USE_POP
if (mx_is_pop (tmp->path))
{
-- add_folder (menu, state, tmp->path, NULL, tmp->new);
-+ add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
+- add_folder (menu, state, buffer, NULL, tmp);
++ add_folder (menu, state, buffer, NULL, tmp, 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, buffer, NULL, tmp, NULL);
continue;
}
#endif
-@@ -496,15 +678,20 @@ static int examine_mailboxes (MUTTMENU *
- strfcpy (buffer, NONULL(tmp->path), sizeof (buffer));
- mutt_pretty_mailbox (buffer, sizeof (buffer));
+@@ -560,15 +748,20 @@ static int examine_mailboxes (MUTTMENU *
+ s.st_mtime = st2.st_mtime;
+ }
-- add_folder (menu, state, buffer, &s, tmp->new);
-+ add_folder (menu, state, buffer, &s, NULL, tmp->new);
+- add_folder (menu, state, buffer, &s, tmp);
++ add_folder (menu, state, buffer, &s, tmp, NULL);
}
while ((tmp = tmp->next));
+ }
@@ -868,20 +952,20 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
return (regexec (re, ((struct folder_file *) menu->data)[n].name, 0, NULL, 0));
}
-@@ -515,6 +702,12 @@ static void folder_entry (char *s, size_
+@@ -579,6 +772,12 @@ static void folder_entry (char *s, size_
folder.ff = &((struct folder_file *) menu->data)[num];
folder.num = num;
+#ifdef USE_NNTP
+ if (option (OPTNEWS))
-+ mutt_FormatString (s, slen, 0, NONULL(GroupFormat), newsgroup_format_str,
-+ (unsigned long) &folder, M_FORMAT_ARROWCURSOR);
++ mutt_FormatString (s, slen, 0, MuttIndexWindow->cols, NONULL(GroupFormat),
++ newsgroup_format_str, (unsigned long) &folder, MUTT_FORMAT_ARROWCURSOR);
+ else
+#endif
- mutt_FormatString (s, slen, 0, NONULL(FolderFormat), folder_format_str,
- (unsigned long) &folder, M_FORMAT_ARROWCURSOR);
+ mutt_FormatString (s, slen, 0, MuttIndexWindow->cols, NONULL(FolderFormat), folder_format_str,
+ (unsigned long) &folder, MUTT_FORMAT_ARROWCURSOR);
}
-@@ -535,6 +728,17 @@ static void init_menu (struct browser_st
+@@ -599,6 +798,17 @@ static void init_menu (struct browser_st
menu->tagged = 0;
@@ -899,7 +983,7 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
if (buffy)
snprintf (title, titlelen, _("Mailboxes [%d]"), mutt_buffy_check (0));
else
-@@ -590,6 +794,31 @@ void _mutt_select_file (char *f, size_t
+@@ -654,6 +864,31 @@ void _mutt_select_file (char *f, size_t
if (!folder)
strfcpy (LastDirBackup, LastDir, sizeof (LastDirBackup));
@@ -910,15 +994,15 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+ strfcpy (prefix, f, sizeof (prefix));
+ else
+ {
-+ LIST *list;
++ NNTP_SERVER *nserv = CurrentNewsSrv;
++ unsigned int i;
+
+ /* default state for news reader mode is browse subscribed newsgroups */
+ buffy = 0;
-+ for (list = CurrentNewsSrv->list; list; list = list->next)
++ for (i = 0; i < nserv->groups_num; i++)
+ {
-+ NNTP_DATA *data = (NNTP_DATA *) list->data;
-+
-+ if (data && data->subscribed)
++ NNTP_DATA *nntp_data = nserv->groups_list[i];
++ if (nntp_data && nntp_data->subscribed)
+ {
+ buffy = 1;
+ break;
@@ -931,29 +1015,29 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
if (*f)
{
mutt_expand_path (f, flen);
-@@ -686,6 +915,9 @@ void _mutt_select_file (char *f, size_t
+@@ -750,6 +985,9 @@ void _mutt_select_file (char *f, size_t
menu->tag = file_tag;
menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_FOLDER,
+#ifdef USE_NNTP
-+ (option (OPTNEWS)) ? FolderNewsHelp :
++ option (OPTNEWS) ? FolderNewsHelp :
+#endif
FolderHelp);
+ mutt_push_current_menu (menu);
- init_menu (&state, menu, title, sizeof (title), buffy);
-@@ -824,7 +1056,11 @@ void _mutt_select_file (char *f, size_t
+@@ -889,7 +1127,11 @@ void _mutt_select_file (char *f, size_t
}
}
+#ifdef USE_NNTP
-+ if (buffy || option (OPTNEWS)) /* news have not path */
++ if (buffy || option (OPTNEWS))
+#else
if (buffy)
+#endif
{
strfcpy (f, state.entry[menu->current].name, flen);
mutt_expand_path (f, flen);
-@@ -882,14 +1118,6 @@ void _mutt_select_file (char *f, size_t
+@@ -946,14 +1188,6 @@ void _mutt_select_file (char *f, size_t
break;
#ifdef USE_IMAP
@@ -968,7 +1052,7 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
case OP_BROWSER_TOGGLE_LSUB:
if (option (OPTIMAPLSUB))
unset_option (OPTIMAPLSUB);
-@@ -990,6 +1218,11 @@ void _mutt_select_file (char *f, size_t
+@@ -1055,6 +1289,11 @@ void _mutt_select_file (char *f, size_t
case OP_CHANGE_DIRECTORY:
@@ -980,7 +1064,7 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
strfcpy (buf, LastDir, sizeof (buf));
#ifdef USE_IMAP
if (!state.imap_browse)
-@@ -1255,6 +1488,190 @@ void _mutt_select_file (char *f, size_t
+@@ -1321,6 +1560,209 @@ void _mutt_select_file (char *f, size_t
else
mutt_error _("Error trying to view file");
}
@@ -992,14 +1076,19 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+ if (option (OPTNEWS))
+ {
+ struct folder_file *f = &state.entry[menu->current];
-+ NNTP_DATA *nd;
++ int rc;
++ NNTP_DATA *nntp_data;
++
++ rc = nntp_newsrc_parse (CurrentNewsSrv);
++ if (rc < 0)
++ break;
+
+ if (i == OP_CATCHUP)
-+ nd = mutt_newsgroup_catchup (CurrentNewsSrv, f->name);
++ nntp_data = mutt_newsgroup_catchup (CurrentNewsSrv, f->name);
+ else
-+ nd = mutt_newsgroup_uncatchup (CurrentNewsSrv, f->name);
++ nntp_data = mutt_newsgroup_uncatchup (CurrentNewsSrv, f->name);
+
-+ if (nd)
++ if (nntp_data)
+ {
+/* FOLDER folder;
+ struct folder_file ff;
@@ -1008,42 +1097,50 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+ folder.ff = &ff;
+ folder.ff->name = f->name;
+ folder.ff->st = NULL;
-+ folder.ff->is_new = nd->new;
-+ folder.ff->nd = nd;
++ 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);
++ mutt_FormatString (buffer, sizeof (buffer), 0, MuttIndexWindow->cols,
++ NONULL(GroupFormat), newsgroup_format_str,
++ (unsigned long) &folder, MUTT_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))
-+ break;
-+
++ if (option (OPTNEWS))
+ {
-+ LIST *tmp;
-+ NNTP_DATA *data;
++ NNTP_SERVER *nserv = CurrentNewsSrv;
++ unsigned int i;
++
++ if (nntp_newsrc_parse (nserv) < 0)
++ break;
+
-+ for (tmp = CurrentNewsSrv->list; tmp; tmp = tmp->next)
++ for (i = 0; i < nserv->groups_num; i++)
+ {
-+ if ((data = (NNTP_DATA *)tmp->data))
-+ data->deleted = 1;
++ NNTP_DATA *nntp_data = nserv->groups_list[i];
++ if (nntp_data)
++ nntp_data->deleted = 1;
+ }
-+ }
-+ nntp_get_active (CurrentNewsSrv);
++ nntp_active_fetch (nserv, 1);
++ 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);
++ 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 */
+
@@ -1054,13 +1151,13 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+#ifdef USE_NNTP
+ case OP_SUBSCRIBE_PATTERN:
+ case OP_UNSUBSCRIBE_PATTERN:
-+ if (option (OPTNEWS))
++ 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 j = menu->current;
-+ NNTP_DATA *nd;
-+ NNTP_SERVER *news = CurrentNewsSrv;
++ int rc, j = menu->current;
+
+ if (i == OP_SUBSCRIBE_PATTERN || i == OP_UNSUBSCRIBE_PATTERN)
+ {
@@ -1078,7 +1175,8 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+ break;
+ }
+
-+ if ((err = REGCOMP (rx, s, REG_NOSUB)) != 0)
++ err = REGCOMP (rx, s, REG_NOSUB);
++ if (err)
+ {
+ regerror (err, rx, buf, sizeof (buf));
+ regfree (rx);
@@ -1095,6 +1193,10 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+ break;
+ }
+
++ rc = nntp_newsrc_parse (nserv);
++ if (rc < 0)
++ break;
++
+ for ( ; j < state.entrylen; j++)
+ {
+ struct folder_file *f = &state.entry[j];
@@ -1103,22 +1205,22 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+ regexec (rx, f->name, 0, NULL, 0) == 0)
+ {
+ if (i == OP_BROWSER_SUBSCRIBE || i == OP_SUBSCRIBE_PATTERN)
-+ nd = mutt_newsgroup_subscribe (news, f->name);
++ nntp_data = mutt_newsgroup_subscribe (nserv, f->name);
+ else
-+ nd = mutt_newsgroup_unsubscribe (news, f->name);
-+/* if (nd)
++ 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 = nd->new;
-+ folder.nd = nd;
++ 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);
++ mutt_FormatString (buffer, sizeof (buffer), 0, MuttIndexWindow->cols,
++ NONULL(GroupFormat), newsgroup_format_str,
++ (unsigned long) &folder, MUTT_FORMAT_ARROWCURSOR);
+ f->desc = safe_strdup (buffer);
+ } */
+ }
@@ -1132,26 +1234,27 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
+ }
+ if (i == OP_SUBSCRIBE_PATTERN)
+ {
-+ LIST *grouplist = NULL;
++ unsigned int i;
+
-+ if (news)
-+ grouplist = news->list;
-+ for (; grouplist; grouplist = grouplist->next)
++ for (i = 0; nserv && i < nserv->groups_num; i++)
+ {
-+ nd = (NNTP_DATA *) grouplist->data;
-+ if (nd && nd->group && !nd->subscribed)
++ nntp_data = nserv->groups_list[i];
++ if (nntp_data && nntp_data->group && !nntp_data->subscribed)
+ {
-+ if (regexec (rx, nd->group, 0, NULL, 0) == 0)
++ if (regexec (rx, nntp_data->group, 0, NULL, 0) == 0)
+ {
-+ mutt_newsgroup_subscribe (news, nd->group);
-+ add_folder (menu, &state, nd->group, NULL, nd, nd->new);
++ mutt_newsgroup_subscribe (nserv, nntp_data->group);
++ add_folder (menu, &state, nntp_data->group, NULL, NULL, nntp_data);
+ }
+ }
+ }
+ init_menu (&state, menu, title, sizeof (title), buffy);
+ }
-+ mutt_newsrc_update (news);
-+ nntp_clear_cacheindex (news);
++ 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);
@@ -1171,9 +1274,9 @@ diff -udprP mutt-1.5.21.orig/browser.c mutt-1.5.21/browser.c
}
}
-diff -udprP mutt-1.5.21.orig/browser.h mutt-1.5.21/browser.h
---- mutt-1.5.21.orig/browser.h 2009-01-05 21:20:53.000000000 +0200
-+++ mutt-1.5.21/browser.h 2010-09-16 13:14:39.000000000 +0300
+diff -udprP mutt-1.10.0.orig/browser.h mutt-1.10.0/browser.h
+--- mutt-1.10.0.orig/browser.h 2017-12-18 22:27:19.000000000 +0200
++++ mutt-1.10.0/browser.h 2018-06-16 17:22:30.192469762 +0300
@@ -19,6 +19,10 @@
#ifndef _BROWSER_H
#define _BROWSER_H 1
@@ -1185,58 +1288,56 @@ diff -udprP mutt-1.5.21.orig/browser.h mutt-1.5.21/browser.h
struct folder_file
{
mode_t mode;
-@@ -37,6 +41,9 @@ struct folder_file
- unsigned selectable : 1;
- unsigned inferiors : 1;
+@@ -44,6 +48,9 @@ struct folder_file
#endif
+ unsigned has_buffy : 1;
+ unsigned local : 1; /* folder is on local filesystem */
+#ifdef USE_NNTP
+ NNTP_DATA *nd;
+#endif
unsigned tagged : 1;
};
-diff -udprP mutt-1.5.21.orig/buffy.c mutt-1.5.21/buffy.c
---- mutt-1.5.21.orig/buffy.c 2010-09-13 20:19:55.000000000 +0300
-+++ mutt-1.5.21/buffy.c 2010-09-16 13:14:39.000000000 +0300
-@@ -405,6 +405,9 @@ int mutt_buffy_check (int force)
+diff -udprP mutt-1.10.0.orig/buffy.c mutt-1.10.0/buffy.c
+--- mutt-1.10.0.orig/buffy.c 2018-04-17 02:31:03.000000000 +0300
++++ mutt-1.10.0/buffy.c 2018-06-16 17:22:30.192469762 +0300
+@@ -512,6 +512,9 @@ int mutt_buffy_check (int force)
/* check device ID and serial number instead of comparing paths */
- if (!Context || Context->magic == M_IMAP || Context->magic == M_POP
+ if (!Context || Context->magic == MUTT_IMAP || Context->magic == MUTT_POP
+#ifdef USE_NNTP
-+ || Context->magic == M_NNTP
++ || Context->magic == MUTT_NNTP
+#endif
|| stat (Context->path, &contex_sb) != 0)
{
contex_sb.st_dev=0;
-@@ -421,6 +424,11 @@ int mutt_buffy_check (int force)
- tmp->magic = M_POP;
+@@ -535,6 +538,11 @@ int mutt_buffy_check (int force)
+ tmp->magic = MUTT_POP;
else
#endif
+#ifdef USE_NNTP
-+ if ((tmp->magic == M_NNTP) || mx_is_nntp (tmp->path))
-+ tmp->magic = M_NNTP;
++ if ((tmp->magic == MUTT_NNTP) || mx_is_nntp (tmp->path))
++ tmp->magic = MUTT_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))
{
-@@ -436,8 +444,11 @@ int mutt_buffy_check (int force)
+@@ -550,7 +558,11 @@ int mutt_buffy_check (int force)
/* 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 )
-- ? mutt_strcmp (tmp->path, Context->path) :
-+ (( tmp->magic == M_IMAP || tmp->magic == M_POP
+#ifdef USE_NNTP
-+ || tmp->magic == M_NNTP
++ (( tmp->magic == MUTT_IMAP || tmp->magic == MUTT_POP || tmp->magic == MUTT_NNTP )
++#else
+ (( tmp->magic == MUTT_IMAP || tmp->magic == MUTT_POP )
+#endif
-+ ) ? mutt_strcmp (tmp->path, Context->path) :
+ ? mutt_strcmp (tmp->path, Context->path) :
(sb.st_dev != contex_sb.st_dev || sb.st_ino != contex_sb.st_ino)))
{
- switch (tmp->magic)
-diff -udprP mutt-1.5.21.orig/complete.c mutt-1.5.21/complete.c
---- mutt-1.5.21.orig/complete.c 2009-01-05 21:20:53.000000000 +0200
-+++ mutt-1.5.21/complete.c 2010-09-16 13:14:39.000000000 +0300
+diff -udprP mutt-1.10.0.orig/complete.c mutt-1.10.0/complete.c
+--- mutt-1.10.0.orig/complete.c 2017-12-03 05:10:17.000000000 +0200
++++ mutt-1.10.0/complete.c 2018-06-16 17:22:30.192469762 +0300
@@ -25,6 +25,9 @@
#include "mailbox.h"
#include "imap.h"
@@ -1247,7 +1348,7 @@ diff -udprP mutt-1.5.21.orig/complete.c mutt-1.5.21/complete.c
#include <dirent.h>
#include <string.h>
-@@ -48,9 +51,71 @@ int mutt_complete (char *s, size_t slen)
+@@ -48,9 +51,70 @@ int mutt_complete (char *s, size_t slen)
char filepart[_POSIX_PATH_MAX];
#ifdef USE_IMAP
char imap_path[LONG_STRING];
@@ -1258,42 +1359,42 @@ diff -udprP mutt-1.5.21.orig/complete.c mutt-1.5.21/complete.c
+#ifdef USE_NNTP
+ if (option (OPTNEWS))
+ {
-+ LIST *l = CurrentNewsSrv->list;
++ NNTP_SERVER *nserv = CurrentNewsSrv;
++ unsigned int n = 0;
+
+ strfcpy (filepart, s, sizeof (filepart));
+
-+ /*
-+ * special case to handle when there is no filepart yet.
-+ * find the first subscribed newsgroup
-+ */
-+ if ((len = mutt_strlen (filepart)) == 0)
++ /* special case to handle when there is no filepart yet
++ * find the first subscribed newsgroup */
++ len = mutt_strlen (filepart);
++ if (len == 0)
+ {
-+ for (; l; l = l->next)
++ for (; n < nserv->groups_num; n++)
+ {
-+ NNTP_DATA *data = (NNTP_DATA *)l->data;
++ NNTP_DATA *nntp_data = nserv->groups_list[n];
+
-+ if (data && data->subscribed)
++ if (nntp_data && nntp_data->subscribed)
+ {
-+ strfcpy (filepart, data->group, sizeof (filepart));
-+ init++;
-+ l = l->next;
++ strfcpy (filepart, nntp_data->group, sizeof (filepart));
++ init = 1;
++ n++;
+ break;
+ }
+ }
+ }
+
-+ for (; l; l = l->next)
++ for (; n < nserv->groups_num; n++)
+ {
-+ NNTP_DATA *data = (NNTP_DATA *)l->data;
++ NNTP_DATA *nntp_data = nserv->groups_list[n];
+
-+ if (data && data->subscribed &&
-+ mutt_strncmp (data->group, filepart, len) == 0)
++ if (nntp_data && nntp_data->subscribed &&
++ mutt_strncmp (nntp_data->group, filepart, len) == 0)
+ {
+ if (init)
+ {
-+ for (i = 0; filepart[i] && data->group[i]; i++)
++ for (i = 0; filepart[i] && nntp_data->group[i]; i++)
+ {
-+ if (filepart[i] != data->group[i])
++ if (filepart[i] != nntp_data->group[i])
+ {
+ filepart[i] = 0;
+ break;
@@ -1303,14 +1404,13 @@ diff -udprP mutt-1.5.21.orig/complete.c mutt-1.5.21/complete.c
+ }
+ else
+ {
-+ strfcpy (filepart, data->group, sizeof (filepart));
++ strfcpy (filepart, nntp_data->group, sizeof (filepart));
+ init = 1;
+ }
+ }
+ }
+
+ strcpy (s, filepart);
-+
+ return (init ? 0 : -1);
+ }
+#endif
@@ -1319,10 +1419,10 @@ diff -udprP mutt-1.5.21.orig/complete.c mutt-1.5.21/complete.c
/* we can use '/' as a delimiter, imap_complete rewrites it */
if (*s == '=' || *s == '+' || *s == '!')
{
-diff -udprP mutt-1.5.21.orig/compose.c mutt-1.5.21/compose.c
---- mutt-1.5.21.orig/compose.c 2010-04-14 21:50:19.000000000 +0300
-+++ mutt-1.5.21/compose.c 2010-09-16 13:14:39.000000000 +0300
-@@ -32,10 +32,15 @@
+diff -udprP mutt-1.10.0.orig/compose.c mutt-1.10.0/compose.c
+--- mutt-1.10.0.orig/compose.c 2018-04-17 02:31:03.000000000 +0300
++++ mutt-1.10.0/compose.c 2018-06-16 17:22:30.193469746 +0300
+@@ -32,11 +32,16 @@
#include "mailbox.h"
#include "sort.h"
#include "charset.h"
@@ -1331,14 +1431,15 @@ diff -udprP mutt-1.5.21.orig/compose.c mutt-1.5.21/compose.c
#ifdef MIXMASTER
#include "remailer.h"
#endif
-+
+
+#ifdef USE_NNTP
+#include "nntp.h"
+#endif
-
++
#include <errno.h>
#include <string.h>
-@@ -67,11 +72,17 @@ enum
+ #include <sys/stat.h>
+@@ -68,10 +73,20 @@ enum
HDR_CRYPT,
HDR_CRYPTINFO,
@@ -1351,140 +1452,131 @@ diff -udprP mutt-1.5.21.orig/compose.c mutt-1.5.21/compose.c
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 - SidebarWidth)
-
- static char *Prompts[] =
-@@ -83,6 +94,16 @@ static char *Prompts[] =
- "Subject: ",
- "Reply-To: ",
- "Fcc: "
+#ifdef USE_NNTP
-+#ifdef MIXMASTER
-+ ,""
++int HeaderPadding[HDR_XCOMMENTTO + 1] = {0};
++#else
+ int HeaderPadding[HDR_CRYPTINFO + 1] = {0};
+#endif
-+ ,""
-+ ,""
-+ ,"Newsgroups: "
-+ ,"Followup-To: "
-+ ,"X-Comment-To: "
+ int MaxHeaderWidth = 0;
+
+ #define HDR_XOFFSET MaxHeaderWidth
+@@ -109,6 +124,14 @@ static const char * const Prompts[] =
+ * than 15-20 character cells.
+ */
+ N_("Sign as: ")
++#ifdef USE_NNTP
++ /* L10N: Compose menu field. May not want to translate. */
++ ,N_("Newsgroups: ")
++ /* L10N: Compose menu field. May not want to translate. */
++ ,N_("Followup-To: ")
++ /* L10N: Compose menu field. May not want to translate. */
++ ,N_("X-Comment-To: ")
+#endif
};
- static struct mapping_t ComposeHelp[] = {
-@@ -97,6 +118,19 @@ static struct mapping_t ComposeHelp[] =
+ static const struct mapping_t ComposeHelp[] = {
+@@ -126,6 +149,21 @@ static const struct mapping_t ComposeHel
{ NULL, 0 }
};
+#ifdef USE_NNTP
+static struct mapping_t ComposeNewsHelp[] = {
-+ { N_("Send"), OP_COMPOSE_SEND_MESSAGE },
-+ { N_("Abort"), OP_EXIT },
-+ { "Newsgroups", OP_COMPOSE_EDIT_NEWSGROUPS },
-+ { "Subj", OP_COMPOSE_EDIT_SUBJECT },
-+ { N_("Attach file"), OP_COMPOSE_ATTACH_FILE },
-+ { N_("Descrip"), OP_COMPOSE_EDIT_DESCRIPTION },
-+ { N_("Help"), OP_HELP },
-+ { NULL }
++ { N_("Send"), OP_COMPOSE_SEND_MESSAGE },
++ { N_("Abort"), OP_EXIT },
++ /* L10N: compose menu help line entry */
++ { N_("Newsgroups"), OP_COMPOSE_EDIT_NEWSGROUPS },
++ /* L10N: compose menu help line entry */
++ { N_("Subj"), OP_COMPOSE_EDIT_SUBJECT },
++ { N_("Attach file"), OP_COMPOSE_ATTACH_FILE },
++ { N_("Descrip"), OP_COMPOSE_EDIT_DESCRIPTION },
++ { N_("Help"), OP_HELP },
++ { NULL, 0 }
+};
+#endif
+
- static void snd_entry (char *b, size_t blen, MUTTMENU *menu, int num)
+ static void calc_header_width_padding (int idx, const char *header, int calc_max)
{
- mutt_FormatString (b, blen, 0, NONULL (AttachFormat), mutt_attach_fmt,
-@@ -112,7 +146,7 @@ static void redraw_crypt_lines (HEADER *
- {
- int off = 0;
-
-- mvaddstr (HDR_CRYPT, SidebarWidth, "Security: ");
-+ mvprintw (HDR_CRYPT, SidebarWidth, TITLE_FMT, "Security: ");
-
- if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
- {
-@@ -148,12 +182,15 @@ static void redraw_crypt_lines (HEADER *
- clrtoeol ();
-
- if ((WithCrypto & APPLICATION_PGP)
-- && msg->security & APPLICATION_PGP && msg->security & SIGN)
-- printw ("%s%s", _(" sign as: "), PgpSignAs ? PgpSignAs : _("<default>"));
-+ && msg->security & APPLICATION_PGP && msg->security & SIGN) {
-+ printw (TITLE_FMT, _(" sign as: "));
-+ printw ("%s", PgpSignAs ? PgpSignAs : _("<default>"));
-+ }
-
- if ((WithCrypto & APPLICATION_SMIME)
- && msg->security & APPLICATION_SMIME && msg->security & SIGN) {
-- printw ("%s%s", _(" sign as: "), SmimeDefaultKey ? SmimeDefaultKey : _("<default>"));
-+ printw (TITLE_FMT, _(" sign as: "));
-+ printw ("%s", SmimeDefaultKey ? SmimeDefaultKey : _("<default>"));
- }
-
- if ((WithCrypto & APPLICATION_SMIME)
-@@ -175,7 +212,7 @@ static void redraw_mix_line (LIST *chain
- int c;
- char *t;
+ int width;
+@@ -161,7 +199,14 @@ static void init_header_padding (void)
+ * the other fields look funny. */
+ calc_header_width_padding (HDR_CRYPTINFO, _(Prompts[HDR_CRYPTINFO]), 0);
-- mvaddstr (HDR_MIX, SidebarWidth, " Mix: ");
-+ mvprintw (HDR_MIX, SidebarWidth, TITLE_FMT, "Mix: ");
-
- if (!chain)
++#ifdef USE_NNTP
++ for (i = HDR_NEWSGROUPS; i <= HDR_XCOMMENTTO; i++)
++ calc_header_width_padding (i, _(Prompts[i]), 1);
++
++ for (i = 0; i <= HDR_XCOMMENTTO; i++)
++#else
+ for (i = 0; i <= HDR_CRYPTINFO; i++)
++#endif
{
-@@ -249,9 +286,28 @@ static void draw_envelope_addr (int line
+ HeaderPadding[i] += MaxHeaderWidth;
+ if (HeaderPadding[i] < 0)
+@@ -357,9 +402,37 @@ static void draw_envelope_addr (int line
static void draw_envelope (HEADER *msg, char *fcc)
{
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);
-+#ifdef USE_NNTP
-+ }
-+ else
++ if (option (OPTNEWSSEND))
+ {
-+ mvprintw (HDR_TO, SidebarWidth, TITLE_FMT , Prompts[HDR_NEWSGROUPS - 1]);
++ SETCOLOR (MT_COLOR_COMPOSE_HEADER);
++ mutt_window_mvprintw (MuttIndexWindow, HDR_TO, 0,
++ "%*s", HeaderPadding[HDR_NEWSGROUPS], _(Prompts[HDR_NEWSGROUPS]));
++ NORMAL_COLOR;
+ mutt_paddstr (W, NONULL (msg->env->newsgroups));
-+ mvprintw (HDR_CC, SidebarWidth, TITLE_FMT , Prompts[HDR_FOLLOWUPTO - 1]);
++
++ SETCOLOR (MT_COLOR_COMPOSE_HEADER);
++ mutt_window_mvprintw (MuttIndexWindow, HDR_CC, 0,
++ "%*s", HeaderPadding[HDR_FOLLOWUPTO], _(Prompts[HDR_FOLLOWUPTO]));
++ NORMAL_COLOR;
+ mutt_paddstr (W, NONULL (msg->env->followup_to));
++
+ if (option (OPTXCOMMENTTO))
+ {
-+ mvprintw (HDR_BCC, SidebarWidth, TITLE_FMT , Prompts[HDR_XCOMMENTTO - 1]);
++ SETCOLOR (MT_COLOR_COMPOSE_HEADER);
++ mutt_window_mvprintw (MuttIndexWindow, HDR_BCC, 0,
++ "%*s", HeaderPadding[HDR_XCOMMENTTO], _(Prompts[HDR_XCOMMENTTO]));
++ NORMAL_COLOR;
+ mutt_paddstr (W, NONULL (msg->env->x_comment_to));
+ }
+ }
++ else
+#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);
-@@ -504,6 +560,12 @@ int mutt_compose_menu (HEADER *msg, /*
- /* Sort, SortAux could be changed in mutt_index_menu() */
++ {
+ draw_envelope_addr (HDR_TO, msg->env->to);
+ draw_envelope_addr (HDR_CC, msg->env->cc);
+ draw_envelope_addr (HDR_BCC, msg->env->bcc);
++ }
+
+ SETCOLOR (MT_COLOR_COMPOSE_HEADER);
+ mutt_window_mvprintw (MuttIndexWindow, HDR_SUBJECT, 0,
+@@ -712,6 +785,12 @@ int mutt_compose_menu (HEADER *msg, /*
int oldSort, oldSortAux;
struct stat st;
+ compose_redraw_data_t rd;
+#ifdef USE_NNTP
-+ int news = 0; /* is it a news article ? */
++ int news = 0; /* is it a news article ? */
+
+ if (option (OPTNEWSSEND))
+ news++;
+#endif
- mutt_attach_init (msg->content);
- idx = mutt_gen_attach_list (msg->content, -1, idx, &idxlen, &idxmax, 0, 1);
-@@ -514,10 +576,18 @@ int mutt_compose_menu (HEADER *msg, /*
+ init_header_padding ();
+
+@@ -722,6 +801,11 @@ int mutt_compose_menu (HEADER *msg, /*
+ menu->offset = HDR_ATTACH;
menu->make_entry = snd_entry;
menu->tag = mutt_tag_attach;
- menu->data = idx;
+#ifdef USE_NNTP
+ if (news)
-+ menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_COMPOSE, ComposeNewsHelp);
++ menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_COMPOSE, ComposeNewsHelp);
+ else
+#endif
menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_COMPOSE, ComposeHelp);
-
+ menu->custom_menu_redraw = compose_menu_redraw;
+ menu->redraw_data = &rd;
+@@ -733,6 +817,9 @@ int mutt_compose_menu (HEADER *msg, /*
+
while (loop)
{
+#ifdef USE_NNTP
@@ -1492,33 +1584,43 @@ diff -udprP mutt-1.5.21.orig/compose.c mutt-1.5.21/compose.c
+#endif
switch (op = mutt_menuLoop (menu))
{
- case OP_REDRAW:
-@@ -530,17 +600,87 @@ int mutt_compose_menu (HEADER *msg, /*
- mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ case OP_COMPOSE_EDIT_FROM:
+@@ -740,6 +827,10 @@ int mutt_compose_menu (HEADER *msg, /*
+ mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
break;
case OP_COMPOSE_EDIT_TO:
+#ifdef USE_NNTP
+ if (news)
+ break;
+#endif
- menu->redraw = edit_address_list (HDR_TO, &msg->env->to);
- mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ edit_address_list (HDR_TO, &msg->env->to);
+ if (option (OPTCRYPTOPPORTUNISTICENCRYPT))
+ {
+@@ -749,6 +840,10 @@ int mutt_compose_menu (HEADER *msg, /*
+ mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
break;
case OP_COMPOSE_EDIT_BCC:
+#ifdef USE_NNTP
+ if (news)
+ break;
+#endif
- menu->redraw = edit_address_list (HDR_BCC, &msg->env->bcc);
- mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ edit_address_list (HDR_BCC, &msg->env->bcc);
+ if (option (OPTCRYPTOPPORTUNISTICENCRYPT))
+ {
+@@ -758,6 +853,10 @@ int mutt_compose_menu (HEADER *msg, /*
+ mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
break;
case OP_COMPOSE_EDIT_CC:
+#ifdef USE_NNTP
+ if (news)
+ break;
+#endif
- menu->redraw = edit_address_list (HDR_CC, &msg->env->cc);
- mutt_message_hook (NULL, msg, M_SEND2HOOK);
+ edit_address_list (HDR_CC, &msg->env->cc);
+ if (option (OPTCRYPTOPPORTUNISTICENCRYPT))
+ {
+@@ -766,6 +865,62 @@ int mutt_compose_menu (HEADER *msg, /*
+ }
+ mutt_message_hook (NULL, msg, MUTT_SEND2HOOK);
break;
+#ifdef USE_NNTP
+ case OP_COMPOSE_EDIT_NEWSGROUPS:
@@ -1528,52 +1630,50 @@ diff -udprP mutt-1.5.21.orig/compose.c mutt-1.5.21/compose.c
+ strfcpy (buf, msg->env->newsgroups, sizeof (buf));
+ else
+ buf[0] = 0;
-+ if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) == 0 && buf[0])
++ if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) == 0)
+ {
-+ FREE (&msg->env->newsgroups);
-+ mutt_remove_trailing_ws (buf);
-+ msg->env->newsgroups = safe_strdup (mutt_skip_whitespace (buf));
++ mutt_str_replace (&msg->env->newsgroups, buf);
+ move (HDR_TO, HDR_XOFFSET);
-+ clrtoeol ();
+ if (msg->env->newsgroups)
-+ printw ("%-*.*s", W, W, msg->env->newsgroups);
++ mutt_paddstr (W, msg->env->newsgroups);
++ else
++ clrtoeol ();
+ }
+ }
+ break;
-+
+ case OP_COMPOSE_EDIT_FOLLOWUP_TO:
+ if (news)
+ {
-+ buf[0] = 0;
+ if (msg->env->followup_to)
+ strfcpy (buf, msg->env->followup_to, sizeof (buf));
-+ if (mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) == 0 && buf[0])
++ else
++ buf[0] = 0;
++ if (mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) == 0)
+ {
-+ FREE (&msg->env->followup_to);
-+ mutt_remove_trailing_ws (buf);
-+ msg->env->followup_to = safe_strdup (mutt_skip_whitespace (buf));
++ mutt_str_replace (&msg->env->followup_to, buf);
+ move (HDR_CC, HDR_XOFFSET);
-+ clrtoeol();
+ if (msg->env->followup_to)
-+ printw ("%-*.*s", W, W, msg->env->followup_to);
++ mutt_paddstr (W, msg->env->followup_to);
++ else
++ clrtoeol ();
+ }
+ }
-+ break;
-+
++ break;
+ case OP_COMPOSE_EDIT_X_COMMENT_TO:
+ if (news && option (OPTXCOMMENTTO))
+ {
-+ buf[0] = 0;
+ if (msg->env->x_comment_to)
+ strfcpy (buf, msg->env->x_comment_to, sizeof (buf));
-+ if (mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) == 0 && buf[0])
++ else
++ buf[0] = 0;
++ if (mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) == 0)
+ {
-+ FREE (&msg->env->x_comment_to);
-+ msg->env->x_comment_to = safe_strdup (buf);
++ mutt_str_replace (&msg->env->x_comment_to, buf);
+ move (HDR_BCC, HDR_XOFFSET);
-+ clrtoeol();
+ if (msg->env->x_comment_to)
-+ printw ("%-*.*s", W, W, msg->env->x_comment_to);
++ mutt_paddstr (W, msg->env->x_comment_to);
++ else
++ clrtoeol ();
+ }
+ }
+ break;
@@ -1581,7 +1681,7 @@ diff -udprP mutt-1.5.21.orig/compose.c mutt-1.5.21/compose.c
case OP_COMPOSE_EDIT_SUBJECT:
if (msg->env->subject)
strfcpy (buf, msg->env->subject, sizeof (buf));
-@@ -703,6 +843,9 @@ int mutt_compose_menu (HEADER *msg, /*
+@@ -910,6 +1065,9 @@ int mutt_compose_menu (HEADER *msg, /*
break;
case OP_COMPOSE_ATTACH_MESSAGE:
@@ -1591,7 +1691,7 @@ diff -udprP mutt-1.5.21.orig/compose.c mutt-1.5.21/compose.c
{
char *prompt;
HEADER *h;
-@@ -710,7 +853,22 @@ int mutt_compose_menu (HEADER *msg, /*
+@@ -917,7 +1075,22 @@ int mutt_compose_menu (HEADER *msg, /*
fname[0] = 0;
prompt = _("Open mailbox to attach message from");
@@ -1599,7 +1699,7 @@ diff -udprP mutt-1.5.21.orig/compose.c mutt-1.5.21/compose.c
+ unset_option (OPTNEWS);
+ if (op == OP_COMPOSE_ATTACH_NEWS_MESSAGE)
+ {
-+ if (!(CurrentNewsSrv = mutt_select_newsserver (NewsServer)))
++ if (!(CurrentNewsSrv = nntp_select_server (NewsServer, 0)))
+ break;
+
+ prompt = _("Open newsgroup to attach message from");
@@ -1609,13 +1709,13 @@ diff -udprP mutt-1.5.21.orig/compose.c mutt-1.5.21/compose.c
+
if (Context)
+#ifdef USE_NNTP
-+ if ((op == OP_COMPOSE_ATTACH_MESSAGE) ^ (Context->magic == M_NNTP))
++ if ((op == OP_COMPOSE_ATTACH_MESSAGE) ^ (Context->magic == MUTT_NNTP))
+#endif
{
strfcpy (fname, NONULL (Context->path), sizeof (fname));
mutt_pretty_mailbox (fname, sizeof (fname));
-@@ -719,6 +877,11 @@ int mutt_compose_menu (HEADER *msg, /*
- if (mutt_enter_fname (prompt, fname, sizeof (fname), &menu->redraw, 1) == -1 || !fname[0])
+@@ -926,6 +1099,11 @@ int mutt_compose_menu (HEADER *msg, /*
+ if (mutt_enter_fname (prompt, fname, sizeof (fname), 1) == -1 || !fname[0])
break;
+#ifdef USE_NNTP
@@ -1626,50 +1726,60 @@ diff -udprP mutt-1.5.21.orig/compose.c mutt-1.5.21/compose.c
mutt_expand_path (fname, sizeof (fname));
#ifdef USE_IMAP
if (!mx_is_imap (fname))
-@@ -726,6 +889,9 @@ int mutt_compose_menu (HEADER *msg, /*
+@@ -933,6 +1111,9 @@ int mutt_compose_menu (HEADER *msg, /*
#ifdef USE_POP
if (!mx_is_pop (fname))
#endif
+#ifdef USE_NNTP
-+ if (!mx_is_nntp (fname) && !option (OPTNEWS))
++ if (!mx_is_nntp (fname) && !option (OPTNEWS))
+#endif
/* check to make sure the file exists and is readable */
if (access (fname, R_OK) == -1)
{
-diff -udprP mutt-1.5.21.orig/config.h.in mutt-1.5.21/config.h.in
---- mutt-1.5.21.orig/config.h.in 2010-08-25 19:32:03.000000000 +0300
-+++ mutt-1.5.21/config.h.in 2010-09-16 13:14:39.000000000 +0300
-@@ -37,6 +37,9 @@
- significant more memory when defined. */
- #undef EXACT_ADDRESS
-
-+/* Compiling with newsreading support with NNTP */
+diff -udprP mutt-1.10.0.orig/config.h.in mutt-1.10.0/config.h.in
+--- mutt-1.10.0.orig/config.h.in 2018-05-15 04:09:08.000000000 +0300
++++ mutt-1.10.0/config.h.in 2018-06-16 17:22:30.193469746 +0300
+@@ -640,6 +640,9 @@
+ /* Define if you want support for the IMAP protocol. */
+ #undef USE_IMAP
+
++/* Define if you want support for the NNTP protocol. */
+#undef USE_NNTP
+
- /* program to use for shell commands */
- #undef EXECSHELL
+ /* Define if you want support for the POP3 protocol. */
+ #undef USE_POP
-diff -udprP mutt-1.5.21.orig/configure.ac mutt-1.5.21/configure.ac
---- mutt-1.5.21.orig/configure.ac 2010-08-24 19:34:21.000000000 +0300
-+++ mutt-1.5.21/configure.ac 2010-09-16 13:14:39.000000000 +0300
-@@ -602,6 +602,14 @@ if test x"$need_imap" = xyes -o x"$need_
- MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS bcache.o"
- fi
+diff -udprP mutt-1.10.0.orig/configure.ac mutt-1.10.0/configure.ac
+--- mutt-1.10.0.orig/configure.ac 2018-05-15 00:51:53.000000000 +0300
++++ mutt-1.10.0/configure.ac 2018-06-16 17:22:30.193469746 +0300
+@@ -633,6 +633,15 @@ AC_ARG_ENABLE(imap, AS_HELP_STRING([--en
+ ])
+ AM_CONDITIONAL(BUILD_IMAP, test x$need_imap = xyes)
-+AC_ARG_ENABLE(nntp, [ --enable-nntp Enable NNTP support],
++AC_ARG_ENABLE(nntp, AC_HELP_STRING([--enable-nntp],[Enable NNTP support]),
+[ if test x$enableval = xyes ; then
+ AC_DEFINE(USE_NNTP,1,[ Define if you want support for the NNTP protocol. ])
+ MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS nntp.o newsrc.o"
++ need_nntp="yes"
+ need_socket="yes"
+ fi
+])
+
- dnl -- end socket dependencies --
+ AC_ARG_ENABLE(smtp, AS_HELP_STRING([--enable-smtp],[include internal SMTP relay support]),
+ [if test $enableval = yes; then
+ AC_DEFINE(USE_SMTP, 1, [Include internal SMTP relay support])
+@@ -640,7 +649,7 @@ AC_ARG_ENABLE(smtp, AS_HELP_STRING([--en
+ need_socket="yes"
+ fi])
+
+-if test x"$need_imap" = xyes -o x"$need_pop" = xyes ; then
++if test x"$need_imap" = xyes -o x"$need_pop" = xyes -o x"$need_nntp" = xyes ; then
+ MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS bcache.o"
+ fi
- if test "$need_socket" = "yes"
-diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
---- mutt-1.5.21.orig/curs_main.c 2010-09-13 20:19:55.000000000 +0300
-+++ mutt-1.5.21/curs_main.c 2010-09-16 13:14:39.000000000 +0300
+diff -udprP mutt-1.10.0.orig/curs_main.c mutt-1.10.0/curs_main.c
+--- mutt-1.10.0.orig/curs_main.c 2018-05-15 00:51:53.000000000 +0300
++++ mutt-1.10.0/curs_main.c 2018-06-16 17:37:28.758111855 +0300
@@ -22,6 +22,7 @@
#include "mutt.h"
@@ -1678,7 +1788,7 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
#include "mutt_menu.h"
#include "mailbox.h"
#include "mapping.h"
-@@ -38,6 +39,10 @@
+@@ -43,6 +44,10 @@
#include "mutt_crypt.h"
@@ -1689,9 +1799,9 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
#include <ctype.h>
#include <stdlib.h>
-@@ -413,12 +418,27 @@ static struct mapping_t IndexHelp[] = {
- { NULL, 0 }
- };
+@@ -547,12 +552,27 @@ static void index_menu_redraw (MUTTMENU
+ menu->redraw = 0;
+ }
+#ifdef USE_NNTP
+struct mapping_t IndexNewsHelp[] = {
@@ -1703,7 +1813,7 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
+ { N_("Followup"), OP_FOLLOWUP },
+ { N_("Catchup"), OP_CATCHUP },
+ { N_("Help"), OP_HELP },
-+ { NULL }
++ { NULL, 0 }
+};
+#endif
+
@@ -1717,20 +1827,20 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
int op = OP_NULL;
int done = 0; /* controls when to exit the "event" loop */
int i = 0, j;
-@@ -439,7 +459,11 @@ int mutt_index_menu (void)
+@@ -571,7 +591,11 @@ int mutt_index_menu (void)
menu->make_entry = index_make_entry;
menu->color = index_color;
menu->current = ci_first_message ();
- menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN, IndexHelp);
+ menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN,
+#ifdef USE_NNTP
-+ (Context && (Context->magic == M_NNTP)) ? IndexNewsHelp :
++ (Context && (Context->magic == MUTT_NNTP)) ? IndexNewsHelp :
+#endif
+ IndexHelp);
+ menu->custom_menu_redraw = index_menu_redraw;
+ mutt_push_current_menu (menu);
- if (!attach_msg)
- mutt_buffy_check(1); /* force the buffy check after we enter the folder */
-@@ -682,6 +706,9 @@ int mutt_index_menu (void)
+@@ -786,6 +810,9 @@ int mutt_index_menu (void)
mutt_curs_set (1); /* fallback from the pager */
}
@@ -1740,23 +1850,28 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
switch (op)
{
-@@ -732,6 +759,120 @@ int mutt_index_menu (void)
+@@ -836,6 +863,161 @@ int mutt_index_menu (void)
menu_current_bottom (menu);
break;
+#ifdef USE_NNTP
-+ case OP_GET_MESSAGE:
+ case OP_GET_PARENT:
+ CHECK_MSGCOUNT;
-+ if (Context->magic == M_NNTP)
++ CHECK_VISIBLE;
++
++ case OP_GET_MESSAGE:
++ CHECK_IN_MAILBOX;
++ CHECK_READONLY;
++ CHECK_ATTACH;
++ if (Context->magic == MUTT_NNTP)
+ {
-+ HEADER *h;
++ HEADER *hdr;
+
+ if (op == OP_GET_MESSAGE)
+ {
+ buf[0] = 0;
-+ if (mutt_get_field (_("Enter Message-Id: "), buf, sizeof (buf), 0) != 0
-+ || !buf[0])
++ if (mutt_get_field (_("Enter Message-Id: "),
++ buf, sizeof (buf), 0) != 0 || !buf[0])
+ break;
+ }
+ else
@@ -1764,41 +1879,46 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
+ LIST *ref = CURHDR->env->references;
+ if (!ref)
+ {
-+ mutt_error _("Article has no parent reference!");
++ mutt_error _("Article has no parent reference.");
+ break;
+ }
+ strfcpy (buf, ref->data, sizeof (buf));
+ }
+ if (!Context->id_hash)
+ Context->id_hash = mutt_make_id_hash (Context);
-+ if ((h = hash_find (Context->id_hash, buf)))
++ hdr = hash_find (Context->id_hash, buf);
++ if (hdr)
+ {
-+ if (h->virtual != -1)
++ if (hdr->virtual != -1)
+ {
-+ menu->current = h->virtual;
++ menu->current = hdr->virtual;
+ menu->redraw = REDRAW_MOTION_RESYNCH;
+ }
-+ else if (h->collapsed)
++ else if (hdr->collapsed)
+ {
-+ mutt_uncollapse_thread (Context, h);
++ mutt_uncollapse_thread (Context, hdr);
+ mutt_set_virtual (Context);
-+ menu->current = h->virtual;
++ menu->current = hdr->virtual;
+ menu->redraw = REDRAW_MOTION_RESYNCH;
+ }
+ else
-+ mutt_error _("Message not visible in limited view.");
++ mutt_error _("Message is not visible in limited view.");
+ }
+ else
+ {
-+ if (nntp_check_msgid (Context, buf) == 0)
++ int rc;
++
++ mutt_message (_("Fetching %s from server..."), buf);
++ rc = nntp_check_msgid (Context, buf);
++ if (rc == 0)
+ {
-+ h = Context->hdrs[Context->msgcount-1];
++ hdr = Context->hdrs[Context->msgcount - 1];
+ mutt_sort_headers (Context, 0);
-+ menu->current = h->virtual;
++ menu->current = hdr->virtual;
+ menu->redraw = REDRAW_FULL;
+ }
-+ else
-+ mutt_error (_("Article %s not found on server"), buf);
++ else if (rc > 0)
++ mutt_error (_("Article %s not found on the server."), buf);
+ }
+ }
+ break;
@@ -1806,54 +1926,85 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
+ case OP_GET_CHILDREN:
+ case OP_RECONSTRUCT_THREAD:
+ CHECK_MSGCOUNT;
-+ if (Context->magic == M_NNTP)
++ CHECK_VISIBLE;
++ CHECK_READONLY;
++ CHECK_ATTACH;
++ if (Context->magic == MUTT_NNTP)
+ {
-+ HEADER *h;
-+ int old = CURHDR->index, i;
++ int oldmsgcount = Context->msgcount;
++ int oldindex = CURHDR->index;
++ int rc = 0;
+
+ if (!CURHDR->env->message_id)
+ {
-+ mutt_error _("No Message-Id. Unable to perform operation");
++ mutt_error _("No Message-Id. Unable to perform operation.");
+ break;
+ }
+
++ mutt_message _("Fetching message headers...");
+ if (!Context->id_hash)
+ Context->id_hash = mutt_make_id_hash (Context);
+ strfcpy (buf, CURHDR->env->message_id, sizeof (buf));
+
++ /* trying to find msgid of the root message */
+ if (op == OP_RECONSTRUCT_THREAD)
+ {
+ LIST *ref = CURHDR->env->references;
+ while (ref)
+ {
-+ nntp_check_msgid (Context, ref->data);
++ if (hash_find (Context->id_hash, ref->data) == NULL)
++ {
++ rc = nntp_check_msgid (Context, ref->data);
++ if (rc < 0)
++ break;
++ }
++
+ /* the last msgid in References is the root message */
+ if (!ref->next)
+ strfcpy (buf, ref->data, sizeof (buf));
+ ref = ref->next;
+ }
+ }
-+ mutt_message _("Check for children of message...");
-+ if (nntp_check_children (Context, buf) == 0)
++
++ /* fetching all child messages */
++ if (rc >= 0)
++ rc = nntp_check_children (Context, buf);
++
++ /* at least one message has been loaded */
++ if (Context->msgcount > oldmsgcount)
+ {
++ HEADER *hdr;
++ int i, quiet = Context->quiet;
++
++ if (rc < 0)
++ Context->quiet = 1;
+ mutt_sort_headers (Context, (op == OP_RECONSTRUCT_THREAD));
-+ h = hash_find (Context->id_hash, buf);
++ Context->quiet = quiet;
++
+ /* if the root message was retrieved, move to it */
-+ if (h)
-+ menu->current = h->virtual;
-+ else /* try to restore old position */
++ hdr = hash_find (Context->id_hash, buf);
++ if (hdr)
++ menu->current = hdr->virtual;
++
++ /* try to restore old position */
++ else
++ {
+ for (i = 0; i < Context->msgcount; i++)
-+ if (Context->hdrs[i]->index == old)
++ {
++ if (Context->hdrs[i]->index == oldindex)
+ {
+ menu->current = Context->hdrs[i]->virtual;
-+ /* As an added courtesy, recenter the menu
++ /* as an added courtesy, recenter the menu
+ * with the current entry at the middle of the screen */
+ menu_check_recenter (menu);
+ menu_current_middle (menu);
+ }
++ }
++ }
++ menu->redraw = REDRAW_FULL;
+ }
-+ menu->redraw = REDRAW_FULL;
-+ mutt_clear_error ();
++ else if (rc >= 0)
++ mutt_error _("No deleted messages found in the thread.");
+ }
+ break;
+#endif
@@ -1861,7 +2012,7 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
case OP_JUMP:
CHECK_MSGCOUNT;
-@@ -828,11 +969,33 @@ int mutt_index_menu (void)
+@@ -946,11 +1128,33 @@ int mutt_index_menu (void)
break;
case OP_MAIN_LIMIT:
@@ -1870,7 +2021,7 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
CHECK_IN_MAILBOX;
menu->oldcurrent = (Context->vcount && menu->current >= 0 && menu->current < Context->vcount) ?
CURHDR->index : -1;
-- if (mutt_pattern_func (M_LIMIT, _("Limit to messages matching: ")) == 0)
+- if (mutt_pattern_func (MUTT_LIMIT, _("Limit to messages matching: ")) == 0)
+ if (op == OP_TOGGLE_READ)
+ {
+ char buf[LONG_STRING];
@@ -1891,13 +2042,13 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
+ FREE (&Context->pattern);
+ Context->pattern = safe_strdup (buf);
+ }
-+ 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 && mutt_pattern_func (MUTT_LIMIT, NULL) == 0) ||
++ mutt_pattern_func (MUTT_LIMIT, _("Limit to messages matching: ")) == 0)
{
if (menu->oldcurrent >= 0)
{
-@@ -1071,15 +1234,22 @@ int mutt_index_menu (void)
-
+@@ -1195,15 +1399,22 @@ int mutt_index_menu (void)
+ #endif
case OP_MAIN_CHANGE_FOLDER:
case OP_MAIN_NEXT_UNREAD_MAILBOX:
-
@@ -1917,7 +2068,7 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
+ op == OP_MAIN_CHANGE_GROUP_READONLY ||
+#endif
+ op == OP_MAIN_CHANGE_FOLDER_READONLY)
-+ flags = M_READONLY;
++ flags = MUTT_READONLY;
+ else
+ flags = 0;
@@ -1926,29 +2077,30 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
cp = _("Open mailbox in read-only mode");
else
cp = _("Open mailbox");
-@@ -1098,6 +1268,21 @@ int mutt_index_menu (void)
- }
- else
- {
+@@ -1236,6 +1447,22 @@ int mutt_index_menu (void)
+ strfcpy (buf, Context->path, sizeof (buf));
+ mutt_pretty_mailbox (buf, sizeof (buf));
+ }
+#ifdef USE_NNTP
+ if (op == OP_MAIN_CHANGE_GROUP ||
+ op == OP_MAIN_CHANGE_GROUP_READONLY)
+ {
+ set_option (OPTNEWS);
-+ if (!(CurrentNewsSrv = mutt_select_newsserver (NewsServer)))
++ 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);
++ nntp_buffy (buf, sizeof (buf));
+ }
+ else
+#endif
mutt_buffy (buf, sizeof (buf));
- if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
-@@ -1117,6 +1302,14 @@ int mutt_index_menu (void)
+ if (mutt_enter_fname (cp, buf, sizeof (buf), 1) == -1)
+@@ -1255,6 +1482,14 @@ int mutt_index_menu (void)
}
}
@@ -1963,54 +2115,60 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
mutt_expand_path (buf, sizeof (buf));
if (mx_get_magic (buf) <= 0)
{
-@@ -1158,15 +1351,18 @@ int mutt_index_menu (void)
- CurrentMenu = MENU_MAIN;
+@@ -1307,9 +1542,7 @@ int mutt_index_menu (void)
+ * switch statement would need to be run. */
mutt_folder_hook (buf);
- if ((Context = mx_open_mailbox (buf,
- (option (OPTREADONLY) || op == OP_MAIN_CHANGE_FOLDER_READONLY) ?
-- M_READONLY : 0, NULL)) != NULL)
+- MUTT_READONLY : 0, NULL)) != NULL)
+ if ((Context = mx_open_mailbox (buf, flags, NULL)) != NULL)
{
menu->current = ci_first_message ();
}
- else
- menu->current = 0;
+@@ -1320,6 +1553,12 @@ int mutt_index_menu (void)
+ mutt_sb_set_open_buffy ();
+ #endif
+#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);
++ (Context && (Context->magic == MUTT_NNTP)) ? IndexNewsHelp : IndexHelp);
+#endif
++
mutt_clear_error ();
mutt_buffy_check(1); /* force the buffy check after we have changed
the folder */
-@@ -1539,6 +1735,15 @@ int mutt_index_menu (void)
+@@ -1397,6 +1636,7 @@ int mutt_index_menu (void)
+ CHECK_MSGCOUNT;
+ CHECK_VISIBLE;
CHECK_READONLY;
- CHECK_ACL(M_ACL_WRITE, _("flag message"));
++ CHECK_ACL(MUTT_ACL_WRITE, _("Cannot break thread"));
-+#ifdef USE_NNTP
-+ if (Context->magic == M_NNTP)
-+ {
-+ mutt_flushinp ();
-+ mutt_error _("Can't change 'important' flag on NNTP server.");
-+ break;
-+ }
-+#endif
-+
- if (tag)
- {
- for (j = 0; j < Context->vcount; j++)
-@@ -1886,6 +2091,17 @@ int mutt_index_menu (void)
+ if ((Sort & SORT_MASK) != SORT_THREADS)
+ mutt_error _("Threading is not enabled.");
+@@ -1432,7 +1672,7 @@ int mutt_index_menu (void)
+ CHECK_VISIBLE;
+ CHECK_READONLY;
+ /* L10N: CHECK_ACL */
+- CHECK_ACL(MUTT_ACL_DELETE, _("Cannot link threads"));
++ CHECK_ACL(MUTT_ACL_WRITE, _("Cannot link threads"));
+
+ if ((Sort & SORT_MASK) != SORT_THREADS)
+ mutt_error _("Threading is not enabled.");
+@@ -2068,6 +2308,20 @@ int mutt_index_menu (void)
}
break;
+#ifdef USE_NNTP
+ case OP_CATCHUP:
-+ if (Context && Context->magic == M_NNTP)
++ CHECK_MSGCOUNT;
++ CHECK_READONLY;
++ CHECK_ATTACH
++ if (Context && Context->magic == MUTT_NNTP)
+ {
-+ if (mutt_newsgroup_catchup (CurrentNewsSrv,
-+ ((NNTP_DATA *)Context->data)->group))
++ NNTP_DATA *nntp_data = Context->data;
++ if (mutt_newsgroup_catchup (nntp_data->nserv, nntp_data->group))
+ menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
+ }
+ break;
@@ -2019,23 +2177,7 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
case OP_DISPLAY_ADDRESS:
CHECK_MSGCOUNT;
-@@ -2013,6 +2229,15 @@ int mutt_index_menu (void)
- menu->redraw = (tag ? REDRAW_INDEX : REDRAW_CURRENT) | REDRAW_STATUS;
- }
- #endif
-+
-+#ifdef USE_NNTP
-+ if (Context->magic == M_NNTP)
-+ {
-+ mutt_flushinp ();
-+ mutt_error _("Can't edit message on newsserver.");
-+ break;
-+ }
-+#endif
-
- MAYBE_REDRAW (menu->redraw);
- break;
-@@ -2090,6 +2315,41 @@ int mutt_index_menu (void)
+@@ -2326,6 +2580,39 @@ int mutt_index_menu (void)
menu->redraw = REDRAW_FULL;
break;
@@ -2051,23 +2193,21 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
+ CHECK_ATTACH;
+ if (op != OP_FOLLOWUP || !CURHDR->env->followup_to ||
+ mutt_strcasecmp (CURHDR->env->followup_to, "poster") ||
-+ query_quadoption (OPT_FOLLOWUPTOPOSTER,_("Reply by mail as poster prefers?")) != M_YES)
++ query_quadoption (OPT_FOLLOWUPTOPOSTER,
++ _("Reply by mail as poster prefers?")) != MUTT_YES)
+ {
-+ if (Context && Context->magic == M_NNTP &&
++ if (Context && Context->magic == MUTT_NNTP &&
+ !((NNTP_DATA *)Context->data)->allowed &&
-+ query_quadoption (OPT_TOMODERATED, _("Posting to this group not allowed, may be moderated. Continue?")) != M_YES)
++ query_quadoption (OPT_TOMODERATED,
++ _("Posting to this group not allowed, may be moderated. Continue?")) != MUTT_YES)
+ break;
+ if (op == OP_POST)
+ ci_send_message (SENDNEWS, NULL, NULL, Context, NULL);
+ else
+ {
+ CHECK_MSGCOUNT;
-+ if (op == OP_FOLLOWUP)
-+ ci_send_message (SENDNEWS|SENDREPLY, NULL, NULL, Context,
-+ tag ? NULL : CURHDR);
-+ else
-+ ci_send_message (SENDNEWS|SENDFORWARD, NULL, NULL, Context,
-+ tag ? NULL : CURHDR);
++ ci_send_message ((op == OP_FOLLOWUP ? SENDREPLY : SENDFORWARD) |
++ SENDNEWS, NULL, NULL, Context, tag ? NULL : CURHDR);
+ }
+ menu->redraw = REDRAW_FULL;
+ break;
@@ -2077,48 +2217,39 @@ diff -udprP mutt-1.5.21.orig/curs_main.c mutt-1.5.21/curs_main.c
case OP_REPLY:
CHECK_ATTACH;
-@@ -2165,6 +2425,12 @@ int mutt_index_menu (void)
- CHECK_READONLY;
- CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
-
-+#ifdef USE_NNTP
-+ /* Close all open NNTP connections */
-+ if (!attach_msg)
-+ nntp_logout_all ();
-+#endif
-+
- rc = mutt_thread_set_flag (CURHDR, M_DELETE, 0,
- op == OP_UNDELETE_THREAD ? 0 : 1);
+diff -udprP mutt-1.10.0.orig/doc/manual.xml.head mutt-1.10.0/doc/manual.xml.head
+--- mutt-1.10.0.orig/doc/manual.xml.head 2018-05-15 00:51:53.000000000 +0300
++++ mutt-1.10.0/doc/manual.xml.head 2018-06-16 17:22:30.195469715 +0300
+@@ -1755,6 +1755,26 @@ See also the <link linkend="postpone">$p
-diff -udprP mutt-1.5.21.orig/doc/manual.xml.head mutt-1.5.21/doc/manual.xml.head
---- mutt-1.5.21.orig/doc/manual.xml.head 2010-08-24 19:34:21.000000000 +0300
-+++ mutt-1.5.21/doc/manual.xml.head 2010-09-16 13:14:39.000000000 +0300
-@@ -1611,6 +1611,22 @@ fo-table</literal> for details.
-
- </sect2>
+ </sect1>
-+<sect2>
++<sect1 id="nntp">
+<title>Reading news via NNTP</title>
+
+<para>
+If compiled with <emphasis>--enable-nntp</emphasis> option, Mutt can
-+read news from newsserver via NNTP. You can open a newsgroup with
-+function ``change-newsgroup'' (default: ``i''). Default newsserver
-+can be obtained from <emphasis>NNTPSERVER</emphasis> environment
-+variable. Like other news readers, info about subscribed newsgroups
-+is saved in file by <link linkend="newsrc">$newsrc</link>
-+variable. Article headers are cached and can be loaded from file when
-+newsgroup entered instead loading from newsserver.
++read news from news server via NNTP. You can open a newsgroup with
++function ``change-newsgroup'' (default: ``i''). Default news server
++can be obtained from <literal>$NNTPSERVER</literal> environment
++variable or from <literal>/etc/nntpserver</literal> file. Like other
++news readers, info about subscribed newsgroups is saved in file by
++<link linkend="newsrc">$newsrc</link> variable. The variable <link
++linkend="news-cache-dir">$news_cache_dir</link> can be used to point
++to a directory. Mutt will create a hierarchy of subdirectories named
++like the account and newsgroup the cache is for. Also the hierarchy
++is used to store header cache if Mutt was compiled with <link
++linkend="header-caching">header cache</link> support.
+</para>
+
-+</sect2>
++</sect1>
+
- </sect1>
+ </chapter>
- <sect1 id="forwarding-mail">
-diff -udprP mutt-1.5.21.orig/doc/mutt.man mutt-1.5.21/doc/mutt.man
---- mutt-1.5.21.orig/doc/mutt.man 2010-08-24 19:34:21.000000000 +0300
-+++ mutt-1.5.21/doc/mutt.man 2010-09-16 13:14:39.000000000 +0300
+ <chapter id="configuration">
+diff -udprP mutt-1.10.0.orig/doc/mutt.man mutt-1.10.0/doc/mutt.man
+--- mutt-1.10.0.orig/doc/mutt.man 2018-05-15 00:51:53.000000000 +0300
++++ mutt-1.10.0/doc/mutt.man 2018-06-16 17:22:30.195469715 +0300
@@ -23,8 +23,8 @@ mutt \- The Mutt Mail User Agent
.SH SYNOPSIS
.PP
@@ -2129,59 +2260,60 @@ diff -udprP mutt-1.5.21.orig/doc/mutt.man mutt-1.5.21/doc/mutt.man
+[\-e \fIcmd\fP] [\-F \fIfile\fP] [\-g \fIserver\fP] [\-m \fItype\fP] [\-f \fIfile\fP]
.PP
.B mutt
- [\-nx]
-@@ -101,6 +101,10 @@ files.
+ [\-Enx]
+@@ -104,6 +104,10 @@ files.
Specify which mailbox to load.
.IP "-F \fImuttrc\fP"
Specify an initialization file to read instead of ~/.muttrc
+.IP "-g \fIserver\fP"
-+Start Mutt with a listing of subscribed newsgroups at specified newsserver.
++Start Mutt with a listing of subscribed newsgroups at specified news server.
+.IP "-G"
+Start Mutt with a listing of subscribed newsgroups.
.IP "-h"
Display help.
.IP "-H \fIdraft\fP"
-diff -udprP mutt-1.5.21.orig/functions.h mutt-1.5.21/functions.h
---- mutt-1.5.21.orig/functions.h 2010-08-24 19:34:21.000000000 +0300
-+++ mutt-1.5.21/functions.h 2010-09-16 13:14:39.000000000 +0300
-@@ -88,6 +88,10 @@ struct binding_t OpMain[] = { /* map: in
+diff -udprP mutt-1.10.0.orig/functions.h mutt-1.10.0/functions.h
+--- mutt-1.10.0.orig/functions.h 2018-05-15 00:51:53.000000000 +0300
++++ mutt-1.10.0/functions.h 2018-06-16 17:22:30.195469715 +0300
+@@ -89,6 +89,10 @@ const struct binding_t OpMain[] = { /* m
{ "break-thread", OP_MAIN_BREAK_THREAD, "#" },
{ "change-folder", OP_MAIN_CHANGE_FOLDER, "c" },
{ "change-folder-readonly", OP_MAIN_CHANGE_FOLDER_READONLY, "\033c" },
+#ifdef USE_NNTP
-+ { "change-newsgroup", OP_MAIN_CHANGE_GROUP, "I" },
++ { "change-newsgroup", OP_MAIN_CHANGE_GROUP, "i" },
+ { "change-newsgroup-readonly",OP_MAIN_CHANGE_GROUP_READONLY, "\033i" },
+#endif
{ "next-unread-mailbox", OP_MAIN_NEXT_UNREAD_MAILBOX, NULL },
{ "collapse-thread", OP_MAIN_COLLAPSE_THREAD, "\033v" },
{ "collapse-all", OP_MAIN_COLLAPSE_ALL, "\033V" },
-@@ -101,7 +105,15 @@ struct binding_t OpMain[] = { /* map: in
- { "edit", OP_EDIT_MESSAGE, "e" },
+@@ -103,7 +107,15 @@ const struct binding_t OpMain[] = { /* m
+ { "edit-label", OP_EDIT_LABEL, "Y" },
{ "edit-type", OP_EDIT_TYPE, "\005" },
{ "forward-message", OP_FORWARD_MESSAGE, "f" },
- { "flag-message", OP_FLAG_MESSAGE, "F" },
+- { "flag-message", OP_FLAG_MESSAGE, "F" },
+#ifdef USE_NNTP
+ { "forward-to-group", OP_FORWARD_TO_GROUP, "\033F" },
-+ { "followup-message", OP_FOLLOWUP, "\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" },
-@@ -128,6 +140,9 @@ struct binding_t OpMain[] = { /* map: in
+@@ -131,6 +143,9 @@ const struct binding_t OpMain[] = { /* m
{ "sort-mailbox", OP_SORT, "o" },
{ "sort-reverse", OP_SORT_REVERSE, "O" },
{ "print-message", OP_PRINT, "p" },
+#ifdef USE_NNTP
-+ { "post-message", OP_POST, "\033m" },
++ { "post-message", OP_POST, "P" },
+#endif
{ "previous-thread", OP_MAIN_PREV_THREAD, "\020" },
{ "previous-subthread", OP_MAIN_PREV_SUBTHREAD, "\033p" },
{ "recall-message", OP_RECALL_MESSAGE, "R" },
-@@ -147,6 +162,10 @@ struct binding_t OpMain[] = { /* map: in
+@@ -150,6 +165,10 @@ const struct binding_t OpMain[] = { /* m
{ "show-version", OP_VERSION, "V" },
{ "set-flag", OP_MAIN_SET_FLAG, "w" },
{ "clear-flag", OP_MAIN_CLEAR_FLAG, "W" },
@@ -2189,10 +2321,19 @@ diff -udprP mutt-1.5.21.orig/functions.h mutt-1.5.21/functions.h
+#ifdef USE_NNTP
+ { "catchup", OP_CATCHUP, "y" },
+#endif
- { "display-message", OP_DISPLAY_MESSAGE, M_ENTER_S },
+ { "display-message", OP_DISPLAY_MESSAGE, MUTT_ENTER_S },
+ { "mark-message", OP_MARK_MSG, "~" },
{ "buffy-list", OP_BUFFY_LIST, "." },
- { "sync-mailbox", OP_MAIN_SYNC_FOLDER, "$" },
-@@ -178,6 +197,10 @@ struct binding_t OpPager[] = { /* map: p
+@@ -162,7 +181,7 @@ const struct binding_t OpMain[] = { /* m
+ { "previous-new-then-unread", OP_MAIN_PREV_NEW_THEN_UNREAD, "\033\t" },
+ { "next-unread", OP_MAIN_NEXT_UNREAD, NULL },
+ { "previous-unread", OP_MAIN_PREV_UNREAD, NULL },
+- { "parent-message", OP_MAIN_PARENT_MESSAGE, "P" },
++ { "parent-message", OP_MAIN_PARENT_MESSAGE, NULL },
+ { "root-message", OP_MAIN_ROOT_MESSAGE, NULL },
+
+
+@@ -193,6 +212,10 @@ const struct binding_t OpPager[] = { /*
{ "bounce-message", OP_BOUNCE_MESSAGE, "b" },
{ "change-folder", OP_MAIN_CHANGE_FOLDER, "c" },
{ "change-folder-readonly", OP_MAIN_CHANGE_FOLDER_READONLY, "\033c" },
@@ -2203,49 +2344,59 @@ diff -udprP mutt-1.5.21.orig/functions.h mutt-1.5.21/functions.h
{ "next-unread-mailbox", OP_MAIN_NEXT_UNREAD_MAILBOX, NULL },
{ "copy-message", OP_COPY_MESSAGE, "C" },
{ "decode-copy", OP_DECODE_COPY, "\033C" },
-@@ -188,8 +211,12 @@ struct binding_t OpPager[] = { /* map: p
- { "clear-flag", OP_MAIN_CLEAR_FLAG, "W" },
+@@ -204,8 +227,12 @@ const struct binding_t OpPager[] = { /*
{ "edit", OP_EDIT_MESSAGE, "e" },
+ { "edit-label", OP_EDIT_LABEL, "Y" },
{ "edit-type", OP_EDIT_TYPE, "\005" },
+#ifdef USE_NNTP
-+ { "followup-message", OP_FOLLOWUP, "\033f" },
++ { "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, "F" },
++ { "flag-message", OP_FLAG_MESSAGE, "\033f" },
{ "group-reply", OP_GROUP_REPLY, "g" },
#ifdef USE_IMAP
{ "imap-fetch-mail", OP_MAIN_IMAP_FETCH, NULL },
-@@ -211,6 +238,9 @@ struct binding_t OpPager[] = { /* map: p
+@@ -227,6 +254,9 @@ const struct binding_t OpPager[] = { /*
{ "sort-mailbox", OP_SORT, "o" },
{ "sort-reverse", OP_SORT_REVERSE, "O" },
{ "print-message", OP_PRINT, "p" },
+#ifdef USE_NNTP
-+ { "post-message", OP_POST, "\033m" },
++ { "post-message", OP_POST, "P" },
+#endif
{ "previous-thread", OP_MAIN_PREV_THREAD, "\020" },
{ "previous-subthread",OP_MAIN_PREV_SUBTHREAD, "\033p" },
- { "quit", OP_QUIT, "Q" },
-@@ -279,6 +309,10 @@ struct binding_t OpAttach[] = { /* map:
+ { "purge-message", OP_PURGE_MESSAGE, NULL },
+@@ -276,7 +306,7 @@ const struct binding_t OpPager[] = { /*
+ { "half-down", OP_HALF_DOWN, NULL },
+ { "previous-line", OP_PREV_LINE, NULL },
+ { "bottom", OP_PAGER_BOTTOM, NULL },
+- { "parent-message", OP_MAIN_PARENT_MESSAGE, "P" },
++ { "parent-message", OP_MAIN_PARENT_MESSAGE, NULL },
+ { "root-message", OP_MAIN_ROOT_MESSAGE, NULL },
+
+
+@@ -309,6 +339,10 @@ const struct binding_t OpAttach[] = { /*
{ "bounce-message", OP_BOUNCE_MESSAGE, "b" },
{ "display-toggle-weed", OP_DISPLAY_HEADERS, "h" },
{ "edit-type", OP_EDIT_TYPE, "\005" },
+#ifdef USE_NNTP
-+ { "followup-message", OP_FOLLOWUP, "\033f" },
++ { "followup-message", OP_FOLLOWUP, "F" },
+ { "forward-to-group", OP_FORWARD_TO_GROUP, "\033F" },
+#endif
{ "print-entry", OP_PRINT, "p" },
{ "save-entry", OP_SAVE, "s" },
{ "pipe-entry", OP_PIPE, "|" },
-@@ -304,6 +338,7 @@ struct binding_t OpAttach[] = { /* map:
- struct binding_t OpCompose[] = { /* map: compose */
+@@ -334,6 +368,7 @@ const struct binding_t OpAttach[] = { /*
+ const struct binding_t OpCompose[] = { /* map: compose */
{ "attach-file", OP_COMPOSE_ATTACH_FILE, "a" },
{ "attach-message", OP_COMPOSE_ATTACH_MESSAGE, "A" },
+ { "attach-news-message",OP_COMPOSE_ATTACH_NEWS_MESSAGE,"\033a" },
{ "edit-bcc", OP_COMPOSE_EDIT_BCC, "b" },
{ "edit-cc", OP_COMPOSE_EDIT_CC, "c" },
{ "copy-file", OP_SAVE, "C" },
-@@ -323,6 +358,11 @@ struct binding_t OpCompose[] = { /* map:
+@@ -353,6 +388,11 @@ const struct binding_t OpCompose[] = { /
{ "print-entry", OP_PRINT, "l" },
{ "edit-mime", OP_COMPOSE_EDIT_MIME, "m" },
{ "new-mime", OP_COMPOSE_NEW_MIME, "n" },
@@ -2256,8 +2407,8 @@ diff -udprP mutt-1.5.21.orig/functions.h mutt-1.5.21/functions.h
+#endif
{ "postpone-message", OP_COMPOSE_POSTPONE_MESSAGE, "P" },
{ "edit-reply-to", OP_COMPOSE_EDIT_REPLY_TO, "r" },
- { "rename-file", OP_COMPOSE_RENAME_FILE, "R" },
-@@ -374,14 +414,25 @@ struct binding_t OpBrowser[] = { /* map:
+ { "rename-attachment",OP_COMPOSE_RENAME_ATTACHMENT, "\017" },
+@@ -405,14 +445,25 @@ const struct binding_t OpBrowser[] = { /
{ "select-new", OP_BROWSER_NEW_FILE, "N" },
{ "check-new", OP_CHECK_NEW, NULL },
{ "toggle-mailboxes", OP_TOGGLE_MAILBOXES, "\t" },
@@ -2283,26 +2434,37 @@ diff -udprP mutt-1.5.21.orig/functions.h mutt-1.5.21/functions.h
{ "toggle-subscribed", OP_BROWSER_TOGGLE_LSUB, "T" },
#endif
{ NULL, 0, NULL }
-diff -udprP mutt-1.5.21.orig/globals.h mutt-1.5.21/globals.h
---- mutt-1.5.21.orig/globals.h 2009-08-25 22:08:52.000000000 +0300
-+++ mutt-1.5.21/globals.h 2010-09-16 13:14:39.000000000 +0300
-@@ -95,6 +95,15 @@ WHERE char *MixEntryFormat;
+diff -udprP mutt-1.10.0.orig/globals.h mutt-1.10.0/globals.h
+--- mutt-1.10.0.orig/globals.h 2018-05-15 00:51:53.000000000 +0300
++++ mutt-1.10.0/globals.h 2018-06-16 17:22:30.196469699 +0300
+@@ -71,7 +71,7 @@ WHERE char *Inbox;
+ WHERE char *Ispell;
+ WHERE char *MailcapPath;
+ WHERE char *Maildir;
+-#if defined(USE_IMAP) || defined(USE_POP)
++#if defined(USE_IMAP) || defined(USE_POP) || defined(USE_NNTP)
+ WHERE char *MessageCachedir;
+ #endif
+ #if USE_HCACHE
+@@ -99,6 +99,17 @@ WHERE char *MixEntryFormat;
#endif
WHERE char *Muttrc INITVAL (NULL);
+#ifdef USE_NNTP
-+WHERE char *NewsCacheDir;
+WHERE char *GroupFormat;
+WHERE char *Inews;
++WHERE char *NewsCacheDir;
+WHERE char *NewsServer;
++WHERE char *NewsgroupsCharset;
++WHERE char *NewsRc;
++WHERE char *NntpAuthenticators;
+WHERE char *NntpUser;
+WHERE char *NntpPass;
-+WHERE char *NewsRc;
+#endif
WHERE char *Outbox;
WHERE char *Pager;
WHERE char *PagerFmt;
-@@ -188,6 +197,11 @@ extern unsigned char QuadOptions[];
+@@ -207,6 +218,11 @@ extern unsigned char QuadOptions[];
WHERE unsigned short Counter INITVAL (0);
@@ -2312,120 +2474,58 @@ diff -udprP mutt-1.5.21.orig/globals.h mutt-1.5.21/globals.h
+#endif
+
WHERE short ConnectTimeout;
+ WHERE short ErrorHistSize;
WHERE short HistSize;
- WHERE short MenuContext;
-diff -udprP mutt-1.5.21.orig/hash.c mutt-1.5.21/hash.c
---- mutt-1.5.21.orig/hash.c 2009-03-19 21:41:18.000000000 +0200
-+++ mutt-1.5.21/hash.c 2010-09-16 13:14:39.000000000 +0300
-@@ -57,6 +57,7 @@ HASH *hash_create (int nelem, int lower)
- if (nelem == 0)
- nelem = 2;
- table->nelem = nelem;
-+ table->curnelem = 0;
- table->table = safe_calloc (nelem, sizeof (struct hash_elem *));
- if (lower)
- {
-@@ -71,6 +72,29 @@ HASH *hash_create (int nelem, int lower)
- return table;
- }
+diff -udprP mutt-1.10.0.orig/hcache.c mutt-1.10.0/hcache.c
+--- mutt-1.10.0.orig/hcache.c 2017-12-18 22:31:37.000000000 +0200
++++ mutt-1.10.0/hcache.c 2018-06-16 17:22:30.196469699 +0300
+@@ -534,6 +534,12 @@ dump_envelope(ENVELOPE * e, unsigned cha
+ d = dump_list(e->in_reply_to, d, off, 0);
+ d = dump_list(e->userhdrs, d, off, convert);
-+HASH *hash_resize (HASH *ptr, int nelem, int lower)
-+{
-+ HASH *table;
-+ struct hash_elem *elem, *tmp;
-+ int i;
-+
-+ table = hash_create (nelem, lower);
++#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
+
-+ for (i = 0; i < ptr->nelem; i++)
-+ {
-+ for (elem = ptr->table[i]; elem; )
-+ {
-+ tmp = elem;
-+ elem = elem->next;
-+ hash_insert (table, tmp->key, tmp->data, 1);
-+ FREE (&tmp);
-+ }
-+ }
-+ FREE (&ptr->table);
-+ FREE (&ptr);
-+ return table;
-+}
+ return d;
+ }
+
+@@ -570,6 +576,12 @@ restore_envelope(ENVELOPE * e, const uns
+ restore_list(&e->references, d, off, 0);
+ restore_list(&e->in_reply_to, d, off, 0);
+ restore_list(&e->userhdrs, d, off, convert);
+
- /* table hash table to update
- * key key to hash on
- * data data to associate with `key'
-@@ -90,6 +114,7 @@ int hash_insert (HASH * table, const cha
- {
- ptr->next = table->table[h];
- table->table[h] = ptr;
-+ table->curnelem++;
- }
- else
- {
-@@ -112,6 +137,7 @@ int hash_insert (HASH * table, const cha
- else
- table->table[h] = ptr;
- ptr->next = tmp;
-+ table->curnelem++;
- }
- return h;
++#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
}
-@@ -142,6 +168,7 @@ void hash_delete_hash (HASH * table, int
- if (destroy)
- destroy (ptr->data);
- FREE (&ptr);
-+ table->curnelem--;
-
- ptr = *last;
- }
-diff -udprP mutt-1.5.21.orig/hash.h mutt-1.5.21/hash.h
---- mutt-1.5.21.orig/hash.h 2009-03-19 21:41:18.000000000 +0200
-+++ mutt-1.5.21/hash.h 2010-09-16 13:14:39.000000000 +0300
-@@ -28,7 +28,7 @@ struct hash_elem
- typedef struct
- {
-- int nelem;
-+ int nelem, curnelem;
- struct hash_elem **table;
- unsigned int (*hash_string)(const unsigned char *, unsigned int);
- int (*cmp_string)(const char *, const char *);
-@@ -41,6 +41,7 @@ HASH;
-
- HASH *hash_create (int nelem, int lower);
- int hash_insert (HASH * table, const char *key, void *data, int allow_dup);
-+HASH *hash_resize (HASH * table, int nelem, int lower);
- void *hash_find_hash (const HASH * table, int hash, const char *key);
- void hash_delete_hash (HASH * table, int hash, const char *key, const void *data,
- void (*destroy) (void *));
-diff -udprP mutt-1.5.21.orig/hdrline.c mutt-1.5.21/hdrline.c
---- mutt-1.5.21.orig/hdrline.c 2009-04-11 02:45:19.000000000 +0300
-+++ mutt-1.5.21/hdrline.c 2010-09-16 13:14:39.000000000 +0300
-@@ -211,6 +211,7 @@ int mutt_user_is_recipient (HEADER *h)
+ static int
+diff -udprP mutt-1.10.0.orig/hdrline.c mutt-1.10.0/hdrline.c
+--- mutt-1.10.0.orig/hdrline.c 2018-05-15 00:51:53.000000000 +0300
++++ mutt-1.10.0/hdrline.c 2018-06-16 17:22:30.196469699 +0300
+@@ -227,6 +227,7 @@ static char *apply_subject_mods (ENVELOP
* %E = number of messages in current thread
* %f = entire from line
* %F = like %n, unless from self
-+ * %g = newsgroup name (if compiled with nntp support)
++ * %g = newsgroup name (if compiled with NNTP support)
* %i = message-id
* %l = number of lines in the message
* %L = like %F, except `lists' are displayed first
-@@ -219,12 +220,14 @@ int mutt_user_is_recipient (HEADER *h)
- * %N = score
- * %O = like %L, except using address instead of name
- * %P = progress indicator for builtin pager
-+ * %R = `x-comment-to:' field (if present and compiled with nntp support)
- * %s = subject
- * %S = short message status (e.g., N/O/D/!/r/-)
- * %t = `to:' field (recipients)
+@@ -243,6 +244,8 @@ static char *apply_subject_mods (ENVELOP
* %T = $to_chars
* %u = user (login) name of author
* %v = first name of author, unless from self
+ * %W = where user is (organization)
++ * %x = `x-comment-to:' field (if present and compiled with NNTP support)
* %X = number of MIME attachments
* %y = `x-label:' field (if present)
* %Y = `x-label:' field (if present, tree unfolded, and != parent's x-label)
-@@ -457,6 +460,12 @@ hdr_format_str (char *dest,
+@@ -474,6 +477,12 @@ hdr_format_str (char *dest,
break;
@@ -2438,23 +2538,7 @@ diff -udprP mutt-1.5.21.orig/hdrline.c mutt-1.5.21/hdrline.c
case 'i':
mutt_format_s (dest, destlen, prefix, hdr->env->message_id ? hdr->env->message_id : "<no.id>");
break;
-@@ -548,6 +557,15 @@ hdr_format_str (char *dest,
- strfcpy(dest, NONULL(hfi->pager_progress), destlen);
- break;
-
-+#ifdef USE_NNTP
-+ case 'R':
-+ if (!optional)
-+ mutt_format_s (dest, destlen, prefix, hdr->env->x_comment_to ? hdr->env->x_comment_to : "");
-+ else if (!hdr->env->x_comment_to)
-+ optional = 0;
-+ break;
-+#endif
-+
- case 's':
-
- if (flags & M_FORMAT_TREE && !hdr->collapsed)
-@@ -637,6 +655,13 @@ hdr_format_str (char *dest,
+@@ -678,6 +687,22 @@ hdr_format_str (char *dest,
mutt_format_s (dest, destlen, prefix, buf2);
break;
@@ -2464,29 +2548,38 @@ diff -udprP mutt-1.5.21.orig/hdrline.c mutt-1.5.21/hdrline.c
+ else if (!hdr->env->organization)
+ optional = 0;
+ break;
++
++#ifdef USE_NNTP
++ case 'x':
++ if (!optional)
++ mutt_format_s (dest, destlen, prefix, hdr->env->x_comment_to ? hdr->env->x_comment_to : "");
++ else if (!hdr->env->x_comment_to)
++ optional = 0;
++ break;
++#endif
+
case 'Z':
ch = ' ';
-diff -udprP mutt-1.5.21.orig/headers.c mutt-1.5.21/headers.c
---- mutt-1.5.21.orig/headers.c 2009-08-25 22:08:52.000000000 +0300
-+++ mutt-1.5.21/headers.c 2010-09-16 13:14:39.000000000 +0300
-@@ -114,6 +114,9 @@ void mutt_edit_headers (const char *edit
+diff -udprP mutt-1.10.0.orig/headers.c mutt-1.10.0/headers.c
+--- mutt-1.10.0.orig/headers.c 2017-12-18 22:31:37.000000000 +0200
++++ mutt-1.10.0/headers.c 2018-06-16 17:22:30.196469699 +0300
+@@ -115,6 +115,9 @@ void mutt_edit_headers (const char *edit
$edit_headers set, we remove References: as they're likely invalid;
we can simply compare strings as we don't generate References for
multiple Message-Ids in IRT anyways */
+#ifdef USE_NNTP
+ if (!option (OPTNEWSSEND))
+#endif
- if (!n->in_reply_to || (msg->env->in_reply_to &&
- mutt_strcmp (n->in_reply_to->data,
+ if (msg->env->in_reply_to &&
+ (!n->in_reply_to || mutt_strcmp (n->in_reply_to->data,
msg->env->in_reply_to->data) != 0))
-diff -udprP mutt-1.5.21.orig/init.c mutt-1.5.21/init.c
---- mutt-1.5.21.orig/init.c 2010-08-25 19:31:40.000000000 +0300
-+++ mutt-1.5.21/init.c 2010-09-16 13:14:39.000000000 +0300
-@@ -2966,6 +2966,28 @@ void mutt_init (int skip_sys_rc, LIST *c
- else
- Fqdn = safe_strdup(NONULL(Hostname));
+diff -udprP mutt-1.10.0.orig/init.c mutt-1.10.0/init.c
+--- mutt-1.10.0.orig/init.c 2018-05-15 00:51:53.000000000 +0300
++++ mutt-1.10.0/init.c 2018-06-16 17:22:30.197469683 +0300
+@@ -3445,6 +3445,28 @@ void mutt_init (int skip_sys_rc, LIST *c
+ Fqdn = safe_strdup(utsname.nodename);
+
+#ifdef USE_NNTP
+ {
@@ -2497,7 +2590,7 @@ diff -udprP mutt-1.5.21.orig/init.c mutt-1.5.21/init.c
+ {
+ buffer[0] = '\0';
+ fgets (buffer, sizeof (buffer), f);
-+ p = &buffer;
++ p = buffer;
+ SKIPWS (p);
+ i = p;
+ while (*i && (*i != ' ') && (*i != '\t') && (*i != '\r') && (*i != '\n')) i++;
@@ -2513,10 +2606,10 @@ diff -udprP mutt-1.5.21.orig/init.c mutt-1.5.21/init.c
if ((p = getenv ("MAIL")))
Spoolfile = safe_strdup (p);
else if ((p = getenv ("MAILDIR")))
-diff -udprP mutt-1.5.21.orig/init.h mutt-1.5.21/init.h
---- mutt-1.5.21.orig/init.h 2010-09-15 18:39:31.000000000 +0300
-+++ mutt-1.5.21/init.h 2010-09-16 13:14:39.000000000 +0300
-@@ -176,6 +176,20 @@ struct option_t MuttVars[] = {
+diff -udprP mutt-1.10.0.orig/init.h mutt-1.10.0/init.h
+--- mutt-1.10.0.orig/init.h 2018-05-15 00:51:53.000000000 +0300
++++ mutt-1.10.0/init.h 2018-06-16 17:29:50.406514947 +0300
+@@ -200,6 +200,20 @@ struct option_t MuttVars[] = {
** If \fIset\fP, Mutt will prompt you for carbon-copy (Cc) recipients before
** editing the body of an outgoing message.
*/
@@ -2537,12 +2630,12 @@ diff -udprP mutt-1.5.21.orig/init.h mutt-1.5.21/init.h
{ "assumed_charset", DT_STR, R_NONE, UL &AssumedCharset, UL 0},
/*
** .pp
-@@ -322,6 +336,14 @@ struct option_t MuttVars[] = {
- ** follow these menus. The option is \fIunset\fP by default because many
- ** visual terminals don't permit making the cursor invisible.
+@@ -372,6 +386,14 @@ struct option_t MuttVars[] = {
+ ** doesn't make intuitive sense. In those cases, it may be
+ ** desirable to \fIunset\fP this variable.
*/
+#ifdef USE_NNTP
-+ { "catchup_newsgroup", DT_QUAD, R_NONE, OPT_CATCHUP, M_ASKYES },
++ { "catchup_newsgroup", DT_QUAD, R_NONE, OPT_CATCHUP, MUTT_ASKYES },
+ /*
+ ** .pp
+ ** If this variable is \fIset\fP, Mutt will mark all articles in newsgroup
@@ -2552,12 +2645,12 @@ diff -udprP mutt-1.5.21.orig/init.h mutt-1.5.21/init.h
#if defined(USE_SSL)
{ "certificate_file", DT_PATH, R_NONE, UL &SslCertFile, UL "~/.mutt_certificates" },
/*
-@@ -798,6 +820,16 @@ struct option_t MuttVars[] = {
+@@ -926,6 +948,16 @@ struct option_t MuttVars[] = {
** sent to both the list and your address, resulting in two copies
** of the same email for you.
*/
+#ifdef USE_NNTP
-+ { "followup_to_poster", DT_QUAD, R_NONE, OPT_FOLLOWUPTOPOSTER, M_ASKYES },
++ { "followup_to_poster", DT_QUAD, R_NONE, OPT_FOLLOWUPTOPOSTER, MUTT_ASKYES },
+ /*
+ ** .pp
+ ** If this variable is \fIset\fP and the keyword "poster" is present in
@@ -2569,7 +2662,7 @@ diff -udprP mutt-1.5.21.orig/init.h mutt-1.5.21/init.h
{ "force_name", DT_BOOL, R_NONE, OPTFORCENAME, 0 },
/*
** .pp
-@@ -880,6 +912,27 @@ struct option_t MuttVars[] = {
+@@ -1024,6 +1056,26 @@ struct option_t MuttVars[] = {
** a regular expression that will match the whole name so mutt will expand
** ``Franklin'' to ``Franklin, Steve''.
*/
@@ -2580,61 +2673,58 @@ diff -udprP mutt-1.5.21.orig/init.h mutt-1.5.21/init.h
+ ** This variable allows you to customize the newsgroup browser display to
+ ** your personal taste. This string is similar to ``$index_format'', but
+ ** has its own set of printf()-like sequences:
-+ ** .pp
-+ ** .ts
-+ ** %C current newsgroup number
-+ ** %d description of newsgroup (becomes from server)
-+ ** %f newsgroup name
-+ ** %M - if newsgroup not allowed for direct post (moderated for example)
-+ ** %N N if newsgroup is new, u if unsubscribed, blank otherwise
-+ ** %n number of new articles in newsgroup
-+ ** %s number of unread articles in newsgroup
-+ ** %>X right justify the rest of the string and pad with character "X"
-+ ** %|X pad to the end of the line with character "X"
-+ ** .te
++ ** .dl
++ ** .dt %C .dd current newsgroup number
++ ** .dt %d .dd description of newsgroup (becomes from server)
++ ** .dt %f .dd newsgroup name
++ ** .dt %M .dd - if newsgroup not allowed for direct post (moderated for example)
++ ** .dt %N .dd N if newsgroup is new, u if unsubscribed, blank otherwise
++ ** .dt %n .dd number of new articles in newsgroup
++ ** .dt %s .dd number of unread articles in newsgroup
++ ** .dt %>X .dd right justify the rest of the string and pad with character "X"
++ ** .dt %|X .dd pad to the end of the line with character "X"
++ ** .de
+ */
+#endif
{ "hdr_format", DT_SYN, R_NONE, UL "index_format", 0 },
/*
*/
-@@ -1256,6 +1309,7 @@ struct option_t MuttVars[] = {
+@@ -1445,6 +1497,7 @@ 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 newsgroup name (if compiled with nntp support)
++ ** .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,
-@@ -1271,12 +1325,14 @@ struct option_t MuttVars[] = {
- ** stashed the message: list name or recipient name
- ** if not sent to a list
- ** .dt %P .dd progress indicator for the built-in pager (how much of the file has been displayed)
-+ ** .dt %R .dd ``x-comment-to:'' field (if present and compiled with nntp support)
- ** .dt %s .dd subject of the message
- ** .dt %S .dd status of the message (``N''/``D''/``d''/``!''/``r''/\(as)
- ** .dt %t .dd ``To:'' field (recipients)
+@@ -1468,6 +1521,8 @@ struct option_t MuttVars[] = {
** .dt %T .dd the appropriate character from the $$to_chars string
** .dt %u .dd user (login) name of the author
** .dt %v .dd first name of the author, or the recipient if the message is from you
-+ ** .dt %W .dd name of organization of author (``organization:'' field)
++ ** .dt %W .dd name of organization of author (``Organization:'' field)
++ ** .dt %x .dd ``X-Comment-To:'' field (if present and compiled with NNTP support)
** .dt %X .dd number of attachments
** (please see the ``$attachments'' section for possible speed effects)
** .dt %y .dd ``X-Label:'' field, if present
-@@ -1311,6 +1367,21 @@ struct option_t MuttVars[] = {
+@@ -1506,6 +1561,25 @@ struct option_t MuttVars[] = {
** Note that these expandos are supported in
** ``$save-hook'', ``$fcc-hook'' and ``$fcc-save-hook'', too.
*/
+#ifdef USE_NNTP
-+ { "inews", DT_PATH, R_NONE, UL &Inews, UL "" },
++ { "inews", DT_PATH, R_NONE, UL &Inews, UL "" },
+ /*
+ ** .pp
+ ** If set, specifies the program and arguments used to deliver news posted
+ ** by Mutt. Otherwise, mutt posts article using current connection to
+ ** news server. The following printf-style sequence is understood:
-+ ** .pp
-+ ** .ts
-+ ** %s newsserver name
-+ ** .te
++ ** .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
+ ** .pp
+ ** Example: set inews="/usr/local/bin/inews -hS"
+ */
@@ -2642,12 +2732,12 @@ diff -udprP mutt-1.5.21.orig/init.h mutt-1.5.21/init.h
{ "ispell", DT_PATH, R_NONE, UL &Ispell, UL ISPELL },
/*
** .pp
-@@ -1545,6 +1616,15 @@ struct option_t MuttVars[] = {
- ** menu, attachments which cannot be decoded in a reasonable manner will
- ** be attached to the newly composed message if this option is \fIset\fP.
+@@ -1793,6 +1867,15 @@ struct option_t MuttVars[] = {
+ ** When \fIset\fP, the $$mime_type_query_command will be run before the
+ ** mime.types lookup.
*/
+#ifdef USE_NNTP
-+ { "mime_subject", DT_BOOL, R_NONE, OPTMIMESUBJECT, 1 },
++ { "mime_subject", DT_BOOL, R_NONE, OPTMIMESUBJECT, 1 },
+ /*
+ ** .pp
+ ** If \fIunset\fP, 8-bit ``subject:'' line in article header will not be
@@ -2658,40 +2748,69 @@ diff -udprP mutt-1.5.21.orig/init.h mutt-1.5.21/init.h
#ifdef MIXMASTER
{ "mix_entry_format", DT_STR, R_NONE, UL &MixEntryFormat, UL "%4n %c %-16s %a" },
/*
-@@ -1592,6 +1672,77 @@ struct option_t MuttVars[] = {
- ** See also $$read_inc, $$write_inc and $$net_inc.
- */
- #endif
+@@ -1847,6 +1930,106 @@ struct option_t MuttVars[] = {
+ ** See the $$status_format documentation for the values that can be formatted
+ ** into this command.
+ */
+#ifdef USE_NNTP
-+ { "news_cache_dir", DT_PATH, R_NONE, UL &NewsCacheDir, UL "~/.mutt" },
++ { "news_cache_dir", DT_PATH, R_NONE, UL &NewsCacheDir, UL "~/.mutt" },
+ /*
+ ** .pp
+ ** This variable pointing to directory where Mutt will save cached news
-+ ** articles headers in. If \fIunset\fP, headers will not be saved at all
-+ ** and will be reloaded each time when you enter to newsgroup.
++ ** 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 },
++ { "news_server", DT_STR, R_NONE, UL &NewsServer, 0 },
+ /*
+ ** .pp
+ ** This variable specifies domain name or address of NNTP server. It
-+ ** defaults to the newsserver specified in the environment variable
++ ** 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 newsserver, ie:
++ ** 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
-+ ** [news[s]://][username[:password]@]newsserver[:port]
++ ** Character set of newsgroups descriptions.
+ */
-+ { "newsrc", DT_PATH, R_NONE, UL &NewsRc, UL "~/.newsrc" },
++ { "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
-+ ** %s newsserver name
++ ** 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 },
++ { "nntp_context", DT_NUM, R_NONE, UL &NntpContext, 1000 },
+ /*
+ ** .pp
+ ** This variable defines number of articles which will be in index when
@@ -2699,6 +2818,12 @@ diff -udprP mutt-1.5.21.orig/init.h mutt-1.5.21/init.h
+ ** 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
@@ -2706,19 +2831,19 @@ diff -udprP mutt-1.5.21.orig/init.h mutt-1.5.21/init.h
+ ** 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 "" },
++ { "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 newsserver.
++ ** connect to news server.
+ */
-+ { "nntp_pass", DT_STR, R_NONE, UL &NntpPass, UL "" },
++ { "nntp_pass", DT_STR, R_NONE, UL &NntpPass, UL "" },
+ /*
+ ** .pp
+ ** Your password for NNTP account.
+ */
-+ { "nntp_poll", DT_NUM, R_NONE, UL &NewsPollTimeout, 60 },
++ { "nntp_poll", DT_NUM, R_NONE, UL &NewsPollTimeout, 60 },
+ /*
+ ** .pp
+ ** The time in seconds until any operations on newsgroup except post new
@@ -2726,68 +2851,62 @@ diff -udprP mutt-1.5.21.orig/init.h mutt-1.5.21/init.h
+ ** recheck newsgroup on each operation in index (stepping, read article,
+ ** etc.).
+ */
-+ { "nntp_reconnect", DT_QUAD, R_NONE, OPT_NNTPRECONNECT, M_ASKYES },
-+ /*
-+ ** .pp
-+ ** Controls whether or not Mutt will try to reconnect to newsserver when
-+ ** connection lost.
-+ */
+#endif
{ "pager", DT_PATH, R_NONE, UL &Pager, UL "builtin" },
/*
** .pp
-@@ -2091,6 +2242,16 @@ struct option_t MuttVars[] = {
+@@ -2395,6 +2578,16 @@ struct option_t MuttVars[] = {
{ "post_indent_str", DT_SYN, R_NONE, UL "post_indent_string", 0 },
/*
*/
+#ifdef USE_NNTP
-+ { "post_moderated", DT_QUAD, R_NONE, OPT_TOMODERATED, M_ASKYES },
++ { "post_moderated", DT_QUAD, R_NONE, OPT_TOMODERATED, MUTT_ASKYES },
+ /*
+ ** .pp
+ ** If set to \fIyes\fP, Mutt will post article to newsgroup that have
-+ ** not permissions to posting (e.g. moderated). \fBNote:\fP if newsserver
++ ** not permissions to posting (e.g. moderated). \fBNote:\fP if news server
+ ** does not support posting to that newsgroup or totally read-only, that
+ ** posting will not have an effect.
+ */
+#endif
- { "postpone", DT_QUAD, R_NONE, OPT_POSTPONE, M_ASKYES },
+ { "postpone", DT_QUAD, R_NONE, OPT_POSTPONE, MUTT_ASKYES },
/*
** .pp
-@@ -2494,6 +2655,28 @@ struct option_t MuttVars[] = {
+@@ -2875,6 +3068,28 @@ struct option_t MuttVars[] = {
** 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 },
++ { "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 },
++ { "show_new_news", DT_BOOL, R_NONE, OPTSHOWNEWNEWS, 1 },
+ /*
+ ** .pp
-+ ** If \fIset\fP, newsserver will be asked for new newsgroups on entering
-+ ** the browser. Otherwise, it will be done only once for a newsserver.
++ ** 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 },
++ { "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
- { "sig_dashes", DT_BOOL, R_NONE, OPTSIGDASHES, 1 },
+ #ifdef USE_SIDEBAR
+ { "sidebar_delim_chars", DT_STR, R_SIDEBAR, UL &SidebarDelimChars, UL "/." },
+ /*
+@@ -4005,6 +4220,14 @@ struct option_t MuttVars[] = {
+ {"xterm_set_titles", DT_SYN, R_NONE, UL "ts_enabled", 0 },
/*
- ** .pp
-@@ -3364,6 +3547,14 @@ struct option_t MuttVars[] = {
- ** Also see the $$read_inc, $$net_inc and $$time_inc variables and the
- ** ``$tuning'' section of the manual for performance considerations.
*/
+#ifdef USE_NNTP
-+ { "x_comment_to", DT_BOOL, R_NONE, OPTXCOMMENTTO, 0 },
++ { "x_comment_to", DT_BOOL, R_NONE, OPTXCOMMENTTO, 0 },
+ /*
+ ** .pp
+ ** If \fIset\fP, Mutt will add ``X-Comment-To:'' field (that contains full
@@ -2797,10 +2916,21 @@ diff -udprP mutt-1.5.21.orig/init.h mutt-1.5.21/init.h
/*--*/
{ NULL, 0, 0, 0, 0 }
};
-diff -udprP mutt-1.5.21.orig/mailbox.h mutt-1.5.21/mailbox.h
---- mutt-1.5.21.orig/mailbox.h 2009-04-30 20:33:48.000000000 +0300
-+++ mutt-1.5.21/mailbox.h 2010-09-16 13:14:39.000000000 +0300
-@@ -74,6 +74,9 @@ int mx_is_imap (const char *);
+diff -udprP mutt-1.10.0.orig/keymap.c mutt-1.10.0/keymap.c
+--- mutt-1.10.0.orig/keymap.c 2018-02-03 21:18:49.000000000 +0200
++++ mutt-1.10.0/keymap.c 2018-06-16 17:22:30.198469667 +0300
+@@ -800,7 +800,6 @@ void km_init (void)
+ km_bindkey ("<enter>", MENU_MAIN, OP_DISPLAY_MESSAGE);
+
+ km_bindkey ("x", MENU_PAGER, OP_EXIT);
+- km_bindkey ("i", MENU_PAGER, OP_EXIT);
+ km_bindkey ("<backspace>", MENU_PAGER, OP_PREV_LINE);
+ km_bindkey ("<pagedown>", MENU_PAGER, OP_NEXT_PAGE);
+ km_bindkey ("<pageup>", MENU_PAGER, OP_PREV_PAGE);
+diff -udprP mutt-1.10.0.orig/mailbox.h mutt-1.10.0/mailbox.h
+--- mutt-1.10.0.orig/mailbox.h 2017-12-18 22:27:19.000000000 +0200
++++ mutt-1.10.0/mailbox.h 2018-06-16 17:22:30.198469667 +0300
+@@ -78,6 +78,9 @@ int mx_is_imap (const char *);
#ifdef USE_POP
int mx_is_pop (const char *);
#endif
@@ -2810,11 +2940,11 @@ diff -udprP mutt-1.5.21.orig/mailbox.h mutt-1.5.21/mailbox.h
int mx_access (const char*, int);
int mx_check_empty (const char *);
-diff -udprP mutt-1.5.21.orig/main.c mutt-1.5.21/main.c
---- mutt-1.5.21.orig/main.c 2010-09-13 20:19:55.000000000 +0300
-+++ mutt-1.5.21/main.c 2010-09-16 13:14:39.000000000 +0300
-@@ -60,6 +60,10 @@
- #include <stringprep.h>
+diff -udprP mutt-1.10.0.orig/main.c mutt-1.10.0/main.c
+--- mutt-1.10.0.orig/main.c 2018-05-15 00:51:53.000000000 +0300
++++ mutt-1.10.0/main.c 2018-06-16 17:22:30.198469667 +0300
+@@ -65,6 +65,10 @@
+ #include <idn/stringprep.h>
#endif
+#ifdef USE_NNTP
@@ -2823,17 +2953,17 @@ diff -udprP mutt-1.5.21.orig/main.c mutt-1.5.21/main.c
+
static const char *ReachingUs = N_("\
To contact the developers, please mail to <mutt-dev at mutt.org>.\n\
- To report a bug, please visit http://bugs.mutt.org/.\n");
-@@ -134,6 +138,8 @@ options:\n\
- " -e <command>\tspecify a command to be executed after initialization\n\
+ To report a bug, please contact the Mutt maintainers via gitlab:\n\
+@@ -145,6 +149,8 @@ options:\n\
+ -e <command>\tspecify a command to be executed after initialization\n\
-f <file>\tspecify which mailbox to read\n\
-F <file>\tspecify an alternate muttrc file\n\
-+ -g <server>\tspecify a newsserver (if compiled with NNTP)\n\
++ -g <server>\tspecify a news server (if compiled with NNTP)\n\
+ -G\t\tselect a newsgroup (if compiled with NNTP)\n\
-H <file>\tspecify a draft file to read header and body from\n\
-i <file>\tspecify a file which Mutt should include in the body\n\
-m <type>\tspecify a default mailbox type\n\
-@@ -254,6 +260,12 @@ static void show_version (void)
+@@ -298,6 +304,12 @@ static void show_version (void)
"-USE_POP "
#endif
@@ -2846,34 +2976,32 @@ diff -udprP mutt-1.5.21.orig/main.c mutt-1.5.21/main.c
#ifdef USE_IMAP
"+USE_IMAP "
#else
-@@ -522,6 +534,9 @@ init_extended_keys();
- #define M_NOSYSRC (1<<2) /* -n */
- #define M_RO (1<<3) /* -R */
- #define M_SELECT (1<<4) /* -y */
-+#ifdef USE_NNTP
-+#define M_NEWS (1<<5) /* -g and -G */
-+#endif
+@@ -593,6 +605,7 @@ init_extended_keys();
+ #define MUTT_NOSYSRC (1<<2) /* -n */
+ #define MUTT_RO (1<<3) /* -R */
+ #define MUTT_SELECT (1<<4) /* -y */
++#define MUTT_NEWS (1<<5) /* -g and -G */
- int main (int argc, char **argv)
+ int main (int argc, char **argv, char **environ)
{
-@@ -594,7 +609,11 @@ int main (int argc, char **argv)
+@@ -682,7 +695,11 @@ int main (int argc, char **argv, char **
argv[nargc++] = argv[optind];
}
+#ifdef USE_NNTP
-+ if ((i = getopt (argc, argv, "+A:a:b:F:f:c:Dd:e:g:GH:s:i:hm:npQ:RvxyzZ")) != EOF)
++ if ((i = getopt (argc, argv, "+A:a:b:F:f:c:Dd:Ee:g:GH:s:i:hm:npQ:RvxyzZ")) != EOF)
+#else
- if ((i = getopt (argc, argv, "+A:a:b:F:f:c:Dd:e:H:s:i:hm:npQ:RvxyzZ")) != EOF)
+ if ((i = getopt (argc, argv, "+A:a:b:F:f:c:Dd:Ee:H:s:i:hm:npQ:RvxyzZ")) != EOF)
+#endif
switch (i)
{
case 'A':
-@@ -691,6 +710,20 @@ int main (int argc, char **argv)
- flags |= M_SELECT;
+@@ -783,6 +800,20 @@ int main (int argc, char **argv, char **
+ flags |= MUTT_SELECT;
break;
+#ifdef USE_NNTP
-+ case 'g': /* Specify a newsserver */
++ case 'g': /* Specify a news server */
+ {
+ char buf[LONG_STRING];
+
@@ -2882,22 +3010,22 @@ diff -udprP mutt-1.5.21.orig/main.c mutt-1.5.21/main.c
+ }
+
+ case 'G': /* List of newsgroups */
-+ flags |= M_SELECT | M_NEWS;
++ flags |= MUTT_SELECT | MUTT_NEWS;
+ break;
+#endif
+
case 'z':
- flags |= M_IGNORE;
+ flags |= MUTT_IGNORE;
break;
-@@ -978,6 +1011,18 @@ int main (int argc, char **argv)
+@@ -1229,6 +1260,18 @@ int main (int argc, char **argv, char **
}
- else if (flags & M_SELECT)
+ else if (flags & MUTT_SELECT)
{
+#ifdef USE_NNTP
-+ if (flags & M_NEWS)
++ if (flags & MUTT_NEWS)
+ {
+ set_option (OPTNEWS);
-+ if(!(CurrentNewsSrv = mutt_select_newsserver (NewsServer)))
++ if(!(CurrentNewsSrv = nntp_select_server (NewsServer, 0)))
+ {
+ mutt_endwin (Errorbuf);
+ exit (1);
@@ -2908,7 +3036,7 @@ diff -udprP mutt-1.5.21.orig/main.c mutt-1.5.21/main.c
if (!Incoming) {
mutt_endwin _("No incoming mailboxes defined.");
exit (1);
-@@ -993,6 +1038,15 @@ int main (int argc, char **argv)
+@@ -1244,6 +1287,15 @@ int main (int argc, char **argv, char **
if (!folder[0])
strfcpy (folder, NONULL(Spoolfile), sizeof (folder));
@@ -2924,41 +3052,40 @@ diff -udprP mutt-1.5.21.orig/main.c mutt-1.5.21/main.c
mutt_expand_path (folder, sizeof (folder));
mutt_str_replace (&CurrentFolder, folder);
-diff -udprP mutt-1.5.21.orig/mutt.h mutt-1.5.21/mutt.h
---- mutt-1.5.21.orig/mutt.h 2010-09-13 20:19:55.000000000 +0300
-+++ mutt-1.5.21/mutt.h 2010-09-16 13:14:39.000000000 +0300
-@@ -229,6 +229,9 @@ enum
- M_PGP_KEY,
- M_XLABEL,
- M_MIMEATTACH,
+diff -udprP mutt-1.10.0.orig/mutt.h mutt-1.10.0/mutt.h
+--- mutt-1.10.0.orig/mutt.h 2018-05-15 00:51:53.000000000 +0300
++++ mutt-1.10.0/mutt.h 2018-06-16 17:23:34.827448604 +0300
+@@ -254,6 +254,9 @@ enum
+ MUTT_XLABEL,
+ MUTT_MIMEATTACH,
+ MUTT_MIMETYPE,
+#ifdef USE_NNTP
-+ M_NEWSGROUPS,
++ MUTT_NEWSGROUPS,
+#endif
/* Options for Mailcap lookup */
- M_EDIT,
-@@ -285,6 +288,12 @@ enum
+ MUTT_EDIT,
+@@ -311,6 +314,11 @@ enum
#endif
OPT_SUBJECT,
OPT_VERIFYSIG, /* verify PGP signatures */
+#ifdef USE_NNTP
+ OPT_TOMODERATED,
-+ OPT_NNTPRECONNECT,
+ OPT_CATCHUP,
+ OPT_FOLLOWUPTOPOSTER,
-+#endif /* USE_NNTP */
++#endif
/* THIS MUST BE THE LAST VALUE. */
OPT_MAX
-@@ -300,6 +309,7 @@ enum
- #define SENDMAILX (1<<6)
- #define SENDKEY (1<<7)
- #define SENDRESEND (1<<8)
-+#define SENDNEWS (1<<9)
-
- /* flags to _mutt_select_file() */
- #define M_SEL_BUFFY (1<<0)
-@@ -319,6 +329,8 @@ enum
+@@ -329,6 +337,7 @@ enum
+ #define SENDPOSTPONEDFCC (1<<9) /* used by mutt_get_postponed() to signal that the x-mutt-fcc header field was present */
+ #define SENDNOFREEHEADER (1<<10) /* Used by the -E flag */
+ #define SENDDRAFTFILE (1<<11) /* Used by the -H flag */
++#define SENDNEWS (1<<12)
+
+ /* flags for mutt_compose_menu() */
+ #define MUTT_COMPOSE_NOFREEHEADER (1<<0)
+@@ -351,6 +360,8 @@ enum
OPTASCIICHARS,
OPTASKBCC,
OPTASKCC,
@@ -2967,17 +3094,17 @@ diff -udprP mutt-1.5.21.orig/mutt.h mutt-1.5.21/mutt.h
OPTATTACHSPLIT,
OPTAUTOEDIT,
OPTAUTOTAG,
-@@ -397,6 +409,9 @@ enum
+@@ -441,6 +452,9 @@ enum
OPTMETOO,
OPTMHPURGE,
OPTMIMEFORWDECODE,
+#ifdef USE_NNTP
+ OPTMIMESUBJECT, /* encode subject line with RFC2047 */
+#endif
+ OPTMIMETYPEQUERYFIRST,
OPTNARROWTREE,
OPTPAGERSTOP,
- OPTPIPEDECODE,
-@@ -478,6 +493,16 @@ enum
+@@ -542,6 +556,17 @@ enum
OPTPGPAUTOINLINE,
OPTPGPREPLYINLINE,
@@ -2987,14 +3114,15 @@ diff -udprP mutt-1.5.21.orig/mutt.h mutt-1.5.21/mutt.h
+ OPTSHOWNEWNEWS,
+ OPTSHOWONLYUNREAD,
+ OPTSAVEUNSUB,
++ OPTLISTGROUP,
+ OPTLOADDESC,
+ OPTXCOMMENTTO,
-+#endif /* USE_NNTP */
++#endif
+
/* pseudo options */
- OPTAUXSORT, /* (pseudo) using auxillary sort function */
-@@ -498,6 +523,7 @@ enum
+ OPTAUXSORT, /* (pseudo) using auxiliary sort function */
+@@ -559,6 +584,7 @@ enum
OPTSORTSUBTHREADS, /* (pseudo) used when $sort_aux changes */
OPTNEEDRESCORE, /* (pseudo) set when the `score' command is used */
OPTATTACHMSG, /* (pseudo) used by attach-message */
@@ -3002,20 +3130,19 @@ diff -udprP mutt-1.5.21.orig/mutt.h mutt-1.5.21/mutt.h
OPTKEEPQUIET, /* (pseudo) shut up the message and refresh
* functions while we are executing an
* external program.
-@@ -508,6 +534,12 @@ enum
+@@ -569,6 +595,11 @@ enum
OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */
- OPTUNBUFFEREDINPUT, /* (pseudo) don't use key buffer */
+ OPTIGNOREMACROEVENTS, /* (pseudo) don't process macro/push/exec events while set */
+#ifdef USE_NNTP
+ OPTNEWS, /* (pseudo) used to change reader mode */
+ OPTNEWSSEND, /* (pseudo) used to change behavior when posting */
-+ OPTNEWSCACHE, /* (pseudo) used to indicate if news cache exist */
+#endif
+
OPTMAX
};
-@@ -587,6 +619,13 @@ typedef struct envelope
+@@ -649,6 +680,13 @@ typedef struct envelope
char *supersedes;
char *date;
char *x_label;
@@ -3029,17 +3156,7 @@ diff -udprP mutt-1.5.21.orig/mutt.h mutt-1.5.21/mutt.h
BUFFER *spam;
LIST *references; /* message references (in reverse order) */
LIST *in_reply_to; /* in-reply-to header content */
-@@ -756,6 +795,9 @@ typedef struct header
- ENVELOPE *env; /* envelope information */
- BODY *content; /* list of MIME parts */
- char *path;
-+#ifdef USE_NNTP
-+ int article_num;
-+#endif
-
- char *tree; /* character string to print thread tree */
- THREAD *thread;
-@@ -771,7 +813,7 @@ typedef struct header
+@@ -836,7 +874,7 @@ typedef struct header
int refno; /* message number on server */
#endif
@@ -3048,10 +3165,25 @@ diff -udprP mutt-1.5.21.orig/mutt.h mutt-1.5.21/mutt.h
void *data; /* driver-specific data */
#endif
-diff -udprP mutt-1.5.21.orig/muttlib.c mutt-1.5.21/muttlib.c
---- mutt-1.5.21.orig/muttlib.c 2010-08-25 19:31:40.000000000 +0300
-+++ mutt-1.5.21/muttlib.c 2010-09-16 13:14:39.000000000 +0300
-@@ -337,7 +337,7 @@ void mutt_free_header (HEADER **h)
+diff -udprP mutt-1.10.0.orig/mutt_sasl.c mutt-1.10.0/mutt_sasl.c
+--- mutt-1.10.0.orig/mutt_sasl.c 2017-12-18 22:31:37.000000000 +0200
++++ mutt-1.10.0/mutt_sasl.c 2018-06-16 17:22:30.199469651 +0300
+@@ -192,6 +192,11 @@ int mutt_sasl_client_new (CONNECTION* co
+ case MUTT_ACCT_TYPE_SMTP:
+ service = "smtp";
+ break;
++#ifdef USE_NNTP
++ case MUTT_ACCT_TYPE_NNTP:
++ service = "nntp";
++ break;
++#endif
+ default:
+ mutt_error (_("Unknown SASL profile"));
+ return -1;
+diff -udprP mutt-1.10.0.orig/muttlib.c mutt-1.10.0/muttlib.c
+--- mutt-1.10.0.orig/muttlib.c 2018-04-17 02:31:03.000000000 +0300
++++ mutt-1.10.0/muttlib.c 2018-06-16 17:22:30.199469651 +0300
+@@ -354,7 +354,7 @@ void mutt_free_header (HEADER **h)
#ifdef MIXMASTER
mutt_free_list (&(*h)->chain);
#endif
@@ -3060,7 +3192,7 @@ diff -udprP mutt-1.5.21.orig/muttlib.c mutt-1.5.21/muttlib.c
FREE (&(*h)->data);
#endif
FREE (h); /* __FREE_CHECKED__ */
-@@ -722,6 +722,13 @@ void mutt_free_envelope (ENVELOPE **p)
+@@ -740,6 +740,13 @@ void mutt_free_envelope (ENVELOPE **p)
FREE (&(*p)->supersedes);
FREE (&(*p)->date);
FREE (&(*p)->x_label);
@@ -3074,14 +3206,14 @@ diff -udprP mutt-1.5.21.orig/muttlib.c mutt-1.5.21/muttlib.c
mutt_buffer_free (&(*p)->spam);
-@@ -1525,6 +1532,14 @@ int mutt_save_confirm (const char *s, st
+@@ -1663,6 +1670,14 @@ int mutt_save_confirm (const char *s, st
}
}
+#ifdef USE_NNTP
-+ if (magic == M_NNTP)
++ if (magic == MUTT_NNTP)
+ {
-+ mutt_error _("Can't save message to newsserver.");
++ mutt_error _("Can't save message to news server.");
+ return 0;
+ }
+#endif
@@ -3089,10 +3221,32 @@ diff -udprP mutt-1.5.21.orig/muttlib.c mutt-1.5.21/muttlib.c
if (stat (s, st) != -1)
{
if (magic == -1)
-diff -udprP mutt-1.5.21.orig/mx.c mutt-1.5.21/mx.c
---- mutt-1.5.21.orig/mx.c 2010-09-13 20:19:55.000000000 +0300
-+++ mutt-1.5.21/mx.c 2010-09-16 13:14:39.000000000 +0300
-@@ -343,6 +343,22 @@ int mx_is_pop (const char *p)
+diff -udprP mutt-1.10.0.orig/mx.c mutt-1.10.0/mx.c
+--- mutt-1.10.0.orig/mx.c 2018-04-17 02:31:03.000000000 +0300
++++ mutt-1.10.0/mx.c 2018-06-16 17:22:30.199469651 +0300
+@@ -45,6 +45,10 @@
+ #include "pop.h"
+ #endif
+
++#ifdef USE_NNTP
++#include "nntp.h"
++#endif
++
+ #include "buffy.h"
+
+ #ifdef USE_DOTLOCK
+@@ -88,6 +92,10 @@ struct mx_ops* mx_get_ops (int magic)
+ case MUTT_COMPRESSED:
+ return &mx_comp_ops;
+ #endif
++#ifdef USE_NNTP
++ case MUTT_NNTP:
++ return &mx_nntp_ops;
++#endif
+ default:
+ return NULL;
+ }
+@@ -378,6 +386,22 @@ int mx_is_pop (const char *p)
}
#endif
@@ -3115,138 +3269,96 @@ diff -udprP mutt-1.5.21.orig/mx.c mutt-1.5.21/mx.c
int mx_get_magic (const char *path)
{
struct stat st;
-@@ -360,6 +376,11 @@ int mx_get_magic (const char *path)
- return M_POP;
+@@ -395,6 +419,11 @@ int mx_get_magic (const char *path)
+ return MUTT_POP;
#endif /* USE_POP */
+#ifdef USE_NNTP
+ if (mx_is_nntp (path))
-+ return M_NNTP;
++ return MUTT_NNTP;
+#endif /* USE_NNTP */
+
if (stat (path, &st) == -1)
{
dprint (1, (debugfile, "mx_get_magic(): unable to stat %s: %s (errno %d).\n",
-@@ -668,6 +689,12 @@ CONTEXT *mx_open_mailbox (const char *pa
- break;
- #endif /* USE_POP */
-
-+#ifdef USE_NNTP
-+ case M_NNTP:
-+ rc = nntp_open_mailbox (ctx);
-+ break;
-+#endif /* USE_NNTP */
-+
- default:
- rc = -1;
- break;
-@@ -764,6 +791,12 @@ static int sync_mailbox (CONTEXT *ctx, i
- rc = pop_sync_mailbox (ctx, index_hint);
- break;
- #endif /* USE_POP */
-+
-+#ifdef USE_NNTP
-+ case M_NNTP:
-+ rc = nntp_sync_mailbox (ctx);
-+ break;
-+#endif /* USE_NNTP */
+@@ -803,6 +832,25 @@ int mx_close_mailbox (CONTEXT *ctx, int
+ return 0;
}
- #if 0
-@@ -790,6 +823,16 @@ int mx_close_mailbox (CONTEXT *ctx, int
-
- ctx->closing = 1;
-
+#ifdef USE_NNTP
-+ if (ctx->magic == M_NNTP)
++ if (ctx->unread && ctx->magic == MUTT_NNTP)
+ {
-+ int ret;
++ NNTP_DATA *nntp_data = ctx->data;
+
-+ ret = nntp_close_mailbox (ctx);
-+ mx_fastclose_mailbox (ctx);
-+ return ret;
++ if (nntp_data && nntp_data->nserv && nntp_data->group)
++ {
++ int rc = query_quadoption (OPT_CATCHUP, _("Mark all articles read?"));
++ if (rc < 0)
++ {
++ ctx->closing = 0;
++ return -1;
++ }
++ else if (rc == MUTT_YES)
++ mutt_newsgroup_catchup (nntp_data->nserv, nntp_data->group);
++ }
+ }
+#endif
- if (ctx->readonly || ctx->dontwrite)
- {
- /* mailbox is readonly or we don't want to write */
-@@ -1341,6 +1384,11 @@ int mx_check_mailbox (CONTEXT *ctx, int
- case M_POP:
- return (pop_check_mailbox (ctx, index_hint));
- #endif /* USE_POP */
+
-+#ifdef USE_NNTP
-+ case M_NNTP:
-+ return (nntp_check_mailbox (ctx));
-+#endif /* USE_NNTP */
- }
+ for (i = 0; i < ctx->msgcount; i++)
+ {
+ if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->read
+@@ -810,6 +858,12 @@ int mx_close_mailbox (CONTEXT *ctx, int
+ read_msgs++;
}
-@@ -1401,6 +1449,15 @@ MESSAGE *mx_open_message (CONTEXT *ctx,
- }
- #endif /* USE_POP */
-
-+#ifdef USE_NNTP
-+ case M_NNTP:
-+ {
-+ if (nntp_fetch_message (msg, ctx, msgno) != 0)
-+ FREE (&msg);
-+ break;
-+ }
-+#endif /* USE_NNTP */
-+
- default:
- dprint (1, (debugfile, "mx_open_message(): function not implemented for mailbox type %d.\n", ctx->magic));
- FREE (&msg);
-@@ -1476,6 +1533,9 @@ int mx_close_message (MESSAGE **msg)
- int r = 0;
-
- if ((*msg)->magic == M_MH || (*msg)->magic == M_MAILDIR
+#ifdef USE_NNTP
-+ || (*msg)->magic == M_NNTP
++ /* don't need to move articles from newsgroup */
++ if (ctx->magic == MUTT_NNTP)
++ read_msgs = 0;
+#endif
- || (*msg)->magic == M_IMAP || (*msg)->magic == M_POP)
++
+ if (read_msgs && quadoption (OPT_MOVE) != MUTT_NO)
{
- r = safe_fclose (&(*msg)->fp);
-diff -udprP mutt-1.5.21.orig/mx.h mutt-1.5.21/mx.h
---- mutt-1.5.21.orig/mx.h 2009-08-25 22:08:52.000000000 +0300
-+++ mutt-1.5.21/mx.h 2010-09-16 13:14:39.000000000 +0300
-@@ -34,6 +34,9 @@ enum
- M_MMDF,
- M_MH,
- M_MAILDIR,
-+#ifdef USE_NNTP
-+ M_NNTP,
-+#endif
- M_IMAP,
- M_POP
- };
-diff -udprP mutt-1.5.21.orig/newsrc.c mutt-1.5.21/newsrc.c
---- mutt-1.5.21.orig/newsrc.c 1970-01-01 03:00:00.000000000 +0300
-+++ mutt-1.5.21/newsrc.c 2010-09-16 13:14:39.000000000 +0300
-@@ -0,0 +1,1170 @@
+ char *p;
+diff -udprP mutt-1.10.0.orig/mx.h mutt-1.10.0/mx.h
+--- mutt-1.10.0.orig/mx.h 2017-12-18 22:31:37.000000000 +0200
++++ mutt-1.10.0/mx.h 2018-06-16 17:22:30.199469651 +0300
+@@ -35,6 +35,9 @@ enum
+ MUTT_MMDF,
+ MUTT_MH,
+ MUTT_MAILDIR,
++#ifdef USE_NNTP
++ MUTT_NNTP,
++#endif
+ MUTT_IMAP,
+ MUTT_POP
+ #ifdef USE_COMPRESSED
+diff -udprP mutt-1.10.0.orig/newsrc.c mutt-1.10.0/newsrc.c
+--- mutt-1.10.0.orig/newsrc.c 1970-01-01 03:00:00.000000000 +0300
++++ mutt-1.10.0/newsrc.c 2018-06-16 17:22:30.200469636 +0300
+@@ -0,0 +1,1259 @@
+/*
+ * Copyright (C) 1998 Brandon Long <blong at fiction.net>
+ * Copyright (C) 1999 Andrej Gritsenko <andrej at lucky.net>
-+ * Copyright (C) 2000-2009 Vsevolod Volkov <vvv at mutt.org.ua>
-+ *
++ * Copyright (C) 2000-2017 Vsevolod Volkov <vvv at mutt.org.ua>
++ *
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-+ */
++ */
+
+#if HAVE_CONFIG_H
-+# include "config.h"
++#include "config.h"
+#endif
+
+#include "mutt.h"
@@ -3259,293 +3371,451 @@ diff -udprP mutt-1.5.21.orig/newsrc.c mutt-1.5.21/newsrc.c
+#include "rfc822.h"
+#include "rfc1524.h"
+#include "rfc2047.h"
++#include "bcache.h"
++
++#if USE_HCACHE
++#include "hcache.h"
++#endif
+
+#include <unistd.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <sys/stat.h>
++#include <sys/types.h>
++#include <dirent.h>
++#include <errno.h>
+
-+void nntp_add_to_list (NNTP_SERVER *s, NNTP_DATA *d)
++/* Find NNTP_DATA for given newsgroup or add it */
++static NNTP_DATA *nntp_data_find (NNTP_SERVER *nserv, const char *group)
+{
-+ LIST *l;
++ NNTP_DATA *nntp_data = hash_find (nserv->groups_hash, group);
+
-+ if (!s || !d)
-+ return;
++ if (!nntp_data)
++ {
++ /* create NNTP_DATA structure and add it to hash */
++ nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1);
++ nntp_data->group = (char *)nntp_data + sizeof (NNTP_DATA);
++ strcpy (nntp_data->group, group);
++ nntp_data->nserv = nserv;
++ nntp_data->deleted = 1;
++ hash_insert (nserv->groups_hash, nntp_data->group, nntp_data);
+
-+ l = safe_calloc (1, sizeof (LIST));
-+ if (s->list)
-+ s->tail->next = l;
-+ else
-+ s->list = l;
-+ s->tail = l;
-+ l->data = (void *) d;
++ /* add NNTP_DATA to list */
++ if (nserv->groups_num >= nserv->groups_max)
++ {
++ nserv->groups_max *= 2;
++ safe_realloc (&nserv->groups_list,
++ nserv->groups_max * sizeof (nntp_data));
++ }
++ nserv->groups_list[nserv->groups_num++] = nntp_data;
++ }
++ return nntp_data;
+}
+
-+static int nntp_parse_newsrc_line (NNTP_SERVER *news, char *line)
++/* Remove all temporarily cache files */
++void nntp_acache_free (NNTP_DATA *nntp_data)
+{
-+ NNTP_DATA *data;
-+ char group[LONG_STRING];
-+ int x = 1;
-+ char *p = line, *b, *h;
-+ size_t len;
++ int i;
+
-+ while (*p)
++ for (i = 0; i < NNTP_ACACHE_LEN; i++)
+ {
-+ if (*p++ == ',')
-+ x++;
++ if (nntp_data->acache[i].path)
++ {
++ unlink (nntp_data->acache[i].path);
++ FREE (&nntp_data->acache[i].path);
++ }
+ }
++}
+
-+ p = line;
-+ while (*p && (*p != ':' && *p != '!')) p++;
-+ if (!*p)
-+ return -1;
-+ len = p + 1 - line;
-+ if (len > sizeof (group))
-+ len = sizeof (group);
-+ strfcpy (group, line, len);
-+ if ((data = (NNTP_DATA *)hash_find (news->newsgroups, group)) == NULL)
-+ {
-+ data = (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1);
-+ data->group = (char *) data + sizeof (NNTP_DATA);
-+ strcpy (data->group, group);
-+ data->nserv = news;
-+ data->deleted = 1;
-+ if (news->newsgroups->nelem < news->newsgroups->curnelem * 2)
-+ news->newsgroups = hash_resize (news->newsgroups, news->newsgroups->nelem * 2, 0);
-+ hash_insert (news->newsgroups, data->group, data, 0);
-+ nntp_add_to_list (news, data);
-+ }
-+ else
-+ FREE ((void **) &data->entries);
++/* Free NNTP_DATA, used to destroy hash elements */
++void nntp_data_free (void *data)
++{
++ NNTP_DATA *nntp_data = data;
+
-+ data->rc = 1;
-+ data->entries = safe_calloc (x*2, sizeof (NEWSRC_ENTRY));
-+ data->max = x*2;
++ if (!nntp_data)
++ return;
++ nntp_acache_free (nntp_data);
++ mutt_bcache_close (&nntp_data->bcache);
++ FREE (&nntp_data->newsrc_ent);
++ FREE (&nntp_data->desc);
++ FREE (&data);
++}
+
-+ if (*p == ':')
-+ data->subscribed = 1;
-+ else
-+ data->subscribed = 0;
++/* Unlock and close .newsrc file */
++void nntp_newsrc_close (NNTP_SERVER *nserv)
++{
++ if (!nserv->newsrc_fp)
++ return;
+
-+ p++;
-+ b = p;
-+ x = 0;
-+ while (*b)
-+ {
-+ while (*p && *p != ',' && *p != '\n') p++;
-+ if (*p)
-+ {
-+ *p = '\0';
-+ p++;
-+ }
-+ if ((h = strchr(b, '-')))
-+ {
-+ *h = '\0';
-+ h++;
-+ data->entries[x].first = atoi(b);
-+ data->entries[x].last = atoi(h);
-+ }
-+ else
-+ {
-+ data->entries[x].first = atoi(b);
-+ data->entries[x].last = data->entries[x].first;
-+ }
-+ b = p;
-+ if (data->entries[x].last != 0)
-+ x++;
-+ }
-+ if (x && !data->lastMessage)
-+ data->lastMessage = data->entries[x-1].last;
-+ data->num = x;
-+ mutt_newsgroup_stat (data);
-+ dprint (2, (debugfile, "parse_line: Newsgroup %s\n", data->group));
-+
-+ return 0;
++ dprint (1, (debugfile, "Unlocking %s\n", nserv->newsrc_file));
++ mx_unlock_file (nserv->newsrc_file, fileno (nserv->newsrc_fp), 0);
++ safe_fclose (&nserv->newsrc_fp);
+}
+
-+static int slurp_newsrc (NNTP_SERVER *news)
++/* Parse .newsrc file:
++ * 0 - not changed
++ * 1 - parsed
++ * -1 - error */
++int nntp_newsrc_parse (NNTP_SERVER *nserv)
+{
-+ FILE *fp;
-+ char *buf;
++ unsigned int i;
++ char *line;
+ struct stat sb;
+
-+ news->stat = stat (news->newsrc, &sb);
-+ news->size = sb.st_size;
-+ news->mtime = sb.st_mtime;
++ /* if file doesn't exist, create it */
++ nserv->newsrc_fp = safe_fopen (nserv->newsrc_file, "a");
++ safe_fclose (&nserv->newsrc_fp);
+
-+ if ((fp = safe_fopen (news->newsrc, "r")) == NULL)
++ /* open .newsrc */
++ nserv->newsrc_fp = safe_fopen (nserv->newsrc_file, "r");
++ if (!nserv->newsrc_fp)
++ {
++ mutt_perror (nserv->newsrc_file);
++ mutt_sleep (2);
+ return -1;
-+ /* hmm, should we use dotlock? */
-+ if (mx_lock_file (news->newsrc, fileno (fp), 0, 0, 1))
++ }
++
++ /* lock it */
++ dprint (1, (debugfile, "Locking %s\n", nserv->newsrc_file));
++ if (mx_lock_file (nserv->newsrc_file, fileno (nserv->newsrc_fp), 0, 0, 1))
+ {
-+ fclose (fp);
++ safe_fclose (&nserv->newsrc_fp);
+ return -1;
+ }
+
-+ buf = safe_malloc (sb.st_size + 1);
-+ while (sb.st_size && fgets (buf, sb.st_size + 1, fp))
-+ nntp_parse_newsrc_line (news, buf);
-+ FREE (&buf);
++ if (stat (nserv->newsrc_file, &sb))
++ {
++ mutt_perror (nserv->newsrc_file);
++ nntp_newsrc_close (nserv);
++ mutt_sleep (2);
++ return -1;
++ }
+
-+ mx_unlock_file (news->newsrc, fileno (fp), 0);
-+ fclose (fp);
-+ return 0;
-+}
++ if (nserv->size == sb.st_size && nserv->mtime == sb.st_mtime)
++ return 0;
+
-+void nntp_cache_expand (char *dst, const char *src)
-+{
-+ snprintf (dst, _POSIX_PATH_MAX, "%s/%s", NewsCacheDir, src);
-+ mutt_expand_path (dst, _POSIX_PATH_MAX);
-+}
++ nserv->size = sb.st_size;
++ nserv->mtime = sb.st_mtime;
++ nserv->newsrc_modified = 1;
++ dprint (1, (debugfile, "Parsing %s\n", nserv->newsrc_file));
+
-+/* Loads $news_cache_dir/.index into memory, loads newsserver data
-+ * and newsgroup cache names */
-+static int nntp_parse_cacheindex (NNTP_SERVER *news)
-+{
-+ struct stat st;
-+ char buf[HUGE_STRING], *cp;
-+ char dir[_POSIX_PATH_MAX], file[_POSIX_PATH_MAX];
-+ FILE *index;
-+ NNTP_DATA *data;
-+ int l, m, t;
-+
-+ /* check is server name defined or not */
-+ if (!news || !news->conn || !news->conn->account.host)
-+ return -1;
-+ unset_option (OPTNEWSCACHE);
-+ if (!NewsCacheDir || !*NewsCacheDir)
-+ return 0;
++ /* .newsrc has been externally modified or hasn't been loaded yet */
++ for (i = 0; i < nserv->groups_num; i++)
++ {
++ NNTP_DATA *nntp_data = nserv->groups_list[i];
+
-+ strfcpy (dir, NewsCacheDir, sizeof (dir));
-+ mutt_expand_path (dir, sizeof(dir));
++ if (!nntp_data)
++ continue;
++
++ nntp_data->subscribed = 0;
++ nntp_data->newsrc_len = 0;
++ FREE (&nntp_data->newsrc_ent);
++ }
+
-+ if (lstat (dir, &st) || (st.st_mode & S_IFDIR) == 0)
++ line = safe_malloc (sb.st_size + 1);
++ while (sb.st_size && fgets (line, sb.st_size + 1, nserv->newsrc_fp))
+ {
-+ snprintf (buf, sizeof(buf), _("Directory %s not exist. Create it?"), dir);
-+ if (mutt_yesorno (buf, M_YES) != M_YES || mkdir (dir, (S_IRWXU+S_IRWXG+
-+ S_IRWXO)))
++ char *b, *h, *p;
++ unsigned int subs = 0, i = 1;
++ NNTP_DATA *nntp_data;
++
++ /* find end of newsgroup name */
++ p = strpbrk (line, ":!");
++ if (!p)
++ continue;
++
++ /* ":" - subscribed, "!" - unsubscribed */
++ if (*p == ':')
++ subs++;
++ *p++ = '\0';
++
++ /* get newsgroup data */
++ nntp_data = nntp_data_find (nserv, line);
++ FREE (&nntp_data->newsrc_ent);
++
++ /* count number of entries */
++ b = p;
++ while (*b)
++ if (*b++ == ',')
++ i++;
++ nntp_data->newsrc_ent = safe_calloc (i, sizeof (NEWSRC_ENTRY));
++ nntp_data->subscribed = subs;
++
++ /* parse entries */
++ i = 0;
++ while (p)
+ {
-+ mutt_error _("Cache directory not created!");
-+ return -1;
++ b = p;
++
++ /* find end of entry */
++ p = strchr (p, ',');
++ if (p)
++ *p++ = '\0';
++
++ /* first-last or single number */
++ h = strchr (b, '-');
++ if (h)
++ *h++ = '\0';
++ else
++ h = b;
++
++ if (sscanf (b, ANUM, &nntp_data->newsrc_ent[i].first) == 1 &&
++ sscanf (h, ANUM, &nntp_data->newsrc_ent[i].last) == 1)
++ i++;
+ }
-+ mutt_clear_error();
-+ }
++ if (i == 0)
++ {
++ nntp_data->newsrc_ent[i].first = 1;
++ nntp_data->newsrc_ent[i].last = 0;
++ i++;
++ }
++ if (nntp_data->lastMessage == 0)
++ nntp_data->lastMessage = nntp_data->newsrc_ent[i - 1].last;
++ nntp_data->newsrc_len = i;
++ safe_realloc (&nntp_data->newsrc_ent, i * sizeof (NEWSRC_ENTRY));
++ nntp_group_unread_stat (nntp_data);
++ dprint (2, (debugfile, "nntp_newsrc_parse: %s\n", nntp_data->group));
++ }
++ FREE (&line);
++ return 1;
++}
+
-+ set_option (OPTNEWSCACHE);
++/* Generate array of .newsrc entries */
++void nntp_newsrc_gen_entries (CONTEXT *ctx)
++{
++ NNTP_DATA *nntp_data = ctx->data;
++ anum_t last = 0, first = 1;
++ int series, i;
++ int save_sort = SORT_ORDER;
++ unsigned int entries;
+
-+ FREE (&news->cache);
-+ snprintf (buf, sizeof(buf), "%s/.index", dir);
-+ if (!(index = safe_fopen (buf, "a+")))
-+ return 0;
-+ rewind (index);
-+ while (fgets (buf, sizeof(buf), index))
++ if (Sort != SORT_ORDER)
+ {
-+ buf[strlen(buf) - 1] = 0; /* strip ending '\n' */
-+ if (!mutt_strncmp (buf, "#: ", 3) &&
-+ !mutt_strcasecmp (buf+3, news->conn->account.host))
-+ break;
++ save_sort = Sort;
++ Sort = SORT_ORDER;
++ mutt_sort_headers (ctx, 0);
+ }
-+ while (fgets (buf, sizeof(buf), index))
++
++ entries = nntp_data->newsrc_len;
++ if (!entries)
+ {
-+ cp = buf;
-+ while (*cp && *cp != ' ') cp++;
-+ if (!*cp) continue;
-+ cp[0] = 0;
-+ if (!mutt_strcmp (buf, "#:"))
-+ break;
-+ sscanf (cp + 1, "%s %d %d", file, &l, &m);
-+ if (!mutt_strcmp (buf, "ALL"))
++ entries = 5;
++ nntp_data->newsrc_ent = safe_calloc (entries, sizeof (NEWSRC_ENTRY));
++ }
++
++ /* Set up to fake initial sequence from 1 to the article before the
++ * first article in our list */
++ nntp_data->newsrc_len = 0;
++ series = 1;
++ for (i = 0; i < ctx->msgcount; i++)
++ {
++ /* search for first unread */
++ if (series)
+ {
-+ news->cache = safe_strdup (file);
-+ news->newgroups_time = m;
++ /* We don't actually check sequential order, since we mark
++ * "missing" entries as read/deleted */
++ last = NHDR (ctx->hdrs[i])->article_num;
++ if (last >= nntp_data->firstMessage && !ctx->hdrs[i]->deleted &&
++ !ctx->hdrs[i]->read)
++ {
++ if (nntp_data->newsrc_len >= entries)
++ {
++ entries *= 2;
++ safe_realloc (&nntp_data->newsrc_ent, entries * sizeof (NEWSRC_ENTRY));
<Skipped 6906 lines>
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/mutt.git/commitdiff/ea57f2c7865672b520bd2521a23b221220d4d2e0
More information about the pld-cvs-commit
mailing list