1 diff -uNr mutt-1.4.orig/ChangeLog.nntp mutt-1.4/ChangeLog.nntp
2 --- mutt-1.4.orig/ChangeLog.nntp Thu Jan 1 01:00:00 1970
3 +++ mutt-1.4/ChangeLog.nntp Sun Nov 3 21:57:20 2002
5 +* Wed May 29 2002 Vsevolod Volkov <vvv@mutt.org.ua>
8 +* Thu May 2 2002 Vsevolod Volkov <vvv@mutt.org.ua>
11 +* Wed Mar 13 2002 Vsevolod Volkov <vvv@mutt.org.ua>
13 +- fixed SIGSEGV in <get-message>, <get-parent>, <get-children>,
14 + <reconstruct-thread> functions
15 +- fixed message about nntp reconnect
16 +- fixed <attach-news-message> function using browser
17 +- added support of Followup-To: poster
18 +- added %n (new articles) in group_index_format
19 +- posting articles without inews by default
21 +* Wed Jan 23 2002 Vsevolod Volkov <vvv@mutt.org.ua>
24 +* Fri Jan 18 2002 Vsevolod Volkov <vvv@mutt.org.ua>
27 +* Thu Jan 3 2002 Vsevolod Volkov <vvv@mutt.org.ua>
29 +- accelerated speed of access to news->newsgroups hash (by <gul@gul.kiev.ua>)
30 +- added default content disposition
32 +* Mon Dec 3 2001 Vsevolod Volkov <vvv@mutt.org.ua>
35 +* Fri Nov 9 2001 Vsevolod Volkov <vvv@mutt.org.ua>
37 +- fixed segfault if mutt_conn_find() returns null
39 +* Wed Oct 31 2001 Vsevolod Volkov <vvv@mutt.org.ua>
41 +- added support of LISTGROUP command
42 +- added support for servers with broken overview
43 +- disabled <flag-message> function on news server
44 +- fixed error storing bad authentication information
46 +* Wed Oct 10 2001 Vsevolod Volkov <vvv@mutt.org.ua>
48 +- fixed typo in buffy.c
49 +- added substitution of %s parameter in $inews variable
51 +* Fri Aug 31 2001 Vsevolod Volkov <vvv@mutt.org.ua>
55 +* Thu Aug 23 2001 Vsevolod Volkov <vvv@mutt.org.ua>
58 +* Wed Jul 25 2001 Vsevolod Volkov <vvv@mutt.org.ua>
60 +- removed 'server-hook', use 'account-hook' instead
61 +- fixed error opening NNTP server without newsgroup using -f option
63 +* Fri Jun 8 2001 Vsevolod Volkov <vvv@mutt.org.ua>
66 +* Sat May 5 2001 Vsevolod Volkov <vvv@mutt.org.ua>
68 +- fixed typo in nntp_attempt_features()
69 +- changed algorithm of XGTITLE command testing
70 +- disabled writing of NNTP password in debug file
71 +- fixed reading and writing of long newsrc lines
72 +- changed checking of last line while reading lines from server
73 +- fixed possible buffer overrun in nntp_parse_newsrc_line()
74 +- removed checking of XHDR command
75 +- compare NNTP return codes without trailing space
77 +* Thu Mar 29 2001 Vsevolod Volkov <vvv@mutt.org.ua>
79 +- support for 'LIST NEWSGROUPS' command to read descriptions
81 +* Fri Mar 2 2001 Vsevolod Volkov <vvv@mutt.org.ua>
84 +* Wed Feb 14 2001 Vsevolod Volkov <vvv@mutt.org.ua>
87 +* Sun Jan 28 2001 Vsevolod Volkov <vvv@mutt.org.ua>
89 +- show number of tagged messages patch from Felix von Leitner <leitner@fefe.de>
91 +* Sun Dec 31 2000 Vsevolod Volkov <vvv@mutt.org.ua>
94 +* Sat Dec 30 2000 Vsevolod Volkov <vvv@mutt.org.ua>
95 +- Fixed problem if last article in group is deleted
97 +* Fri Dec 22 2000 Vsevolod Volkov <vvv@mutt.org.ua>
98 +- Fixed checking of XGTITLE command on some servers
100 +* Mon Dec 18 2000 Vsevolod Volkov <vvv@mutt.org.ua>
101 +- Added \r in AUTHINFO commands
103 +* Mon Nov 27 2000 Vsevolod Volkov <vvv@mutt.org.ua>
106 +* Wed Nov 1 2000 Vsevolod Volkov <vvv@mutt.org.ua>
108 +- fixed error opening newsgroup from mutt started with -g or -G
110 +* Thu Oct 12 2000 Vsevolod Volkov <vvv@mutt.org.ua>
112 +- hotkey 'G' (get-message) replaced with '^G'
114 +* Thu Sep 21 2000 Vsevolod Volkov <vvv@mutt.org.ua>
116 +- changed delay displaying error messages from 1 to 2 seconds
117 +- fixed error compiling with nntp and without imap
119 +* Wed Sep 6 2000 Vsevolod Volkov <vvv@mutt.org.ua>
120 +- fixed catchup in index
121 +- fixed nntp_open_mailbox()
123 +* Sat Sep 2 2000 Vsevolod Volkov <vvv@mutt.org.ua>
124 +- functions <edit> and <delete-entry> disabled
125 +- format of news mailbox names changed to url form
126 +- option nntp_attempts removed
127 +- option reconnect_news renamed to nntp_reconnect
128 +- default value of nntp_poll changed from 30 to 60
129 +- error handling improved
131 +* Wed Aug 30 2000 Vsevolod Volkov <vvv@mutt.org.ua>
133 +- new option show_only_unread
134 +- add newsgroup completion
136 +* Fri Aug 4 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
139 +* Sat Jul 29 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
142 +* Sun Jul 9 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
144 +- authentication code update
145 +- fix for changing to newsgroup from mailbox with read messages
146 +- socket code optimization
148 +* Wed Jun 21 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
151 +* Wed Jun 14 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
152 +- don't substitute current newsgroup with deleted new messages
154 +* Mon Jun 12 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
156 +- fix for substitution of newsgroup after reconnection
157 +- fix for loading newsgroups with very long names
158 +- fix for loading more than 32768 newsgroups
160 +* Wed May 24 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
163 +* Sat May 20 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
166 +* Fri May 12 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
169 +* Thu May 11 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
172 +* Thu May 4 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
175 +* Sun Apr 23 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
178 +* Fri Apr 7 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
179 +- add substitution of newsgroup with new messages by default
181 +* Wed Apr 5 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
182 +- add attach message from newsgroup
183 +- add one-line help in newsreader mode
184 +- disable 'change-dir' command in newsgroups browser
187 +* Tue Apr 4 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
188 +- get default newsserver name from file /etc/nntpserver
189 +- use case insensitive server names
190 +- add print-style sequence %s to $newsrc
193 +* Sat Apr 1 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
194 +- remove 'X-FTN-Origin' header processing
196 +* Thu Mar 30 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
200 +* Thu Mar 23 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
201 +- fix mutt_select_newsserver()
202 +- remove 'toggle-mode' function
203 +- add 'change-newsgroup' function
205 +* Wed Mar 22 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
208 +* Tue Mar 21 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
209 +- fix error 'bounce' function after 'post'
210 +- add 'forward to newsgroup' function
212 +* Mon Mar 20 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
213 +- 'forward' function works in newsreader mode
214 +- add 'post' and 'followup' functions to pager and attachment menu
215 +- fix active descriptions and allowed flag reload
217 +* Tue Mar 14 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
219 +- remove deleted newsgroups from list
221 +* Mon Mar 13 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
222 +- update .newsrc in browser
224 +* Sun Mar 12 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
225 +- reload .newsrc if externally modified
226 +- fix active cache update
228 +* Sun Mar 5 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
231 +* Sat Mar 4 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
232 +- patch *.update_list_file is not required
233 +- count lines when loading descriptions
234 +- remove cache of unsubscribed newsgroups
236 +* Thu Mar 2 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
237 +- load list of newsgroups from cache faster
239 +* Wed Mar 1 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
242 +* Tue Feb 29 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
243 +- fix unread messages in browser
244 +- fix newsrc_gen_entries()
246 +* Mon Feb 28 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
247 +- fix mutt_newsgroup_stat()
248 +- fix nntp_delete_cache()
249 +- fix nntp_get_status()
250 +- fix check_children()
251 +- fix nntp_fetch_headers()
253 +* Fri Feb 25 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
256 +* Thu Feb 24 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
257 +- fix updating new messages in cache
259 +* Mon Feb 21 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
260 +- change default cache filenames
261 +- fix updating new messages in cache
263 +* Fri Feb 18 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
264 +- fix segmentation fault in news groups browser
266 +* Tue Feb 15 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
269 +* Thu Feb 10 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
272 +* Sun Jan 30 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
273 +- add X-Comment-To editing
274 +- add my_hdr support for Newsgroups:, Followup-To: and X-Comment-To: headers
275 +- add variables $ask_followup_to and $ask_x_comment_to
277 +* Fri Jan 28 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
280 +* Wed Aug 23 2000 Andrej Gritsenko <andrej@lucky.net>
281 +- nntp.c: inserted server hook when opened a newsgroup - for
282 + difference between mail and news reader environment
283 +- parse.c: `X-FTN-Origin:' processed for bad Fido gates
285 +* Tue Aug 22 2000 Vsevolod Volkov <vvv@mutt.org.ua>
286 +- browser.c, complete.c: newsgroup completion patch
288 +* Wed Dec 22 1999 Andrej Gritsenko <andrej@lucky.net>
289 +- send.c: fixed bug with `Subject:' on followup
291 +* Sat Dec 18 1999 Andrej Gritsenko <andrej@lucky.net>
294 +* Tue Oct 26 1999 Andrej Gritsenko <andrej@lucky.net>
297 +* Mon Jun 14 1999 Andrej Gritsenko <andrej@lucky.net>
298 +- sendlib.c: use $mime_subject for news articles only
300 +* Fri Jun 11 1999 Edouard G. Parmelan <Edouard.Parmelan@quadratec.fr>
301 +- nntp.c: bugfix with number of new articles
303 +* Thu Jun 10 1999 Andrej Gritsenko <andrej@lucky.net>
304 +- nntp.c: fixed incomplete creating of index file
306 +* Wed Jun 9 1999 Andrej Gritsenko <andrej@lucky.net>
308 +- doc/manual*: documentation updated
310 +* Sun Feb 21 1999 Andrej Gritsenko <andrej@lucky.net>
311 +- browser.c, newsrc.c, nntp.c: couple of fixes
313 +* Wed Dec 16 1998 Andrej Gritsenko <andrej@lucky.net>
314 +- curs_main.c, newsrc.c, nntp.c: fixes on number of read
317 +* Tue Dec 15 1998 Vikas Agnihotri <vikasa@att.com>
318 +- nntp.c: fix with gone cache files
320 +* Tue Dec 15 1998 Andrej Gritsenko <andrej@lucky.net>
321 +- newsrc.c, nntp.c: fixes on number of read articles
323 +* Mon Dec 14 1998 Andrej Gritsenko <andrej@lucky.net>
324 +- browser.c, newsrc.c, nntp.c, nntp.h: changed then simplified
327 +* Mon Dec 14 1998 Vikas Agnihotri <vikasa@att.com>
328 +- browser.c: cosmetic patch
329 +- nntp.c: say "Fetching %s from server..."
331 +* Sun Dec 13 1998 Andrej Gritsenko <andrej@lucky.net>
332 +- commands.c, newsrc.c, nntp.c, nntp.h: don't save newsrc file
333 + so often (noted by Vikas Agnihotri)
335 +* Sat Dec 12 1998 Andrej Gritsenko <andrej@lucky.net>
336 +- browser.c, functions.h, nntp.c, nntp.h: fixed incorrect first
339 +* Wed Dec 9 1998 Vikas Agnihotri <vikasa@att.com>
340 +- nntp.c: fixed bug in `reconstruct-thread' function
341 +- curs_main.c, nntp.c: fixed the bug in non-XOVER case of get
344 +* Tue Dec 8 1998 Andrej Gritsenko <andrej@lucky.net>
345 +- nntp.c: fixed error in getting status of article
347 +* Tue Dec 8 1998 Vikas Agnihotri <vikasa@att.com>
348 +- mutt.h, pattern.c: added `~w' search pattern
350 +* Tue Dec 8 1998 Andrej Gritsenko <andrej@lucky.net>
351 +- nntp.c: bugfix when get children
353 +* Tue Dec 8 1998 Vikas Agnihotri <vikasa@att.com>
354 +- newsrc.c: bugfix in mutt_newsgroup_catchup()
356 +* Tue Dec 8 1998 Andrej Gritsenko <andrej@lucky.net>
357 +- browser.c: bugfix in _mutt_select_file()
359 +* Sat Dec 5 1998 Andrej Gritsenko <andrej@lucky.net>
360 +- browser.c, newsrc.c, nntp.c, nntp.h: fix the sorting of
361 + newsgroups in browser (from Vikas Agnihotri)
363 +* Fri Dec 4 1998 Vikas Agnihotri <vikasa@att.com>
364 +- OPS, curs_main.c, functions.h, nntp.c, nntp.h: new functions:
365 + `get-children' and `reconstruct-thread'
367 +* Thu Dec 3 1998 Vikas Agnihotri <vikasa@att.com>
368 +- OPS, curs_main.c, functions.h, nntp.c, nntp.h: new functions:
369 + `get-message' and `get-parent'
371 +* Wed Dec 2 1998 Vikas Agnihotri <vikasa@att.com>
372 +- OPS, compose.c, curs_main.c, functions.h, parse.c, send.c,
373 + sendlib.c: added `Followup-To:' field editing
375 +* Wed Dec 2 1998 Vikas Agnihotri <vikasa@att.com>
376 +- OPS, browser.c, functions.h: new `load-active' function
378 +* Tue Dec 1 1998 Andrej Gritsenko <andrej@lucky.net>
379 +- browser.c: added option for blank %s in $group_index_format
380 +- hdrline.c, lib.c, mutt.h, parse.c: added %g and %W parameters
382 +- hook.c, newsrc.c, nntp.c, sendlib.c: some small bugfixes
384 +* Mon Nov 30 1998 Andrej Gritsenko <andrej@lucky.net>
385 +- send.c: bugfix in `Followup-To:' field
387 +* Sun Nov 29 1998 Vikas Agnihotri <vikasa@att.com>
388 +- compose.c, lib.c, parse.c, protos.h: remove white spaces from
389 + `Newsgroup:' field to prevent a unnecessary rejection of article
391 +* Sat Nov 28 1998 Vikas Agnihotri <vikasa@att.com>
392 +- newsrc.c: fixed bug in catchup
394 +* Sat Nov 28 1998 Vikas Agnihotri <vikasa@att.com>
395 +- browser.c: make indicator advance when (un)subscribe
397 +* Sat Nov 28 1998 Andrej Gritsenko <andrej@lucky.net>
398 +- newsrc.c: fixed segmentation fault in newsrc_update_line()
400 +* Sat Nov 28 1998 Andrej Gritsenko <andrej@lucky.net>
401 +- OPS, browser.c, functions.h, init.h, mutt.h, mx.c, newsrc.c,
402 + nntp.c, nntp.h: corrected reading of newsrc file and added new
405 +* Thu Nov 26 1998 Andrej Gritsenko <andrej@lucky.net>
406 +- browser.c, newsrc.c: implementation of `(un)subscribe-pattern'
407 + functions from Vikas Agnihotri
408 +- globals.h, init.h, nntp.h, nntp.c: added variable $nntp_poll
409 + to avoid of polling newsserver on each keypressing
411 +* Thu Nov 26 1998 Andrej Gritsenko <andrej@lucky.net>
412 +- nntp.c, socket.c: fixed parsing of long XOVER lines
413 +- send.c: removed silly ask for newsgroup name (noted by Vikas
417 +- commands.c: bugfix in mutt_update_list_file()
419 +* Wed Nov 25 1998 Andrej Gritsenko <andrej@lucky.net>
420 +- updated to mutt-0.94.17
421 +- init.c, nntp.c, nntp.h, parse.c, send.c: couple of bugfixes
422 + from Vikas Agnihotri
424 +* Sat Nov 21 1998 Andrej Gritsenko <andrej@lucky.net>
425 +- [mutt-0.94.13] couple of files: pre-alpha version of patch,
426 + partially based on code that written by Brandon Long
427 diff -uNr mutt-1.4.orig/Makefile.am mutt-1.4/Makefile.am
428 --- mutt-1.4.orig/Makefile.am Sun Nov 3 21:42:52 2002
429 +++ mutt-1.4/Makefile.am Sun Nov 3 21:57:20 2002
431 EXTRA_mutt_SOURCES = account.c md5c.c mutt_sasl.c mutt_socket.c mutt_ssl.c \
432 mutt_tunnel.c pop.c pop_auth.c pop_lib.c pgp.c pgpinvoke.c pgpkey.c \
433 pgplib.c sha1.c pgpmicalg.c gnupgparse.c resize.c dotlock.c remailer.c \
434 - browser.h mbyte.h remailer.h url.h mutt_ssl_nss.c pgppacket.c
435 + browser.h mbyte.h remailer.h url.h mutt_ssl_nss.c pgppacket.c \
438 EXTRA_DIST = COPYRIGHT GPL OPS OPS.PGP TODO configure acconfig.h account.h \
439 attach.h buffy.h charset.h compress.h copy.h dotlock.h functions.h \
441 mutt_regex.h mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h \
442 mx.h pager.h pgp.h pop.h protos.h reldate.h rfc1524.h rfc2047.h \
443 rfc2231.h rfc822.h sha1.h sort.h mime.types VERSION prepare \
444 + nntp.h ChangeLog.nntp \
445 _regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \
446 mbyte.h lib.h extlib.c pgpewrap.c pgplib.h Muttrc.head Muttrc \
447 makedoc.c stamp-doc-rc README.SSL \
448 diff -uNr mutt-1.4.orig/Muttrc mutt-1.4/Muttrc
449 --- mutt-1.4.orig/Muttrc Sun Nov 3 21:42:52 2002
450 +++ mutt-1.4/Muttrc Sun Nov 3 21:57:20 2002
452 # editing the body of an outgoing message.
455 +# set ask_follow_up=no
457 +# Name: ask_follow_up
462 +# If set, Mutt will prompt you for follow-up groups before editing
463 +# the body of an outgoing message.
466 +# set ask_x_comment_to=no
468 +# Name: ask_x_comment_to
473 +# If set, Mutt will prompt you for x-comment-to field before editing
474 +# the body of an outgoing message.
477 # set attach_format="%u%D%I %t%4n %T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] "
479 # Name: attach_format
481 # bouncing messages. Postfix users may wish to unset this variable.
484 +# set catchup_newsgroup=ask-yes
486 +# Name: catchup_newsgroup
491 +# If this variable is set, Mutt will mark all articles in newsgroup
492 +# as read when you quit the newsgroup (catchup newsgroup).
499 # resulting in two copies of the same email for you.
502 +# set followup_to_poster=ask-yes
504 +# Name: followup_to_poster
509 +# If this variable is set and the keyword "poster" is present in
510 +# Followup-To header, follow-up to newsgroup function is not
511 +# permitted. The message will be mailed to the submitter of the
519 # "Franklin" to "Franklin, Steve".
522 +# set group_index_format="%4C %M%N %5s %-45.45f %d"
524 +# Name: group_index_format
526 +# Default: "%4C %M%N %5s %-45.45f %d"
529 +# This variable allows you to customize the newsgroup browser display to
530 +# your personal taste. This string is similar to ``index_format'', but
531 +# has its own set of printf()-like sequences:
533 +# %C current newsgroup number
534 +# %d description of newsgroup (becomes from server)
536 +# %M - if newsgroup not allowed for direct post (moderated for example)
537 +# %N N if newsgroup is new, u if unsubscribed, blank otherwise
538 +# %n number of new articles in newsgroup
539 +# %s number of unread articles in newsgroup
540 +# %>X right justify the rest of the string and pad with character "X"
541 +# %|X pad to the end of the line with character "X"
547 @@ -1187,6 +1255,7 @@
548 # %E number of messages in current thread
549 # %f entire From: line (address + real name)
550 # %F author name, or recipient name if the message is from you
551 +# %g newsgroup name (if compiled with nntp support)
552 # %i message-id of the current message
553 # %l number of lines in the message
554 # %L If an address in the To or CC header field matches an address
555 @@ -1204,6 +1273,7 @@
556 # %T the appropriate character from the $to_chars string
557 # %u user (login) name of the author
558 # %v first name of the author, or the recipient if the message is from you
559 +# %W name of organization of author (`organization:' field)
560 # %y `x-label:' field, if present
561 # %Y `x-label' field, if present, and (1) not at part of a thread tree,
562 # (2) at the top of a thread, or (3) `x-label' is different from
563 @@ -1227,6 +1297,22 @@
564 # See also: ``$to_chars''.
574 +# If set, specifies the program and arguments used to deliver news posted
575 +# by Mutt. Otherwise, mutt posts article using current connection to
576 +# news server. The following printf-style sequence is understood:
578 +# %s newsserver name
580 +# Example: set inews="/usr/local/bin/inews -hS"
583 # set ispell="/usr/bin/ispell"
586 @@ -1496,6 +1582,18 @@
587 # be attached to the newly composed message if this option is set.
590 +# set mime_subject=yes
592 +# Name: mime_subject
597 +# If unset, 8-bit ``subject:'' line in article header will not be
598 +# encoded according to RFC2047 to base64. This is useful when message
599 +# is Usenet article, because MIME for news is nonstandard feature.
602 # set mix_entry_format="%4n %c %-16s %a"
604 # Name: mix_entry_format
605 @@ -1550,6 +1648,118 @@
606 # escape sequences see the section on ``$index_format''.
609 +# set news_cache_dir="~/.mutt"
611 +# Name: news_cache_dir
613 +# Default: "~/.mutt"
616 +# This variable pointing to directory where Mutt will save cached news
617 +# articles headers in. If unset, headers will not be saved at all
618 +# and will be reloaded each time when you enter to newsgroup.
621 +# set news_server=""
628 +# This variable specifies domain name or address of NNTP server. It
629 +# defaults to the newsserver specified in the environment variable
630 +# $NNTPSERVER or contained in the file /etc/nntpserver. You can also
631 +# specify username and an alternative port for each newsserver, ie:
633 +# [nntp[s]://][username[:password]@]newsserver[:port]
636 +# set newsrc="~/.newsrc"
640 +# Default: "~/.newsrc"
643 +# The file, containing info about subscribed newsgroups - names and
644 +# indexes of read articles. The following printf-style sequence
647 +# %s newsserver name
650 +# set nntp_context=1000
652 +# Name: nntp_context
657 +# This variable defines number of articles which will be in index when
658 +# newsgroup entered. If active newsgroup have more articles than this
659 +# number, oldest articles will be ignored. Also controls how many
660 +# articles headers will be saved in cache when you quit newsgroup.
663 +# set nntp_load_description=yes
665 +# Name: nntp_load_description
670 +# This variable controls whether or not descriptions for each newsgroup
671 +# must be loaded when newsgroup is added to list (first time list
672 +# loading or new newsgroup adding).
682 +# Your login name on the NNTP server. If unset and NNTP server requires
683 +# authentification, Mutt will prompt you for your account name when you
684 +# connect to newsserver.
694 +# Your password for NNTP account.
704 +# The time in seconds until any operations on newsgroup except post new
705 +# article will cause recheck for new news. If set to 0, Mutt will
706 +# recheck newsgroup on each operation in index (stepping, read article,
710 +# set nntp_reconnect=ask-yes
712 +# Name: nntp_reconnect
717 +# Controls whether or not Mutt will try to reconnect to newsserver when
721 # set pager="builtin"
724 @@ -2293,6 +2503,19 @@
725 # string after the inclusion of a message which is being replied to.
728 +# set post_moderated=ask-yes
730 +# Name: post_moderated
735 +# If set to yes, Mutt will post article to newsgroup that have
736 +# not permissions to posting (e.g. moderated). Note: if newsserver
737 +# does not support posting to that newsgroup or totally read-only, that
738 +# posting will not have an effect.
741 # set postpone=ask-yes
744 @@ -2802,6 +3025,41 @@
745 # shell from /etc/passwd is used.
748 +# set save_unsubscribed=no
750 +# Name: save_unsubscribed
755 +# When set, info about unsubscribed newsgroups will be saved into
756 +# ``newsrc'' file and into cache.
759 +# set show_new_news=yes
761 +# Name: show_new_news
766 +# If set, newsserver will be asked for new newsgroups on entering
767 +# the browser. Otherwise, it will be done only once for a newsserver.
768 +# Also controls whether or not number of new articles of subscribed
769 +# newsgroups will be then checked.
772 +# set show_only_unread=no
774 +# Name: show_only_unread
779 +# If set, only subscribed newsgroups that contain unread articles
780 +# will be displayed in browser.
786 @@ -3285,6 +3543,18 @@
797 +# When set, Mutt will look for IPv6 addresses of hosts it tries to
798 +# contact. If this option is unset, Mutt will restrict itself to IPv4 addresses.
799 +# Normally, the default should work.
805 @@ -3387,3 +3657,14 @@
806 # messages to be sent. Exim users may wish to use this.
809 +# set x_comment_to=no
811 +# Name: x_comment_to
816 +# If set, Mutt will add ``X-Comment-To:'' field (that contains full
817 +# name of original article author) to article that followuped to newsgroup.
820 diff -uNr mutt-1.4.orig/Muttrc.head mutt-1.4/Muttrc.head
821 --- mutt-1.4.orig/Muttrc.head Sun Nov 3 21:42:51 2002
822 +++ mutt-1.4/Muttrc.head Thu Jan 1 01:00:00 1970
825 -# System configuration file for Mutt
828 -# default list of header fields to weed when displaying
830 -ignore "from " received content- mime-version status x-status message-id
831 -ignore sender references return-path lines
833 -# imitate the old search-body function
834 -macro index \eb '/~b ' 'search in message bodies'
836 -# simulate the old url menu
837 -macro index \cb |urlview\n 'call urlview to extract URLs out of a message'
838 -macro pager \cb |urlview\n 'call urlview to extract URLs out of a message'
840 -# Show documentation when pressing F1
841 -macro generic <f1> "!less /usr/local/doc/mutt/manual.txt\n" "Show Mutt documentation"
842 -macro index <f1> "!less /usr/local/doc/mutt/manual.txt\n" "Show Mutt documentation"
843 -macro pager <f1> "!less /usr/local/doc/mutt/manual.txt\n" "Show Mutt documentation"
845 -# Use folders which match on \\.gz$ as gzipped folders:
846 -# open-hook \\.gz$ "gzip -cd %f > %t"
847 -# close-hook \\.gz$ "gzip -c %t > %f"
848 -# append-hook \\.gz$ "gzip -c %t >> %f"
850 -# open-hook \\.bz2$ "bzip2 -cd %f > %t"
851 -# close-hook \\.bz2$ "bzip2 -c %t > %f"
852 -# append-hook \\.bz2$ "bzip2 -c %t >> %f"
854 -# If Mutt is unable to determine your site's domain name correctly, you can
855 -# set the default here.
857 -# set hostname=cs.hmc.edu
859 -# If your sendmail supports the -B8BITMIME flag, enable the following
867 diff -uNr mutt-1.4.orig/OPS mutt-1.4/OPS
868 --- mutt-1.4.orig/OPS Sun Nov 3 21:42:52 2002
869 +++ mutt-1.4/OPS Sun Nov 3 21:57:20 2002
871 OP_BROWSER_NEW_FILE "select a new file in this directory"
872 OP_BROWSER_VIEW_FILE "view file"
873 OP_BROWSER_TELL "display the currently selected file's name"
874 -OP_BROWSER_SUBSCRIBE "subscribe to current mailbox (IMAP only)"
875 -OP_BROWSER_UNSUBSCRIBE "unsubscribe to current mailbox (IMAP only)"
876 +OP_CATCHUP "mark all articles in newsgroup as read"
877 +OP_BROWSER_SUBSCRIBE "subscribe to current (IMAP/NNTP only)"
878 +OP_BROWSER_UNSUBSCRIBE "unsubscribe to current (IMAP/NNTP only)"
879 OP_BROWSER_TOGGLE_LSUB "toggle view all/subscribed mailboxes (IMAP only)"
880 OP_CHANGE_DIRECTORY "change directories"
881 OP_CHECK_NEW "check mailboxes for new mail"
882 OP_COMPOSE_ATTACH_FILE "attach a file(s) to this message"
883 OP_COMPOSE_ATTACH_MESSAGE "attach message(s) to this message"
884 +OP_COMPOSE_ATTACH_NEWS_MESSAGE "attach newsmessage(s) to this message"
885 OP_COMPOSE_EDIT_BCC "edit the BCC list"
886 OP_COMPOSE_EDIT_CC "edit the CC list"
887 OP_COMPOSE_EDIT_DESCRIPTION "edit attachment description"
889 OP_COMPOSE_EDIT_HEADERS "edit the message with headers"
890 OP_COMPOSE_EDIT_MESSAGE "edit the message"
891 OP_COMPOSE_EDIT_MIME "edit attachment using mailcap entry"
892 +OP_COMPOSE_EDIT_NEWSGROUPS "edit the newsgroups list"
893 OP_COMPOSE_EDIT_REPLY_TO "edit the Reply-To field"
894 +OP_COMPOSE_EDIT_FOLLOWUP_TO "edit the Followup-To field"
895 +OP_COMPOSE_EDIT_X_COMMENT_TO "edit the X-Comment-To field"
896 OP_COMPOSE_EDIT_SUBJECT "edit the subject of this message"
897 OP_COMPOSE_EDIT_TO "edit the TO list"
898 OP_CREATE_MAILBOX "create a new mailbox (IMAP only)"
900 OP_FILTER "filter attachment through a shell command"
901 OP_FIRST_ENTRY "move to the first entry"
902 OP_FLAG_MESSAGE "toggle a message's 'important' flag"
903 +OP_FOLLOWUP "followup to newsgroup"
904 +OP_FORWARD_TO_GROUP "forward to newsgroup"
905 OP_FORWARD_MESSAGE "forward a message with comments"
906 OP_GENERIC_SELECT_ENTRY "select the current entry"
907 +OP_GET_CHILDREN "get all children of the current message"
908 +OP_GET_MESSAGE "get message with Message-Id"
909 +OP_GET_PARENT "get parent of the current message"
910 OP_GROUP_REPLY "reply to all recipients"
911 OP_HALF_DOWN "scroll down 1/2 page"
912 OP_HALF_UP "scroll up 1/2 page"
914 OP_JUMP "jump to an index number"
915 OP_LAST_ENTRY "move to the last entry"
916 OP_LIST_REPLY "reply to specified mailing list"
917 +OP_LOAD_ACTIVE "load active file from NNTP server"
918 OP_MACRO "execute a macro"
919 OP_MAIL "compose a new mail message"
920 OP_MAIN_BREAK_THREAD "break the thread in two"
921 OP_MAIN_CHANGE_FOLDER "open a different folder"
922 OP_MAIN_CHANGE_FOLDER_READONLY "open a different folder in read only mode"
923 +OP_MAIN_CHANGE_GROUP "open a different newsgroup"
924 +OP_MAIN_CHANGE_GROUP_READONLY "open a different newsgroup in read only mode"
925 OP_MAIN_CLEAR_FLAG "clear a status flag from a message"
926 OP_MAIN_DELETE_PATTERN "delete messages matching a pattern"
927 +OP_RECONSTRUCT_THREAD "reconstruct thread containing current message"
928 OP_MAIN_IMAP_FETCH "force retrieval of mail from IMAP server"
929 OP_MAIN_FETCH_MAIL "retrieve mail from POP server"
930 OP_MAIN_FIRST_MESSAGE "move to the first message"
932 OP_PAGER_SKIP_QUOTED "skip beyond quoted text"
933 OP_PAGER_TOP "jump to the top of the message"
934 OP_PIPE "pipe message/attachment to a shell command"
935 +OP_POST "post message to newsgroup"
936 OP_PREV_ENTRY "move to the previous entry"
937 OP_PREV_LINE "scroll up one line"
938 OP_PREV_PAGE "move to the previous page"
939 @@ -159,17 +174,21 @@
940 OP_SIG_SEARCH "search signatures matching a pattern"
941 OP_SORT "sort messages"
942 OP_SORT_REVERSE "sort messages in reverse order"
943 +OP_SUBSCRIBE_PATTERN "subscribe to newsgroups matching a pattern"
944 OP_TAG "tag the current entry"
945 OP_TAG_PREFIX "apply next function to tagged messages"
946 OP_TAG_SUBTHREAD "tag the current subthread"
947 OP_TAG_THREAD "tag the current thread"
948 OP_TOGGLE_NEW "toggle a message's 'new' flag"
949 +OP_TOGGLE_READ "toggle view of read messages"
950 OP_TOGGLE_WRITE "toggle whether the mailbox will be rewritten"
951 OP_TOGGLE_MAILBOXES "toggle whether to browse mailboxes or all files"
952 OP_TOP_PAGE "move to the top of the page"
953 +OP_UNCATCHUP "mark all articles in newsgroup as unread"
954 OP_UNDELETE "undelete the current entry"
955 OP_UNDELETE_THREAD "undelete all messages in thread"
956 OP_UNDELETE_SUBTHREAD "undelete all messages in subthread"
957 +OP_UNSUBSCRIBE_PATTERN "unsubscribe from newsgroups matching a pattern"
958 OP_VERSION "show the Mutt version number and date"
959 OP_VIEW_ATTACH "view attachment using mailcap entry if necessary"
960 OP_VIEW_ATTACHMENTS "show MIME attachments"
961 diff -uNr mutt-1.4.orig/PATCHES mutt-1.4/PATCHES
962 --- mutt-1.4.orig/PATCHES Sun Nov 3 21:42:52 2002
963 +++ mutt-1.4/PATCHES Sun Nov 3 21:57:20 2002
966 diff -uNr mutt-1.4.orig/acconfig.h mutt-1.4/acconfig.h
967 --- mutt-1.4.orig/acconfig.h Tue Jan 15 23:08:12 2002
968 +++ mutt-1.4/acconfig.h Sun Nov 3 21:57:20 2002
973 +/* Compiling with newsreading support with NNTP */
976 /* program to use for shell commands */
977 #define EXECSHELL "/bin/sh"
979 diff -uNr mutt-1.4.orig/account.c mutt-1.4/account.c
980 --- mutt-1.4.orig/account.c Thu Apr 26 15:36:33 2001
981 +++ mutt-1.4/account.c Sun Nov 3 21:57:20 2002
987 + if (a1->type == M_ACCT_TYPE_NNTP && NntpUser)
991 if (a1->flags & a2->flags & M_ACCT_USER)
992 return (!strcmp (a1->user, a2->user));
993 if (a1->flags & M_ACCT_USER)
999 + if (account->type == M_ACCT_TYPE_NNTP)
1001 + if (account->flags & M_ACCT_SSL)
1002 + url->scheme = U_NNTPS;
1004 + url->scheme = U_NNTP;
1008 url->host = account->host;
1009 if (account->flags & M_ACCT_PORT)
1010 url->port = account->port;
1011 @@ -138,6 +153,10 @@
1012 else if ((account->type == M_ACCT_TYPE_POP) && PopUser)
1013 strfcpy (account->user, PopUser, sizeof (account->user));
1016 + else if ((account->type == M_ACCT_TYPE_NNTP) && NntpUser)
1017 + strfcpy (account->user, NntpUser, sizeof (account->user));
1019 /* prompt (defaults to unix username), copy into account->user */
1022 @@ -167,6 +186,10 @@
1023 else if ((account->type == M_ACCT_TYPE_POP) && PopPass)
1024 strfcpy (account->pass, PopPass, sizeof (account->pass));
1027 + else if ((account->type == M_ACCT_TYPE_NNTP) && NntpPass)
1028 + strfcpy (account->pass, NntpPass, sizeof (account->pass));
1032 snprintf (prompt, sizeof (prompt), _("Password for %s@%s: "),
1033 diff -uNr mutt-1.4.orig/account.h mutt-1.4/account.h
1034 --- mutt-1.4.orig/account.h Tue Jan 2 10:34:30 2001
1035 +++ mutt-1.4/account.h Sun Nov 3 21:57:20 2002
1038 M_ACCT_TYPE_NONE = 0,
1044 diff -uNr mutt-1.4.orig/attach.h mutt-1.4/attach.h
1045 --- mutt-1.4.orig/attach.h Tue Sep 11 13:20:34 2001
1046 +++ mutt-1.4/attach.h Sun Nov 3 21:57:20 2002
1049 void mutt_attach_bounce (FILE *, HEADER *, ATTACHPTR **, short, BODY *);
1050 void mutt_attach_resend (FILE *, HEADER *, ATTACHPTR **, short, BODY *);
1051 -void mutt_attach_forward (FILE *, HEADER *, ATTACHPTR **, short, BODY *);
1052 +void mutt_attach_forward (FILE *, HEADER *, ATTACHPTR **, short, BODY *, int);
1053 void mutt_attach_reply (FILE *, HEADER *, ATTACHPTR **, short, BODY *, int);
1054 diff -uNr mutt-1.4.orig/browser.c mutt-1.4/browser.c
1055 --- mutt-1.4.orig/browser.c Sun Nov 3 21:42:52 2002
1056 +++ mutt-1.4/browser.c Sun Nov 3 22:00:14 2002
1072 +static struct mapping_t FolderNewsHelp[] = {
1073 + { N_("Exit"), OP_EXIT },
1074 + { N_("List"), OP_TOGGLE_MAILBOXES },
1075 + { N_("Subscribe"), OP_BROWSER_SUBSCRIBE },
1076 + { N_("Unsubscribe"), OP_BROWSER_UNSUBSCRIBE },
1077 + { N_("Catchup"), OP_CATCHUP },
1078 + { N_("Mask"), OP_ENTER_MASK },
1079 + { N_("Help"), OP_HELP },
1084 typedef struct folder_t
1086 struct folder_file *ff;
1087 @@ -109,9 +125,17 @@
1092 + if (option (OPTNEWS))
1095 f = browser_compare_date;
1099 + if (option (OPTNEWS))
1102 f = browser_compare_size;
1105 @@ -299,8 +323,106 @@
1110 +static const char *
1111 +newsgroup_format_str (char *dest, size_t destlen, char op, const char *src,
1112 + const char *fmt, const char *ifstring, const char *elsestring,
1113 + unsigned long data, format_flag flags)
1115 + char fn[SHORT_STRING], tmp[SHORT_STRING];
1116 + FOLDER *folder = (FOLDER *) data;
1121 + snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
1122 + snprintf (dest, destlen, tmp, folder->num + 1);
1126 + strncpy (fn, folder->ff->name, sizeof(fn) - 1);
1127 + snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
1128 + snprintf (dest, destlen, tmp, fn);
1132 + snprintf (tmp, sizeof (tmp), "%%%sc", fmt);
1133 + if (folder->ff->nd->subscribed)
1134 + snprintf (dest, destlen, tmp, ' ');
1136 + snprintf (dest, destlen, tmp, folder->ff->new ? 'N' : 'u');
1140 + snprintf (tmp, sizeof (tmp), "%%%sc", fmt);
1141 + if (folder->ff->nd->deleted)
1142 + snprintf (dest, destlen, tmp, 'D');
1144 + snprintf (dest, destlen, tmp, folder->ff->nd->allowed ? ' ' : '-');
1148 + if (flags & M_FORMAT_OPTIONAL)
1150 + if (folder->ff->nd->unread != 0)
1151 + mutt_FormatString (dest, destlen, ifstring, newsgroup_format_str,
1154 + mutt_FormatString (dest, destlen, elsestring, newsgroup_format_str,
1157 + else if (Context && Context->data == folder->ff->nd)
1159 + snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
1160 + snprintf (dest, destlen, tmp, Context->unread);
1164 + snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
1165 + snprintf (dest, destlen, tmp, folder->ff->nd->unread);
1170 + if (Context && Context->data == folder->ff->nd)
1172 + snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
1173 + snprintf (dest, destlen, tmp, Context->new);
1175 + else if (option (OPTMARKOLD) &&
1176 + folder->ff->nd->lastCached >= folder->ff->nd->firstMessage &&
1177 + folder->ff->nd->lastCached <= folder->ff->nd->lastMessage)
1179 + snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
1180 + snprintf (dest, destlen, tmp, folder->ff->nd->lastMessage - folder->ff->nd->lastCached);
1184 + snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
1185 + snprintf (dest, destlen, tmp, folder->ff->nd->unread);
1190 + if (folder->ff->nd->desc != NULL)
1192 + snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
1193 + snprintf (dest, destlen, tmp, folder->ff->nd->desc);
1197 + snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
1198 + snprintf (dest, destlen, tmp, "");
1204 +#endif /* USE_NNTP */
1206 static void add_folder (MUTTMENU *m, struct browser_state *state,
1207 - const char *name, const struct stat *s, int new)
1208 + const char *name, const struct stat *s,
1209 + void *data, int new)
1211 if (state->entrylen == state->entrymax)
1213 @@ -329,6 +451,10 @@
1215 (state->entry)[state->entrylen].imap = 0;
1218 + if (option (OPTNEWS))
1219 + (state->entry)[state->entrylen].nd = (NNTP_DATA *) data;
1221 (state->entrylen)++;
1224 @@ -344,9 +470,35 @@
1225 menu->data = state->entry;
1228 +/* get list of all files/newsgroups with mask */
1229 static int examine_directory (MUTTMENU *menu, struct browser_state *state,
1230 char *d, const char *prefix)
1233 + if (option (OPTNEWS))
1237 + NNTP_SERVER *news = CurrentNewsSrv;
1239 +/* mutt_buffy_check (0); */
1240 + init_state (state, menu);
1242 + for (tmp = news->list; tmp; tmp = tmp->next)
1244 + if (!(data = (NNTP_DATA *)tmp->data))
1246 + if (prefix && *prefix && strncmp (prefix, data->group,
1247 + strlen (prefix)) != 0)
1249 + if (!((regexec (Mask.rx, data->group, 0, NULL, 0) == 0) ^ Mask.not))
1251 + add_folder (menu, state, data->group, NULL, data, data->new);
1255 +#endif /* USE_NNTP */
1260 @@ -411,60 +563,95 @@
1262 while (tmp && mutt_strcmp (buffer, tmp->path))
1264 - add_folder (menu, state, de->d_name, &s, (tmp) ? tmp->new : 0);
1265 + add_folder (menu, state, de->d_name, &s, NULL, (tmp) ? tmp->new : 0);
1270 browser_sort (state);
1274 +/* get list of mailboxes/subscribed newsgroups */
1275 static int examine_mailboxes (MUTTMENU *menu, struct browser_state *state)
1278 char buffer[LONG_STRING];
1279 - BUFFY *tmp = Incoming;
1283 - mutt_buffy_check (0);
1285 + if (option (OPTNEWS))
1289 + NNTP_SERVER *news = CurrentNewsSrv;
1291 - init_state (state, menu);
1292 +/* mutt_buffy_check (0); */
1293 + init_state (state, menu);
1298 - if (mx_is_imap (tmp->path))
1299 + for (tmp = news->list; tmp; tmp = tmp->next)
1301 - add_folder (menu, state, tmp->path, NULL, tmp->new);
1303 + if ((data = (NNTP_DATA *) tmp->data) != NULL && (data->new ||
1304 + (data->subscribed && (!option (OPTSHOWONLYUNREAD) || data->unread))))
1305 + add_folder (menu, state, data->group, NULL, data, data->new);
1311 - if (mx_is_pop (tmp->path))
1313 + BUFFY *tmp = Incoming;
1317 + mutt_buffy_check (0);
1319 + init_state (state, menu);
1323 - add_folder (menu, state, tmp->path, NULL, tmp->new);
1327 + if (mx_is_imap (tmp->path))
1329 + add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
1333 - if (lstat (tmp->path, &s) == -1)
1336 + if (mx_is_pop (tmp->path))
1338 + add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
1343 + if (mx_is_nntp (tmp->path))
1345 + add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
1349 + if (lstat (tmp->path, &s) == -1)
1352 - if ((! S_ISREG (s.st_mode)) && (! S_ISDIR (s.st_mode)) &&
1353 - (! S_ISLNK (s.st_mode)))
1355 + if ((! S_ISREG (s.st_mode)) && (! S_ISDIR (s.st_mode)) &&
1356 + (! S_ISLNK (s.st_mode)))
1359 - strfcpy (buffer, NONULL(tmp->path), sizeof (buffer));
1360 - mutt_pretty_mailbox (buffer);
1361 + strfcpy (buffer, NONULL(tmp->path), sizeof (buffer));
1362 + mutt_pretty_mailbox (buffer);
1364 - add_folder (menu, state, buffer, &s, tmp->new);
1365 + add_folder (menu, state, buffer, &s, NULL, tmp->new);
1367 + while ((tmp = tmp->next));
1369 - while ((tmp = tmp->next));
1370 browser_sort (state);
1374 int select_file_search (MUTTMENU *menu, regex_t *re, int n)
1377 + if (option (OPTNEWS))
1378 + return (regexec (re, ((struct folder_file *) menu->data)[n].desc, 0, NULL, 0));
1380 return (regexec (re, ((struct folder_file *) menu->data)[n].name, 0, NULL, 0));
1383 @@ -475,7 +662,13 @@
1384 folder.ff = &((struct folder_file *) menu->data)[num];
1387 - mutt_FormatString (s, slen, NONULL(FolderFormat), folder_format_str,
1389 + if (option (OPTNEWS))
1390 + mutt_FormatString (s, slen, NONULL(GroupFormat), newsgroup_format_str,
1391 + (unsigned long) &folder, M_FORMAT_ARROWCURSOR);
1394 + mutt_FormatString (s, slen, NONULL(FolderFormat), folder_format_str,
1395 (unsigned long) &folder, M_FORMAT_ARROWCURSOR);
1398 @@ -495,7 +688,18 @@
1405 + if (option (OPTNEWS))
1408 + snprintf (title, titlelen, _("Subscribed newsgroups"));
1410 + snprintf (title, titlelen, _("Newsgroups on server [%s]"),
1411 + CurrentNewsSrv->conn->account.host);
1416 snprintf (title, titlelen, _("Mailboxes [%d]"), mutt_buffy_check (0));
1418 @@ -551,6 +755,31 @@
1420 strfcpy (LastDirBackup, LastDir, sizeof (LastDirBackup));
1423 + if (option (OPTNEWS))
1426 + strfcpy (prefix, f, sizeof (prefix));
1431 + /* default state for news reader mode is browse subscribed newsgroups */
1433 + for (list = CurrentNewsSrv->list; list; list = list->next)
1435 + NNTP_DATA *data = (NNTP_DATA *) list->data;
1437 + if (data && data->subscribed)
1449 mutt_expand_path (f, flen);
1451 menu->tag = file_tag;
1453 menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_FOLDER,
1455 + (option (OPTNEWS)) ? FolderNewsHelp :
1459 init_menu (&state, menu, title, sizeof (title), buffy, FolderColumns);
1460 @@ -777,7 +1009,11 @@
1465 + if (buffy || option (OPTNEWS)) /* news have not path */
1470 strfcpy (f, state.entry[menu->current].name, flen);
1471 mutt_expand_path (f, flen);
1472 @@ -835,14 +1071,6 @@
1476 - case OP_BROWSER_SUBSCRIBE:
1477 - imap_subscribe (state.entry[menu->current].name, 1);
1480 - case OP_BROWSER_UNSUBSCRIBE:
1481 - imap_subscribe (state.entry[menu->current].name, 0);
1484 case OP_BROWSER_TOGGLE_LSUB:
1485 if (option (OPTIMAPLSUB))
1487 @@ -913,6 +1141,11 @@
1489 case OP_CHANGE_DIRECTORY:
1492 + if (option (OPTNEWS))
1496 strfcpy (buf, LastDir, sizeof (buf));
1498 if (!state.imap_browse)
1499 @@ -1163,6 +1396,190 @@
1501 mutt_error _("Error trying to view file");
1507 + case OP_UNCATCHUP:
1508 + if (option (OPTNEWS))
1510 + struct folder_file *f = &state.entry[menu->current];
1513 + if (i == OP_CATCHUP)
1514 + nd = mutt_newsgroup_catchup (CurrentNewsSrv, f->name);
1516 + nd = mutt_newsgroup_uncatchup (CurrentNewsSrv, f->name);
1521 + struct folder_file ff;
1522 + char buffer[_POSIX_PATH_MAX + SHORT_STRING];
1525 + folder.ff->name = f->name;
1526 + folder.ff->st = NULL;
1527 + folder.ff->is_new = nd->new;
1528 + folder.ff->nd = nd;
1529 + safe_free ((void **) &f->desc);
1530 + mutt_FormatString (buffer, sizeof (buffer), NONULL(GroupFormat),
1531 + newsgroup_format_str, (unsigned long) &folder,
1532 + M_FORMAT_ARROWCURSOR);
1533 + f->desc = safe_strdup (buffer); */
1534 + if (menu->current + 1 < menu->max)
1536 + menu->redraw = REDRAW_MOTION_RESYNCH;
1541 + case OP_LOAD_ACTIVE:
1542 + if (!option (OPTNEWS))
1549 + for (tmp = CurrentNewsSrv->list; tmp; tmp = tmp->next)
1551 + if ((data = (NNTP_DATA *)tmp->data))
1552 + data->deleted = 1;
1555 + nntp_get_active (CurrentNewsSrv);
1557 + destroy_state (&state);
1559 + examine_mailboxes (menu, &state);
1561 + examine_directory (menu, &state, NULL, NULL);
1562 + init_menu (&state, menu, title, sizeof (title), buffy, 1);
1564 +#endif /* USE_NNTP */
1566 +#if defined USE_IMAP || defined USE_NNTP
1567 + case OP_BROWSER_SUBSCRIBE:
1568 + case OP_BROWSER_UNSUBSCRIBE:
1571 + case OP_SUBSCRIBE_PATTERN:
1572 + case OP_UNSUBSCRIBE_PATTERN:
1573 + if (option (OPTNEWS))
1575 + regex_t *rx = (regex_t *) safe_malloc (sizeof (regex_t));
1577 + int j = menu->current;
1579 + NNTP_SERVER *news = CurrentNewsSrv;
1581 + if (i == OP_SUBSCRIBE_PATTERN || i == OP_UNSUBSCRIBE_PATTERN)
1587 + if (i == OP_SUBSCRIBE_PATTERN)
1588 + snprintf (tmp, sizeof (tmp), _("Subscribe pattern: "));
1590 + snprintf (tmp, sizeof (tmp), _("Unsubscribe pattern: "));
1591 + if (mutt_get_field (tmp, buf, sizeof (buf), 0) != 0 || !buf[0])
1597 + if ((err = REGCOMP (rx, s, REG_NOSUB)) != 0)
1599 + regerror (err, rx, buf, sizeof (buf));
1601 + safe_free ((void **) &rx);
1602 + mutt_error ("%s", buf);
1605 + menu->redraw = REDRAW_FULL;
1608 + else if (!state.entrylen)
1610 + mutt_error _("No newsgroups match the mask");
1614 + for ( ; j < state.entrylen; j++)
1616 + struct folder_file *f = &state.entry[j];
1618 + if (i == OP_BROWSER_SUBSCRIBE || i == OP_BROWSER_UNSUBSCRIBE ||
1619 + regexec (rx, f->name, 0, NULL, 0) == 0)
1621 + if (i == OP_BROWSER_SUBSCRIBE || i == OP_SUBSCRIBE_PATTERN)
1622 + nd = mutt_newsgroup_subscribe (news, f->name);
1624 + nd = mutt_newsgroup_unsubscribe (news, f->name);
1628 + char buffer[_POSIX_PATH_MAX + SHORT_STRING];
1630 + folder.name = f->name;
1632 + folder.new = nd->new;
1634 + safe_free ((void **) &f->desc);
1635 + mutt_FormatString (buffer, sizeof (buffer), NONULL(GroupFormat),
1636 + newsgroup_format_str, (unsigned long) &folder,
1637 + M_FORMAT_ARROWCURSOR);
1638 + f->desc = safe_strdup (buffer);
1641 + if (i == OP_BROWSER_SUBSCRIBE || i == OP_BROWSER_UNSUBSCRIBE)
1643 + if (menu->current + 1 < menu->max)
1645 + menu->redraw = REDRAW_MOTION_RESYNCH;
1649 + if (i == OP_SUBSCRIBE_PATTERN)
1651 + LIST *grouplist = NULL;
1654 + grouplist = news->list;
1655 + for (; grouplist; grouplist = grouplist->next)
1657 + nd = (NNTP_DATA *) grouplist->data;
1658 + if (nd && nd->group && !nd->subscribed)
1660 + if (regexec (rx, nd->group, 0, NULL, 0) == 0)
1662 + mutt_newsgroup_subscribe (news, nd->group);
1663 + add_folder (menu, &state, nd->group, NULL, nd, nd->new);
1667 + init_menu (&state, menu, title, sizeof (title), buffy, 1);
1669 + mutt_newsrc_update (news);
1670 + nntp_clear_cacheindex (news);
1671 + if (i != OP_BROWSER_SUBSCRIBE && i != OP_BROWSER_UNSUBSCRIBE)
1673 + safe_free ((void **) &rx);
1677 +#endif /* USE_IMAP && USE_NNTP */
1678 +#endif /* USE_NNTP */
1681 + if (i == OP_BROWSER_SUBSCRIBE)
1682 + imap_subscribe (state.entry[menu->current].name, 1);
1684 + imap_subscribe (state.entry[menu->current].name, 0);
1686 +#endif /* USE_IMAP */
1690 diff -uNr mutt-1.4.orig/browser.h mutt-1.4/browser.h
1691 --- mutt-1.4.orig/browser.h Mon Aug 21 17:42:20 2000
1692 +++ mutt-1.4/browser.h Sun Nov 3 21:57:20 2002
1695 #define _BROWSER_H 1
1705 unsigned selectable : 1;
1706 unsigned inferiors : 1;
1711 unsigned tagged : 1;
1714 struct browser_state
1716 struct folder_file *entry;
1717 - short entrylen; /* number of real entries */
1718 - short entrymax; /* max entry */
1719 + unsigned int entrylen; /* number of real entries */
1720 + unsigned int entrymax; /* max entry */
1724 diff -uNr mutt-1.4.orig/buffy.c mutt-1.4/buffy.c
1725 --- mutt-1.4.orig/buffy.c Mon Mar 25 12:30:08 2002
1726 +++ mutt-1.4/buffy.c Sun Nov 3 21:57:20 2002
1729 if (!Context || Context->magic != M_POP)
1732 + if (!Context || Context->magic != M_NNTP)
1734 /* check device ID and serial number instead of comparing paths */
1735 if (!Context || !Context->path || stat (Context->path, &contex_sb) != 0)
1737 @@ -278,6 +281,11 @@
1742 + if ((tmp->magic == M_NNTP) || mx_is_nntp (tmp->path))
1743 + tmp->magic = M_NNTP;
1746 if (stat (tmp->path, &sb) != 0 || sb.st_size == 0 ||
1747 (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0))
1749 @@ -294,25 +302,21 @@
1750 /* check to see if the folder is the currently selected folder
1752 if (!Context || !Context->path ||
1753 -#if defined USE_IMAP || defined USE_POP
1758 - tmp->magic == M_IMAP
1759 + || tmp->magic == M_IMAP
1765 - tmp->magic == M_POP
1766 + || tmp->magic == M_POP
1768 - ) ? mutt_strcmp (tmp->path, Context->path) :
1770 + || tmp->magic == M_NNTP
1772 - (sb.st_dev != contex_sb.st_dev || sb.st_ino != contex_sb.st_ino)
1773 -#if defined USE_IMAP || defined USE_POP
1778 + ) ? mutt_strcmp (tmp->path, Context->path) :
1779 + (sb.st_dev != contex_sb.st_dev || sb.st_ino != contex_sb.st_ino)
1785 @@ -380,6 +384,11 @@
1797 diff -uNr mutt-1.4.orig/commands.c mutt-1.4/commands.c
1798 --- mutt-1.4.orig/commands.c Sun Nov 3 21:42:52 2002
1799 +++ mutt-1.4/commands.c Sun Nov 3 21:57:20 2002
1804 +#include "rfc1524.h"
1805 #include <sys/types.h>
1806 #include <sys/stat.h>
1808 @@ -791,6 +792,131 @@
1812 +int mutt_update_list_file (char *filename, char *section, char *key, char *line)
1816 + char buf[HUGE_STRING];
1817 + char oldfile[_POSIX_PATH_MAX];
1819 + int ext = 0, done = 0, r = 0;
1821 + snprintf (oldfile, sizeof(oldfile), "%s.bak", filename);
1822 + dprint (1, (debugfile, "Renaming %s to %s\n", filename, oldfile));
1824 + /* if file not exist, create it */
1825 + if ((ifp = safe_fopen (filename, "a")))
1827 + if (_mutt_rename_file (filename, oldfile, 1))
1829 + mutt_perror _("Unable to create backup file");
1832 + dprint (1, (debugfile, "Opening %s\n", oldfile));
1833 + if (!(ifp = safe_fopen (oldfile, "r")))
1835 + mutt_perror _("Unable to open backup file for reading");
1838 + dprint (1, (debugfile, "Opening %s\n", filename));
1839 + if (!(ofp = fopen (filename, "w")))
1842 + mutt_perror _("Unable to open new file for writing");
1845 + if (mx_lock_file (filename, fileno (ofp), 1, 0, 1))
1849 + mutt_error (_("Unable to lock %s, old file saved as %s"), filename, oldfile);
1855 + while (r != EOF && !done && fgets (buf, sizeof (buf), ifp))
1857 + r = fputs (buf, ofp);
1859 + while (*c && *c != '\n') c++;
1860 + c[0] = 0; /* strip EOL */
1861 + if (!strncmp (buf, "#: ", 3) && !mutt_strcasecmp (buf+3, section))
1864 + if (r != EOF && !done)
1866 + snprintf (buf, sizeof(buf), "#: %s\n", section);
1867 + r = fputs (buf, ofp);
1872 + while (r != EOF && fgets (buf, sizeof (buf), ifp))
1877 + while (*c && (*c != '\r') && (*c != '\n')) c++;
1879 + if (*c != '\\') ext = 0;
1881 + else if ((section && !strncmp (buf, "#: ", 3)))
1883 + if (!done && line)
1885 + fputs (line, ofp);
1886 + fputc ('\n', ofp);
1888 + r = fputs (buf, ofp);
1892 + else if (key && !strncmp (buf, key, strlen(key)) &&
1893 + (!*key || buf[strlen(key)] == ' '))
1897 + while (*c && (*c != '\r') && (*c != '\n')) c++;
1899 + if (*c == '\\') ext = 1;
1900 + if (!done && line)
1902 + r = fputs (line, ofp);
1904 + r = fputc ('\n', ofp);
1910 + r = fputs (buf, ofp);
1914 + while (r != EOF && fgets (buf, sizeof (buf), ifp))
1915 + r = fputs (buf, ofp);
1917 + /* If there wasn't a line to replace, put it on the end of the file */
1918 + if (r != EOF && !done && line)
1920 + fputs (line, ofp);
1921 + r = fputc ('\n', ofp);
1923 + mx_unlock_file (filename, fileno (ofp), 0);
1931 + unlink (filename);
1932 + mutt_error (_("Cannot write new %s, old file saved as %s"), filename,
1938 void mutt_version (void)
1940 diff -uNr mutt-1.4.orig/complete.c mutt-1.4/complete.c
1941 --- mutt-1.4.orig/complete.c Wed Nov 7 11:22:08 2001
1942 +++ mutt-1.4/complete.c Sun Nov 3 21:57:20 2002
1944 #include "mailbox.h"
1954 char filepart[_POSIX_PATH_MAX];
1956 char imap_path[LONG_STRING];
1959 dprint (2, (debugfile, "mutt_complete: completing %s\n", s));
1962 + if (option (OPTNEWS))
1964 + LIST *l = CurrentNewsSrv->list;
1966 + strfcpy (filepart, s, sizeof (filepart));
1969 + * special case to handle when there is no filepart yet.
1970 + * find the first subscribed newsgroup
1972 + if ((len = mutt_strlen (filepart)) == 0)
1974 + for (; l; l = l->next)
1976 + NNTP_DATA *data = (NNTP_DATA *)l->data;
1978 + if (data && data->subscribed)
1980 + strfcpy (filepart, data->group, sizeof (filepart));
1988 + for (; l; l = l->next)
1990 + NNTP_DATA *data = (NNTP_DATA *)l->data;
1992 + if (data && data->subscribed &&
1993 + mutt_strncmp (data->group, filepart, len) == 0)
1997 + for (i = 0; filepart[i] && data->group[i]; i++)
1999 + if (filepart[i] != data->group[i])
2009 + strfcpy (filepart, data->group, sizeof (filepart));
2015 + strcpy (s, filepart);
2017 + return (init ? 0 : -1);
2022 /* we can use '/' as a delimiter, imap_complete rewrites it */
2023 if (*s == '=' || *s == '+' || *s == '!')
2025 diff -uNr mutt-1.4.orig/compose.c mutt-1.4/compose.c
2026 --- mutt-1.4.orig/compose.c Sun Nov 3 21:42:52 2002
2027 +++ mutt-1.4/compose.c Sun Nov 3 21:57:20 2002
2029 #include "mailbox.h"
2031 #include "charset.h"
2035 #include "remailer.h"
2055 HDR_ATTACH = (HDR_FCC + 5) /* where to start printing the attachments */
2058 -#define HDR_XOFFSET 10
2059 -#define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
2060 +#define HDR_XOFFSET 14
2061 +#define TITLE_FMT "%14s" /* Used for Prompts, which are ASCII */
2062 #define W (COLS - HDR_XOFFSET)
2064 static char *Prompts[] =
2080 static struct mapping_t ComposeHelp[] = {
2086 +static struct mapping_t ComposeNewsHelp[] = {
2087 + { N_("Send"), OP_COMPOSE_SEND_MESSAGE },
2088 + { N_("Abort"), OP_EXIT },
2089 + { "Newsgroups", OP_COMPOSE_EDIT_NEWSGROUPS },
2090 + { "Subj", OP_COMPOSE_EDIT_SUBJECT },
2091 + { N_("Attach file"), OP_COMPOSE_ATTACH_FILE },
2092 + { N_("Descrip"), OP_COMPOSE_EDIT_DESCRIPTION },
2093 + { N_("Help"), OP_HELP },
2098 static void snd_entry (char *b, size_t blen, MUTTMENU *menu, int num)
2100 mutt_FormatString (b, blen, NONULL (AttachFormat), mutt_attach_fmt,
2103 static void redraw_pgp_lines (int pgp)
2105 - mvaddstr (HDR_PGP, 0, " PGP: ");
2106 + mvaddstr (HDR_PGP, 0, " PGP: ");
2107 if ((pgp & (PGPENCRYPT | PGPSIGN)) == (PGPENCRYPT | PGPSIGN))
2108 addstr (_("Sign, Encrypt"));
2109 else if (pgp & PGPENCRYPT)
2111 move (HDR_PGPSIGINFO, 0);
2114 - printw ("%s%s", _(" sign as: "), PgpSignAs ? PgpSignAs : _("<default>"));
2115 + printw (" %s%s", _(" sign as: "), PgpSignAs ? PgpSignAs : _("<default>"));
2118 static int pgp_send_menu (int bits, int *redraw)
2119 @@ -258,9 +291,28 @@
2120 static void draw_envelope (HEADER *msg, char *fcc)
2122 draw_envelope_addr (HDR_FROM, msg->env->from);
2124 + if (!option (OPTNEWSSEND))
2127 draw_envelope_addr (HDR_TO, msg->env->to);
2128 draw_envelope_addr (HDR_CC, msg->env->cc);
2129 draw_envelope_addr (HDR_BCC, msg->env->bcc);
2134 + mvprintw (HDR_TO, 0, TITLE_FMT , Prompts[HDR_NEWSGROUPS - 1]);
2135 + mutt_paddstr (W, NONULL (msg->env->newsgroups));
2136 + mvprintw (HDR_CC, 0, TITLE_FMT , Prompts[HDR_FOLLOWUPTO - 1]);
2137 + mutt_paddstr (W, NONULL (msg->env->followup_to));
2138 + if (option (OPTXCOMMENTTO))
2140 + mvprintw (HDR_BCC, 0, TITLE_FMT , Prompts[HDR_XCOMMENTTO - 1]);
2141 + mutt_paddstr (W, NONULL (msg->env->x_comment_to));
2145 mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
2146 mutt_paddstr (W, NONULL (msg->env->subject));
2147 draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
2148 @@ -506,6 +558,12 @@
2149 /* Sort, SortAux could be changed in mutt_index_menu() */
2150 int oldSort, oldSortAux;
2153 + int news = 0; /* is it a news article ? */
2155 + if (option (OPTNEWSSEND))
2159 mutt_attach_init (msg->content);
2160 idx = mutt_gen_attach_list (msg->content, -1, idx, &idxlen, &idxmax, 0, 1);
2161 @@ -517,10 +575,18 @@
2162 menu->make_entry = snd_entry;
2163 menu->tag = mutt_tag_attach;
2167 + menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_COMPOSE, ComposeNewsHelp);
2170 menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_COMPOSE, ComposeHelp);
2175 + unset_option (OPTNEWS); /* for any case */
2177 switch (op = mutt_menuLoop (menu))
2180 @@ -532,14 +598,81 @@
2181 menu->redraw = edit_address_list (HDR_FROM, &msg->env->from);
2183 case OP_COMPOSE_EDIT_TO:
2184 - menu->redraw = edit_address_list (HDR_TO, &msg->env->to);
2188 + menu->redraw = edit_address_list (HDR_TO, &msg->env->to);
2190 case OP_COMPOSE_EDIT_BCC:
2191 - menu->redraw = edit_address_list (HDR_BCC, &msg->env->bcc);
2195 + menu->redraw = edit_address_list (HDR_BCC, &msg->env->bcc);
2197 case OP_COMPOSE_EDIT_CC:
2198 - menu->redraw = edit_address_list (HDR_CC, &msg->env->cc);
2202 + menu->redraw = edit_address_list (HDR_CC, &msg->env->cc);
2205 + case OP_COMPOSE_EDIT_NEWSGROUPS:
2208 + if (msg->env->newsgroups)
2209 + strfcpy (buf, msg->env->newsgroups, sizeof (buf));
2212 + if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) == 0 && buf[0])
2214 + safe_free ((void **) &msg->env->newsgroups);
2215 + mutt_remove_trailing_ws (buf);
2216 + msg->env->newsgroups = safe_strdup (mutt_skip_whitespace (buf));
2217 + move (HDR_TO, HDR_XOFFSET);
2219 + if (msg->env->newsgroups)
2220 + printw ("%-*.*s", W, W, msg->env->newsgroups);
2225 + case OP_COMPOSE_EDIT_FOLLOWUP_TO:
2229 + if (msg->env->followup_to)
2230 + strfcpy (buf, msg->env->followup_to, sizeof (buf));
2231 + if (mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) == 0 && buf[0])
2233 + safe_free ((void **) &msg->env->followup_to);
2234 + mutt_remove_trailing_ws (buf);
2235 + msg->env->followup_to = safe_strdup (mutt_skip_whitespace (buf));
2236 + move (HDR_CC, HDR_XOFFSET);
2238 + if (msg->env->followup_to)
2239 + printw ("%-*.*s", W, W, msg->env->followup_to);
2244 + case OP_COMPOSE_EDIT_X_COMMENT_TO:
2245 + if (news && option (OPTXCOMMENTTO))
2248 + if (msg->env->x_comment_to)
2249 + strfcpy (buf, msg->env->x_comment_to, sizeof (buf));
2250 + if (mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) == 0 && buf[0])
2252 + safe_free ((void **) &msg->env->x_comment_to);
2253 + msg->env->x_comment_to = safe_strdup (buf);
2254 + move (HDR_BCC, HDR_XOFFSET);
2256 + if (msg->env->x_comment_to)
2257 + printw ("%-*.*s", W, W, msg->env->x_comment_to);
2262 case OP_COMPOSE_EDIT_SUBJECT:
2263 if (msg->env->subject)
2264 strfcpy (buf, msg->env->subject, sizeof (buf));
2268 case OP_COMPOSE_ATTACH_MESSAGE:
2270 + case OP_COMPOSE_ATTACH_NEWS_MESSAGE:
2275 @@ -702,7 +838,22 @@
2277 prompt = _("Open mailbox to attach message from");
2280 + unset_option (OPTNEWS);
2281 + if (op == OP_COMPOSE_ATTACH_NEWS_MESSAGE)
2283 + if (!(CurrentNewsSrv = mutt_select_newsserver (NewsServer)))
2286 + prompt = _("Open newsgroup to attach message from");
2287 + set_option (OPTNEWS);
2293 + if ((op == OP_COMPOSE_ATTACH_MESSAGE) ^ (Context->magic == M_NNTP))
2296 strfcpy (fname, NONULL (Context->path), sizeof (fname));
2297 mutt_pretty_mailbox (fname);
2298 @@ -711,6 +862,11 @@
2299 if (mutt_enter_fname (prompt, fname, sizeof (fname), &menu->redraw, 1) == -1 || !fname[0])
2303 + if (option (OPTNEWS))
2304 + nntp_expand_path (fname, sizeof (fname), &CurrentNewsSrv->conn->account);
2307 mutt_expand_path (fname, sizeof (fname));
2309 if (!mx_is_imap (fname))
2312 if (!mx_is_pop (fname))
2315 + if (!mx_is_nntp (fname) && !option (OPTNEWS))
2317 /* check to make sure the file exists and is readable */
2318 if (access (fname, R_OK) == -1)
2320 diff -uNr mutt-1.4.orig/configure.in mutt-1.4/configure.in
2321 --- mutt-1.4.orig/configure.in Sun Nov 3 21:42:52 2002
2322 +++ mutt-1.4/configure.in Sun Nov 3 21:57:20 2002
2323 @@ -457,6 +457,14 @@
2325 AM_CONDITIONAL(BUILD_IMAP, test x$need_imap = xyes)
2327 +AC_ARG_ENABLE(nntp, [ --enable-nntp Enable NNTP support],
2328 +[ if test x$enableval = xyes ; then
2329 + AC_DEFINE(USE_NNTP)
2330 + MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS nntp.o newsrc.o"
2335 dnl -- end socket dependencies --
2337 if test "$need_socket" = "yes"
2338 diff -uNr mutt-1.4.orig/curs_main.c mutt-1.4/curs_main.c
2339 --- mutt-1.4.orig/curs_main.c Sun Nov 3 21:42:52 2002
2340 +++ mutt-1.4/curs_main.c Sun Nov 3 21:57:20 2002
2344 #include "mutt_curses.h"
2346 #include "mutt_menu.h"
2347 #include "mailbox.h"
2348 #include "mapping.h"
2360 @@ -405,12 +410,27 @@
2365 +struct mapping_t IndexNewsHelp[] = {
2366 + { N_("Quit"), OP_QUIT },
2367 + { N_("Del"), OP_DELETE },
2368 + { N_("Undel"), OP_UNDELETE },
2369 + { N_("Save"), OP_SAVE },
2370 + { N_("Post"), OP_POST },
2371 + { N_("Followup"), OP_FOLLOWUP },
2372 + { N_("Catchup"), OP_CATCHUP },
2373 + { N_("Help"), OP_HELP },
2378 /* This function handles the message index window as well as commands returned
2379 * from the pager (MENU_PAGER).
2381 int mutt_index_menu (void)
2383 char buf[LONG_STRING], helpstr[SHORT_STRING];
2386 int done = 0; /* controls when to exit the "event" loop */
2388 @@ -432,7 +452,11 @@
2389 menu->make_entry = index_make_entry;
2390 menu->color = index_color;
2391 menu->current = ci_first_message ();
2392 - menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN, IndexHelp);
2393 + menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN,
2395 + (Context && (Context->magic == M_NNTP)) ? IndexNewsHelp :
2400 mutt_buffy_check(1); /* force the buffy check after we enter the folder */
2402 mutt_curs_set (1); /* fallback from the pager */
2406 + unset_option (OPTNEWS); /* for any case */
2411 @@ -683,6 +710,120 @@
2412 menu_current_bottom (menu);
2416 + case OP_GET_MESSAGE:
2417 + case OP_GET_PARENT:
2419 + if (Context->magic == M_NNTP)
2423 + if (op == OP_GET_MESSAGE)
2426 + if (mutt_get_field (_("Enter Message-Id: "), buf, sizeof (buf), 0) != 0
2432 + LIST *ref = CURHDR->env->references;
2435 + mutt_error _("Article has no parent reference!");
2438 + strfcpy (buf, ref->data, sizeof (buf));
2440 + if (!Context->id_hash)
2441 + Context->id_hash = mutt_make_id_hash (Context);
2442 + if ((h = hash_find (Context->id_hash, buf)))
2444 + if (h->virtual != -1)
2446 + menu->current = h->virtual;
2447 + menu->redraw = REDRAW_MOTION_RESYNCH;
2449 + else if (h->collapsed)
2451 + mutt_uncollapse_thread (Context, h);
2452 + mutt_set_virtual (Context);
2453 + menu->current = h->virtual;
2454 + menu->redraw = REDRAW_MOTION_RESYNCH;
2457 + mutt_error _("Message not visible in limited view.");
2461 + if (nntp_check_msgid (Context, buf) == 0)
2463 + h = Context->hdrs[Context->msgcount-1];
2464 + mutt_sort_headers (Context, 0);
2465 + menu->current = h->virtual;
2466 + menu->redraw = REDRAW_FULL;
2469 + mutt_error (_("Article %s not found on server"), buf);
2474 + case OP_GET_CHILDREN:
2475 + case OP_RECONSTRUCT_THREAD:
2477 + if (Context->magic == M_NNTP)
2480 + int old = CURHDR->index, i;
2482 + if (!CURHDR->env->message_id)
2484 + mutt_error _("No Message-Id. Unable to perform operation");
2488 + if (!Context->id_hash)
2489 + Context->id_hash = mutt_make_id_hash (Context);
2490 + strfcpy (buf, CURHDR->env->message_id, sizeof (buf));
2492 + if (op == OP_RECONSTRUCT_THREAD)
2494 + LIST *ref = CURHDR->env->references;
2497 + nntp_check_msgid (Context, ref->data);
2498 + /* the last msgid in References is the root message */
2500 + strfcpy (buf, ref->data, sizeof (buf));
2504 + mutt_message _("Check for children of message...");
2505 + if (nntp_check_children (Context, buf) == 0)
2507 + mutt_sort_headers (Context, (op == OP_RECONSTRUCT_THREAD));
2508 + h = hash_find (Context->id_hash, buf);
2509 + /* if the root message was retrieved, move to it */
2511 + menu->current = h->virtual;
2512 + else /* try to restore old position */
2513 + for (i = 0; i < Context->msgcount; i++)
2514 + if (Context->hdrs[i]->index == old)
2516 + menu->current = Context->hdrs[i]->virtual;
2517 + /* As an added courtesy, recenter the menu
2518 + * with the current entry at the middle of the screen */
2519 + menu_check_recenter (menu);
2520 + menu_current_middle (menu);
2523 + menu->redraw = REDRAW_FULL;
2524 + mutt_clear_error ();
2532 @@ -778,11 +919,33 @@
2536 + case OP_TOGGLE_READ:
2539 menu->oldcurrent = (Context->vcount && menu->current >= 0 && menu->current < Context->vcount) ?
2541 - if (mutt_pattern_func (M_LIMIT, _("Limit to messages matching: ")) == 0)
2542 + if (op == OP_TOGGLE_READ)
2544 + char buf[LONG_STRING];
2546 + if (!Context->pattern || strncmp (Context->pattern, "!~R!~D~s", 8) != 0)
2548 + snprintf (buf, sizeof (buf), "!~R!~D~s%s",
2549 + Context->pattern ? Context->pattern : ".*");
2550 + set_option (OPTHIDEREAD);
2554 + strfcpy (buf, Context->pattern + 8, sizeof(buf));
2555 + if (!*buf || strncmp (buf, ".*", 2) == 0)
2556 + snprintf (buf, sizeof(buf), "~A");
2557 + unset_option (OPTHIDEREAD);
2559 + FREE (&Context->pattern);
2560 + Context->pattern = safe_strdup (buf);
2562 + if ((op == OP_TOGGLE_READ && mutt_pattern_func (M_LIMIT, NULL) == 0) ||
2563 + mutt_pattern_func (M_LIMIT, _("Limit to messages matching: ")) == 0)
2565 if (menu->oldcurrent >= 0)
2567 @@ -980,20 +1143,43 @@
2570 case OP_MAIN_CHANGE_FOLDER:
2573 - op = OP_MAIN_CHANGE_FOLDER_READONLY;
2575 - /* fallback to the readonly case */
2577 case OP_MAIN_CHANGE_FOLDER_READONLY:
2579 + case OP_MAIN_CHANGE_GROUP:
2580 + case OP_MAIN_CHANGE_GROUP_READONLY:
2583 + if (attach_msg || option (OPTREADONLY) ||
2585 + op == OP_MAIN_CHANGE_GROUP_READONLY ||
2587 + op == OP_MAIN_CHANGE_FOLDER_READONLY)
2588 + flags = M_READONLY;
2592 - if ((op == OP_MAIN_CHANGE_FOLDER_READONLY) || option (OPTREADONLY))
2594 cp = _("Open mailbox in read-only mode");
2596 cp = _("Open mailbox");
2600 + unset_option (OPTNEWS);
2601 + if (op == OP_MAIN_CHANGE_GROUP ||
2602 + op == OP_MAIN_CHANGE_GROUP_READONLY)
2604 + set_option (OPTNEWS);
2605 + if (!(CurrentNewsSrv = mutt_select_newsserver (NewsServer)))
2608 + cp = _("Open newsgroup in read-only mode");
2610 + cp = _("Open newsgroup");
2615 mutt_buffy (buf, sizeof (buf));
2617 if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
2618 @@ -1004,6 +1190,14 @@
2623 + if (option (OPTNEWS))
2625 + unset_option (OPTNEWS);
2626 + nntp_expand_path (buf, sizeof (buf), &CurrentNewsSrv->conn->account);
2630 mutt_expand_path (buf, sizeof (buf));
2631 if (mx_get_magic (buf) <= 0)
2633 @@ -1039,15 +1233,18 @@
2635 mutt_folder_hook (buf);
2637 - if ((Context = mx_open_mailbox (buf,
2638 - (option (OPTREADONLY) || op == OP_MAIN_CHANGE_FOLDER_READONLY) ?
2639 - M_READONLY : 0, NULL)) != NULL)
2640 + if ((Context = mx_open_mailbox (buf, flags, NULL)) != NULL)
2642 menu->current = ci_first_message ();
2648 + /* mutt_buffy_check() must be done with mail-reader mode! */
2649 + menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN,
2650 + (Context && (Context->magic == M_NNTP)) ? IndexNewsHelp : IndexHelp);
2652 mutt_clear_error ();
2653 mutt_buffy_check(1); /* force the buffy check after we have changed
2655 @@ -1422,6 +1619,15 @@
2660 + if (Context->magic == M_NNTP)
2663 + mutt_error _("Can't change 'important' flag on NNTP server.");
2670 for (j = 0; j < Context->vcount; j++)
2671 @@ -1767,6 +1973,17 @@
2677 + if (Context && Context->magic == M_NNTP)
2679 + if (mutt_newsgroup_catchup (CurrentNewsSrv,
2680 + ((NNTP_DATA *)Context->data)->group))
2681 + menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
2686 case OP_DISPLAY_ADDRESS:
2689 @@ -1801,6 +2018,15 @@
2694 + if (Context->magic == M_NNTP)
2697 + mutt_error _("Can't edit message on newsserver.");
2702 mutt_edit_message (Context, tag ? NULL : CURHDR);
2703 menu->redraw = REDRAW_FULL;
2705 @@ -1955,6 +2181,37 @@
2707 menu->redraw = REDRAW_FULL;
2713 + case OP_FORWARD_TO_GROUP:
2716 + if (op != OP_FOLLOWUP || !CURHDR->env->followup_to ||
2717 + mutt_strcasecmp (CURHDR->env->followup_to, "poster") ||
2718 + query_quadoption (OPT_FOLLOWUPTOPOSTER,_("Reply by mail as poster prefers?")) != M_YES)
2720 + if (Context && Context->magic == M_NNTP &&
2721 + !((NNTP_DATA *)Context->data)->allowed &&
2722 + query_quadoption (OPT_TOMODERATED, _("Posting to this group not allowed, may be moderated. Continue?")) != M_YES)
2724 + if (op == OP_POST)
2725 + ci_send_message (SENDNEWS, NULL, NULL, Context, NULL);
2729 + if (op == OP_FOLLOWUP)
2730 + ci_send_message (SENDNEWS|SENDREPLY, NULL, NULL, Context,
2731 + tag ? NULL : CURHDR);
2733 + ci_send_message (SENDNEWS|SENDFORWARD, NULL, NULL, Context,
2734 + tag ? NULL : CURHDR);
2736 + menu->redraw = REDRAW_FULL;
2743 @@ -2081,6 +2338,12 @@
2748 + /* Close all open NNTP connections */
2750 + nntp_logout_all ();
2754 mutt_menuDestroy (&menu);
2756 diff -uNr mutt-1.4.orig/doc/manual.sgml mutt-1.4/doc/manual.sgml
2757 --- mutt-1.4.orig/doc/manual.sgml Sun Nov 3 21:42:51 2002
2758 +++ mutt-1.4/doc/manual.sgml Sun Nov 3 21:57:20 2002
2759 @@ -723,6 +723,17 @@
2761 See also the <ref id="postpone" name="$postpone"> quad-option.
2763 +<sect1>Reading news via NNTP<label id="reading_news">
2766 +If compiled with ``--enable-nntp'' option, Mutt can read news from newsserver
2767 +via NNTP. You can open a newsgroup with function ``change-newsgroup''
2768 +(default: i). Default newsserver can be obtained from <em/NNTPSERVER/
2769 +environment variable. Like other news readers, info about subscribed
2770 +newsgroups is saved in file by <ref id="newsrc" name="$newsrc">
2771 +variable. Article headers are cached and can be loaded from file when
2772 +newsgroup entered instead loading from newsserver.
2777 @@ -3262,6 +3273,26 @@
2778 editing the body of an outgoing message.
2781 +<sect2>ask_follow_up<label id="ask_follow_up">
2783 +Type: boolean<newline>
2787 +If set, Mutt will prompt you for follow-up groups before editing
2788 +the body of an outgoing message.
2791 +<sect2>ask_x_comment_to<label id="ask_x_comment_to">
2793 +Type: boolean<newline>
2797 +If set, Mutt will prompt you for x-comment-to field before editing
2798 +the body of an outgoing message.
2801 <sect2>attach_format<label id="attach_format">
2803 Type: string<newline>
2804 @@ -3379,6 +3410,16 @@
2805 bouncing messages. Postfix users may wish to unset this variable.
2808 +<sect2>catchup_newsgroup<label id="catchup_newsgroup">
2810 +Type: quadoption<newline>
2814 +If this variable is <em>set</em>, Mutt will mark all articles in newsgroup
2815 +as read when you quit the newsgroup (catchup newsgroup).
2818 <sect2>charset<label id="charset">
2820 Type: string<newline>
2821 @@ -3781,6 +3822,18 @@
2822 resulting in two copies of the same email for you.
2825 +<sect2>followup_to_poster<label id="followup_to_poster">
2827 +Type: quadoption<newline>
2831 +If this variable is <em>set</em> and the keyword &dquot;poster&dquot; is present in
2832 +<em>Followup-To</em> header, follow-up to newsgroup function is not
2833 +permitted. The message will be mailed to the submitter of the
2837 <sect2>force_name<label id="force_name">
2839 Type: boolean<newline>
2840 @@ -3859,6 +3912,30 @@
2841 &dquot;Franklin&dquot; to &dquot;Franklin, Steve&dquot;.
2844 +<sect2>group_index_format<label id="group_index_format">
2846 +Type: string<newline>
2847 +Default: &dquot;%4C %M%N %5s %-45.45f %d&dquot;
2850 +This variable allows you to customize the newsgroup browser display to
2851 +your personal taste. This string is similar to ``<ref id="index_format" name="index_format">'', but
2852 +has its own set of printf()-like sequences:
2856 +%C current newsgroup number
2857 +%d description of newsgroup (becomes from server)
2859 +%M - if newsgroup not allowed for direct post (moderated for example)
2860 +%N N if newsgroup is new, u if unsubscribed, blank otherwise
2861 +%n number of new articles in newsgroup
2862 +%s number of unread articles in newsgroup
2863 +%>X right justify the rest of the string and pad with character "X"
2864 +%|X pad to the end of the line with character "X"
2868 <sect2>hdrs<label id="hdrs">
2870 Type: boolean<newline>
2871 @@ -4203,6 +4280,7 @@
2872 <tag>%E </tag>number of messages in current thread
2873 <tag>%f </tag>entire From: line (address + real name)
2874 <tag>%F </tag>author name, or recipient name if the message is from you
2875 +<tag>%g </tag>newsgroup name (if compiled with nntp support)
2876 <tag>%i </tag>message-id of the current message
2877 <tag>%l </tag>number of lines in the message
2878 <tag>%L </tag>If an address in the To or CC header field matches an address
2879 @@ -4220,6 +4298,7 @@
2880 <tag>%T </tag>the appropriate character from the <ref id="to_chars" name="$to_chars"> string
2881 <tag>%u </tag>user (login) name of the author
2882 <tag>%v </tag>first name of the author, or the recipient if the message is from you
2883 +<tag>%W </tag>name of organization of author (`organization:' field)
2884 <tag>%y </tag>`x-label:' field, if present
2885 <tag>%Y </tag>`x-label' field, if present, and (1) not at part of a thread tree,
2886 (2) at the top of a thread, or (3) `x-label' is different from
2887 @@ -4244,6 +4323,24 @@
2888 See also: ``<ref id="to_chars" name="$to_chars">''.
2891 +<sect2>inews<label id="inews">
2893 +Type: path<newline>
2894 +Default: &dquot;&dquot;
2897 +If set, specifies the program and arguments used to deliver news posted
2898 +by Mutt. Otherwise, mutt posts article using current connection to
2899 +news server. The following printf-style sequence is understood:
2905 +</verb></tscreen><p>
2906 +Example: set inews=&dquot;/usr/local/bin/inews -hS&dquot;
2909 <sect2>ispell<label id="ispell">
2912 @@ -4491,6 +4588,17 @@
2913 be attached to the newly composed message if this option is set.
2916 +<sect2>mime_subject<label id="mime_subject">
2918 +Type: boolean<newline>
2922 +If <em>unset</em>, 8-bit ``subject:'' line in article header will not be
2923 +encoded according to RFC2047 to base64. This is useful when message
2924 +is Usenet article, because MIME for news is nonstandard feature.
2927 <sect2>mix_entry_format<label id="mix_entry_format">
2929 Type: string<newline>
2930 @@ -4544,6 +4652,112 @@
2931 escape sequences see the section on ``<ref id="index_format" name="$index_format">''.
2934 +<sect2>news_cache_dir<label id="news_cache_dir">
2936 +Type: path<newline>
2937 +Default: &dquot;˜/.mutt&dquot;
2940 +This variable pointing to directory where Mutt will save cached news
2941 +articles headers in. If <em>unset</em>, headers will not be saved at all
2942 +and will be reloaded each time when you enter to newsgroup.
2945 +<sect2>news_server<label id="news_server">
2947 +Type: string<newline>
2948 +Default: &dquot;&dquot;
2951 +This variable specifies domain name or address of NNTP server. It
2952 +defaults to the newsserver specified in the environment variable
2953 +$NNTPSERVER or contained in the file /etc/nntpserver. You can also
2954 +specify username and an alternative port for each newsserver, ie:
2956 +[nntp[s]://][username[:password]@]newsserver[:port]
2959 +<sect2>newsrc<label id="newsrc">
2961 +Type: path<newline>
2962 +Default: &dquot;˜/.newsrc&dquot;
2965 +The file, containing info about subscribed newsgroups - names and
2966 +indexes of read articles. The following printf-style sequence
2975 +<sect2>nntp_context<label id="nntp_context">
2977 +Type: number<newline>
2981 +This variable defines number of articles which will be in index when
2982 +newsgroup entered. If active newsgroup have more articles than this
2983 +number, oldest articles will be ignored. Also controls how many
2984 +articles headers will be saved in cache when you quit newsgroup.
2987 +<sect2>nntp_load_description<label id="nntp_load_description">
2989 +Type: boolean<newline>
2993 +This variable controls whether or not descriptions for each newsgroup
2994 +must be loaded when newsgroup is added to list (first time list
2995 +loading or new newsgroup adding).
2998 +<sect2>nntp_user<label id="nntp_user">
3000 +Type: string<newline>
3001 +Default: &dquot;&dquot;
3004 +Your login name on the NNTP server. If <em>unset</em> and NNTP server requires
3005 +authentification, Mutt will prompt you for your account name when you
3006 +connect to newsserver.
3009 +<sect2>nntp_pass<label id="nntp_pass">
3011 +Type: string<newline>
3012 +Default: &dquot;&dquot;
3015 +Your password for NNTP account.
3018 +<sect2>nntp_poll<label id="nntp_poll">
3020 +Type: number<newline>
3024 +The time in seconds until any operations on newsgroup except post new
3025 +article will cause recheck for new news. If set to 0, Mutt will
3026 +recheck newsgroup on each operation in index (stepping, read article,
3030 +<sect2>nntp_reconnect<label id="nntp_reconnect">
3032 +Type: quadoption<newline>
3036 +Controls whether or not Mutt will try to reconnect to newsserver when
3040 <sect2>pager<label id="pager">
3043 @@ -5240,6 +5454,18 @@
3044 string after the inclusion of a message which is being replied to.
3047 +<sect2>post_moderated<label id="post_moderated">
3049 +Type: quadoption<newline>
3053 +If set to <em>yes</em>, Mutt will post article to newsgroup that have
3054 +not permissions to posting (e.g. moderated). <bf>Note:</bf> if newsserver
3055 +does not support posting to that newsgroup or totally read-only, that
3056 +posting will not have an effect.
3059 <sect2>postpone<label id="postpone">
3061 Type: quadoption<newline>
3062 @@ -5723,6 +5949,38 @@
3063 shell from /etc/passwd is used.
3066 +<sect2>save_unsubscribed<label id="save_unsubscribed">
3068 +Type: boolean<newline>
3072 +When <em>set</em>, info about unsubscribed newsgroups will be saved into
3073 +``newsrc'' file and into cache.
3076 +<sect2>show_new_news<label id="show_new_news">
3078 +Type: boolean<newline>
3082 +If <em>set</em>, newsserver will be asked for new newsgroups on entering
3083 +the browser. Otherwise, it will be done only once for a newsserver.
3084 +Also controls whether or not number of new articles of subscribed
3085 +newsgroups will be then checked.
3088 +<sect2>show_only_unread<label id="show_only_unread">
3090 +Type: boolean<newline>
3094 +If <em>set</em>, only subscribed newsgroups that contain unread articles
3095 +will be displayed in browser.
3098 <sect2>sig_dashes<label id="sig_dashes">
3100 Type: boolean<newline>
3101 @@ -6189,6 +6447,17 @@
3105 +<sect2>use_ipv6<label id="use_ipv6">
3107 +Type: boolean<newline>
3111 +When <em>set</em>, Mutt will look for IPv6 addresses of hosts it tries to
3112 +contact. If this option is unset, Mutt will restrict itself to IPv4 addresses.
3113 +Normally, the default should work.
3116 <sect2>user_agent<label id="user_agent">
3118 Type: boolean<newline>
3119 @@ -6283,6 +6552,16 @@
3120 messages to be sent. Exim users may wish to use this.
3123 +<sect2>x_comment_to<label id="x_comment_to">
3125 +Type: boolean<newline>
3129 +If <em>set</em>, Mutt will add ``X-Comment-To:'' field (that contains full
3130 +name of original article author) to article that followuped to newsgroup.
3133 <sect1>Functions<label id="functions">
3135 The following is the list of available functions listed by the mapping
3136 diff -uNr mutt-1.4.orig/doc/manual.sgml.head mutt-1.4/doc/manual.sgml.head
3137 --- mutt-1.4.orig/doc/manual.sgml.head Sun Nov 3 21:42:52 2002
3138 +++ mutt-1.4/doc/manual.sgml.head Sun Nov 3 21:57:20 2002
3139 @@ -724,6 +724,17 @@
3141 See also the <ref id="postpone" name="$postpone"> quad-option.
3143 +<sect1>Reading news via NNTP<label id="reading_news">
3146 +If compiled with ``--enable-nntp'' option, Mutt can read news from newsserver
3147 +via NNTP. You can open a newsgroup with function ``change-newsgroup''
3148 +(default: i). Default newsserver can be obtained from <em/NNTPSERVER/
3149 +environment variable. Like other news readers, info about subscribed
3150 +newsgroups is saved in file by <ref id="newsrc" name="$newsrc">
3151 +variable. Article headers are cached and can be loaded from file when
3152 +newsgroup entered instead loading from newsserver.
3157 diff -uNr mutt-1.4.orig/doc/mutt.man mutt-1.4/doc/mutt.man
3158 --- mutt-1.4.orig/doc/mutt.man Thu Aug 30 14:55:37 2001
3159 +++ mutt-1.4/doc/mutt.man Sun Nov 3 21:57:20 2002
3165 -[-e \fIcmd\fP] [-F \fIfile\fP] [-m \fItype\fP] [-f \fIfile\fP]
3167 +[-e \fIcmd\fP] [-F \fIfile\fP] [-g \fIserver\fP] [-m \fItype\fP] [-f \fIfile\fP]
3172 Specify which mailbox to load.
3173 .IP "-F \fImuttrc\fP"
3174 Specify an initialization file to read instead of ~/.muttrc
3175 +.IP "-g \fIserver\fP"
3176 +Start Mutt with a listing of subscribed newsgroups at specified newsserver.
3178 +Start Mutt with a listing of subscribed newsgroups.
3181 .IP "-H \fIdraft\fP"
3182 diff -uNr mutt-1.4.orig/doc/muttrc.man mutt-1.4/doc/muttrc.man
3183 --- mutt-1.4.orig/doc/muttrc.man Sun Nov 3 21:42:51 2002
3184 +++ mutt-1.4/doc/muttrc.man Sun Nov 3 21:57:47 2002
3186 \fBpgp-hook\fP \fIpattern\fP \fIkey-id\fP
3187 The pgp-hook command provides a method by which you can
3188 specify the ID of the public key to be used when encrypting messages
3189 -to a certain recipient.
3190 +to a certain recipient. You may use multiple \fBpgp-hook\fPs with the
3191 +same \fIpattern\fP; multiple matching \fBpgp-hook\fPs result in the use
3192 +of multiple \fIkey-id\fPs for recipient.
3195 \fBopen-hook\fP \fIregexp\fP "\fIcommand\fP"
3196 @@ -622,6 +624,28 @@
3206 +If set, Mutt will prompt you for follow-up groups before editing
3207 +the body of an outgoing message.
3211 +.B ask_x_comment_to
3217 +If set, Mutt will prompt you for x-comment-to field before editing
3218 +the body of an outgoing message.
3225 @@ -773,6 +797,17 @@
3229 +.B catchup_newsgroup
3235 +If this variable is \fIset\fP, Mutt will mark all articles in newsgroup
3236 +as read when you quit the newsgroup (catchup newsgroup).
3243 @@ -990,7 +1025,7 @@
3247 -Default: \(lq/usr/local/bin/mutt_dotlock\(rq
3248 +Default: \(lq/usr/bin/mutt_dotlock\(rq
3251 Contains the path of the mutt_dotlock (8) binary to be used by
3252 @@ -1161,6 +1196,16 @@
3262 +Specifies the number of folder columns in folder browser.
3269 @@ -1235,6 +1280,19 @@
3273 +.B followup_to_poster
3279 +If this variable is \fIset\fP and the keyword \(rqposter\(rq is present in
3280 +\fIFollowup-To\fP header, follow-up to newsgroup function is not
3281 +permitted. The message will be mailed to the submitter of the
3289 @@ -1319,6 +1377,39 @@
3293 +.B group_index_format
3296 +Default: \(lq%4C %M%N %5s %-45.45f %d\(rq
3299 +This variable allows you to customize the newsgroup browser display to
3300 +your personal taste. This string is similar to \(lqindex_format\(rq, but
3301 +has its own set of printf()-like sequences:
3309 +%C current newsgroup number
3310 +%d description of newsgroup (becomes from server)
3312 +%M - if newsgroup not allowed for direct post (moderated for example)
3313 +%N N if newsgroup is new, u if unsubscribed, blank otherwise
3314 +%n number of new articles in newsgroup
3315 +%s number of unread articles in newsgroup
3316 +%>X right justify the rest of the string and pad with character \(rqX\(rq
3317 +%|X pad to the end of the line with character \(rqX\(rq
3329 @@ -1711,6 +1802,9 @@
3331 author name, or recipient name if the message is from you
3334 +newsgroup name (if compiled with nntp support)
3337 message-id of the current message
3339 @@ -1756,6 +1850,9 @@
3341 first name of the author, or the recipient if the message is from you
3344 +name of organization of author (`organization:' field)
3347 `x-label:' field, if present
3349 @@ -1798,10 +1895,37 @@
3359 +If set, specifies the program and arguments used to deliver news posted
3360 +by Mutt. Otherwise, mutt posts article using current connection to
3361 +news server. The following printf-style sequence is understood:
3376 +Example: set inews=\(rq/usr/local/bin/inews -hS\(rq
3383 -Default: \(lq/usr/bin/ispell\(rq
3384 +Default: \(lqispell\(rq
3387 How to invoke ispell (GNU's spell-checking software).
3388 @@ -2067,6 +2191,18 @@
3398 +If \fIunset\fP, 8-bit \(lqsubject:\(rq line in article header will not be
3399 +encoded according to RFC2047 to base64. This is useful when message
3400 +is Usenet article, because MIME for news is nonstandard feature.
3407 @@ -2131,6 +2267,142 @@
3417 +This variable controls the width of the thread tree when sorting by
3418 +threads. When set, it makes the tree approximately twice as narrow,
3419 +to allow more room the tree and message subjects. This is useful on
3427 +Default: \(lq~/.mutt\(rq
3430 +This variable pointing to directory where Mutt will save cached news
3431 +articles headers in. If \fIunset\fP, headers will not be saved at all
3432 +and will be reloaded each time when you enter to newsgroup.
3442 +This variable specifies domain name or address of NNTP server. It
3443 +defaults to the newsserver specified in the environment variable
3444 +$NNTPSERVER or contained in the file /etc/nntpserver. You can also
3445 +specify username and an alternative port for each newsserver, ie:
3447 +[nntp[s]://][username[:password]@]newsserver[:port]
3454 +Default: \(lq~/.newsrc\(rq
3457 +The file, containing info about subscribed newsgroups - names and
3458 +indexes of read articles. The following printf-style sequence
3482 +This variable defines number of articles which will be in index when
3483 +newsgroup entered. If active newsgroup have more articles than this
3484 +number, oldest articles will be ignored. Also controls how many
3485 +articles headers will be saved in cache when you quit newsgroup.
3489 +.B nntp_load_description
3495 +This variable controls whether or not descriptions for each newsgroup
3496 +must be loaded when newsgroup is added to list (first time list
3497 +loading or new newsgroup adding).
3507 +Your login name on the NNTP server. If \fIunset\fP and NNTP server requires
3508 +authentification, Mutt will prompt you for your account name when you
3509 +connect to newsserver.
3519 +Your password for NNTP account.
3529 +The time in seconds until any operations on newsgroup except post new
3530 +article will cause recheck for new news. If set to 0, Mutt will
3531 +recheck newsgroup on each operation in index (stepping, read article,
3542 +Controls whether or not Mutt will try to reconnect to newsserver when
3550 @@ -2207,6 +2479,19 @@
3554 +.B pgp_autoselectkey
3560 +If set, then a list of keys is not presented for selection when only
3561 +one matching key is available. This may be useful in conjunction with
3562 +the \fIpgp-hook\fP command (with \(lq$pgp_confirmhook\(rq set) and the
3563 +\(lq$pgp_ignore_subkeys\(rq variable.
3570 @@ -2234,6 +2519,19 @@
3580 +If set, then you will be prompted for confirmation of keys when using
3581 +the \fIpgp-hook\fP command. If unset, no such confirmation prompt will
3582 +be presented. This is generally considered unsafe, especially where
3583 +typos are concerned.
3587 .B pgp_ignore_subkeys
3590 @@ -2916,6 +3214,19 @@
3600 +If set to \fIyes\fP, Mutt will post article to newsgroup that have
3601 +not permissions to posting (e.g. moderated). \fBNote:\fP if newsserver
3602 +does not support posting to that newsgroup or totally read-only, that
3603 +posting will not have an effect.
3610 @@ -3056,6 +3367,29 @@
3620 +Controls whether or not empty lines will be quoted using
3621 +\(lqindent_string\(rq.
3631 +Controls how quoted lines will be quoted. If set, one quote
3632 +character will be added to the end of existing prefix. Otherwise,
3633 +quoted lines will be prepended by \(lqindent_string\(rq.
3639 Type: regular expression
3640 @@ -3455,6 +3789,41 @@
3644 +.B save_unsubscribed
3650 +When \fIset\fP, info about unsubscribed newsgroups will be saved into
3651 +\(lqnewsrc\(rq file and into cache.
3661 +If \fIset\fP, newsserver will be asked for new newsgroups on entering
3662 +the browser. Otherwise, it will be done only once for a newsserver.
3663 +Also controls whether or not number of new articles of subscribed
3664 +newsgroups will be then checked.
3668 +.B show_only_unread
3674 +If \fIset\fP, only subscribed newsgroups that contain unread articles
3675 +will be displayed in browser.
3682 @@ -3496,6 +3865,19 @@
3686 +.B signatures_directory
3692 +Specifies the path where your signatures are located. In the files of
3693 +this directory, the signatures are separated by blank lines and/or
3694 +sig_dashes (\(lq-- \(rq).
3695 +You can choose between these signatures from the compose menu.
3702 @@ -3788,6 +4170,11 @@
3704 currently active limit pattern, if any *
3707 +the current date and time. \(lqfmt\(rq is
3708 +expanded by the system call \(lqstrftime\(rq;
3709 +a leading bang disables locales
3712 right justify the rest of the string and pad with \(rqX\(rq
3714 @@ -3840,6 +4227,21 @@
3724 +This variable controls, if positive, the maximum interval in seconds
3725 +before the time in the status line is updated. It is checked at
3726 +every key press and after a keyboard $timeout.
3727 +If the value is zero, the status line will be updated at every check.
3728 +If it is negative, the status time will only be updated
3729 +if it necessary to update to the status line for some other reason.
3736 @@ -3960,6 +4362,18 @@
3746 +If set, this variable specifies the path of the trash folder where the
3747 +mails marked for deletion will be moved, instead of being irremediably
3755 @@ -4017,6 +4431,18 @@
3765 +When \fIset\fP, Mutt will look for IPv6 addresses of hosts it tries to
3766 +contact. If this option is unset, Mutt will restrict itself to IPv4 addresses.
3767 +Normally, the default should work.
3774 @@ -4118,6 +4544,17 @@
3775 messages to be sent. Exim users may wish to use this.
3785 +If \fIset\fP, Mutt will add \(lqX-Comment-To:\(rq field (that contains full
3786 +name of original article author) to article that followuped to newsgroup.
3792 diff -uNr mutt-1.4.orig/functions.h mutt-1.4/functions.h
3793 --- mutt-1.4.orig/functions.h Sun Nov 3 21:42:52 2002
3794 +++ mutt-1.4/functions.h Sun Nov 3 21:57:20 2002
3796 { "break-thread", OP_MAIN_BREAK_THREAD, "#" },
3797 { "change-folder", OP_MAIN_CHANGE_FOLDER, "c" },
3798 { "change-folder-readonly", OP_MAIN_CHANGE_FOLDER_READONLY, "\033c" },
3800 + { "change-newsgroup", OP_MAIN_CHANGE_GROUP, NULL },
3801 + { "change-newsgroup-readonly",OP_MAIN_CHANGE_GROUP_READONLY, NULL },
3803 { "collapse-thread", OP_MAIN_COLLAPSE_THREAD, "\033v" },
3804 { "collapse-all", OP_MAIN_COLLAPSE_ALL, "\033V" },
3805 { "copy-message", OP_COPY_MESSAGE, "C" },
3807 { "edit", OP_EDIT_MESSAGE, "e" },
3808 { "edit-type", OP_EDIT_TYPE, "\005" },
3809 { "forward-message", OP_FORWARD_MESSAGE, "f" },
3810 - { "flag-message", OP_FLAG_MESSAGE, "F" },
3812 + { "forward-to-group", OP_FORWARD_TO_GROUP, NULL },
3813 + { "followup-message", OP_FOLLOWUP, NULL },
3814 + { "get-children", OP_GET_CHILDREN, NULL },
3815 + { "get-message", OP_GET_MESSAGE, NULL },
3816 + { "get-parent", OP_GET_PARENT, NULL },
3817 + { "reconstruct-thread", OP_RECONSTRUCT_THREAD, NULL },
3819 + { "flag-message", OP_FLAG_MESSAGE, "F" },
3820 { "group-reply", OP_GROUP_REPLY, "g" },
3822 { "fetch-mail", OP_MAIN_FETCH_MAIL, "G" },
3824 { "sort-mailbox", OP_SORT, "o" },
3825 { "sort-reverse", OP_SORT_REVERSE, "O" },
3826 { "print-message", OP_PRINT, "p" },
3828 + { "post-message", OP_POST, NULL },
3830 { "previous-thread", OP_MAIN_PREV_THREAD, "\020" },
3831 { "previous-subthread", OP_MAIN_PREV_SUBTHREAD, "\033p" },
3832 { "recall-message", OP_RECALL_MESSAGE, "R" },
3833 @@ -127,6 +142,10 @@
3834 { "show-version", OP_VERSION, "V" },
3835 { "set-flag", OP_MAIN_SET_FLAG, "w" },
3836 { "clear-flag", OP_MAIN_CLEAR_FLAG, "W" },
3837 + { "toggle-read", OP_TOGGLE_READ, NULL },
3839 + { "catchup", OP_CATCHUP, NULL },
3841 { "display-message", OP_DISPLAY_MESSAGE, M_ENTER_S },
3842 { "sync-mailbox", OP_MAIN_SYNC_FOLDER, "$" },
3843 { "display-address", OP_DISPLAY_ADDRESS, "@" },
3844 @@ -158,6 +177,10 @@
3845 { "bounce-message", OP_BOUNCE_MESSAGE, "b" },
3846 { "change-folder", OP_MAIN_CHANGE_FOLDER, "c" },
3847 { "change-folder-readonly", OP_MAIN_CHANGE_FOLDER_READONLY, "\033c" },
3849 + { "change-newsgroup", OP_MAIN_CHANGE_GROUP, NULL },
3850 + { "change-newsgroup-readonly",OP_MAIN_CHANGE_GROUP_READONLY, NULL },
3852 { "copy-message", OP_COPY_MESSAGE, "C" },
3853 { "decode-copy", OP_DECODE_COPY, "\033C" },
3854 { "delete-message", OP_DELETE, "d" },
3855 @@ -165,8 +188,12 @@
3856 { "delete-subthread", OP_DELETE_SUBTHREAD, "\033d" },
3857 { "edit", OP_EDIT_MESSAGE, "e" },
3858 { "edit-type", OP_EDIT_TYPE, "\005" },
3860 + { "followup-message", OP_FOLLOWUP, NULL },
3861 + { "forward-to-group", OP_FORWARD_TO_GROUP, NULL },
3863 { "forward-message", OP_FORWARD_MESSAGE, "f" },
3864 - { "flag-message", OP_FLAG_MESSAGE, "F" },
3865 + { "flag-message", OP_FLAG_MESSAGE, "F" },
3866 { "group-reply", OP_GROUP_REPLY, "g" },
3868 { "imap-fetch-mail", OP_MAIN_IMAP_FETCH, NULL },
3870 { "next-thread", OP_MAIN_NEXT_THREAD, "\016" },
3871 { "next-subthread", OP_MAIN_NEXT_SUBTHREAD, "\033n" },
3872 { "print-message", OP_PRINT, "p" },
3874 + { "post-message", OP_POST, NULL },
3876 { "previous-thread", OP_MAIN_PREV_THREAD, "\020" },
3877 { "previous-subthread",OP_MAIN_PREV_SUBTHREAD, "\033p" },
3878 { "purge-message", OP_PURGE_MESSAGE, NULL },
3879 @@ -252,6 +282,10 @@
3880 { "bounce-message", OP_BOUNCE_MESSAGE, "b" },
3881 { "display-toggle-weed", OP_DISPLAY_HEADERS, "h" },
3882 { "edit-type", OP_EDIT_TYPE, "\005" },
3884 + { "followup-message", OP_FOLLOWUP, NULL },
3885 + { "forward-to-group", OP_FORWARD_TO_GROUP, NULL },
3887 { "print-entry", OP_PRINT, "p" },
3888 { "save-entry", OP_SAVE, "s" },
3889 { "pipe-entry", OP_PIPE, "|" },
3891 struct binding_t OpCompose[] = {
3892 { "attach-file", OP_COMPOSE_ATTACH_FILE, "a" },
3893 { "attach-message", OP_COMPOSE_ATTACH_MESSAGE, "A" },
3894 + { "attach-news-message",OP_COMPOSE_ATTACH_NEWS_MESSAGE,NULL },
3895 { "edit-bcc", OP_COMPOSE_EDIT_BCC, "b" },
3896 { "edit-cc", OP_COMPOSE_EDIT_CC, "c" },
3897 { "copy-file", OP_SAVE, "C" },
3898 @@ -301,6 +336,11 @@
3899 { "print-entry", OP_PRINT, "l" },
3900 { "edit-mime", OP_COMPOSE_EDIT_MIME, "m" },
3901 { "new-mime", OP_COMPOSE_NEW_MIME, "n" },
3903 + { "edit-newsgroups", OP_COMPOSE_EDIT_NEWSGROUPS, NULL },
3904 + { "edit-followup-to", OP_COMPOSE_EDIT_FOLLOWUP_TO, NULL },
3905 + { "edit-x-comment-to",OP_COMPOSE_EDIT_X_COMMENT_TO, NULL },
3907 { "postpone-message", OP_COMPOSE_POSTPONE_MESSAGE, "P" },
3908 { "edit-reply-to", OP_COMPOSE_EDIT_REPLY_TO, "r" },
3909 { "rename-file", OP_COMPOSE_RENAME_FILE, "R" },
3910 @@ -352,12 +392,23 @@
3911 { "select-new", OP_BROWSER_NEW_FILE, "N" },
3912 { "check-new", OP_CHECK_NEW, NULL },
3913 { "toggle-mailboxes", OP_TOGGLE_MAILBOXES, "\t" },
3915 + { "reload-active", OP_LOAD_ACTIVE, NULL},
3916 + { "subscribe-pattern", OP_SUBSCRIBE_PATTERN, NULL },
3917 + { "unsubscribe-pattern", OP_UNSUBSCRIBE_PATTERN, NULL },
3918 + { "catchup", OP_CATCHUP, NULL },
3919 + { "uncatchup", OP_UNCATCHUP, NULL },
3921 { "view-file", OP_BROWSER_VIEW_FILE, " " },
3923 { "create-mailbox", OP_CREATE_MAILBOX, "C" },
3924 { "delete-mailbox", OP_DELETE_MAILBOX, "d" },
3926 +#if defined USE_IMAP || defined USE_NNTP
3927 { "subscribe", OP_BROWSER_SUBSCRIBE, "s" },
3928 { "unsubscribe", OP_BROWSER_UNSUBSCRIBE, "u" },
3931 { "toggle-subscribed", OP_BROWSER_TOGGLE_LSUB, "T" },
3934 diff -uNr mutt-1.4.orig/globals.h mutt-1.4/globals.h
3935 --- mutt-1.4.orig/globals.h Sun Nov 3 21:42:52 2002
3936 +++ mutt-1.4/globals.h Sun Nov 3 21:57:20 2002
3940 WHERE char *Muttrc INITVAL (NULL);
3942 +WHERE char *NewsCacheDir;
3943 +WHERE char *GroupFormat;
3945 +WHERE char *NewsServer;
3946 +WHERE char *NntpUser;
3947 +WHERE char *NntpPass;
3948 +WHERE char *NewsRc;
3952 WHERE char *PagerFmt;
3953 @@ -146,6 +155,11 @@
3955 WHERE unsigned short Counter INITVAL (0);
3958 +WHERE short NewsPollTimeout;
3959 +WHERE short NntpContext;
3962 WHERE short ConnectTimeout;
3963 WHERE short FolderColumns;
3964 WHERE short HistSize;
3965 diff -uNr mutt-1.4.orig/hash.c mutt-1.4/hash.c
3966 --- mutt-1.4.orig/hash.c Mon Nov 19 11:41:32 2001
3967 +++ mutt-1.4/hash.c Sun Nov 3 21:57:20 2002
3971 table->nelem = nelem;
3972 + table->curnelem = 0;
3973 table->table = safe_calloc (nelem, sizeof (struct hash_elem *));
3977 +HASH *hash_resize (HASH *ptr, int nelem)
3980 + struct hash_elem *elem, *tmp;
3983 + table = hash_create (nelem);
3985 + for (i = 0; i < ptr->nelem; i++)
3987 + for (elem = ptr->table[i]; elem; )
3990 + elem = elem->next;
3991 + hash_insert (table, tmp->key, tmp->data, 1);
3992 + safe_free ((void **) &tmp);
3995 + safe_free ((void **) &ptr->table);
3996 + safe_free ((void **) &ptr);
4001 /* table hash table to update
4002 * key key to hash on
4003 * data data to associate with `key'
4006 ptr->next = table->table[h];
4007 table->table[h] = ptr;
4008 + table->curnelem++;
4014 table->table[h] = ptr;
4016 + table->curnelem++;
4022 if (destroy) destroy (ptr->data);
4024 + table->curnelem--;
4028 diff -uNr mutt-1.4.orig/hash.h mutt-1.4/hash.h
4029 --- mutt-1.4.orig/hash.h Fri Mar 3 11:10:08 2000
4030 +++ mutt-1.4/hash.h Sun Nov 3 21:57:20 2002
4036 + int nelem, curnelem;
4037 struct hash_elem **table;
4041 HASH *hash_create (int nelem);
4042 int hash_string (const unsigned char *s, int n);
4043 int hash_insert (HASH * table, const char *key, void *data, int allow_dup);
4044 +HASH *hash_resize (HASH * table, int nelem);
4045 void *hash_find_hash (const HASH * table, int hash, const char *key);
4046 void hash_delete_hash (HASH * table, int hash, const char *key, const void *data,
4047 void (*destroy) (void *));
4048 diff -uNr mutt-1.4.orig/hdrline.c mutt-1.4/hdrline.c
4049 --- mutt-1.4.orig/hdrline.c Sun Nov 3 21:42:52 2002
4050 +++ mutt-1.4/hdrline.c Sun Nov 3 21:57:20 2002
4052 * %E = number of messages in current thread
4053 * %f = entire from line
4054 * %F = like %n, unless from self
4055 + * %g = newsgroup name (if compiled with nntp support)
4057 * %l = number of lines in the message
4058 * %L = like %F, except `lists' are displayed first
4061 * %u = user (login) name of author
4062 * %v = first name of author, unless from self
4063 + * %W = where user is (organization)
4064 * %y = `x-label:' field (if present)
4065 * %Y = `x-label:' field (if present, tree unfolded, and != parent's x-label)
4066 * %Z = status flags */
4067 @@ -484,6 +486,12 @@
4073 + mutt_format_s (dest, destlen, prefix, hdr->env->newsgroups ? hdr->env->newsgroups : "");
4078 mutt_format_s (dest, destlen, prefix, hdr->env->message_id ? hdr->env->message_id : "<no.id>");
4080 @@ -655,6 +663,13 @@
4081 mutt_format_s (dest, destlen, prefix, buf2);
4086 + mutt_format_s (dest, destlen, prefix, hdr->env->organization ? hdr->env->organization : "");
4087 + else if (!hdr->env->organization)
4094 diff -uNr mutt-1.4.orig/headers.c mutt-1.4/headers.c
4095 --- mutt-1.4.orig/headers.c Mon Nov 5 22:19:33 2001
4096 +++ mutt-1.4/headers.c Sun Nov 3 21:57:20 2002
4098 msg->env = n; n = NULL;
4100 if (!msg->env->in_reply_to)
4102 + if (!option (OPTNEWSSEND))
4104 mutt_free_list (&msg->env->references);
4106 mutt_expand_aliases_env (msg->env);
4107 diff -uNr mutt-1.4.orig/init.c mutt-1.4/init.c
4108 --- mutt-1.4.orig/init.c Sun Nov 3 21:42:51 2002
4109 +++ mutt-1.4/init.c Sun Nov 3 21:57:20 2002
4110 @@ -1789,6 +1789,28 @@
4112 Fqdn = safe_strdup(NONULL(Hostname));
4119 + if ((f = safe_fopen (SYSCONFDIR "/nntpserver", "r")))
4122 + fgets (buffer, sizeof (buffer), f);
4126 + while (*i && (*i != ' ') && (*i != '\t') && (*i != '\r') && (*i != '\n')) i++;
4128 + NewsServer = safe_strdup (p);
4132 + if ((p = getenv ("NNTPSERVER")))
4133 + NewsServer = safe_strdup (p);
4136 if ((p = getenv ("MAIL")))
4137 Spoolfile = safe_strdup (p);
4138 else if ((p = getenv ("MAILDIR")))
4139 diff -uNr mutt-1.4.orig/init.h mutt-1.4/init.h
4140 --- mutt-1.4.orig/init.h Sun Nov 3 21:42:52 2002
4141 +++ mutt-1.4/init.h Sun Nov 3 21:57:20 2002
4142 @@ -193,6 +193,20 @@
4143 ** If set, Mutt will prompt you for carbon-copy (Cc) recipients before
4144 ** editing the body of an outgoing message.
4147 + { "ask_follow_up", DT_BOOL, R_NONE, OPTASKFOLLOWUP, 0 },
4150 + ** If set, Mutt will prompt you for follow-up groups before editing
4151 + ** the body of an outgoing message.
4153 + { "ask_x_comment_to", DT_BOOL, R_NONE, OPTASKXCOMMENTTO, 0 },
4156 + ** If set, Mutt will prompt you for x-comment-to field before editing
4157 + ** the body of an outgoing message.
4160 { "attach_format", DT_STR, R_NONE, UL &AttachFormat, UL "%u%D%I %t%4n %T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] " },
4163 @@ -273,6 +287,14 @@
4164 ** When this variable is set, mutt will include Delivered-To headers when
4165 ** bouncing messages. Postfix users may wish to unset this variable.
4168 + { "catchup_newsgroup", DT_QUAD, R_NONE, OPT_CATCHUP, M_ASKYES },
4171 + ** If this variable is \fIset\fP, Mutt will mark all articles in newsgroup
4172 + ** as read when you quit the newsgroup (catchup newsgroup).
4175 { "charset", DT_STR, R_NONE, UL &Charset, UL 0 },
4178 @@ -565,6 +587,16 @@
4179 ** subscribed list will be sent to both the list and your address,
4180 ** resulting in two copies of the same email for you.
4183 + { "followup_to_poster", DT_QUAD, R_NONE, OPT_FOLLOWUPTOPOSTER, M_ASKYES },
4186 + ** If this variable is \fIset\fP and the keyword "poster" is present in
4187 + ** \fIFollowup-To\fP header, follow-up to newsgroup function is not
4188 + ** permitted. The message will be mailed to the submitter of the
4189 + ** message via mail.
4192 { "force_name", DT_BOOL, R_NONE, OPTFORCENAME, 0 },
4195 @@ -628,6 +660,27 @@
4196 ** a regular expression that will match the whole name so mutt will expand
4197 ** "Franklin" to "Franklin, Steve".
4200 + { "group_index_format", DT_STR, R_BOTH, UL &GroupFormat, UL "%4C %M%N %5s %-45.45f %d" },
4203 + ** This variable allows you to customize the newsgroup browser display to
4204 + ** your personal taste. This string is similar to ``$index_format'', but
4205 + ** has its own set of printf()-like sequences:
4208 + ** %C current newsgroup number
4209 + ** %d description of newsgroup (becomes from server)
4210 + ** %f newsgroup name
4211 + ** %M - if newsgroup not allowed for direct post (moderated for example)
4212 + ** %N N if newsgroup is new, u if unsubscribed, blank otherwise
4213 + ** %n number of new articles in newsgroup
4214 + ** %s number of unread articles in newsgroup
4215 + ** %>X right justify the rest of the string and pad with character "X"
4216 + ** %|X pad to the end of the line with character "X"
4220 { "hdr_format", DT_SYN, R_NONE, UL "index_format", 0 },
4224 ** .dt %E .dd number of messages in current thread
4225 ** .dt %f .dd entire From: line (address + real name)
4226 ** .dt %F .dd author name, or recipient name if the message is from you
4227 + ** .dt %g .dd newsgroup name (if compiled with nntp support)
4228 ** .dt %i .dd message-id of the current message
4229 ** .dt %l .dd number of lines in the message
4230 ** .dt %L .dd If an address in the To or CC header field matches an address
4232 ** .dt %T .dd the appropriate character from the $$to_chars string
4233 ** .dt %u .dd user (login) name of the author
4234 ** .dt %v .dd first name of the author, or the recipient if the message is from you
4235 + ** .dt %W .dd name of organization of author (`organization:' field)
4236 ** .dt %y .dd `x-label:' field, if present
4237 ** .dt %Y .dd `x-label' field, if present, and (1) not at part of a thread tree,
4238 ** (2) at the top of a thread, or (3) `x-label' is different from
4239 @@ -913,6 +968,21 @@
4241 ** See also: ``$$to_chars''.
4244 + { "inews", DT_PATH, R_NONE, UL &Inews, UL "" },
4247 + ** If set, specifies the program and arguments used to deliver news posted
4248 + ** by Mutt. Otherwise, mutt posts article using current connection to
4249 + ** news server. The following printf-style sequence is understood:
4252 + ** %s newsserver name
4255 + ** Example: set inews="/usr/local/bin/inews -hS"
4258 { "ispell", DT_PATH, R_NONE, UL &Ispell, UL ISPELL },
4261 @@ -1077,6 +1147,16 @@
4262 ** be attached to the newly composed message if this option is set.
4266 + { "mime_subject", DT_BOOL, R_NONE, OPTMIMESUBJECT, 1 },
4269 + ** If \fIunset\fP, 8-bit ``subject:'' line in article header will not be
4270 + ** encoded according to RFC2047 to base64. This is useful when message
4271 + ** is Usenet article, because MIME for news is nonstandard feature.
4276 { "mix_entry_format", DT_STR, R_NONE, UL &MixEntryFormat, UL "%4n %c %-16s %a" },
4278 @@ -1128,6 +1208,77 @@
4279 ** to allow more room the tree and message subjects. This is useful on
4283 + { "news_cache_dir", DT_PATH, R_NONE, UL &NewsCacheDir, UL "~/.mutt" },
4286 + ** This variable pointing to directory where Mutt will save cached news
4287 + ** articles headers in. If \fIunset\fP, headers will not be saved at all
4288 + ** and will be reloaded each time when you enter to newsgroup.
4290 + { "news_server", DT_STR, R_NONE, UL &NewsServer, 0 },
4293 + ** This variable specifies domain name or address of NNTP server. It
4294 + ** defaults to the newsserver specified in the environment variable
4295 + ** $$$NNTPSERVER or contained in the file /etc/nntpserver. You can also
4296 + ** specify username and an alternative port for each newsserver, ie:
4298 + ** [nntp[s]://][username[:password]@]newsserver[:port]
4300 + { "newsrc", DT_PATH, R_NONE, UL &NewsRc, UL "~/.newsrc" },
4303 + ** The file, containing info about subscribed newsgroups - names and
4304 + ** indexes of read articles. The following printf-style sequence
4308 + ** %s newsserver name
4311 + { "nntp_context", DT_NUM, R_NONE, UL &NntpContext, 1000 },
4314 + ** This variable defines number of articles which will be in index when
4315 + ** newsgroup entered. If active newsgroup have more articles than this
4316 + ** number, oldest articles will be ignored. Also controls how many
4317 + ** articles headers will be saved in cache when you quit newsgroup.
4319 + { "nntp_load_description", DT_BOOL, R_NONE, OPTLOADDESC, 1 },
4322 + ** This variable controls whether or not descriptions for each newsgroup
4323 + ** must be loaded when newsgroup is added to list (first time list
4324 + ** loading or new newsgroup adding).
4326 + { "nntp_user", DT_STR, R_NONE, UL &NntpUser, UL "" },
4329 + ** Your login name on the NNTP server. If \fIunset\fP and NNTP server requires
4330 + ** authentification, Mutt will prompt you for your account name when you
4331 + ** connect to newsserver.
4333 + { "nntp_pass", DT_STR, R_NONE, UL &NntpPass, UL "" },
4336 + ** Your password for NNTP account.
4338 + { "nntp_poll", DT_NUM, R_NONE, UL &NewsPollTimeout, 60 },
4341 + ** The time in seconds until any operations on newsgroup except post new
4342 + ** article will cause recheck for new news. If set to 0, Mutt will
4343 + ** recheck newsgroup on each operation in index (stepping, read article,
4346 + { "nntp_reconnect", DT_QUAD, R_NONE, OPT_NNTPRECONNECT, M_ASKYES },
4349 + ** Controls whether or not Mutt will try to reconnect to newsserver when
4350 + ** connection lost.
4353 { "pager", DT_PATH, R_NONE, UL &Pager, UL "builtin" },
4356 @@ -1633,6 +1784,16 @@
4357 { "post_indent_str", DT_SYN, R_NONE, UL "post_indent_string", 0 },
4361 + { "post_moderated", DT_QUAD, R_NONE, OPT_TOMODERATED, M_ASKYES },
4364 + ** If set to \fIyes\fP, Mutt will post article to newsgroup that have
4365 + ** not permissions to posting (e.g. moderated). \fBNote:\fP if newsserver
4366 + ** does not support posting to that newsgroup or totally read-only, that
4367 + ** posting will not have an effect.
4370 { "postpone", DT_QUAD, R_NONE, OPT_POSTPONE, M_ASKYES },
4373 @@ -1991,6 +2152,28 @@
4374 ** Command to use when spawning a subshell. By default, the user's login
4375 ** shell from /etc/passwd is used.
4378 + { "save_unsubscribed",DT_BOOL, R_NONE, OPTSAVEUNSUB, 0 },
4381 + ** When \fIset\fP, info about unsubscribed newsgroups will be saved into
4382 + ** ``newsrc'' file and into cache.
4384 + { "show_new_news", DT_BOOL, R_NONE, OPTSHOWNEWNEWS, 1 },
4387 + ** If \fIset\fP, newsserver will be asked for new newsgroups on entering
4388 + ** the browser. Otherwise, it will be done only once for a newsserver.
4389 + ** Also controls whether or not number of new articles of subscribed
4390 + ** newsgroups will be then checked.
4392 + { "show_only_unread", DT_BOOL, R_NONE, OPTSHOWONLYUNREAD, 0 },
4395 + ** If \fIset\fP, only subscribed newsgroups that contain unread articles
4396 + ** will be displayed in browser.
4399 { "sig_dashes", DT_BOOL, R_NONE, OPTSIGDASHES, 1 },
4402 @@ -2437,6 +2620,14 @@
4403 ** Controls whether mutt writes out the Bcc header when preparing
4404 ** messages to be sent. Exim users may wish to use this.
4407 + { "x_comment_to", DT_BOOL, R_NONE, OPTXCOMMENTTO, 0 },
4410 + ** If \fIset\fP, Mutt will add ``X-Comment-To:'' field (that contains full
4411 + ** name of original article author) to article that followuped to newsgroup.
4417 diff -uNr mutt-1.4.orig/keymap.c mutt-1.4/keymap.c
4418 --- mutt-1.4.orig/keymap.c Sun Nov 3 21:42:52 2002
4419 +++ mutt-1.4/keymap.c Sun Nov 3 21:57:20 2002
4421 km_bindkey ("<enter>", MENU_MAIN, OP_DISPLAY_MESSAGE);
4423 km_bindkey ("x", MENU_PAGER, OP_EXIT);
4424 - km_bindkey ("i", MENU_PAGER, OP_EXIT);
4425 km_bindkey ("<backspace>", MENU_PAGER, OP_PREV_LINE);
4426 km_bindkey ("<pagedown>", MENU_PAGER, OP_NEXT_PAGE);
4427 km_bindkey ("<pageup>", MENU_PAGER, OP_PREV_PAGE);
4428 diff -uNr mutt-1.4.orig/mailbox.h mutt-1.4/mailbox.h
4429 --- mutt-1.4.orig/mailbox.h Wed Mar 20 10:53:34 2002
4430 +++ mutt-1.4/mailbox.h Sun Nov 3 21:57:20 2002
4433 int mx_is_pop (const char *);
4436 +int mx_is_nntp (const char *);
4439 int mx_access (const char*, int);
4441 diff -uNr mutt-1.4.orig/main.c mutt-1.4/main.c
4442 --- mutt-1.4.orig/main.c Sun Nov 3 21:42:51 2002
4443 +++ mutt-1.4/main.c Sun Nov 3 21:57:20 2002
4452 static const char *ReachingUs = N_("\
4453 To contact the developers, please mail to <mutt-dev@mutt.org>.\n\
4454 To report a bug, please use the flea(1) utility.\n");
4456 -e <command>\tspecify a command to be executed after initialization\n\
4457 -f <file>\tspecify which mailbox to read\n\
4458 -F <file>\tspecify an alternate muttrc file\n\
4459 + -g <server>\tspecify a newsserver (if compiled with NNTP)\n\
4460 + -G\t\tselect a newsgroup (if compiled with NNTP)\n\
4461 -H <file>\tspecify a draft file to read header from\n\
4462 -i <file>\tspecify a file which Mutt should include in the reply\n\
4463 -m <type>\tspecify a default mailbox type\n\
4464 @@ -202,6 +208,12 @@
4478 #define M_NOSYSRC (1<<2) /* -n */
4479 #define M_RO (1<<3) /* -R */
4480 #define M_SELECT (1<<4) /* -y */
4482 +#define M_NEWS (1<<5) /* -g and -G */
4485 int main (int argc, char **argv)
4487 @@ -489,7 +504,11 @@
4488 memset (Options, 0, sizeof (Options));
4489 memset (QuadOptions, 0, sizeof (QuadOptions));
4492 + while ((i = getopt (argc, argv, "a:b:F:f:c:d:e:H:s:i:hm:npRvxyg:GzZ")) != EOF)
4494 while ((i = getopt (argc, argv, "a:b:F:f:c:d:e:H:s:i:hm:npRvxyzZ")) != EOF)
4499 @@ -571,6 +590,20 @@
4504 + case 'g': /* Specify a newsserver */
4506 + char buf[LONG_STRING];
4508 + snprintf (buf, sizeof (buf), "set news_server=%s", optarg);
4509 + commands = mutt_add_list (commands, buf);
4512 + case 'G': /* List of newsgroups */
4513 + flags |= M_SELECT | M_NEWS;
4520 @@ -802,6 +835,18 @@
4522 else if (flags & M_SELECT)
4525 + if (flags & M_NEWS)
4527 + set_option (OPTNEWS);
4528 + if(!(CurrentNewsSrv = mutt_select_newsserver (NewsServer)))
4530 + mutt_endwin (Errorbuf);
4537 mutt_endwin _("No incoming mailboxes defined.");
4539 @@ -817,6 +862,15 @@
4542 strfcpy (folder, NONULL(Spoolfile), sizeof (folder));
4545 + if (option (OPTNEWS))
4547 + unset_option (OPTNEWS);
4548 + nntp_expand_path (folder, sizeof (folder), &CurrentNewsSrv->conn->account);
4552 mutt_expand_path (folder, sizeof (folder));
4554 mutt_str_replace (&LastFolder, folder);
4555 diff -uNr mutt-1.4.orig/mutt.h mutt-1.4/mutt.h
4556 --- mutt-1.4.orig/mutt.h Sun Nov 3 21:42:52 2002
4557 +++ mutt-1.4/mutt.h Sun Nov 3 21:57:20 2002
4566 /* Options for Mailcap lookup */
4568 @@ -266,6 +269,12 @@
4569 OPT_VERIFYSIG, /* verify PGP signatures */
4570 OPT_PGPTRADITIONAL, /* create old-style PGP messages */
4574 + OPT_NNTPRECONNECT,
4576 + OPT_FOLLOWUPTOPOSTER,
4577 +#endif /* USE_NNTP */
4582 #define SENDMAILX (1<<6)
4583 #define SENDKEY (1<<7)
4584 #define SENDRESEND (1<<8)
4585 +#define SENDNEWS (1<<9)
4587 /* flags to _mutt_select_file() */
4588 #define M_SEL_BUFFY (1<<0)
4603 + OPTMIMESUBJECT, /* encode subject line with RFC2047 */
4608 @@ -445,6 +460,16 @@
4612 + /* news options */
4616 + OPTSHOWONLYUNREAD,
4620 +#endif /* USE_NNTP */
4622 /* pseudo options */
4624 OPTAUXSORT, /* (pseudo) using auxillary sort function */
4626 OPTSORTSUBTHREADS, /* (pseudo) used when $sort_aux changes */
4627 OPTNEEDRESCORE, /* (pseudo) set when the `score' command is used */
4628 OPTATTACHMSG, /* (pseudo) used by attach-message */
4629 + OPTHIDEREAD, /* (pseudo) whether or not hide read messages */
4630 OPTKEEPQUIET, /* (pseudo) shut up the message and refresh
4631 * functions while we are executing an
4633 @@ -475,6 +501,12 @@
4634 OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */
4638 + OPTNEWS, /* (pseudo) used to change reader mode */
4639 + OPTNEWSSEND, /* (pseudo) used to change behavior when posting */
4640 + OPTNEWSCACHE, /* (pseudo) used to indicate if news cache exist */
4646 @@ -538,6 +570,13 @@
4650 + char *organization;
4654 + char *followup_to;
4655 + char *x_comment_to;
4657 LIST *references; /* message references (in reverse order) */
4658 LIST *in_reply_to; /* in-reply-to header content */
4659 LIST *userhdrs; /* user defined headers */
4661 ENVELOPE *env; /* envelope information */
4662 BODY *content; /* list of MIME parts */
4668 char *tree; /* character string to print thread tree */
4669 struct thread *thread;
4671 int refno; /* message number on server */
4674 -#if defined USE_POP || defined USE_IMAP
4675 +#if defined USE_POP || defined USE_IMAP || defined USE_NNTP
4676 void *data; /* driver-specific data */
4680 int appended; /* how many saved messages? */
4681 int flagged; /* how many flagged messages */
4682 int msgnotreadyet; /* which msg "new" in pager, -1 if none */
4683 -#if defined USE_POP || defined USE_IMAP
4684 +#if defined USE_POP || defined USE_IMAP || defined USE_NNTP
4685 void *data; /* driver specific data */
4686 #endif /* USE_IMAP */
4688 diff -uNr mutt-1.4.orig/muttlib.c mutt-1.4/muttlib.c
4689 --- mutt-1.4.orig/muttlib.c Sun Nov 3 21:42:52 2002
4690 +++ mutt-1.4/muttlib.c Sun Nov 3 21:57:20 2002
4693 mutt_free_list (&(*h)->chain);
4695 -#if defined USE_POP || defined USE_IMAP
4696 +#if defined USE_POP || defined USE_IMAP || defined USE_NNTP
4697 safe_free ((void**) &(*h)->data);
4699 safe_free ((void **) h);
4700 @@ -648,6 +648,13 @@
4701 safe_free ((void **) &(*p)->message_id);
4702 safe_free ((void **) &(*p)->supersedes);
4703 safe_free ((void **) &(*p)->date);
4704 + safe_free ((void **) &(*p)->organization);
4706 + safe_free ((void **) &(*p)->newsgroups);
4707 + safe_free ((void **) &(*p)->xref);
4708 + safe_free ((void **) &(*p)->followup_to);
4709 + safe_free ((void **) &(*p)->x_comment_to);
4711 mutt_free_list (&(*p)->references);
4712 mutt_free_list (&(*p)->in_reply_to);
4713 mutt_free_list (&(*p)->userhdrs);
4714 @@ -1143,6 +1150,14 @@
4720 + if (magic == M_NNTP)
4722 + mutt_error _("Can't save message to newsserver.");
4727 if (stat (s, st) != -1)
4729 diff -uNr mutt-1.4.orig/mx.c mutt-1.4/mx.c
4730 --- mutt-1.4.orig/mx.c Sun Nov 3 21:42:52 2002
4731 +++ mutt-1.4/mx.c Sun Nov 3 21:57:20 2002
4743 @@ -354,6 +358,22 @@
4748 +int mx_is_nntp (const char *p)
4750 + url_scheme_t scheme;
4755 + scheme = url_check_scheme (p);
4756 + if (scheme == U_NNTP || scheme == U_NNTPS)
4763 int mx_get_magic (const char *path)
4766 @@ -371,6 +391,11 @@
4768 #endif /* USE_POP */
4771 + if (mx_is_nntp (path))
4773 +#endif /* USE_NNTP */
4775 if (stat (path, &st) == -1)
4777 dprint (1, (debugfile, "mx_get_magic(): unable to stat %s: %s (errno %d).\n",
4778 @@ -721,6 +746,12 @@
4780 #endif /* USE_POP */
4784 + rc = nntp_open_mailbox (ctx);
4786 +#endif /* USE_NNTP */
4791 @@ -766,6 +797,10 @@
4792 if (ctx->magic == M_POP)
4793 pop_close_mailbox (ctx);
4794 #endif /* USE_POP */
4796 + if (ctx->magic == M_NNTP)
4797 + nntp_fastclose_mailbox (ctx);
4798 +#endif /* USE_NNTP */
4800 hash_destroy (&ctx->id_hash, NULL);
4801 mutt_clear_threads (ctx);
4802 @@ -823,6 +858,12 @@
4803 rc = pop_sync_mailbox (ctx, index_hint);
4805 #endif /* USE_POP */
4809 + rc = nntp_sync_mailbox (ctx);
4811 +#endif /* USE_NNTP */
4815 @@ -899,6 +940,16 @@
4820 + if (ctx->magic == M_NNTP)
4824 + ret = nntp_close_mailbox (ctx);
4825 + mx_fastclose_mailbox (ctx);
4829 if (ctx->readonly || ctx->dontwrite)
4831 /* mailbox is readonly or we don't want to write */
4832 @@ -1460,6 +1511,11 @@
4834 return (pop_check_mailbox (ctx, index_hint));
4835 #endif /* USE_POP */
4839 + return (nntp_check_mailbox (ctx));
4840 +#endif /* USE_NNTP */
4844 @@ -1520,6 +1576,15 @@
4846 #endif /* USE_POP */
4851 + if (nntp_fetch_message (msg, ctx, msgno) != 0)
4855 +#endif /* USE_NNTP */
4858 dprint (1, (debugfile, "mx_open_message(): function not implemented for mailbox type %d.\n", ctx->magic));
4860 @@ -1608,6 +1673,9 @@
4862 || (*msg)->magic == M_POP
4865 + || (*msg)->magic == M_NNTP
4869 r = safe_fclose (&(*msg)->fp);
4870 diff -uNr mutt-1.4.orig/mx.h mutt-1.4/mx.h
4871 --- mutt-1.4.orig/mx.h Sun Nov 3 21:42:51 2002
4872 +++ mutt-1.4/mx.h Sun Nov 3 21:57:20 2002
4874 #ifdef USE_COMPRESSED
4882 WHERE short DefaultMagic INITVAL (M_MBOX);
4883 diff -uNr mutt-1.4.orig/newsrc.c mutt-1.4/newsrc.c
4884 --- mutt-1.4.orig/newsrc.c Thu Jan 1 01:00:00 1970
4885 +++ mutt-1.4/newsrc.c Sun Nov 3 21:57:20 2002
4888 + * Copyright (C) 1998 Brandon Long <blong@fiction.net>
4889 + * Copyright (C) 1999 Andrej Gritsenko <andrej@lucky.net>
4890 + * Copyright (C) 2000-2001 Vsevolod Volkov <vvv@mutt.org.ua>
4892 + * This program is free software; you can redistribute it and/or modify
4893 + * it under the terms of the GNU General Public License as published by
4894 + * the Free Software Foundation; either version 2 of the License, or
4895 + * (at your option) any later version.
4897 + * This program is distributed in the hope that it will be useful,
4898 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4899 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4900 + * GNU General Public License for more details.
4902 + * You should have received a copy of the GNU General Public License
4903 + * along with this program; if not, write to the Free Software
4904 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
4908 +#include "mutt_curses.h"
4912 +#include "mailbox.h"
4914 +#include "rfc822.h"
4915 +#include "rfc1524.h"
4916 +#include "rfc2047.h"
4918 +#include <unistd.h>
4919 +#include <string.h>
4921 +#include <stdlib.h>
4922 +#include <sys/stat.h>
4924 +void nntp_add_to_list (NNTP_SERVER *s, NNTP_DATA *d)
4931 + l = safe_calloc (1, sizeof (LIST));
4933 + s->tail->next = l;
4937 + l->data = (void *) d;
4940 +static int nntp_parse_newsrc_line (NNTP_SERVER *news, char *line)
4943 + char group[LONG_STRING];
4945 + char *p = line, *b, *h;
4955 + while (*p && (*p != ':' && *p != '!')) p++;
4958 + len = p + 1 - line;
4959 + if (len > sizeof (group))
4960 + len = sizeof (group);
4961 + strfcpy (group, line, len);
4962 + if ((data = (NNTP_DATA *)hash_find (news->newsgroups, group)) == NULL)
4964 + data = (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1);
4965 + data->group = (char *) data + sizeof (NNTP_DATA);
4966 + strcpy (data->group, group);
4967 + data->nserv = news;
4968 + data->deleted = 1;
4969 + if (news->newsgroups->nelem < news->newsgroups->curnelem * 2)
4970 + news->newsgroups = hash_resize (news->newsgroups, news->newsgroups->nelem * 2);
4971 + hash_insert (news->newsgroups, data->group, data, 0);
4972 + nntp_add_to_list (news, data);
4975 + FREE ((void **) &data->entries);
4978 + data->entries = safe_calloc (x*2, sizeof (NEWSRC_ENTRY));
4982 + data->subscribed = 1;
4984 + data->subscribed = 0;
4991 + while (*p && *p != ',' && *p != '\n') p++;
4997 + if ((h = strchr(b, '-')))
5001 + data->entries[x].first = atoi(b);
5002 + data->entries[x].last = atoi(h);
5006 + data->entries[x].first = atoi(b);
5007 + data->entries[x].last = data->entries[x].first;
5010 + if (data->entries[x].last != 0)
5013 + if (x && !data->lastMessage)
5014 + data->lastMessage = data->entries[x-1].last;
5016 + mutt_newsgroup_stat (data);
5017 + dprint (2, (debugfile, "parse_line: Newsgroup %s\n", data->group));
5022 +static int slurp_newsrc (NNTP_SERVER *news)
5028 + news->stat = stat (news->newsrc, &sb);
5029 + news->size = sb.st_size;
5030 + news->mtime = sb.st_mtime;
5032 + if ((fp = safe_fopen (news->newsrc, "r")) == NULL)
5034 + /* hmm, should we use dotlock? */
5035 + if (mx_lock_file (news->newsrc, fileno (fp), 0, 0, 1))
5041 + buf = safe_malloc (sb.st_size + 1);
5042 + while (fgets (buf, sb.st_size + 1, fp))
5043 + nntp_parse_newsrc_line (news, buf);
5046 + mx_unlock_file (news->newsrc, fileno (fp), 0);
5051 +void nntp_cache_expand (char *dst, const char *src)
5053 + snprintf (dst, _POSIX_PATH_MAX, "%s/%s", NewsCacheDir, src);
5054 + mutt_expand_path (dst, _POSIX_PATH_MAX);
5057 +/* Loads $news_cache_dir/.index into memory, loads newsserver data
5058 + * and newsgroup cache names */
5059 +static int nntp_parse_cacheindex (NNTP_SERVER *news)
5062 + char buf[HUGE_STRING], *cp;
5063 + char dir[_POSIX_PATH_MAX], file[_POSIX_PATH_MAX];
5068 + /* check is server name defined or not */
5069 + if (!news || !news->conn || !news->conn->account.host)
5071 + unset_option (OPTNEWSCACHE);
5072 + if (!NewsCacheDir || !*NewsCacheDir)
5075 + strfcpy (dir, NewsCacheDir, sizeof (dir));
5076 + mutt_expand_path (dir, sizeof(dir));
5078 + if (lstat (dir, &st) || (st.st_mode & S_IFDIR) == 0)
5080 + snprintf (buf, sizeof(buf), _("Directory %s not exist. Create it?"), dir);
5081 + if (mutt_yesorno (buf, M_YES) != M_YES || mkdir (dir, (S_IRWXU+S_IRWXG+
5084 + mutt_error _("Cache directory not created!");
5087 + mutt_clear_error();
5090 + set_option (OPTNEWSCACHE);
5092 + FREE (&news->cache);
5093 + snprintf (buf, sizeof(buf), "%s/.index", dir);
5094 + if (!(index = safe_fopen (buf, "a+")))
5097 + while (fgets (buf, sizeof(buf), index))
5099 + buf[strlen(buf) - 1] = 0; /* strip ending '\n' */
5100 + if (!mutt_strncmp (buf, "#: ", 3) &&
5101 + !mutt_strcasecmp (buf+3, news->conn->account.host))
5104 + while (fgets (buf, sizeof(buf), index))
5107 + while (*cp && *cp != ' ') cp++;
5108 + if (!*cp) continue;
5110 + if (!mutt_strcmp (buf, "#:"))
5112 + sscanf (cp + 1, "%s %d %d", file, &l, &m);
5113 + if (!mutt_strcmp (buf, "ALL"))
5115 + news->cache = safe_strdup (file);
5116 + news->newgroups_time = m;
5118 + else if (news->newsgroups)
5120 + if ((data = (NNTP_DATA *)hash_find (news->newsgroups, buf)) == NULL)
5122 + data = (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + strlen (buf) + 1);
5123 + data->group = (char *) data + sizeof (NNTP_DATA);
5124 + strcpy(data->group, buf);
5125 + data->nserv = news;
5126 + data->deleted = 1;
5127 + if (news->newsgroups->nelem < news->newsgroups->curnelem * 2)
5128 + news->newsgroups = hash_resize (news->newsgroups, news->newsgroups->nelem * 2);
5129 + hash_insert (news->newsgroups, data->group, data, 0);
5130 + nntp_add_to_list (news, data);
5132 + data->cache = safe_strdup (file);
5134 + if (!data->firstMessage || data->lastMessage < m)
5136 + if (!data->firstMessage)
5137 + data->firstMessage = l;
5138 + if (data->lastMessage < m)
5139 + data->lastMessage = m;
5140 + data->lastCached = m;
5141 + if (t || !data->unread)
5142 + mutt_newsgroup_stat (data);
5150 +nntp_format_str (char *dest, size_t destlen, char op, const char *src,
5151 + const char *fmt, const char *ifstring, const char *elsestring,
5152 + unsigned long data, format_flag flags)
5154 + char fn[SHORT_STRING], tmp[SHORT_STRING];
5159 + strncpy (fn, NewsServer, sizeof(fn) - 1);
5160 + mutt_strlower (fn);
5161 + snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
5162 + snprintf (dest, destlen, tmp, fn);
5168 +/* nntp_parse_url: given an NNPT URL, return host, port,
5169 + * username, password and newsgroup will recognise. */
5170 +int nntp_parse_url (const char *server, ACCOUNT *acct,
5171 + char *group, size_t group_len)
5179 + acct->port = NNTP_PORT;
5180 + acct->type = M_ACCT_TYPE_NNTP;
5182 + c = safe_strdup (server);
5183 + url_parse_ciss (&url, c);
5185 + if (url.scheme == U_NNTP || url.scheme == U_NNTPS)
5187 + if (url.scheme == U_NNTPS)
5189 + acct->flags |= M_ACCT_SSL;
5190 + acct->port = NNTP_SSL_PORT;
5195 + strfcpy (group, url.path, group_len);
5197 + ret = mutt_account_fromurl (acct, &url);
5204 +void nntp_expand_path (char *line, size_t len, ACCOUNT *acct)
5208 + url.path = safe_strdup (line);
5209 + mutt_account_tourl (acct, &url);
5210 + url_ciss_tostring (&url, line, len, 0);
5215 + * Automatically loads a newsrc into memory, if necessary.
5216 + * Checks the size/mtime of a newsrc file, if it doesn't match, load
5217 + * again. Hmm, if a system has broken mtimes, this might mean the file
5218 + * is reloaded every time, which we'd have to fix.
5220 + * a newsrc file is a line per newsgroup, with the newsgroup, then a
5221 + * ':' denoting subscribed or '!' denoting unsubscribed, then a
5222 + * comma separated list of article numbers and ranges.
5224 +NNTP_SERVER *mutt_select_newsserver (char *server)
5226 + char file[_POSIX_PATH_MAX];
5230 + NNTP_SERVER *serv;
5233 + if (!server || !*server)
5235 + mutt_error _("No newsserver defined!");
5239 + buf = p = safe_calloc (strlen (server) + 10, sizeof (char));
5240 + if (url_check_scheme (server) == U_UNKNOWN)
5242 + strcpy (buf, "nntp://");
5243 + p = strchr (buf, '\0');
5245 + strcpy (p, server);
5247 + if ((nntp_parse_url (buf, &acct, file, sizeof (file))) < 0 || *file)
5250 + mutt_error (_("%s is an invalid newsserver specification!"), server);
5255 + conn = mutt_conn_find (NULL, &acct);
5259 + mutt_FormatString (file, sizeof (file), NONULL (NewsRc), nntp_format_str, 0, 0);
5260 + mutt_expand_path (file, sizeof (file));
5262 + serv = (NNTP_SERVER *)conn->data;
5267 + /* externally modified? */
5268 + if (serv->stat != stat (file, &sb) || (!serv->stat &&
5269 + (serv->size != sb.st_size || serv->mtime != sb.st_mtime)))
5271 + for (list = serv->list; list; list = list->next)
5273 + NNTP_DATA *data = (NNTP_DATA *) list->data;
5277 + data->subscribed = 0;
5282 + slurp_newsrc (serv);
5283 + nntp_clear_cacheindex (serv);
5286 + if (serv->status == NNTP_BYE)
5287 + serv->status = NNTP_NONE;
5288 + nntp_check_newgroups (serv, 0);
5292 + /* New newsserver */
5293 + serv = safe_calloc (1, sizeof (NNTP_SERVER));
5294 + serv->conn = conn;
5295 + serv->newsrc = safe_strdup (file);
5296 + serv->newsgroups = hash_create (1009);
5297 + slurp_newsrc (serv); /* load .newsrc */
5298 + nntp_parse_cacheindex (serv); /* load .index */
5299 + if (option (OPTNEWSCACHE) && serv->cache && nntp_get_cache_all (serv) >= 0)
5300 + nntp_check_newgroups (serv, 1);
5301 + else if (nntp_get_active (serv) < 0)
5303 + hash_destroy (&serv->newsgroups, nntp_delete_data);
5304 + for (list = serv->list; list; list = list->next)
5305 + list->data = NULL;
5306 + mutt_free_list (&serv->list);
5307 + FREE (&serv->newsrc);
5308 + FREE (&serv->cache);
5312 + nntp_clear_cacheindex (serv);
5313 + conn->data = (void *)serv;
5319 + * full status flags are not supported by nntp, but we can fake some
5320 + * of them. This is how:
5321 + * Read = a read message number is in the .newsrc
5322 + * New = a message is new since we last read this newsgroup
5323 + * Old = anything else
5324 + * So, Read is marked as such in the newsrc, old is anything that is
5325 + * "skipped" in the newsrc, and new is anything not in the newsrc nor
5326 + * in the cache. By skipped, I mean before the last unread message
5328 +void nntp_get_status (CONTEXT *ctx, HEADER *h, char *group, int article)
5330 + NNTP_DATA *data = (NNTP_DATA *) ctx->data;
5334 + data = (NNTP_DATA *) hash_find (data->nserv->newsgroups, group);
5340 + dprint (3, (debugfile, "newsgroup %s not found\n", group));
5345 + for (x = 0; x < data->num; x++)
5347 + if ((article >= data->entries[x].first) &&
5348 + (article <= data->entries[x].last))
5350 + /* we cannot use mutt_set_flag() because mx_update_context()
5351 + didn't called yet */
5356 + /* If article was not cached yet, it is new! :) */
5357 + if (!data->cache || article > data->lastCached)
5359 + /* Old articles are articles which aren't read but an article after them
5360 + * has been cached */
5361 + if (option (OPTMARKOLD))
5365 +void mutt_newsgroup_stat (NNTP_DATA *data)
5368 + unsigned int first, last;
5371 + if (data->lastMessage == 0 || data->firstMessage > data->lastMessage)
5374 + data->unread = data->lastMessage - data->firstMessage + 1;
5375 + for (i = 0; i < data->num; i++)
5377 + first = data->entries[i].first;
5378 + if (first < data->firstMessage)
5379 + first = data->firstMessage;
5380 + last = data->entries[i].last;
5381 + if (last > data->lastMessage)
5382 + last = data->lastMessage;
5383 + if (first <= last)
5384 + data->unread -= last - first + 1;
5388 +static int puti (char *line, int num)
5392 + for (p = s; num; )
5394 + *p++ = '0' + num % 10;
5398 + *line++ = *--p, num++;
5403 +static void nntp_create_newsrc_line (NNTP_DATA *data, char **buf, char **pline, size_t *buflen)
5405 + char *line = *pline;
5406 + size_t len = *buflen - (*pline - *buf);
5409 + if (len < LONG_STRING * 10)
5414 + safe_realloc ((void **) buf, *buflen);
5415 + line = *buf + (*pline - line);
5417 + strcpy (line, data->group);
5418 + len -= strlen (line) + 1;
5419 + line += strlen (line);
5420 + *line++ = data->subscribed ? ':' : '!';
5423 + for (x = 0; x < data->num; x++)
5425 + if (len < LONG_STRING)
5431 + safe_realloc ((void **) buf, *buflen);
5432 + line = *buf + (*pline - line);
5441 + if (data->entries[x].first == data->entries[x].last)
5442 + snprintf (line, len, "%d%n", data->entries[x].first, &i);
5444 + snprintf (line, len, "%d-%d%n",
5445 + data->entries[x].first, data->entries[x].last, &i);
5449 + i = puti (line, data->entries[x].first);
5450 + line +=i; len -= i;
5451 + if (data->entries[x].first != data->entries[x].last)
5455 + i = puti (line, data->entries[x].last);
5456 + line +=i; len -= i;
5465 +void newsrc_gen_entries (CONTEXT *ctx)
5467 + NNTP_DATA *data = (NNTP_DATA *)ctx->data;
5469 + unsigned int last = 0, first = 1;
5470 + int save_sort = SORT_ORDER;
5472 + if (Sort != SORT_ORDER)
5475 + Sort = SORT_ORDER;
5476 + mutt_sort_headers (ctx, 0);
5481 + data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY));
5486 + * Set up to fake initial sequence from 1 to the article before the
5487 + * first article in our list
5492 + for (x = 0; x < ctx->msgcount; x++)
5494 + if (series) /* search for first unread */
5497 + * We don't actually check sequential order, since we mark
5498 + * "missing" entries as read/deleted
5500 + last = ctx->hdrs[x]->article_num;
5501 + if (last >= data->firstMessage && !ctx->hdrs[x]->deleted &&
5502 + !ctx->hdrs[x]->read)
5504 + if (data->num >= data->max)
5506 + data->max = data->max * 2;
5507 + safe_realloc ((void **)&data->entries,
5508 + data->max * sizeof (NEWSRC_ENTRY));
5510 + data->entries[data->num].first = first;
5511 + data->entries[data->num].last = last - 1;
5516 + else /* search for first read */
5518 + if (ctx->hdrs[x]->deleted || ctx->hdrs[x]->read)
5523 + last = ctx->hdrs[x]->article_num;
5526 + if (series && first <= data->lastLoaded)
5528 + if (data->num >= data->max)
5530 + data->max = data->max * 2;
5531 + safe_realloc ((void **)&data->entries,
5532 + data->max * sizeof (NEWSRC_ENTRY));
5534 + data->entries[data->num].first = first;
5535 + data->entries[data->num].last = data->lastLoaded;
5539 + if (save_sort != Sort)
5542 + mutt_sort_headers (ctx, 0);
5546 +int mutt_newsrc_update (NNTP_SERVER *news)
5556 + llen = len = 10 * LONG_STRING;
5557 + line = buf = safe_calloc (1, len);
5558 + /* we will generate full newsrc here */
5559 + for (tmp = news->list; tmp; tmp = tmp->next)
5561 + data = (NNTP_DATA *) tmp->data;
5562 + if (!data || !data->rc)
5564 + nntp_create_newsrc_line (data, &buf, &line, &llen);
5565 + dprint (2, (debugfile, "Added to newsrc: %s", line));
5566 + line += strlen (line);
5568 + /* newrc being fully rewritten */
5569 + if (news->newsrc &&
5570 + (r = mutt_update_list_file (news->newsrc, NULL, "", buf)) == 0)
5574 + stat (news->newsrc, &st);
5575 + news->size = st.st_size;
5576 + news->mtime = st.st_mtime;
5582 +static FILE *mutt_mkname (char *s)
5584 + char buf[_POSIX_PATH_MAX], *pc;
5588 + nntp_cache_expand (buf, s);
5589 + if ((fp = safe_fopen (buf, "w")))
5592 + nntp_cache_expand (buf, "cache-XXXXXX");
5593 + pc = buf + strlen (buf) - 12; /* positioning to "cache-XXXXXX" */
5594 + if ((fd = mkstemp (buf)) == -1)
5596 + strcpy (s, pc); /* generated name */
5597 + return fdopen (fd, "w");
5600 +/* Updates info into .index file: ALL or about selected newsgroup */
5601 +static int nntp_update_cacheindex (NNTP_SERVER *serv, NNTP_DATA *data)
5603 + char buf[LONG_STRING], *key = "ALL";
5604 + char file[_POSIX_PATH_MAX];
5606 + if (!serv || !serv->conn || !serv->conn->account.host)
5609 + if (data && data->group)
5611 + key = data->group;
5612 + snprintf (buf, sizeof (buf), "%s %s %d %d", key, data->cache,
5613 + data->firstMessage, data->lastLoaded);
5617 + strfcpy (file, serv->cache, sizeof (file));
5618 + snprintf (buf, sizeof (buf), "ALL %s 0 %d", file, (int)serv->newgroups_time);
5620 + nntp_cache_expand (file, ".index");
5621 + return mutt_update_list_file (file, serv->conn->account.host, key, buf);
5624 +/* Remove cache files of unsubscribed newsgroups */
5625 +void nntp_clear_cacheindex (NNTP_SERVER *news)
5630 + if (option (OPTSAVEUNSUB) || !news)
5633 + for (tmp = news->list; tmp; tmp = tmp->next)
5635 + data = (NNTP_DATA *) tmp->data;
5636 + if (!data || data->subscribed || !data->cache)
5638 + nntp_delete_cache (data);
5639 + dprint (2, (debugfile, "Removed from .index: %s\n", data->group));
5644 +int nntp_save_cache_index (NNTP_SERVER *news)
5646 + char buf[HUGE_STRING];
5647 + char file[_POSIX_PATH_MAX];
5652 + if (!news || !news->newsgroups)
5654 + if (!option (OPTNEWSCACHE))
5659 + nntp_cache_expand (file, news->cache);
5661 + f = safe_fopen (file, "w");
5665 + strfcpy (buf, news->conn->account.host, sizeof(buf));
5666 + f = mutt_mkname (buf);
5667 + news->cache = safe_strdup (buf);
5668 + nntp_cache_expand (file, buf);
5673 + for (l = news->list; l; l = l->next)
5675 + if ((d = (NNTP_DATA *)l->data) && !d->deleted)
5678 + snprintf (buf, sizeof(buf), "%s %d %d %c %s\n", d->group,
5679 + d->lastMessage, d->firstMessage, d->allowed ? 'y' : 'n',
5682 + snprintf (buf, sizeof(buf), "%s %d %d %c\n", d->group,
5683 + d->lastMessage, d->firstMessage, d->allowed ? 'y' : 'n');
5684 + if (fputs (buf, f) == EOF)
5694 + if (nntp_update_cacheindex (news, NULL))
5702 +int nntp_save_cache_group (CONTEXT *ctx)
5704 + char buf[HUGE_STRING], addr[STRING];
5705 + char file[_POSIX_PATH_MAX];
5709 + int i = 0, save = SORT_ORDER;
5712 + if (!option (OPTNEWSCACHE))
5714 + if (!ctx || !ctx->data || ctx->magic != M_NNTP)
5717 + if (((NNTP_DATA *)ctx->data)->cache)
5719 + nntp_cache_expand (file, ((NNTP_DATA *)ctx->data)->cache);
5721 + f = safe_fopen (file, "w");
5725 + snprintf (buf, sizeof(buf), "%s-%s",
5726 + ((NNTP_DATA *)ctx->data)->nserv->conn->account.host,
5727 + ((NNTP_DATA *)ctx->data)->group);
5728 + f = mutt_mkname (buf);
5729 + ((NNTP_DATA *)ctx->data)->cache = safe_strdup (buf);
5730 + nntp_cache_expand (file, buf);
5735 + if (Sort != SORT_ORDER)
5738 + Sort = SORT_ORDER;
5739 + mutt_sort_headers (ctx, 0);
5742 + /* Save only $nntp_context messages... */
5743 + ((NNTP_DATA *)ctx->data)->lastCached = 0;
5744 + if (NntpContext && ctx->msgcount > NntpContext)
5745 + i = ctx->msgcount - NntpContext;
5746 + for (; i < ctx->msgcount; i++)
5748 + if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->article_num != prev)
5752 + rfc822_write_address (addr, sizeof(addr), h->env->from);
5753 + tm = gmtime (&h->date_sent);
5754 + snprintf (buf, sizeof(buf),
5755 + "%d\t%s\t%s\t%d %s %d %02d:%02d:%02d GMT\t%s\t",
5756 + h->article_num, h->env->subject, addr, tm->tm_mday,
5757 + Months[tm->tm_mon], tm->tm_year+1900, tm->tm_hour, tm->tm_min,
5758 + tm->tm_sec, h->env->message_id);
5760 + if (h->env->references)
5761 + mutt_write_references (h->env->references, f);
5762 + snprintf (buf, sizeof(buf), "\t%ld\t%d\tXref: %s\n", h->content->length,
5763 + h->lines, NONULL(h->env->xref));
5764 + if (fputs (buf, f) == EOF)
5771 + prev = ctx->hdrs[i]->article_num;
5777 + mutt_sort_headers (ctx, 0);
5781 + if (nntp_update_cacheindex (((NNTP_DATA *)ctx->data)->nserv,
5782 + (NNTP_DATA *)ctx->data))
5787 + ((NNTP_DATA *)ctx->data)->lastCached = ((NNTP_DATA *)ctx->data)->lastLoaded;
5791 +void nntp_delete_cache (NNTP_DATA *data)
5793 + char buf[_POSIX_PATH_MAX];
5795 + if (!option (OPTNEWSCACHE) || !data || !data->cache || !data->nserv)
5798 + nntp_cache_expand (buf, data->cache);
5800 + FREE (&data->cache);
5801 + data->lastCached = 0;
5802 + nntp_cache_expand (buf, ".index");
5803 + mutt_update_list_file (buf, data->nserv->conn->account.host, data->group, NULL);
5806 +NNTP_DATA *mutt_newsgroup_subscribe (NNTP_SERVER *news, char *group)
5810 + if (!news || !news->newsgroups || !group || !*group)
5812 + if (!(data = (NNTP_DATA *)hash_find (news->newsgroups, group)))
5814 + data = (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1);
5815 + data->group = (char *) data + sizeof (NNTP_DATA);
5816 + strcpy (data->group, group);
5817 + data->nserv = news;
5818 + data->deleted = 1;
5819 + if (news->newsgroups->nelem < news->newsgroups->curnelem * 2)
5820 + news->newsgroups = hash_resize (news->newsgroups, news->newsgroups->nelem * 2);
5821 + hash_insert (news->newsgroups, data->group, data, 0);
5822 + nntp_add_to_list (news, data);
5824 + if (!data->subscribed)
5826 + data->subscribed = 1;
5832 +NNTP_DATA *mutt_newsgroup_unsubscribe (NNTP_SERVER *news, char *group)
5836 + if (!news || !news->newsgroups || !group || !*group ||
5837 + !(data = (NNTP_DATA *)hash_find (news->newsgroups, group)))
5839 + if (data->subscribed)
5841 + data->subscribed = 0;
5842 + if (!option (OPTSAVEUNSUB))
5848 +NNTP_DATA *mutt_newsgroup_catchup (NNTP_SERVER *news, char *group)
5852 + if (!news || !news->newsgroups || !group || !*group ||
5853 + !(data = (NNTP_DATA *)hash_find (news->newsgroups, group)))
5857 + data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY));
5861 + data->entries[0].first = 1;
5863 + data->entries[0].last = data->lastMessage;
5864 + if (Context && Context->data == data)
5868 + for (x = 0; x < Context->msgcount; x++)
5869 + mutt_set_flag (Context, Context->hdrs[x], M_READ, 1);
5874 +NNTP_DATA *mutt_newsgroup_uncatchup (NNTP_SERVER *news, char *group)
5878 + if (!news || !news->newsgroups || !group || !*group ||
5879 + !(data = (NNTP_DATA *)hash_find (news->newsgroups, group)))
5883 + data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY));
5887 + data->entries[0].first = 1;
5888 + data->entries[0].last = data->firstMessage - 1;
5889 + if (Context && Context->data == data)
5893 + data->unread = Context->msgcount;
5894 + for (x = 0; x < Context->msgcount; x++)
5895 + mutt_set_flag (Context, Context->hdrs[x], M_READ, 0);
5898 + data->unread = data->lastMessage - data->entries[0].last;
5902 +/* this routine gives the first newsgroup with new messages */
5903 +void nntp_buffy (char *s)
5907 + for (list = CurrentNewsSrv->list; list; list = list->next)
5909 + NNTP_DATA *data = (NNTP_DATA *) list->data;
5911 + if (data && data->subscribed && data->unread)
5913 + if (Context && Context->magic == M_NNTP &&
5914 + !mutt_strcmp (data->group, ((NNTP_DATA *) Context->data)->group))
5916 + unsigned int i, unread = 0;
5918 + for (i = 0; i < Context->msgcount; i++)
5919 + if (!Context->hdrs[i]->read && !Context->hdrs[i]->deleted)
5924 + strcpy (s, data->group);
5929 diff -uNr mutt-1.4.orig/nntp.c mutt-1.4/nntp.c
5930 --- mutt-1.4.orig/nntp.c Thu Jan 1 01:00:00 1970
5931 +++ mutt-1.4/nntp.c Sun Nov 3 21:57:20 2002
5934 + * Copyright (C) 1998 Brandon Long <blong@fiction.net>
5935 + * Copyright (C) 1999 Andrej Gritsenko <andrej@lucky.net>
5936 + * Copyright (C) 2000-2002 Vsevolod Volkov <vvv@mutt.org.ua>
5938 + * This program is free software; you can redistribute it and/or modify
5939 + * it under the terms of the GNU General Public License as published by
5940 + * the Free Software Foundation; either version 2 of the License, or
5941 + * (at your option) any later version.
5943 + * This program is distributed in the hope that it will be useful,
5944 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5945 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5946 + * GNU General Public License for more details.
5948 + * You should have received a copy of the GNU General Public License
5949 + * along with this program; if not, write to the Free Software
5950 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
5954 +#include "mutt_curses.h"
5958 +#include "rfc1524.h"
5959 +#include "rfc2047.h"
5960 +#include "mailbox.h"
5967 +#include <unistd.h>
5968 +#include <string.h>
5970 +#include <stdlib.h>
5972 +static unsigned int _checked = 0;
5975 +static void nntp_error (const char *where, const char *msg)
5977 + dprint (1, (debugfile, "nntp_error(): unexpected response in %s: %s\n", where, msg));
5981 +static int nntp_connect_error (NNTP_SERVER *serv)
5983 + serv->status = NNTP_NONE;
5984 + mutt_socket_close (serv->conn);
5985 + mutt_error _("Server closed connection!");
5990 +static int nntp_connect_and_auth (NNTP_SERVER *serv)
5992 + CONNECTION *conn = serv->conn;
5994 + unsigned char flags = conn->account.flags;
5996 + serv->status = NNTP_NONE;
5998 + if (mutt_socket_open (conn) < 0)
6001 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
6002 + return nntp_connect_error (serv);
6004 + if (!mutt_strncmp ("200", buf, 3))
6005 + mutt_message (_("Connected to %s. Posting ok."), conn->account.host);
6006 + else if (!mutt_strncmp ("201", buf, 3))
6007 + mutt_message (_("Connected to %s. Posting NOT ok."), conn->account.host);
6010 + mutt_socket_close (conn);
6011 + mutt_remove_trailing_ws (buf);
6012 + mutt_error ("%s", buf);
6019 + /* Tell INN to switch to mode reader if it isn't so. Ignore all
6020 + returned codes and messages. */
6021 + mutt_socket_write (conn, "MODE READER\r\n");
6022 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
6023 + return nntp_connect_error (serv);
6025 + mutt_socket_write (conn, "STAT\r\n");
6026 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
6027 + return nntp_connect_error (serv);
6029 + if (!(conn->account.flags & M_ACCT_USER) && mutt_strncmp ("480", buf, 3))
6031 + serv->status = NNTP_OK;
6035 + if (mutt_account_getuser (&conn->account) || !conn->account.user[0] ||
6036 + mutt_account_getpass (&conn->account) || !conn->account.pass[0])
6038 + mutt_socket_close (conn);
6039 + serv->status = NNTP_BYE;
6040 + conn->account.flags = flags;
6044 + mutt_message _("Logging in...");
6046 + snprintf (buf, sizeof (buf), "AUTHINFO USER %s\r\n", conn->account.user);
6047 + mutt_socket_write (conn, buf);
6048 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
6050 + conn->account.flags = flags;
6051 + return nntp_connect_error (serv);
6055 + /* don't print the password unless we're at the ungodly debugging level */
6056 + if (debuglevel < M_SOCK_LOG_FULL)
6057 + dprint (M_SOCK_LOG_CMD, (debugfile, "> AUTHINFO PASS *\n"));
6059 + snprintf (buf, sizeof (buf), "AUTHINFO PASS %s\r\n", conn->account.pass);
6060 + mutt_socket_write_d (conn, buf, M_SOCK_LOG_FULL);
6061 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
6063 + conn->account.flags = flags;
6064 + return nntp_connect_error (serv);
6067 + if (!mutt_strncmp ("281", buf, 3))
6069 + serv->status = NNTP_OK;
6073 + mutt_socket_close (conn);
6074 + conn->account.flags = flags;
6075 + mutt_error _("Login failed.");
6080 +static int nntp_attempt_features (NNTP_SERVER *serv)
6082 + char buf[LONG_STRING];
6083 + CONNECTION *conn = serv->conn;
6085 + mutt_socket_write (conn, "XOVER\r\n");
6086 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
6087 + return nntp_connect_error (serv);
6088 + if (mutt_strncmp ("500", buf, 3))
6089 + serv->hasXOVER = 1;
6091 + mutt_socket_write (conn, "XPAT\r\n");
6092 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
6093 + return nntp_connect_error (serv);
6094 + if (mutt_strncmp ("500", buf, 3))
6095 + serv->hasXPAT = 1;
6097 + mutt_socket_write (conn, "XGTITLE +\r\n");
6098 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
6099 + return nntp_connect_error (serv);
6100 + if (mutt_strncmp ("500", buf, 3))
6101 + serv->hasXGTITLE = 1;
6103 + if (!mutt_strncmp ("282", buf, 3))
6107 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
6108 + return nntp_connect_error (serv);
6109 + } while (!(buf[0] == '.' && buf[1] == '\0'));
6115 +static int nntp_open_connection (NNTP_SERVER *serv)
6117 + if (serv->status == NNTP_OK)
6119 + if (serv->status == NNTP_BYE)
6121 + if (nntp_connect_and_auth (serv) < 0)
6123 + if (nntp_attempt_features (serv) < 0)
6128 +static int nntp_reconnect (NNTP_SERVER *serv)
6130 + char buf[SHORT_STRING];
6132 + mutt_socket_close (serv->conn);
6136 + if (nntp_connect_and_auth (serv) == 0)
6139 + snprintf (buf, sizeof (buf), _("Connection to %s lost. Reconnect?"),
6140 + serv->conn->account.host);
6141 + if (query_quadoption (OPT_NNTPRECONNECT, buf) != M_YES)
6143 + serv->status = NNTP_BYE;
6149 +/* Send data from line[LONG_STRING] and receive answer to same line */
6150 +static int mutt_nntp_query (NNTP_DATA *data, char *line, size_t linelen)
6152 + char buf[LONG_STRING];
6155 + if (data->nserv->status == NNTP_BYE)
6160 + if (!*line && data->group)
6162 + snprintf (buf, sizeof (buf), "GROUP %s\r\n", data->group);
6163 + mutt_socket_write (data->nserv->conn, buf);
6166 + mutt_socket_write (data->nserv->conn, line);
6169 + if (mutt_socket_readln (buf, sizeof (buf), data->nserv->conn) < 0)
6171 + if (nntp_reconnect (data->nserv) < 0)
6176 + snprintf (buf, sizeof (buf), "GROUP %s\r\n", data->group);
6177 + mutt_socket_write (data->nserv->conn, buf);
6178 + if (mutt_socket_readln (buf, sizeof (buf), data->nserv->conn) < 0)
6181 + if (*line) done = FALSE;
6185 + strfcpy (line, buf, linelen);
6190 + * This function calls funct(*line, *data) for each received line,
6191 + * funct(NULL, *data) if rewind(*data) needs, exits when fail or done.
6194 + * 1 - correct but not performed (may be, have to be continued),
6195 + * -1 - conection lost,
6196 + * -2 - invalid command or execution error,
6197 + * -3 - error in funct(*line, *data).
6199 +static int mutt_nntp_fetch (NNTP_DATA *nntp_data, char *query, char *msg,
6200 + int (*funct) (char *, void *), void *data, int tagged)
6202 + char buf[LONG_STRING];
6206 + size_t lenbuf = 0;
6211 + strfcpy (buf, query, sizeof (buf));
6212 + if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0)
6214 + if (buf[0] == '5')
6216 + if (buf[0] != '2')
6221 + inbuf = safe_malloc (sizeof (buf));
6225 + chunk = mutt_socket_readln_d (buf, sizeof (buf), nntp_data->nserv->conn,
6231 + if (!lenbuf && buf[0] == '.')
6233 + if (buf[1] == '\0')
6238 + if (buf[1] == '.')
6242 + strfcpy (inbuf + lenbuf, p, sizeof (buf));
6244 + if (chunk >= sizeof (buf))
6246 + lenbuf += strlen (p);
6251 + if (msg && ReadInc && (line % ReadInc == 0)) {
6253 + mutt_message (_("%s (tagged: %d) %d"), msg, tagged, line);
6255 + mutt_message ("%s %d", msg, line);
6258 + if (ret == 0 && funct (inbuf, data) < 0)
6263 + safe_realloc ((void **) &inbuf, lenbuf + sizeof (buf));
6266 + funct (NULL, data);
6272 +static int nntp_read_tempfile (char *line, void *file)
6274 + FILE *f = (FILE *)file;
6281 + if (fputc ('\n', f) == EOF)
6287 +static void nntp_parse_xref (CONTEXT *ctx, char *group, char *xref, HEADER *h)
6289 + register char *p, *b;
6290 + register char *colon = NULL;
6295 + /* skip to next word */
6297 + while (*b && ((*b == ' ') || (*b == '\t'))) b++;
6300 + /* skip to end of word */
6301 + while (*p && (*p != ' ') && (*p != '\t'))
6316 + nntp_get_status (ctx, h, p, atoi(colon));
6317 + if (h && h->article_num == 0 && mutt_strcmp (group, b) == 0)
6318 + h->article_num = atoi(colon);
6326 + * 1 if article not found
6327 + * -1 if read or write error on tempfile or socket
6329 +static int nntp_read_header (CONTEXT *ctx, const char *msgid, int article_num)
6331 + NNTP_DATA *nntp_data = ((NNTP_DATA *)ctx->data);
6333 + char buf[LONG_STRING];
6334 + char tempfile[_POSIX_PATH_MAX];
6336 + HEADER *h = ctx->hdrs[ctx->msgcount];
6338 + mutt_mktemp (tempfile);
6339 + if (!(f = safe_fopen (tempfile, "w+")))
6343 + snprintf (buf, sizeof (buf), "HEAD %d\r\n", article_num);
6345 + snprintf (buf, sizeof (buf), "HEAD %s\r\n", msgid);
6347 + ret = mutt_nntp_fetch (nntp_data, buf, NULL, nntp_read_tempfile, f, 0);
6352 + dprint(1, (debugfile, "nntp_read_header: %s\n", buf));
6355 + unlink (tempfile);
6356 + return (ret == -1 ? -1 : 1);
6359 + h->article_num = article_num;
6360 + h->env = mutt_read_rfc822_header (f, h, 0, 0);
6362 + unlink (tempfile);
6364 + if (h->env->xref != NULL)
6365 + nntp_parse_xref (ctx, nntp_data->group, h->env->xref, h);
6366 + else if (h->article_num == 0 && msgid)
6368 + snprintf (buf, sizeof (buf), "STAT %s\r\n", msgid);
6369 + if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) == 0)
6370 + h->article_num = atoi (buf + 4);
6376 +static int parse_description (char *line, void *n)
6378 +#define news ((NNTP_SERVER *) n)
6379 + register char *d = line;
6384 + while (*d && *d != '\t' && *d != ' ') d++;
6387 + while (*d && (*d == '\t' || *d == ' ')) d++;
6388 + dprint (2, (debugfile, "group: %s, desc: %s\n", line, d));
6389 + if ((data = (NNTP_DATA *) hash_find (news->newsgroups, line)) != NULL &&
6390 + mutt_strcmp (d, data->desc))
6392 + FREE (&data->desc);
6393 + data->desc = safe_strdup (d);
6399 +static void nntp_get_desc (NNTP_DATA *data, char *mask, char *msg)
6403 + if (!option (OPTLOADDESC) || !data || !data->nserv)
6406 + /* Get newsgroup description, if we can */
6407 + if (data->nserv->hasXGTITLE)
6408 + snprintf (buf, sizeof (buf), "XGTITLE %s\r\n", mask);
6410 + snprintf (buf, sizeof (buf), "LIST NEWSGROUPS %s\r\n", mask);
6411 + if (mutt_nntp_fetch (data, buf, msg, parse_description, data->nserv, 0) != 0)
6414 + nntp_error ("nntp_get_desc()", buf);
6420 + * XOVER returns a tab separated list of:
6421 + * id|subject|from|date|Msgid|references|bytes|lines|xref
6423 + * This has to duplicate some of the functionality of
6424 + * mutt_read_rfc822_header(), since it replaces the call to that (albeit with
6425 + * a limited number of headers which are "parsed" by placement in the list)
6427 +static int nntp_parse_xover (CONTEXT *ctx, char *buf, HEADER *hdr)
6429 + NNTP_DATA *nntp_data = (NNTP_DATA *) ctx->data;
6433 + hdr->env = mutt_new_envelope();
6434 + hdr->env->newsgroups = safe_strdup (nntp_data->group);
6435 + hdr->content = mutt_new_body();
6436 + hdr->content->type = TYPETEXT;
6437 + hdr->content->subtype = safe_strdup ("plain");
6438 + hdr->content->encoding = ENC7BIT;
6439 + hdr->content->disposition = DISPINLINE;
6440 + hdr->content->length = -1;
6443 + for (x = 0; !done && x < 9; x++)
6445 + /* if from file, need to skip newline character */
6446 + while (*p && *p != '\n' && *p != '\t') p++;
6454 + hdr->article_num = atoi (b);
6455 + nntp_get_status (ctx, hdr, NULL, hdr->article_num);
6458 + hdr->env->subject = safe_strdup (b);
6459 + /* Now we need to do the things which would normally be done in
6460 + * mutt_read_rfc822_header() */
6461 + if (hdr->env->subject)
6463 + regmatch_t pmatch[1];
6465 + rfc2047_decode (&hdr->env->subject);
6467 + if (regexec (ReplyRegexp.rx, hdr->env->subject, 1, pmatch, 0) == 0)
6468 + hdr->env->real_subj = hdr->env->subject + pmatch[0].rm_eo;
6470 + hdr->env->real_subj = hdr->env->subject;
6474 + rfc822_free_address (&hdr->env->from);
6475 + hdr->env->from = rfc822_parse_adrlist (hdr->env->from, b);
6476 + rfc2047_decode_adrlist (hdr->env->from);
6479 + hdr->date_sent = mutt_parse_date (b, hdr);
6480 + hdr->received = hdr->date_sent;
6483 + FREE (&hdr->env->message_id);
6484 + hdr->env->message_id = safe_strdup (b);
6487 + mutt_free_list (&hdr->env->references);
6488 + hdr->env->references = mutt_parse_references (b, 0);
6491 + hdr->content->length = atoi (b);
6494 + hdr->lines = atoi (b);
6498 + FREE (&hdr->env->xref);
6499 + b = b + 6; /* skips the "Xref: " */
6500 + hdr->env->xref = safe_strdup (b);
6501 + nntp_parse_xref (ctx, nntp_data->group, b, hdr);
6513 + unsigned int base;
6514 + unsigned int first;
6515 + unsigned int last;
6516 + unsigned short *messages;
6520 +#define fc ((FETCH_CONTEXT *) c)
6521 +static int nntp_fetch_numbers (char *line, void *c)
6527 + num = atoi (line);
6528 + if (num < fc->base || num > fc->last)
6530 + fc->messages[num - fc->base] = 1;
6534 +static int add_xover_line (char *line, void *c)
6536 + unsigned int num, total;
6537 + CONTEXT *ctx = fc->ctx;
6538 + NNTP_DATA *data = (NNTP_DATA *)ctx->data;
6543 + if (ctx->msgcount >= ctx->hdrmax)
6544 + mx_alloc_memory (ctx);
6545 + ctx->hdrs[ctx->msgcount] = mutt_new_header ();
6546 + ctx->hdrs[ctx->msgcount]->index = ctx->msgcount;
6548 + nntp_parse_xover (ctx, line, ctx->hdrs[ctx->msgcount]);
6549 + num = ctx->hdrs[ctx->msgcount]->article_num;
6551 + if (num >= fc->first && num <= fc->last && fc->messages[num - fc->base])
6554 + if (num > data->lastLoaded)
6555 + data->lastLoaded = num;
6556 + num = num - fc->first + 1;
6557 + total = fc->last - fc->first + 1;
6558 + if (!ctx->quiet && fc->msg && ReadInc && (num % ReadInc == 0))
6559 + mutt_message ("%s %d/%d", fc->msg, num, total);
6562 + mutt_free_header (&ctx->hdrs[ctx->msgcount]); /* skip it */
6568 +static int nntp_fetch_headers (CONTEXT *ctx, unsigned int first,
6569 + unsigned int last)
6571 + char buf[HUGE_STRING];
6572 + char *msg = _("Fetching message headers...");
6573 + NNTP_DATA *nntp_data = ((NNTP_DATA *)ctx->data);
6577 + unsigned int current;
6581 + /* if empty group or nothing to do */
6582 + if (!last || first > last)
6585 + /* fetch list of articles */
6586 + mutt_message _("Fetching list of articles...");
6590 + fc.messages = safe_calloc (last - first + 1, sizeof (unsigned short));
6591 + snprintf (buf, sizeof (buf), "LISTGROUP %s\r\n", nntp_data->group);
6592 + if (mutt_nntp_fetch (nntp_data, buf, NULL, nntp_fetch_numbers, &fc, 0) != 0)
6594 + mutt_error (_("LISTGROUP command failed: %s"), buf);
6596 + nntp_error ("nntp_fetch_headers()", buf);
6598 + FREE (&fc.messages);
6602 + /* CACHE: must be loaded xover cache here */
6603 + num = nntp_data->lastCached - first + 1;
6604 + if (option (OPTNEWSCACHE) && nntp_data->cache && num > 0)
6606 + nntp_cache_expand (buf, nntp_data->cache);
6607 + mutt_message _("Fetching headers from cache...");
6608 + if ((f = safe_fopen (buf, "r")))
6612 + /* counting number of lines */
6613 + while (fgets (buf, sizeof (buf), f) != NULL)
6616 + while (r > num && fgets (buf, sizeof (buf), f) != NULL)
6618 + oldmsgcount = ctx->msgcount;
6620 + fc.last = first + num - 1;
6622 + while (fgets (buf, sizeof (buf), f) != NULL)
6623 + add_xover_line (buf, &fc);
6625 + nntp_data->lastLoaded = fc.last;
6626 + first = fc.last + 1;
6627 + if (ctx->msgcount > oldmsgcount)
6628 + mx_update_context (ctx, ctx->msgcount - oldmsgcount);
6631 + nntp_delete_cache (nntp_data);
6633 + num = last - first + 1;
6636 + FREE (&fc.messages);
6641 + * Without XOVER, we have to fetch each article header and parse
6642 + * it. With XOVER, we ask for all of them
6644 + mutt_message (msg);
6645 + if (nntp_data->nserv->hasXOVER)
6647 + oldmsgcount = ctx->msgcount;
6651 + snprintf (buf, sizeof (buf), "XOVER %d-%d\r\n", first, last);
6652 + ret = mutt_nntp_fetch (nntp_data, buf, NULL, add_xover_line, &fc, 0);
6653 + if (ctx->msgcount > oldmsgcount)
6654 + mx_update_context (ctx, ctx->msgcount - oldmsgcount);
6657 + mutt_error (_("XOVER command failed: %s"), buf);
6659 + nntp_error ("nntp_fetch_headers()", buf);
6661 + FREE (&fc.messages);
6667 + for (current = first; current <= last; current++)
6671 + ret = current - first + 1;
6672 + mutt_message ("%s %d/%d", msg, ret, num);
6674 + if (!fc.messages[current - fc.base])
6677 + if (ctx->msgcount >= ctx->hdrmax)
6678 + mx_alloc_memory (ctx);
6679 + h = ctx->hdrs[ctx->msgcount] = mutt_new_header ();
6680 + h->index = ctx->msgcount;
6682 + ret = nntp_read_header (ctx, NULL, current);
6683 + if (ret == 0) /* Got article. Fetch next header */
6685 + nntp_get_status (ctx, h, NULL, h->article_num);
6687 + mx_update_context (ctx, 1);
6690 + mutt_free_header (&h); /* skip it */
6693 + FREE (&fc.messages);
6697 + if (current > nntp_data->lastLoaded)
6698 + nntp_data->lastLoaded = current;
6700 + FREE (&fc.messages);
6701 + nntp_data->lastLoaded = last;
6702 + mutt_clear_error ();
6707 + * currently, nntp "mailbox" is "newsgroup"
6709 +int nntp_open_mailbox (CONTEXT *ctx)
6711 + NNTP_DATA *nntp_data;
6712 + NNTP_SERVER *serv;
6713 + char buf[HUGE_STRING];
6714 + char server[LONG_STRING];
6716 + unsigned int first;
6719 + if (nntp_parse_url (ctx->path, &acct, buf, sizeof (buf)) < 0 || !*buf)
6721 + mutt_error (_("%s is an invalid newsgroup specification!"), ctx->path);
6727 + nntp_expand_path (server, sizeof (server), &acct);
6728 + if (!(serv = mutt_select_newsserver (server)) || serv->status != NNTP_OK)
6731 + CurrentNewsSrv = serv;
6733 + /* create NNTP-specific state struct if nof found in list */
6734 + if ((nntp_data = (NNTP_DATA *) hash_find (serv->newsgroups, buf)) == NULL)
6736 + nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + strlen (buf) + 1);
6737 + nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
6738 + strcpy (nntp_data->group, buf);
6739 + hash_insert (serv->newsgroups, nntp_data->group, nntp_data, 0);
6740 + nntp_add_to_list (serv, nntp_data);
6742 + ctx->data = nntp_data;
6743 + nntp_data->nserv = serv;
6745 + mutt_message (_("Selecting %s..."), nntp_data->group);
6747 + if (!nntp_data->desc)
6749 + nntp_get_desc (nntp_data, nntp_data->group, NULL);
6750 + if (nntp_data->desc)
6751 + nntp_save_cache_index (serv);
6755 + if (mutt_nntp_query (nntp_data, buf, sizeof(buf)) < 0)
6758 + nntp_error ("nntp_open_mailbox()", buf);
6763 + if (mutt_strncmp ("211", buf, 3))
6765 + LIST *l = serv->list;
6767 + /* GROUP command failed */
6768 + if (!mutt_strncmp ("411", buf, 3))
6770 + mutt_error (_("Newsgroup %s not found on server %s"),
6771 + nntp_data->group, serv->conn->account.host);
6773 + /* CACHE: delete cache and line from .index */
6774 + nntp_delete_cache (nntp_data);
6775 + hash_delete (serv->newsgroups, nntp_data->group, NULL, nntp_delete_data);
6776 + while (l && l->data != (void *) nntp_data) l = l->next;
6786 + sscanf (buf + 4, "%d %u %u %s", &count, &nntp_data->firstMessage,
6787 + &nntp_data->lastMessage, buf);
6789 + nntp_data->deleted = 0;
6791 + time (&serv->check_time);
6794 + * Check for max adding context. If it is greater than $nntp_context,
6795 + * strip off extra articles
6797 + first = nntp_data->firstMessage;
6798 + if (NntpContext && nntp_data->lastMessage - first + 1 > NntpContext)
6799 + first = nntp_data->lastMessage - NntpContext + 1;
6801 + nntp_data->lastLoaded = first - 1;
6802 + return nntp_fetch_headers (ctx, first, nntp_data->lastMessage);
6805 +int nntp_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno)
6807 + char buf[LONG_STRING];
6808 + char path[_POSIX_PATH_MAX];
6809 + NNTP_CACHE *cache;
6810 + char *m = _("Fetching message...");
6813 + /* see if we already have the message in our cache */
6814 + cache = &((NNTP_DATA *) ctx->data)->acache[ctx->hdrs[msgno]->index % NNTP_CACHE_LEN];
6816 + /* if everything is fine, assign msg->fp and return */
6817 + if (cache->path && cache->index == ctx->hdrs[msgno]->index &&
6818 + (msg->fp = fopen (cache->path, "r")))
6821 + /* clear the previous entry */
6822 + unlink (cache->path);
6823 + free (cache->path);
6827 + cache->index = ctx->hdrs[msgno]->index;
6828 + mutt_mktemp (path);
6829 + cache->path = safe_strdup (path);
6830 + if (!(msg->fp = safe_fopen (path, "w+")))
6832 + FREE (&cache->path);
6836 + if (ctx->hdrs[msgno]->article_num == 0)
6837 + snprintf (buf, sizeof (buf), "ARTICLE %s\r\n",
6838 + ctx->hdrs[msgno]->env->message_id);
6840 + snprintf (buf, sizeof (buf), "ARTICLE %d\r\n",
6841 + ctx->hdrs[msgno]->article_num);
6843 + ret = mutt_nntp_fetch ((NNTP_DATA *)ctx->data, buf, m, nntp_read_tempfile,
6844 + msg->fp, ctx->tagged);
6847 + mutt_error (_("Article %d not found on server"),
6848 + ctx->hdrs[msgno]->article_num);
6849 + dprint (1, (debugfile, "nntp_fetch_message: %s\n", buf));
6856 + FREE (&cache->path);
6860 + mutt_free_envelope (&ctx->hdrs[msgno]->env);
6861 + ctx->hdrs[msgno]->env = mutt_read_rfc822_header (msg->fp, ctx->hdrs[msgno], 0, 0);
6862 + /* fix content length */
6863 + fseek(msg->fp, 0, SEEK_END);
6864 + ctx->hdrs[msgno]->content->length = ftell (msg->fp) -
6865 + ctx->hdrs[msgno]->content->offset;
6867 + /* this is called in mutt before the open which fetches the message,
6868 + * which is probably wrong, but we just call it again here to handle
6869 + * the problem instead of fixing it.
6871 + mutt_parse_mime_message (ctx, ctx->hdrs[msgno]);
6873 + /* These would normally be updated in mx_update_context(), but the
6874 + * full headers aren't parsed with XOVER, so the information wasn't
6878 + ctx->hdrs[msgno]->pgp = pgp_query (ctx->hdrs[msgno]->content);
6879 +#endif /* HAVE_PGP */
6881 + mutt_clear_error();
6888 +int nntp_post (const char *msg) {
6889 + char buf[LONG_STRING];
6892 + NNTP_DATA *nntp_data;
6894 + if (Context && Context->magic == M_NNTP)
6895 + nntp_data = (NNTP_DATA *)Context->data;
6898 + if (!(CurrentNewsSrv = mutt_select_newsserver (NewsServer)) ||
6899 + !CurrentNewsSrv->list || !CurrentNewsSrv->list->data)
6901 + mutt_error (_("Can't post article. No connection to news server."));
6904 + nntp_data = (NNTP_DATA *)CurrentNewsSrv->list->data;
6907 + if (!(f = safe_fopen (msg, "r")))
6909 + mutt_error (_("Can't post article. Unable to open %s"), msg);
6913 + strfcpy (buf, "POST\r\n", sizeof (buf));
6914 + if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0)
6916 + mutt_error (_("Can't post article. Connection to %s lost."),
6917 + nntp_data->nserv->conn->account.host);
6920 + if (buf[0] != '3')
6922 + mutt_error (_("Can't post article: %s"), buf);
6928 + while (fgets (buf + 1, sizeof (buf) - 2, f) != NULL)
6930 + len = strlen (buf);
6931 + if (buf[len - 1] == '\n')
6933 + buf[len - 1] = '\r';
6938 + if (buf[1] == '.')
6939 + mutt_socket_write_d (nntp_data->nserv->conn, buf, M_SOCK_LOG_HDR);
6941 + mutt_socket_write_d (nntp_data->nserv->conn, buf + 1, M_SOCK_LOG_HDR);
6945 + if (buf[strlen (buf) - 1] != '\n')
6946 + mutt_socket_write_d (nntp_data->nserv->conn, "\r\n", M_SOCK_LOG_HDR);
6947 + mutt_socket_write_d (nntp_data->nserv->conn, ".\r\n", M_SOCK_LOG_HDR);
6948 + if (mutt_socket_readln (buf, sizeof (buf), nntp_data->nserv->conn) < 0)
6950 + mutt_error (_("Can't post article. Connection to %s lost."),
6951 + nntp_data->nserv->conn->account.host);
6954 + if (buf[0] != '2')
6956 + mutt_error (_("Can't post article: %s"), buf);
6963 +/* nntp_logout_all: close all open connections. */
6964 +void nntp_logout_all (void)
6966 + char buf[LONG_STRING];
6970 + conn = mutt_socket_head ();
6976 + if (conn->account.type == M_ACCT_TYPE_NNTP)
6978 + mutt_message (_("Closing connection to %s..."), conn->account.host);
6979 + mutt_socket_write (conn, "QUIT\r\n");
6980 + mutt_socket_readln (buf, sizeof (buf), conn);
6981 + mutt_clear_error ();
6982 + mutt_socket_close (conn);
6984 + mutt_socket_free (tmp);
6987 + conn = conn->next;
6991 +static void nntp_free_acache (NNTP_DATA *data)
6995 + for (i = 0; i < NNTP_CACHE_LEN; i++)
6997 + if (data->acache[i].path)
6999 + unlink (data->acache[i].path);
7000 + FREE (&data->acache[i].path);
7005 +void nntp_delete_data (void *p)
7007 + NNTP_DATA *data = (NNTP_DATA *)p;
7011 + FREE (&data->entries);
7012 + FREE (&data->desc);
7013 + FREE (&data->cache);
7014 + nntp_free_acache (data);
7018 +int nntp_sync_mailbox (CONTEXT *ctx)
7020 + NNTP_DATA *data = ctx->data;
7022 + /* CACHE: update cache and .index files */
7023 + if ((option (OPTSAVEUNSUB) || data->subscribed))
7024 + nntp_save_cache_group (ctx);
7025 + nntp_free_acache (data);
7027 + data->nserv->check_time = 0; /* next nntp_check_mailbox() will really check */
7031 +void nntp_fastclose_mailbox (CONTEXT *ctx)
7033 + NNTP_DATA *data = (NNTP_DATA *) ctx->data, *tmp;
7037 + nntp_free_acache (data);
7038 + if (!data->nserv || !data->nserv->newsgroups || !data->group)
7040 + nntp_save_cache_index (data->nserv);
7041 + if ((tmp = hash_find (data->nserv->newsgroups, data->group)) == NULL
7043 + nntp_delete_data (data);
7046 +/* commit changes and terminate connection */
7047 +int nntp_close_mailbox (CONTEXT *ctx)
7051 + mutt_message _("Quitting newsgroup...");
7054 + NNTP_DATA *data = (NNTP_DATA *) ctx->data;
7057 + if (data->nserv && data->nserv->conn && ctx->unread)
7059 + ret = query_quadoption (OPT_CATCHUP, _("Mark all articles read?"));
7061 + mutt_newsgroup_catchup (data->nserv, data->group);
7066 + nntp_sync_mailbox (ctx);
7067 + if (ctx->data && ((NNTP_DATA *)ctx->data)->nserv)
7069 + NNTP_SERVER *news;
7071 + news = ((NNTP_DATA *)ctx->data)->nserv;
7072 + newsrc_gen_entries (ctx);
7073 + ((NNTP_DATA *)ctx->data)->unread = ctx->unread;
7074 + mutt_newsrc_update (news);
7076 + mutt_clear_error();
7080 +/* use the GROUP command to poll for new mail */
7081 +static int _nntp_check_mailbox (CONTEXT *ctx, NNTP_DATA *nntp_data)
7083 + char buf[LONG_STRING];
7086 + if (nntp_data->nserv->check_time + NewsPollTimeout > time (NULL))
7090 + if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0)
7093 + nntp_error ("nntp_check_mailbox()", buf);
7097 + if (mutt_strncmp ("211", buf, 3))
7100 + if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0)
7103 + nntp_error ("nntp_check_mailbox()", buf);
7108 + if (!mutt_strncmp ("211", buf, 3))
7113 + sscanf (buf + 4, "%d %d %d", &count, &first, &last);
7114 + nntp_data->firstMessage = first;
7115 + nntp_data->lastMessage = last;
7116 + if (ctx && last > nntp_data->lastLoaded)
7118 + nntp_fetch_headers (ctx, nntp_data->lastLoaded + 1, last);
7119 + time (&nntp_data->nserv->check_time);
7122 + if (!last || (!nntp_data->rc && !nntp_data->lastCached))
7123 + nntp_data->unread = count;
7125 + mutt_newsgroup_stat (nntp_data);
7126 + /* active was renumbered? */
7127 + if (last < nntp_data->lastLoaded)
7129 + if (!nntp_data->max)
7131 + nntp_data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY));
7132 + nntp_data->max = 5;
7134 + nntp_data->lastCached = 0;
7135 + nntp_data->num = 1;
7136 + nntp_data->entries[0].first = 1;
7137 + nntp_data->entries[0].last = 0;
7141 + time (&nntp_data->nserv->check_time);
7145 +int nntp_check_mailbox (CONTEXT *ctx)
7147 + return _nntp_check_mailbox (ctx, (NNTP_DATA *)ctx->data);
7150 +static int add_group (char *buf, void *serv)
7152 +#define s ((NNTP_SERVER *) serv)
7153 + char group[LONG_STRING], mod, desc[HUGE_STRING];
7155 + NNTP_DATA *nntp_data;
7158 + _checked = n; /* _checked have N, where N = number of groups */
7159 + if (!buf) /* at EOF must be zerouth */
7166 + sscanf (buf, "%s %d %d %c %[^\n]", group, &last, &first, &mod, desc);
7169 + if ((nntp_data = (NNTP_DATA *) hash_find (s->newsgroups, group)) == NULL)
7172 + nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1);
7173 + nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
7174 + strcpy (nntp_data->group, group);
7175 + nntp_data->nserv = s;
7176 + if (s->newsgroups->nelem < s->newsgroups->curnelem * 2)
7177 + s->newsgroups = hash_resize (s->newsgroups, s->newsgroups->nelem * 2);
7178 + hash_insert (s->newsgroups, nntp_data->group, nntp_data, 0);
7179 + nntp_add_to_list (s, nntp_data);
7181 + nntp_data->deleted = 0;
7182 + nntp_data->firstMessage = first;
7183 + nntp_data->lastMessage = last;
7185 + nntp_data->allowed = 1;
7187 + nntp_data->allowed = 0;
7188 + if (nntp_data->desc)
7189 + FREE (&nntp_data->desc);
7191 + nntp_data->desc = safe_strdup (desc);
7192 + if (nntp_data->rc || nntp_data->lastCached)
7193 + mutt_newsgroup_stat (nntp_data);
7194 + else if (nntp_data->lastMessage &&
7195 + nntp_data->firstMessage <= nntp_data->lastMessage)
7196 + nntp_data->unread = nntp_data->lastMessage - nntp_data->firstMessage + 1;
7198 + nntp_data->unread = 0;
7204 +int nntp_check_newgroups (NNTP_SERVER *serv, int force)
7206 + char buf[LONG_STRING];
7207 + NNTP_DATA nntp_data;
7213 + if (!serv || !serv->newgroups_time)
7216 + if (nntp_open_connection (serv) < 0)
7219 + /* check subscribed groups for new news */
7220 + if (option (OPTSHOWNEWNEWS))
7222 + mutt_message _("Checking for new messages...");
7223 + for (l = serv->list; l; l = l->next)
7225 + serv->check_time = 0; /* really check! */
7226 + if (l->data && ((NNTP_DATA *) l->data)->subscribed)
7227 + _nntp_check_mailbox (NULL, (NNTP_DATA *) l->data);
7233 + mutt_message _("Checking for new newsgroups...");
7234 + now = serv->newgroups_time;
7235 + time (&serv->newgroups_time);
7236 + t = gmtime (&now);
7237 + snprintf (buf, sizeof (buf), "NEWGROUPS %02d%02d%02d %02d%02d%02d GMT\r\n",
7238 + (t->tm_year % 100), t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min,
7240 + nntp_data.nserv = serv;
7241 + if (Context && Context->magic == M_NNTP)
7242 + nntp_data.group = ((NNTP_DATA *)Context->data)->group;
7244 + nntp_data.group = NULL;
7246 + if (mutt_nntp_fetch (&nntp_data, buf, _("Adding new newsgroups..."),
7247 + add_group, serv, 0) != 0)
7250 + nntp_error ("nntp_check_newgroups()", buf);
7255 + mutt_message _("Loading descriptions...");
7257 + emp.next = l->next;
7259 + emp.next = serv->list;
7264 + ((NNTP_DATA *) l->data)->new = 1;
7265 + nntp_get_desc ((NNTP_DATA *) l->data, ((NNTP_DATA *) l->data)->group, NULL);
7268 + nntp_save_cache_index (serv);
7269 + mutt_clear_error ();
7273 +/* Load list of all newsgroups from cache ALL */
7274 +int nntp_get_cache_all (NNTP_SERVER *serv)
7276 + char buf[HUGE_STRING];
7279 + nntp_cache_expand (buf, serv->cache);
7280 + if ((f = safe_fopen (buf, "r")))
7284 + while (fgets (buf, sizeof(buf), f) != NULL)
7286 + if (ReadInc && (i % ReadInc == 0))
7287 + mutt_message (_("Loading list from cache... %d"), i);
7288 + add_group (buf, serv);
7291 + add_group (NULL, NULL);
7293 + mutt_clear_error ();
7298 + FREE (&serv->cache);
7303 +/* Load list of all newsgroups from active */
7304 +int nntp_get_active (NNTP_SERVER *serv)
7306 + char msg[SHORT_STRING];
7307 + NNTP_DATA nntp_data;
7310 + if (nntp_open_connection (serv) < 0)
7313 + snprintf (msg, sizeof(msg), _("Loading list of all newsgroups on server %s..."),
7314 + serv->conn->account.host);
7315 + mutt_message (msg);
7316 + time (&serv->newgroups_time);
7317 + nntp_data.nserv = serv;
7318 + nntp_data.group = NULL;
7320 + if (mutt_nntp_fetch (&nntp_data, "LIST\r\n", msg, add_group, serv, 0) < 0)
7323 + nntp_error ("nntp_get_active()", "LIST\r\n");
7328 + strfcpy (msg, _("Loading descriptions..."), sizeof (msg));
7329 + mutt_message (msg);
7330 + nntp_get_desc (&nntp_data, "*", msg);
7332 + for (tmp = serv->list; tmp; tmp = tmp->next)
7334 + NNTP_DATA *data = (NNTP_DATA *)tmp->data;
7336 + if (data && data->deleted && !data->rc)
7338 + nntp_delete_cache (data);
7339 + hash_delete (serv->newsgroups, data->group, NULL, nntp_delete_data);
7343 + nntp_save_cache_index (serv);
7345 + mutt_clear_error ();
7350 + * returns -1 if error ocurred while retrieving header,
7351 + * number of articles which ones exist in context on success.
7353 +int nntp_check_msgid (CONTEXT *ctx, const char *msgid)
7357 + /* if msgid is already in context, don't reload them */
7358 + if (hash_find (ctx->id_hash, msgid))
7360 + if (ctx->msgcount == ctx->hdrmax)
7361 + mx_alloc_memory (ctx);
7362 + ctx->hdrs[ctx->msgcount] = mutt_new_header ();
7363 + ctx->hdrs[ctx->msgcount]->index = ctx->msgcount;
7365 + mutt_message (_("Fetching %s from server..."), msgid);
7366 + ret = nntp_read_header (ctx, msgid, 0);
7367 + /* since nntp_read_header() may set read flag, we must reset it */
7368 + ctx->hdrs[ctx->msgcount]->read = 0;
7370 + mutt_free_header (&ctx->hdrs[ctx->msgcount]);
7374 + mx_update_context (ctx, 1);
7385 + unsigned int *child;
7388 +static int check_children (char *s, void *c)
7390 +#define cc ((CHILD_CONTEXT *) c)
7391 + unsigned int i, n;
7393 + if (!s || (n = atoi (s)) == 0)
7395 + for (i = 0; i < cc->ctx->msgcount; i++)
7396 + if (cc->ctx->hdrs[i]->article_num == n)
7398 + if (cc->num >= cc->max)
7399 + safe_realloc ((void **) &cc->child, sizeof (unsigned int) * (cc->max += 25));
7400 + cc->child[cc->num++] = n;
7406 +int nntp_check_children (CONTEXT *ctx, const char *msgid)
7408 + NNTP_DATA *nntp_data = (NNTP_DATA *)ctx->data;
7410 + int i, ret = 0, tmp = 0;
7413 + if (!nntp_data || !nntp_data->nserv || !nntp_data->nserv->conn ||
7414 + !nntp_data->nserv->conn->account.host)
7416 + if (nntp_data->firstMessage > nntp_data->lastLoaded)
7418 + if (!nntp_data->nserv->hasXPAT)
7420 + mutt_error (_("Server %s does not support this operation!"),
7421 + nntp_data->nserv->conn->account.host);
7425 + snprintf (buf, sizeof (buf), "XPAT References %d-%d *%s*\r\n",
7426 + nntp_data->firstMessage, nntp_data->lastLoaded, msgid);
7431 + cc.child = safe_malloc (sizeof (unsigned int) * 25);
7432 + if (mutt_nntp_fetch (nntp_data, buf, NULL, check_children, &cc, 0))
7434 + safe_free ((void **) &cc.child);
7437 + /* dont try to read the xover cache. check_children() already
7438 + * made sure that we dont have the article, so we need to visit
7439 + * the server. Reading the cache at this point is also bad
7440 + * because it would duplicate messages */
7441 + if (option (OPTNEWSCACHE))
7444 + unset_option (OPTNEWSCACHE);
7446 + for (i = 0; i < cc.num; i++)
7448 + if ((ret = nntp_fetch_headers (ctx, cc.child[i], cc.child[i])))
7450 + if (ctx->msgcount &&
7451 + ctx->hdrs[ctx->msgcount - 1]->article_num == cc.child[i])
7452 + ctx->hdrs[ctx->msgcount - 1]->read = 0;
7455 + set_option (OPTNEWSCACHE);
7456 + safe_free ((void **) &cc.child);
7459 diff -uNr mutt-1.4.orig/nntp.h mutt-1.4/nntp.h
7460 --- mutt-1.4.orig/nntp.h Thu Jan 1 01:00:00 1970
7461 +++ mutt-1.4/nntp.h Sun Nov 3 21:57:20 2002
7464 + * Copyright (C) 1998 Brandon Long <blong@fiction.net>
7465 + * Copyright (C) 1999 Andrej Gritsenko <andrej@lucky.net>
7466 + * Copyright (C) 2000-2002 Vsevolod Volkov <vvv@mutt.org.ua>
7468 + * This program is free software; you can redistribute it and/or modify
7469 + * it under the terms of the GNU General Public License as published by
7470 + * the Free Software Foundation; either version 2 of the License, or
7471 + * (at your option) any later version.
7473 + * This program is distributed in the hope that it will be useful,
7474 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
7475 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7476 + * GNU General Public License for more details.
7478 + * You should have received a copy of the GNU General Public License
7479 + * along with this program; if not, write to the Free Software
7480 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
7486 +#include "mutt_socket.h"
7487 +#include "mailbox.h"
7491 +#define NNTP_PORT 119
7492 +#define NNTP_SSL_PORT 563
7494 +/* number of entries in the hash table */
7495 +#define NNTP_CACHE_LEN 10
7512 + unsigned int hasXPAT : 1;
7513 + unsigned int hasXGTITLE : 1;
7514 + unsigned int hasXOVER : 1;
7515 + unsigned int status : 3;
7521 + time_t newgroups_time;
7522 + time_t check_time;
7524 + LIST *list; /* list of newsgroups */
7525 + LIST *tail; /* last entry of list */
7531 + unsigned int index;
7537 + NEWSRC_ENTRY *entries;
7538 + unsigned int num; /* number of used entries */
7539 + unsigned int max; /* number of allocated entries */
7540 + unsigned int unread;
7541 + unsigned int firstMessage;
7542 + unsigned int lastMessage;
7543 + unsigned int lastLoaded;
7544 + unsigned int lastCached;
7545 + unsigned int subscribed : 1;
7546 + unsigned int rc : 1;
7547 + unsigned int new : 1;
7548 + unsigned int allowed : 1;
7549 + unsigned int deleted : 1;
7553 + NNTP_SERVER *nserv;
7554 + NNTP_CACHE acache[NNTP_CACHE_LEN];
7557 +/* internal functions */
7558 +int nntp_get_active (NNTP_SERVER *);
7559 +int nntp_get_cache_all (NNTP_SERVER *);
7560 +int nntp_save_cache_index (NNTP_SERVER *);
7561 +int nntp_check_newgroups (NNTP_SERVER *, int);
7562 +int nntp_save_cache_group (CONTEXT *);
7563 +int nntp_parse_url (const char *, ACCOUNT *, char *, size_t);
7564 +void newsrc_gen_entries (CONTEXT *);
7565 +void nntp_get_status (CONTEXT *, HEADER *, char *, int);
7566 +void mutt_newsgroup_stat (NNTP_DATA *);
7567 +void nntp_delete_cache (NNTP_DATA *);
7568 +void nntp_add_to_list (NNTP_SERVER *, NNTP_DATA *);
7569 +void nntp_cache_expand (char *, const char *);
7570 +void nntp_delete_data (void *);
7572 +/* exposed interface */
7573 +NNTP_SERVER *mutt_select_newsserver (char *);
7574 +NNTP_DATA *mutt_newsgroup_subscribe (NNTP_SERVER *, char *);
7575 +NNTP_DATA *mutt_newsgroup_unsubscribe (NNTP_SERVER *, char *);
7576 +NNTP_DATA *mutt_newsgroup_catchup (NNTP_SERVER *, char *);
7577 +NNTP_DATA *mutt_newsgroup_uncatchup (NNTP_SERVER *, char *);
7578 +void nntp_clear_cacheindex (NNTP_SERVER *);
7579 +int mutt_newsrc_update (NNTP_SERVER *);
7580 +int nntp_open_mailbox (CONTEXT *);
7581 +int nntp_sync_mailbox (CONTEXT *);
7582 +int nntp_check_mailbox (CONTEXT *);
7583 +int nntp_close_mailbox (CONTEXT *);
7584 +void nntp_fastclose_mailbox (CONTEXT *);
7585 +int nntp_fetch_message (MESSAGE *, CONTEXT *, int);
7586 +int nntp_post (const char *);
7587 +int nntp_check_msgid (CONTEXT *, const char *);
7588 +int nntp_check_children (CONTEXT *, const char *);
7589 +void nntp_buffy (char *);
7590 +void nntp_expand_path (char *, size_t, ACCOUNT *);
7591 +void nntp_logout_all ();
7592 +const char *nntp_format_str (char *, size_t, char, const char *, const char *,
7593 + const char *, const char *, unsigned long, format_flag);
7595 +NNTP_SERVER *CurrentNewsSrv INITVAL (NULL);
7597 +#endif /* _NNTP_H_ */
7598 diff -uNr mutt-1.4.orig/pager.c mutt-1.4/pager.c
7599 --- mutt-1.4.orig/pager.c Sun Nov 3 21:42:52 2002
7600 +++ mutt-1.4/pager.c Sun Nov 3 21:57:20 2002
7613 @@ -1445,6 +1450,16 @@
7618 +static struct mapping_t PagerNewsHelpExtra[] = {
7619 + { N_("Post"), OP_POST },
7620 + { N_("Followup"), OP_FOLLOWUP },
7621 + { N_("Del"), OP_DELETE },
7622 + { N_("Next"), OP_MAIN_NEXT_UNDELETED },
7629 /* This pager is actually not so simple as it once was. It now operates in
7630 @@ -1486,6 +1501,10 @@
7631 int old_PagerIndexLines; /* some people want to resize it
7632 * while inside the pager... */
7635 + char *followup_to;
7638 if (!(flags & M_SHOWCOLOR))
7639 flags |= M_SHOWFLAT;
7641 @@ -1525,7 +1544,11 @@
7642 if (IsHeader (extra))
7644 strfcpy (tmphelp, helpstr, sizeof (tmphelp));
7645 - mutt_compile_help (buffer, sizeof (buffer), MENU_PAGER, PagerHelpExtra);
7646 + mutt_compile_help (buffer, sizeof (buffer), MENU_PAGER,
7648 + (Context && (Context->magic == M_NNTP)) ? PagerNewsHelpExtra :
7651 snprintf (helpstr, sizeof (helpstr), "%s %s", tmphelp, buffer);
7654 @@ -2300,6 +2323,15 @@
7659 + if (Context->magic == M_NNTP)
7662 + mutt_error _("Can't change 'important' flag on NNTP server.");
7667 mutt_set_flag (Context, extra->hdr, M_FLAG, !extra->hdr->flagged);
7668 redraw = REDRAW_STATUS | REDRAW_INDEX;
7669 if (option (OPTRESOLVE))
7670 @@ -2333,6 +2365,60 @@
7671 redraw = REDRAW_FULL;
7676 + CHECK_MODE(IsHeader (extra) && !IsAttach (extra));
7678 + if (extra->ctx && extra->ctx->magic == M_NNTP &&
7679 + !((NNTP_DATA *)extra->ctx->data)->allowed &&
7680 + query_quadoption (OPT_TOMODERATED,_("Posting to this group not allowed, may be moderated. Continue?")) != M_YES)
7682 + ci_send_message (SENDNEWS, NULL, NULL, extra->ctx, NULL);
7683 + redraw = REDRAW_FULL;
7686 + case OP_FORWARD_TO_GROUP:
7687 + CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
7689 + if (extra->ctx && extra->ctx->magic == M_NNTP &&
7690 + !((NNTP_DATA *)extra->ctx->data)->allowed &&
7691 + query_quadoption (OPT_TOMODERATED,_("Posting to this group not allowed, may be moderated. Continue?")) != M_YES)
7693 + if (IsMsgAttach (extra))
7694 + mutt_attach_forward (extra->fp, extra->hdr, extra->idx,
7695 + extra->idxlen, extra->bdy, SENDNEWS);
7697 + ci_send_message (SENDNEWS|SENDFORWARD, NULL, NULL, extra->ctx, extra->hdr);
7698 + redraw = REDRAW_FULL;
7702 + CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
7705 + if (IsMsgAttach (extra))
7706 + followup_to = extra->bdy->hdr->env->followup_to;
7708 + followup_to = extra->hdr->env->followup_to;
7710 + if (!followup_to || mutt_strcasecmp (followup_to, "poster") ||
7711 + query_quadoption (OPT_FOLLOWUPTOPOSTER,_("Reply by mail as poster prefers?")) != M_YES)
7713 + if (extra->ctx && extra->ctx->magic == M_NNTP &&
7714 + !((NNTP_DATA *)extra->ctx->data)->allowed &&
7715 + query_quadoption (OPT_TOMODERATED,_("Posting to this group not allowed, may be moderated. Continue?")) != M_YES)
7717 + if (IsMsgAttach (extra))
7718 + mutt_attach_reply (extra->fp, extra->hdr, extra->idx,
7719 + extra->idxlen, extra->bdy, SENDNEWS|SENDREPLY);
7721 + ci_send_message (SENDNEWS|SENDREPLY, NULL, NULL,
7722 + extra->ctx, extra->hdr);
7723 + redraw = REDRAW_FULL;
7729 CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
7731 @@ -2379,7 +2465,7 @@
7733 if (IsMsgAttach (extra))
7734 mutt_attach_forward (extra->fp, extra->hdr, extra->idx,
7735 - extra->idxlen, extra->bdy);
7736 + extra->idxlen, extra->bdy, 0);
7738 ci_send_message (SENDFORWARD, NULL, NULL, extra->ctx, extra->hdr);
7739 redraw = REDRAW_FULL;
7740 diff -uNr mutt-1.4.orig/parse.c mutt-1.4/parse.c
7741 --- mutt-1.4.orig/parse.c Tue Jan 29 11:05:20 2002
7742 +++ mutt-1.4/parse.c Sun Nov 3 21:57:20 2002
7747 -static LIST *mutt_parse_references (char *s, int in_reply_to)
7748 +LIST *mutt_parse_references (char *s, int in_reply_to)
7750 LIST *t, *lst = NULL;
7752 @@ -1047,6 +1047,17 @@
7753 e->from = rfc822_parse_adrlist (e->from, p);
7757 + else if (!mutt_strcasecmp (line+1, "ollowup-to"))
7759 + if (!e->followup_to)
7761 + mutt_remove_trailing_ws (p);
7762 + e->followup_to = safe_strdup (mutt_skip_whitespace (p));
7770 @@ -1098,6 +1109,27 @@
7776 + if (!mutt_strcasecmp (line + 1, "ewsgroups"))
7778 + safe_free ((void **)&e->newsgroups);
7779 + mutt_remove_trailing_ws (p);
7780 + e->newsgroups = safe_strdup (mutt_skip_whitespace (p));
7787 + /* field `Organization:' saves only for pager! */
7788 + if (!mutt_strcasecmp (line + 1, "rganization"))
7790 + if (!e->organization && mutt_strcasecmp (p, "unknown"))
7791 + e->organization = safe_strdup (p);
7796 if (!ascii_strcasecmp (line + 1, "eferences"))
7798 @@ -1207,7 +1239,21 @@
7799 e->x_label = safe_strdup(p);
7804 + else if (!mutt_strcasecmp (line + 1, "-comment-to"))
7806 + if (!e->x_comment_to)
7807 + e->x_comment_to = safe_strdup (p);
7810 + else if (!mutt_strcasecmp (line + 1, "ref"))
7813 + e->xref = safe_strdup (p);
7821 diff -uNr mutt-1.4.orig/pattern.c mutt-1.4/pattern.c
7822 --- mutt-1.4.orig/pattern.c Sun Nov 3 21:42:52 2002
7823 +++ mutt-1.4/pattern.c Sun Nov 3 21:57:20 2002
7825 { 't', M_TO, 0, eat_regexp },
7826 { 'U', M_UNREAD, 0, NULL },
7827 { 'v', M_COLLAPSED, 0, NULL },
7829 + { 'w', M_NEWSGROUPS, 0, eat_regexp },
7831 { 'x', M_REFERENCE, 0, eat_regexp },
7832 { 'y', M_XLABEL, 0, eat_regexp },
7833 { 'z', M_SIZE, 0, eat_range },
7834 @@ -1053,6 +1056,10 @@
7835 return (pat->not ^ (h->env->x_label && regexec (pat->rx, h->env->x_label, 0, NULL, 0) == 0));
7837 return (pat->not ^ (h->thread && h->thread->duplicate_thread));
7839 + case M_NEWSGROUPS:
7840 + return (pat->not ^ (h->env->newsgroups && regexec (pat->rx, h->env->newsgroups, 0, NULL, 0) == 0));
7843 mutt_error (_("error: unknown op %d (report this error)."), pat->op);
7845 @@ -1120,6 +1127,7 @@
7848 strfcpy (buf, NONULL (Context->pattern), sizeof (buf));
7849 + if (prompt || op != M_LIMIT)
7850 if (mutt_get_field (prompt, buf, sizeof (buf), M_PATTERN | M_CLEAR) != 0 || !buf[0])
7853 diff -uNr mutt-1.4.orig/po/POTFILES.in mutt-1.4/po/POTFILES.in
7854 --- mutt-1.4.orig/po/POTFILES.in Sun Nov 3 21:42:51 2002
7855 +++ mutt-1.4/po/POTFILES.in Sun Nov 3 21:57:20 2002
7865 diff -uNr mutt-1.4.orig/postpone.c mutt-1.4/postpone.c
7866 --- mutt-1.4.orig/postpone.c Sun Nov 3 21:42:52 2002
7867 +++ mutt-1.4/postpone.c Sun Nov 3 21:57:20 2002
7868 @@ -125,15 +125,26 @@
7870 if (LastModify < st.st_mtime)
7873 + int optnews = option (OPTNEWS);
7875 LastModify = st.st_mtime;
7877 if (access (Postponed, R_OK | F_OK) != 0)
7878 return (PostCount = 0);
7881 + unset_option (OPTNEWS);
7883 if (mx_open_mailbox (Postponed, M_NOSORT | M_QUIET, &ctx) == NULL)
7886 PostCount = ctx.msgcount;
7887 mx_fastclose_mailbox (&ctx);
7890 + set_option (OPTNEWS);
7895 diff -uNr mutt-1.4.orig/protos.h mutt-1.4/protos.h
7896 --- mutt-1.4.orig/protos.h Sun Nov 3 21:42:52 2002
7897 +++ mutt-1.4/protos.h Sun Nov 3 21:57:20 2002
7899 HASH *mutt_make_subj_hash (CONTEXT *);
7901 LIST *mutt_make_references(ENVELOPE *e);
7902 +LIST *mutt_parse_references (char *, int);
7904 ENVELOPE *mutt_read_rfc822_header (FILE *, HEADER *, short, short);
7905 HEADER *mutt_dup_header (HEADER *);
7907 void mutt_update_tree (ATTACHPTR **, short);
7908 void mutt_version (void);
7909 void mutt_view_attachments (HEADER *);
7910 +void mutt_write_references (LIST *, FILE *);
7911 void mutt_set_virtual (CONTEXT *);
7913 int mutt_addr_is_user (ADDRESS *);
7915 int mutt_search_command (int, int);
7916 int mutt_compose_menu (HEADER *, char *, size_t, HEADER *);
7917 int mutt_thread_set_flag (HEADER *, int, int, int);
7918 +int mutt_update_list_file (char *, char *, char *, char *);
7919 int mutt_user_is_recipient (HEADER *);
7920 void mutt_update_num_postponed (void);
7921 int mutt_view_attachment (FILE*, BODY *, int, HEADER *, ATTACHPTR **, short);
7922 diff -uNr mutt-1.4.orig/recvattach.c mutt-1.4/recvattach.c
7923 --- mutt-1.4.orig/recvattach.c Wed Sep 26 12:33:09 2001
7924 +++ mutt-1.4/recvattach.c Sun Nov 3 21:57:20 2002
7925 @@ -989,6 +989,15 @@
7930 + if (Context->magic == M_NNTP)
7933 + mutt_error _("Can't delete attachment from newsserver.");
7941 @@ -1084,10 +1093,33 @@
7942 case OP_FORWARD_MESSAGE:
7944 mutt_attach_forward (fp, hdr, idx, idxlen,
7945 - menu->tagprefix ? NULL : idx[menu->current]->content);
7946 + menu->tagprefix ? NULL : idx[menu->current]->content, 0);
7947 menu->redraw = REDRAW_FULL;
7951 + case OP_FORWARD_TO_GROUP:
7953 + mutt_attach_forward (fp, hdr, idx, idxlen,
7954 + menu->tagprefix ? NULL : idx[menu->current]->content, SENDNEWS);
7955 + menu->redraw = REDRAW_FULL;
7961 + if (!idx[menu->current]->content->hdr->env->followup_to ||
7962 + mutt_strcasecmp (idx[menu->current]->content->hdr->env->followup_to, "poster") ||
7963 + query_quadoption (OPT_FOLLOWUPTOPOSTER,_("Reply by mail as poster prefers?")) != M_YES)
7965 + mutt_attach_reply (fp, hdr, idx, idxlen,
7966 + menu->tagprefix ? NULL : idx[menu->current]->content,
7967 + SENDNEWS|SENDREPLY);
7968 + menu->redraw = REDRAW_FULL;
7974 case OP_GROUP_REPLY:
7976 diff -uNr mutt-1.4.orig/recvcmd.c mutt-1.4/recvcmd.c
7977 --- mutt-1.4.orig/recvcmd.c Wed Jan 2 10:33:38 2002
7978 +++ mutt-1.4/recvcmd.c Sun Nov 3 21:57:20 2002
7980 static void attach_forward_bodies (FILE * fp, HEADER * hdr,
7981 ATTACHPTR ** idx, short idxlen,
7984 + short nattach, int flags)
7987 short mime_fwd_all = 0;
7991 /* now that we have the template, send it. */
7992 - ci_send_message (0, tmphdr, tmpbody, NULL, parent);
7993 + ci_send_message (flags, tmphdr, tmpbody, NULL, parent);
8000 static void attach_forward_msgs (FILE * fp, HEADER * hdr,
8001 - ATTACHPTR ** idx, short idxlen, BODY * cur)
8002 + ATTACHPTR ** idx, short idxlen, BODY * cur, int flags)
8004 HEADER *curhdr = NULL;
8006 @@ -612,23 +612,23 @@
8008 mutt_free_header (&tmphdr);
8010 - ci_send_message (0, tmphdr, *tmpbody ? tmpbody : NULL,
8011 + ci_send_message (flags, tmphdr, *tmpbody ? tmpbody : NULL,
8016 void mutt_attach_forward (FILE * fp, HEADER * hdr,
8017 - ATTACHPTR ** idx, short idxlen, BODY * cur)
8018 + ATTACHPTR ** idx, short idxlen, BODY * cur, int flags)
8023 if (check_all_msg (idx, idxlen, cur, 0) == 0)
8024 - attach_forward_msgs (fp, hdr, idx, idxlen, cur);
8025 + attach_forward_msgs (fp, hdr, idx, idxlen, cur, flags);
8028 nattach = count_tagged (idx, idxlen);
8029 - attach_forward_bodies (fp, hdr, idx, idxlen, cur, nattach);
8030 + attach_forward_bodies (fp, hdr, idx, idxlen, cur, nattach, flags);
8034 @@ -686,28 +686,40 @@
8040 + if ((flags & SENDNEWS))
8042 - if (mutt_fetch_recips (env, curenv, flags) == -1)
8044 + /* in case followup set Newsgroups: with Followup-To: if it present */
8045 + if (!env->newsgroups && curenv &&
8046 + mutt_strcasecmp (curenv->followup_to, "poster"))
8047 + env->newsgroups = safe_strdup (curenv->followup_to);
8052 - for (i = 0; i < idxlen; i++)
8055 - if (idx[i]->content->tagged
8056 - && mutt_fetch_recips (env, idx[i]->content->hdr->env, flags) == -1)
8057 + if (mutt_fetch_recips (env, curenv, flags) == -1)
8062 + for (i = 0; i < idxlen; i++)
8064 + if (idx[i]->content->tagged
8065 + && mutt_fetch_recips (env, idx[i]->content->hdr->env, flags) == -1)
8070 + if ((flags & SENDLISTREPLY) && !env->to)
8072 + mutt_error _("No mailing lists found!");
8076 + mutt_fix_reply_recipients (env);
8079 - if ((flags & SENDLISTREPLY) && !env->to)
8081 - mutt_error _("No mailing lists found!");
8085 - mutt_fix_reply_recipients (env);
8086 mutt_make_misc_reply_headers (env, Context, curhdr, curenv);
8089 @@ -768,6 +780,13 @@
8090 char prefix[SHORT_STRING];
8094 + if (flags & SENDNEWS)
8095 + set_option (OPTNEWSSEND);
8097 + unset_option (OPTNEWSSEND);
8100 if (check_all_msg (idx, idxlen, cur, 0) == -1)
8102 nattach = count_tagged (idx, idxlen);
8103 diff -uNr mutt-1.4.orig/rfc1524.c mutt-1.4/rfc1524.c
8104 --- mutt-1.4.orig/rfc1524.c Tue May 15 09:23:49 2001
8105 +++ mutt-1.4/rfc1524.c Sun Nov 3 21:57:20 2002
8106 @@ -563,13 +563,13 @@
8110 -int mutt_rename_file (char *oldfile, char *newfile)
8111 +int _mutt_rename_file (char *oldfile, char *newfile, int overwrite)
8115 if (access (oldfile, F_OK) != 0)
8117 - if (access (newfile, F_OK) == 0)
8118 + if (!overwrite && access (newfile, F_OK) == 0)
8120 if ((ofp = fopen (oldfile,"r")) == NULL)
8123 mutt_unlink (oldfile);
8127 +int mutt_rename_file (char *oldfile, char *newfile)
8129 + return _mutt_rename_file (oldfile, newfile, 0);
8131 diff -uNr mutt-1.4.orig/rfc1524.h mutt-1.4/rfc1524.h
8132 --- mutt-1.4.orig/rfc1524.h Fri Mar 3 11:10:13 2000
8133 +++ mutt-1.4/rfc1524.h Sun Nov 3 21:57:20 2002
8135 int rfc1524_expand_filename (char *, char *, char *, size_t);
8136 int rfc1524_mailcap_lookup (BODY *, char *, rfc1524_entry *, int);
8137 int mutt_rename_file (char *, char *);
8138 +int _mutt_rename_file (char *, char *, int);
8140 #endif /* _RFC1524_H */
8141 diff -uNr mutt-1.4.orig/send.c mutt-1.4/send.c
8142 --- mutt-1.4.orig/send.c Wed Jan 30 23:50:40 2002
8143 +++ mutt-1.4/send.c Sun Nov 3 21:57:20 2002
8153 #include "remailer.h"
8155 @@ -196,17 +200,51 @@
8159 -static int edit_envelope (ENVELOPE *en)
8160 +static int edit_envelope (ENVELOPE *en, int flags)
8162 char buf[HUGE_STRING];
8163 LIST *uh = UserHeader;
8165 - if (edit_address (&en->to, "To: ") == -1 || en->to == NULL)
8167 - if (option (OPTASKCC) && edit_address (&en->cc, "Cc: ") == -1)
8169 - if (option (OPTASKBCC) && edit_address (&en->bcc, "Bcc: ") == -1)
8172 + if (option (OPTNEWSSEND))
8174 + if (en->newsgroups)
8175 + strfcpy (buf, en->newsgroups, sizeof (buf));
8178 + if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) != 0)
8180 + safe_free ((void **)&en->newsgroups);
8181 + en->newsgroups = safe_strdup (buf);
8183 + if (en->followup_to)
8184 + strfcpy (buf, en->followup_to, sizeof (buf));
8187 + if (option (OPTASKFOLLOWUP) && mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) != 0)
8189 + safe_free ((void **)&en->followup_to);
8190 + en->followup_to = safe_strdup (buf);
8192 + if (en->x_comment_to)
8193 + strfcpy (buf, en->x_comment_to, sizeof (buf));
8196 + if (option (OPTXCOMMENTTO) && option (OPTASKXCOMMENTTO) && mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) != 0)
8198 + safe_free ((void **)&en->x_comment_to);
8199 + en->x_comment_to = safe_strdup (buf);
8204 + if (edit_address (&en->to, "To: ") == -1 || en->to == NULL)
8206 + if (option (OPTASKCC) && edit_address (&en->cc, "Cc: ") == -1)
8208 + if (option (OPTASKBCC) && edit_address (&en->bcc, "Bcc: ") == -1)
8214 @@ -242,6 +280,14 @@
8219 +char *nntp_get_header (const char *s)
8222 + return safe_strdup (s);
8226 static void process_user_recips (ENVELOPE *env)
8228 LIST *uh = UserHeader;
8229 @@ -254,6 +300,14 @@
8230 env->cc = rfc822_parse_adrlist (env->cc, uh->data + 3);
8231 else if (ascii_strncasecmp ("bcc:", uh->data, 4) == 0)
8232 env->bcc = rfc822_parse_adrlist (env->bcc, uh->data + 4);
8234 + else if (ascii_strncasecmp ("newsgroups:", uh->data, 11) == 0)
8235 + env->newsgroups = nntp_get_header (uh->data + 11);
8236 + else if (ascii_strncasecmp ("followup-to:", uh->data, 12) == 0)
8237 + env->followup_to = nntp_get_header (uh->data + 12);
8238 + else if (ascii_strncasecmp ("x-comment-to:", uh->data, 13) == 0)
8239 + env->x_comment_to = nntp_get_header (uh->data + 13);
8244 @@ -284,6 +338,12 @@
8245 else if (ascii_strncasecmp ("to:", uh->data, 3) != 0 &&
8246 ascii_strncasecmp ("cc:", uh->data, 3) != 0 &&
8247 ascii_strncasecmp ("bcc:", uh->data, 4) != 0 &&
8249 + ascii_strncasecmp ("newsgroups:", uh->data, 11) != 0 &&
8250 + ascii_strncasecmp ("followup-to:", uh->data, 12) != 0 &&
8251 + ascii_strncasecmp ("x-comment-to:", uh->data, 13) != 0 &&
8253 + ascii_strncasecmp ("supersedes:", uh->data, 11) != 0 &&
8254 ascii_strncasecmp ("subject:", uh->data, 8) != 0)
8257 @@ -597,6 +657,10 @@
8259 env->subject = safe_strdup ("Re: your mail");
8262 + if (option (OPTNEWSSEND) && option (OPTXCOMMENTTO) && curenv->from)
8263 + env->x_comment_to = safe_strdup (mutt_get_name (curenv->from));
8267 void mutt_add_to_reference_headers (ENVELOPE *env, ENVELOPE *curenv, LIST ***pp, LIST ***qq)
8268 @@ -679,27 +743,39 @@
8270 if (flags & SENDREPLY)
8274 + if ((flags & SENDNEWS))
8278 - for (i = 0; i < ctx->vcount; i++)
8279 + /* in case followup set Newsgroups: with Followup-To: if it present */
8280 + if (!env->newsgroups && curenv &&
8281 + mutt_strcasecmp (curenv->followup_to, "poster"))
8282 + env->newsgroups = safe_strdup (curenv->followup_to);
8289 - h = ctx->hdrs[ctx->v2r[i]];
8290 - if (h->tagged && mutt_fetch_recips (env, h->env, flags) == -1)
8293 + for (i = 0; i < ctx->vcount; i++)
8295 + h = ctx->hdrs[ctx->v2r[i]];
8296 + if (h->tagged && mutt_fetch_recips (env, h->env, flags) == -1)
8300 + else if (mutt_fetch_recips (env, curenv, flags) == -1)
8303 + if ((flags & SENDLISTREPLY) && !env->to)
8305 + mutt_error _("No mailing lists found!");
8309 - else if (mutt_fetch_recips (env, curenv, flags) == -1)
8312 - if ((flags & SENDLISTREPLY) && !env->to)
8314 - mutt_error _("No mailing lists found!");
8316 + mutt_fix_reply_recipients (env);
8319 - mutt_fix_reply_recipients (env);
8320 mutt_make_misc_reply_headers (env, ctx, cur, curenv);
8321 mutt_make_reference_headers (tag ? NULL : curenv, env, ctx);
8323 @@ -828,7 +904,18 @@
8324 * it hasn't already been set
8327 - if (option (OPTFOLLOWUPTO) && !e->mail_followup_to)
8328 + if (!option (OPTFOLLOWUPTO))
8331 + if (option (OPTNEWSSEND))
8333 + if (!e->followup_to && e->newsgroups && (strrchr (e->newsgroups, ',')))
8334 + e->followup_to = safe_strdup (e->newsgroups);
8339 + if (!e->mail_followup_to)
8341 if (mutt_is_list_cc (0, e->to, e->cc))
8343 @@ -1084,6 +1171,13 @@
8348 + if (flags & SENDNEWS)
8349 + set_option (OPTNEWSSEND);
8351 + unset_option (OPTNEWSSEND);
8354 if (!flags && !msg && quadoption (OPT_RECALL) != M_NO &&
8355 mutt_num_postponed (1))
8357 @@ -1115,6 +1209,22 @@
8359 if ((flags = mutt_get_postponed (ctx, msg, &cur, fcc, sizeof (fcc))) < 0)
8363 + * If postponed message is a news article, it have
8364 + * a "Newsgroups:" header line, then set appropriate flag.
8366 + if (msg->env->newsgroups)
8368 + flags |= SENDNEWS;
8369 + set_option (OPTNEWSSEND);
8373 + flags &= ~SENDNEWS;
8374 + unset_option (OPTNEWSSEND);
8379 if (flags & (SENDPOSTPONED|SENDRESEND))
8380 @@ -1195,11 +1305,16 @@
8381 if (option (OPTHDRS))
8382 process_user_recips (msg->env);
8385 + if ((flags & SENDNEWS) && ctx && ctx->magic == M_NNTP && !msg->env->newsgroups)
8386 + msg->env->newsgroups = safe_strdup (((NNTP_DATA *)ctx->data)->group);
8389 if (! (flags & SENDMAILX) &&
8390 ! (option (OPTAUTOEDIT) && option (OPTEDITHDRS)) &&
8391 ! ((flags & SENDREPLY) && option (OPTFASTREPLY)))
8393 - if (edit_envelope (msg->env) == -1)
8394 + if (edit_envelope (msg->env, flags) == -1)
8398 @@ -1349,6 +1464,11 @@
8403 + if (flags & SENDNEWS)
8404 + mutt_message _("Article not posted.");
8407 mutt_message _("Mail not sent.");
8410 @@ -1380,6 +1500,9 @@
8415 + if (!(flags & SENDNEWS))
8417 if (!msg->env->to && !msg->env->cc && !msg->env->bcc)
8419 if (! (flags & SENDBATCH))
8420 @@ -1402,6 +1525,19 @@
8421 mutt_error _("No subject specified.");
8425 + if ((flags & SENDNEWS) && !msg->env->subject)
8427 + mutt_error _("No subject specified.");
8431 + if ((flags & SENDNEWS) && !msg->env->newsgroups)
8433 + mutt_error _("No newsgroup specified.");
8438 if (msg->content->next)
8439 msg->content = mutt_make_multipart (msg->content);
8440 @@ -1588,7 +1724,12 @@
8443 else if (!option (OPTNOCURSES) && ! (flags & SENDMAILX))
8444 - mutt_message (i == 0 ? _("Mail sent.") : _("Sending in background."));
8445 + mutt_message (i != 0 ? _("Sending in background.") :
8447 + (flags & SENDNEWS) ? _("Article posted.") : _("Mail sent."));
8453 if (msg->pgp & PGPENCRYPT)
8454 diff -uNr mutt-1.4.orig/sendlib.c mutt-1.4/sendlib.c
8455 --- mutt-1.4.orig/sendlib.c Sat Apr 20 09:25:49 2002
8456 +++ mutt-1.4/sendlib.c Sun Nov 3 21:57:20 2002
8458 #include <sys/wait.h>
8465 #ifdef HAVE_SYSEXITS_H
8466 #include <sysexits.h>
8467 #else /* Make sure EX_OK is defined <philiph@pobox.com> */
8468 @@ -1537,7 +1541,7 @@
8469 /* need to write the list in reverse because they are stored in reverse order
8470 * when parsed to speed up threading
8472 -static void write_references (LIST *r, FILE *f)
8473 +void mutt_write_references (LIST *r, FILE *f)
8476 int refcnt = 0, refmax = 0;
8477 @@ -1579,6 +1583,9 @@
8479 LIST *tmp = env->userhdrs;
8482 + if (!option (OPTNEWSSEND))
8484 if (mode == 0 && !privacy)
8485 fputs (mutt_make_date (buffer, sizeof(buffer)), fp);
8487 @@ -1598,6 +1605,9 @@
8488 mutt_write_address_list (env->to, fp, 4);
8492 + if (!option (OPTNEWSSEND))
8494 fputs ("To: \n", fp);
8497 @@ -1606,6 +1616,9 @@
8498 mutt_write_address_list (env->cc, fp, 4);
8502 + if (!option (OPTNEWSSEND))
8504 fputs ("Cc: \n", fp);
8507 @@ -1617,8 +1630,28 @@
8512 + if (!option (OPTNEWSSEND))
8514 fputs ("Bcc: \n", fp);
8517 + if (env->newsgroups)
8518 + fprintf (fp, "Newsgroups: %s\n", env->newsgroups);
8519 + else if (mode == 1 && option (OPTNEWSSEND))
8520 + fputs ("Newsgroups: \n", fp);
8522 + if (env->followup_to)
8523 + fprintf (fp, "Followup-To: %s\n", env->followup_to);
8524 + else if (mode == 1 && option (OPTNEWSSEND))
8525 + fputs ("Followup-To: \n", fp);
8527 + if (env->x_comment_to)
8528 + fprintf (fp, "X-Comment-To: %s\n", env->x_comment_to);
8529 + else if (mode == 1 && option (OPTNEWSSEND) && option (OPTXCOMMENTTO))
8530 + fputs ("X-Comment-To: \n", fp);
8534 fprintf (fp, "Subject: %s\n", env->subject);
8536 @@ -1637,6 +1670,9 @@
8537 fputs ("Reply-To: \n", fp);
8539 if (env->mail_followup_to)
8541 + if (!option (OPTNEWSSEND))
8544 fputs ("Mail-Followup-To: ", fp);
8545 mutt_write_address_list (env->mail_followup_to, fp, 18);
8546 @@ -1647,7 +1683,7 @@
8547 if (env->references)
8549 fputs ("References:", fp);
8550 - write_references (env->references, fp);
8551 + mutt_write_references (env->references, fp);
8555 @@ -1659,7 +1695,7 @@
8556 if (env->in_reply_to)
8558 fputs ("In-Reply-To:", fp);
8559 - write_references (env->in_reply_to, fp);
8560 + mutt_write_references (env->in_reply_to, fp);
8564 @@ -1967,11 +2003,30 @@
8565 const char *msg, /* file containing message */
8566 int eightbit) /* message contains 8bit chars */
8568 - char *ps = NULL, *path = NULL, *s = safe_strdup (Sendmail), *childout = NULL;
8569 + char *ps = NULL, *path = NULL, *s = NULL, *childout = NULL;
8571 size_t argslen = 0, argsmax = 0;
8575 + if (option (OPTNEWSSEND))
8577 + char cmd[LONG_STRING];
8579 + mutt_FormatString (cmd, sizeof (cmd), NONULL (Inews), nntp_format_str, 0, 0);
8582 + i = nntp_post (msg);
8587 + s = safe_strdup (cmd);
8591 + s = safe_strdup (Sendmail);
8595 while ((ps = strtok (ps, " ")))
8596 @@ -1995,6 +2050,10 @@
8601 + if (!option (OPTNEWSSEND))
8604 if (eightbit && option (OPTUSE8BITMIME))
8605 args = add_option (args, &argslen, &argsmax, "-B8BITMIME");
8607 @@ -2017,6 +2076,9 @@
8608 args = add_args (args, &argslen, &argsmax, to);
8609 args = add_args (args, &argslen, &argsmax, cc);
8610 args = add_args (args, &argslen, &argsmax, bcc);
8615 if (argslen == argsmax)
8616 safe_realloc ((void **) &args, sizeof (char *) * (++argsmax));
8617 @@ -2148,6 +2210,9 @@
8618 rfc2047_encode_adrlist (env->reply_to, "Reply-To");
8622 + if (!option (OPTNEWSSEND) || option (OPTMIMESUBJECT))
8625 rfc2047_encode_string (&env->subject);
8627 @@ -2234,6 +2299,10 @@
8629 rfc822_write_address (resent_from, sizeof (resent_from), from);
8632 + unset_option (OPTNEWSSEND);
8635 _mutt_bounce_message (fp, h, to, resent_from, from);
8637 rfc822_free_address (&from);
8638 diff -uNr mutt-1.4.orig/sort.c mutt-1.4/sort.c
8639 --- mutt-1.4.orig/sort.c Thu Dec 13 13:10:59 2001
8640 +++ mutt-1.4/sort.c Sun Nov 3 21:57:20 2002
8641 @@ -144,6 +144,15 @@
8642 HEADER **ha = (HEADER **) a;
8643 HEADER **hb = (HEADER **) b;
8646 + if ((*ha)->article_num && (*hb)->article_num)
8648 + int result = (*ha)->article_num - (*hb)->article_num;
8649 + AUXSORT(result,a,b);
8650 + return (SORTCODE (result));
8654 /* no need to auxsort because you will never have equality here */
8655 return (SORTCODE ((*ha)->index - (*hb)->index));
8657 diff -uNr mutt-1.4.orig/url.c mutt-1.4/url.c
8658 --- mutt-1.4.orig/url.c Mon Oct 29 12:53:45 2001
8659 +++ mutt-1.4/url.c Sun Nov 3 21:57:20 2002
8661 { "imaps", U_IMAPS },
8664 + { "nntp", U_NNTP },
8665 + { "nntps", U_NNTPS },
8666 { "mailto", U_MAILTO },
8669 diff -uNr mutt-1.4.orig/url.h mutt-1.4/url.h
8670 --- mutt-1.4.orig/url.h Tue Sep 4 11:30:04 2001
8671 +++ mutt-1.4/url.h Sun Nov 3 21:57:20 2002