1 WARNING: Run the following script before configure:
9 Vsevolod Volkov <vvv@mutt.org.ua>
12 Index: mutt-1.5.20/ChangeLog.nntp
13 ===================================================================
14 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
15 +++ mutt-1.5.20/ChangeLog.nntp 2009-10-13 22:56:13.014521379 -0300
17 +* Thu Aug 13 2009 Vsevolod Volkov <vvv@mutt.org.ua>
18 +- fixed writting references in nntp_save_cache_group()
20 +* Tue Jun 15 2009 Vsevolod Volkov <vvv@mutt.org.ua>
23 +* Tue Mar 20 2009 Vsevolod Volkov <vvv@mutt.org.ua>
24 +- save Date: header of recorded outgoing articles
26 +* Tue Jan 6 2009 Vsevolod Volkov <vvv@mutt.org.ua>
29 +* Mon May 19 2008 Vsevolod Volkov <vvv@mutt.org.ua>
31 +- fixed SIGSEGV when followup or forward to newsgroup
33 +* Sun Nov 4 2007 Vsevolod Volkov <vvv@mutt.org.ua>
36 +* Tue Jul 3 2007 Vsevolod Volkov <vvv@mutt.org.ua>
37 +- fixed arguments of nntp_format_str()
39 +* Fri Jun 15 2007 Vsevolod Volkov <vvv@mutt.org.ua>
40 +- fixed error selecting news group
42 +* Tue Jun 12 2007 Vsevolod Volkov <vvv@mutt.org.ua>
45 +* Wed Apr 11 2007 Vsevolod Volkov <vvv@mutt.org.ua>
46 +- fixed posting error if $smtp_url is set
47 +- added support of print-style sequence %R (x-comment-to)
49 +* Sun Apr 8 2007 Vsevolod Volkov <vvv@mutt.org.ua>
51 +- nntp://... url changed to news://...
52 +- added indicator of fetching descriptions progress
54 +* Tue Feb 28 2007 Vsevolod Volkov <vvv@mutt.org.ua>
57 +* Tue Aug 15 2006 Vsevolod Volkov <vvv@mutt.org.ua>
60 +* Mon Jul 17 2006 Vsevolod Volkov <vvv@mutt.org.ua>
62 +- fixed reading empty .newsrc
64 +* Sat Sep 17 2005 Vsevolod Volkov <vvv@mutt.org.ua>
67 +* Sat Aug 13 2005 Vsevolod Volkov <vvv@mutt.org.ua>
70 +* Sun Mar 13 2005 Vsevolod Volkov <vvv@mutt.org.ua>
73 +* Sun Feb 13 2005 Vsevolod Volkov <vvv@mutt.org.ua>
76 +* Sat Feb 5 2005 Vsevolod Volkov <vvv@mutt.org.ua>
78 +- function mutt_update_list_file() moved to newsrc.c and changed algorithm
80 +* Thu Jul 8 2004 Vsevolod Volkov <vvv@mutt.org.ua>
81 +- fixed error in nntp_logout_all()
83 +* Sat Apr 3 2004 Vsevolod Volkov <vvv@mutt.org.ua>
84 +- fixed debug output in mutt_newsrc_update()
85 +- added optional support of LISTGROUP command
86 +- fixed typo in nntp_parse_xref()
88 +* Tue Feb 3 2004 Vsevolod Volkov <vvv@mutt.org.ua>
91 +* Thu Dec 18 2003 Vsevolod Volkov <vvv@mutt.org.ua>
94 +* Thu Nov 6 2003 Vsevolod Volkov <vvv@mutt.org.ua>
97 +* Wed Nov 5 2003 Vsevolod Volkov <vvv@mutt.org.ua>
99 +- added space after newsgroup name in .newsrc file
101 +* Sun May 18 2003 Vsevolod Volkov <vvv@mutt.org.ua>
102 +- nntp patch: fixed SIGSEGV when posting article
104 +* Sat Mar 22 2003 Vsevolod Volkov <vvv@mutt.org.ua>
107 +* Sat Dec 21 2002 Vsevolod Volkov <vvv@mutt.org.ua>
109 +- replace safe_free calls by the FREE macro
111 +* Fri Dec 6 2002 Vsevolod Volkov <vvv@mutt.org.ua>
113 +- nntp authentication can be passed after any command
115 +* Sat May 4 2002 Vsevolod Volkov <vvv@mutt.org.ua>
118 +* Thu May 2 2002 Vsevolod Volkov <vvv@mutt.org.ua>
121 +* Wed Mar 13 2002 Vsevolod Volkov <vvv@mutt.org.ua>
123 +- fixed SIGSEGV in <get-message>, <get-parent>, <get-children>,
124 + <reconstruct-thread> functions
125 +- fixed message about nntp reconnect
126 +- fixed <attach-news-message> function using browser
127 +- added support of Followup-To: poster
128 +- added %n (new articles) in group_index_format
129 +- posting articles without inews by default
131 +* Wed Jan 23 2002 Vsevolod Volkov <vvv@mutt.org.ua>
134 +* Fri Jan 18 2002 Vsevolod Volkov <vvv@mutt.org.ua>
137 +* Thu Jan 3 2002 Vsevolod Volkov <vvv@mutt.org.ua>
139 +- accelerated speed of access to news->newsgroups hash (by <gul@gul.kiev.ua>)
140 +- added default content disposition
142 +* Mon Dec 3 2001 Vsevolod Volkov <vvv@mutt.org.ua>
145 +* Fri Nov 9 2001 Vsevolod Volkov <vvv@mutt.org.ua>
146 +- update to 1.3.23.2
147 +- fixed segfault if mutt_conn_find() returns null
149 +* Wed Oct 31 2001 Vsevolod Volkov <vvv@mutt.org.ua>
150 +- update to 1.3.23.1
151 +- added support of LISTGROUP command
152 +- added support for servers with broken overview
153 +- disabled <flag-message> function on news server
154 +- fixed error storing bad authentication information
156 +* Wed Oct 10 2001 Vsevolod Volkov <vvv@mutt.org.ua>
158 +- fixed typo in buffy.c
159 +- added substitution of %s parameter in $inews variable
161 +* Fri Aug 31 2001 Vsevolod Volkov <vvv@mutt.org.ua>
162 +- update to 1.3.22.1
165 +* Thu Aug 23 2001 Vsevolod Volkov <vvv@mutt.org.ua>
168 +* Wed Jul 25 2001 Vsevolod Volkov <vvv@mutt.org.ua>
170 +- removed 'server-hook', use 'account-hook' instead
171 +- fixed error opening NNTP server without newsgroup using -f option
173 +* Fri Jun 8 2001 Vsevolod Volkov <vvv@mutt.org.ua>
176 +* Sat May 5 2001 Vsevolod Volkov <vvv@mutt.org.ua>
178 +- fixed typo in nntp_attempt_features()
179 +- changed algorithm of XGTITLE command testing
180 +- disabled writing of NNTP password in debug file
181 +- fixed reading and writing of long newsrc lines
182 +- changed checking of last line while reading lines from server
183 +- fixed possible buffer overrun in nntp_parse_newsrc_line()
184 +- removed checking of XHDR command
185 +- compare NNTP return codes without trailing space
187 +* Thu Mar 29 2001 Vsevolod Volkov <vvv@mutt.org.ua>
189 +- support for 'LIST NEWSGROUPS' command to read descriptions
191 +* Fri Mar 2 2001 Vsevolod Volkov <vvv@mutt.org.ua>
194 +* Wed Feb 14 2001 Vsevolod Volkov <vvv@mutt.org.ua>
197 +* Sun Jan 28 2001 Vsevolod Volkov <vvv@mutt.org.ua>
199 +- show number of tagged messages patch from Felix von Leitner <leitner@fefe.de>
201 +* Sun Dec 31 2000 Vsevolod Volkov <vvv@mutt.org.ua>
204 +* Sat Dec 30 2000 Vsevolod Volkov <vvv@mutt.org.ua>
205 +- Fixed problem if last article in group is deleted
207 +* Fri Dec 22 2000 Vsevolod Volkov <vvv@mutt.org.ua>
208 +- Fixed checking of XGTITLE command on some servers
210 +* Mon Dec 18 2000 Vsevolod Volkov <vvv@mutt.org.ua>
211 +- Added \r in AUTHINFO commands
213 +* Mon Nov 27 2000 Vsevolod Volkov <vvv@mutt.org.ua>
216 +* Wed Nov 1 2000 Vsevolod Volkov <vvv@mutt.org.ua>
218 +- fixed error opening newsgroup from mutt started with -g or -G
220 +* Thu Oct 12 2000 Vsevolod Volkov <vvv@mutt.org.ua>
222 +- hotkey 'G' (get-message) replaced with '^G'
224 +* Thu Sep 21 2000 Vsevolod Volkov <vvv@mutt.org.ua>
226 +- changed delay displaying error messages from 1 to 2 seconds
227 +- fixed error compiling with nntp and without imap
229 +* Wed Sep 6 2000 Vsevolod Volkov <vvv@mutt.org.ua>
230 +- fixed catchup in index
231 +- fixed nntp_open_mailbox()
233 +* Sat Sep 2 2000 Vsevolod Volkov <vvv@mutt.org.ua>
234 +- functions <edit> and <delete-entry> disabled
235 +- format of news mailbox names changed to url form
236 +- option nntp_attempts removed
237 +- option reconnect_news renamed to nntp_reconnect
238 +- default value of nntp_poll changed from 30 to 60
239 +- error handling improved
241 +* Wed Aug 30 2000 Vsevolod Volkov <vvv@mutt.org.ua>
243 +- new option show_only_unread
244 +- add newsgroup completion
246 +* Fri Aug 4 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
249 +* Sat Jul 29 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
252 +* Sun Jul 9 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
254 +- authentication code update
255 +- fix for changing to newsgroup from mailbox with read messages
256 +- socket code optimization
258 +* Wed Jun 21 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
261 +* Wed Jun 14 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
262 +- don't substitute current newsgroup with deleted new messages
264 +* Mon Jun 12 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
266 +- fix for substitution of newsgroup after reconnection
267 +- fix for loading newsgroups with very long names
268 +- fix for loading more than 32768 newsgroups
270 +* Wed May 24 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
273 +* Sat May 20 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
276 +* Fri May 12 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
279 +* Thu May 11 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
282 +* Thu May 4 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
285 +* Sun Apr 23 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
288 +* Fri Apr 7 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
289 +- add substitution of newsgroup with new messages by default
291 +* Wed Apr 5 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
292 +- add attach message from newsgroup
293 +- add one-line help in newsreader mode
294 +- disable 'change-dir' command in newsgroups browser
297 +* Tue Apr 4 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
298 +- get default newsserver name from file /etc/nntpserver
299 +- use case insensitive server names
300 +- add print-style sequence %s to $newsrc
303 +* Sat Apr 1 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
304 +- remove 'X-FTN-Origin' header processing
306 +* Thu Mar 30 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
310 +* Thu Mar 23 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
311 +- fix mutt_select_newsserver()
312 +- remove 'toggle-mode' function
313 +- add 'change-newsgroup' function
315 +* Wed Mar 22 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
318 +* Tue Mar 21 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
319 +- fix error 'bounce' function after 'post'
320 +- add 'forward to newsgroup' function
322 +* Mon Mar 20 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
323 +- 'forward' function works in newsreader mode
324 +- add 'post' and 'followup' functions to pager and attachment menu
325 +- fix active descriptions and allowed flag reload
327 +* Tue Mar 14 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
329 +- remove deleted newsgroups from list
331 +* Mon Mar 13 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
332 +- update .newsrc in browser
334 +* Sun Mar 12 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
335 +- reload .newsrc if externally modified
336 +- fix active cache update
338 +* Sun Mar 5 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
341 +* Sat Mar 4 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
342 +- patch *.update_list_file is not required
343 +- count lines when loading descriptions
344 +- remove cache of unsubscribed newsgroups
346 +* Thu Mar 2 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
347 +- load list of newsgroups from cache faster
349 +* Wed Mar 1 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
352 +* Tue Feb 29 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
353 +- fix unread messages in browser
354 +- fix newsrc_gen_entries()
356 +* Mon Feb 28 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
357 +- fix mutt_newsgroup_stat()
358 +- fix nntp_delete_cache()
359 +- fix nntp_get_status()
360 +- fix check_children()
361 +- fix nntp_fetch_headers()
363 +* Fri Feb 25 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
366 +* Thu Feb 24 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
367 +- fix updating new messages in cache
369 +* Mon Feb 21 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
370 +- change default cache filenames
371 +- fix updating new messages in cache
373 +* Fri Feb 18 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
374 +- fix segmentation fault in news groups browser
376 +* Tue Feb 15 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
379 +* Thu Feb 10 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
382 +* Sun Jan 30 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
383 +- add X-Comment-To editing
384 +- add my_hdr support for Newsgroups:, Followup-To: and X-Comment-To: headers
385 +- add variables $ask_followup_to and $ask_x_comment_to
387 +* Fri Jan 28 2000 Vsevolod Volkov <vvv@mutt.kiev.ua>
389 Index: mutt-1.5.20/OPS
390 ===================================================================
391 --- mutt-1.5.20.orig/OPS 2009-10-13 22:47:23.746523069 -0300
392 +++ mutt-1.5.20/OPS 2009-10-13 22:56:13.016523074 -0300
394 OP_BROWSER_NEW_FILE "select a new file in this directory"
395 OP_BROWSER_VIEW_FILE "view file"
396 OP_BROWSER_TELL "display the currently selected file's name"
397 -OP_BROWSER_SUBSCRIBE "subscribe to current mailbox (IMAP only)"
398 -OP_BROWSER_UNSUBSCRIBE "unsubscribe from current mailbox (IMAP only)"
399 +OP_BROWSER_SUBSCRIBE "subscribe to current mbox (IMAP/NNTP only)"
400 +OP_BROWSER_UNSUBSCRIBE "unsubscribe from current mbox (IMAP/NNTP only)"
401 OP_BROWSER_TOGGLE_LSUB "toggle view all/subscribed mailboxes (IMAP only)"
402 OP_BUFFY_LIST "list mailboxes with new mail"
403 +OP_CATCHUP "mark all articles in newsgroup as read"
404 OP_CHANGE_DIRECTORY "change directories"
405 OP_CHECK_NEW "check mailboxes for new mail"
406 OP_COMPOSE_ATTACH_FILE "attach file(s) to this message"
407 OP_COMPOSE_ATTACH_MESSAGE "attach message(s) to this message"
408 +OP_COMPOSE_ATTACH_NEWS_MESSAGE "attach newsmessage(s) to this message"
409 OP_COMPOSE_EDIT_BCC "edit the BCC list"
410 OP_COMPOSE_EDIT_CC "edit the CC list"
411 OP_COMPOSE_EDIT_DESCRIPTION "edit attachment description"
413 OP_COMPOSE_EDIT_HEADERS "edit the message with headers"
414 OP_COMPOSE_EDIT_MESSAGE "edit the message"
415 OP_COMPOSE_EDIT_MIME "edit attachment using mailcap entry"
416 +OP_COMPOSE_EDIT_NEWSGROUPS "edit the newsgroups list"
417 OP_COMPOSE_EDIT_REPLY_TO "edit the Reply-To field"
418 +OP_COMPOSE_EDIT_FOLLOWUP_TO "edit the Followup-To field"
419 +OP_COMPOSE_EDIT_X_COMMENT_TO "edit the X-Comment-To field"
420 OP_COMPOSE_EDIT_SUBJECT "edit the subject of this message"
421 OP_COMPOSE_EDIT_TO "edit the TO list"
422 OP_CREATE_MAILBOX "create a new mailbox (IMAP only)"
424 OP_FILTER "filter attachment through a shell command"
425 OP_FIRST_ENTRY "move to the first entry"
426 OP_FLAG_MESSAGE "toggle a message's 'important' flag"
427 +OP_FOLLOWUP "followup to newsgroup"
428 +OP_FORWARD_TO_GROUP "forward to newsgroup"
429 OP_FORWARD_MESSAGE "forward a message with comments"
430 OP_GENERIC_SELECT_ENTRY "select the current entry"
431 +OP_GET_CHILDREN "get all children of the current message"
432 +OP_GET_MESSAGE "get message with Message-Id"
433 +OP_GET_PARENT "get parent of the current message"
434 OP_GROUP_REPLY "reply to all recipients"
435 OP_HALF_DOWN "scroll down 1/2 page"
436 OP_HALF_UP "scroll up 1/2 page"
438 OP_JUMP "jump to an index number"
439 OP_LAST_ENTRY "move to the last entry"
440 OP_LIST_REPLY "reply to specified mailing list"
441 +OP_LOAD_ACTIVE "load active file from NNTP server"
442 OP_MACRO "execute a macro"
443 OP_MAIL "compose a new mail message"
444 OP_MAIN_BREAK_THREAD "break the thread in two"
445 OP_MAIN_CHANGE_FOLDER "open a different folder"
446 OP_MAIN_CHANGE_FOLDER_READONLY "open a different folder in read only mode"
447 +OP_MAIN_CHANGE_GROUP "open a different newsgroup"
448 +OP_MAIN_CHANGE_GROUP_READONLY "open a different newsgroup in read only mode"
449 OP_MAIN_CLEAR_FLAG "clear a status flag from a message"
450 OP_MAIN_DELETE_PATTERN "delete messages matching a pattern"
451 OP_MAIN_IMAP_FETCH "force retrieval of mail from IMAP server"
453 OP_PAGER_SKIP_QUOTED "skip beyond quoted text"
454 OP_PAGER_TOP "jump to the top of the message"
455 OP_PIPE "pipe message/attachment to a shell command"
456 +OP_POST "post message to newsgroup"
457 OP_PREV_ENTRY "move to the previous entry"
458 OP_PREV_LINE "scroll up one line"
459 OP_PREV_PAGE "move to the previous page"
461 OP_QUERY_APPEND "append new query results to current results"
462 OP_QUIT "save changes to mailbox and quit"
463 OP_RECALL_MESSAGE "recall a postponed message"
464 +OP_RECONSTRUCT_THREAD "reconstruct thread containing current message"
465 OP_REDRAW "clear and redraw the screen"
466 OP_REFORMAT_WINCH "{internal}"
467 OP_RENAME_MAILBOX "rename the current mailbox (IMAP only)"
468 @@ -160,18 +175,22 @@
469 OP_SHELL_ESCAPE "invoke a command in a subshell"
470 OP_SORT "sort messages"
471 OP_SORT_REVERSE "sort messages in reverse order"
472 +OP_SUBSCRIBE_PATTERN "subscribe to newsgroups matching a pattern"
473 OP_TAG "tag the current entry"
474 OP_TAG_PREFIX "apply next function to tagged messages"
475 OP_TAG_PREFIX_COND "apply next function ONLY to tagged messages"
476 OP_TAG_SUBTHREAD "tag the current subthread"
477 OP_TAG_THREAD "tag the current thread"
478 OP_TOGGLE_NEW "toggle a message's 'new' flag"
479 +OP_TOGGLE_READ "toggle view of read messages"
480 OP_TOGGLE_WRITE "toggle whether the mailbox will be rewritten"
481 OP_TOGGLE_MAILBOXES "toggle whether to browse mailboxes or all files"
482 OP_TOP_PAGE "move to the top of the page"
483 +OP_UNCATCHUP "mark all articles in newsgroup as unread"
484 OP_UNDELETE "undelete the current entry"
485 OP_UNDELETE_THREAD "undelete all messages in thread"
486 OP_UNDELETE_SUBTHREAD "undelete all messages in subthread"
487 +OP_UNSUBSCRIBE_PATTERN "unsubscribe from newsgroups matching a pattern"
488 OP_VERSION "show the Mutt version number and date"
489 OP_VIEW_ATTACH "view attachment using mailcap entry if necessary"
490 OP_VIEW_ATTACHMENTS "show MIME attachments"
491 Index: mutt-1.5.20/account.c
492 ===================================================================
493 --- mutt-1.5.20.orig/account.c 2009-10-13 22:47:23.061521522 -0300
494 +++ mutt-1.5.20/account.c 2009-10-13 23:01:19.663513737 -0300
500 + if (a1->type == M_ACCT_TYPE_NNTP && NntpUser)
504 if (a1->flags & a2->flags & M_ACCT_USER)
505 return (!strcmp (a1->user, a2->user));
506 if (a1->flags & M_ACCT_USER)
512 + if (account->type == M_ACCT_TYPE_NNTP)
514 + if (account->flags & M_ACCT_SSL)
515 + url->scheme = U_NNTPS;
517 + url->scheme = U_NNTP;
521 url->host = account->host;
522 if (account->flags & M_ACCT_PORT)
523 url->port = account->port;
525 else if ((account->type == M_ACCT_TYPE_POP) && PopUser)
526 strfcpy (account->user, PopUser, sizeof (account->user));
529 + else if ((account->type == M_ACCT_TYPE_NNTP) && NntpUser)
530 + strfcpy (account->user, NntpUser, sizeof (account->user));
532 else if (option (OPTNOCURSES))
534 /* prompt (defaults to unix username), copy into account->user */
536 else if ((account->type == M_ACCT_TYPE_SMTP) && SmtpPass)
537 strfcpy (account->pass, SmtpPass, sizeof (account->pass));
540 + else if ((account->type == M_ACCT_TYPE_NNTP) && NntpPass)
541 + strfcpy (account->pass, NntpPass, sizeof (account->pass));
543 else if (option (OPTNOCURSES))
546 Index: mutt-1.5.20/account.h
547 ===================================================================
548 --- mutt-1.5.20.orig/account.h 2008-11-11 17:55:46.000000000 -0200
549 +++ mutt-1.5.20/account.h 2009-10-13 22:56:13.055780287 -0300
551 M_ACCT_TYPE_NONE = 0,
560 Index: mutt-1.5.20/attach.h
561 ===================================================================
562 --- mutt-1.5.20.orig/attach.h 2008-11-11 17:55:46.000000000 -0200
563 +++ mutt-1.5.20/attach.h 2009-10-13 22:56:13.072604694 -0300
566 void mutt_attach_bounce (FILE *, HEADER *, ATTACHPTR **, short, BODY *);
567 void mutt_attach_resend (FILE *, HEADER *, ATTACHPTR **, short, BODY *);
568 -void mutt_attach_forward (FILE *, HEADER *, ATTACHPTR **, short, BODY *);
569 +void mutt_attach_forward (FILE *, HEADER *, ATTACHPTR **, short, BODY *, int);
570 void mutt_attach_reply (FILE *, HEADER *, ATTACHPTR **, short, BODY *, int);
572 #endif /* _ATTACH_H_ */
573 Index: mutt-1.5.20/browser.c
574 ===================================================================
575 --- mutt-1.5.20.orig/browser.c 2009-10-13 22:47:21.524523079 -0300
576 +++ mutt-1.5.20/browser.c 2009-10-13 22:56:13.089514680 -0300
592 +static struct mapping_t FolderNewsHelp[] = {
593 + { N_("Exit"), OP_EXIT },
594 + { N_("List"), OP_TOGGLE_MAILBOXES },
595 + { N_("Subscribe"), OP_BROWSER_SUBSCRIBE },
596 + { N_("Unsubscribe"), OP_BROWSER_UNSUBSCRIBE },
597 + { N_("Catchup"), OP_CATCHUP },
598 + { N_("Mask"), OP_ENTER_MASK },
599 + { N_("Help"), OP_HELP },
604 typedef struct folder_t
606 struct folder_file *ff;
612 + if (option (OPTNEWS))
615 f = browser_compare_date;
619 + if (option (OPTNEWS))
622 f = browser_compare_size;
625 @@ -308,8 +332,106 @@
631 +newsgroup_format_str (char *dest, size_t destlen, size_t col, char op, const char *src,
632 + const char *fmt, const char *ifstring, const char *elsestring,
633 + unsigned long data, format_flag flags)
635 + char fn[SHORT_STRING], tmp[SHORT_STRING];
636 + FOLDER *folder = (FOLDER *) data;
641 + snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
642 + snprintf (dest, destlen, tmp, folder->num + 1);
646 + strncpy (fn, folder->ff->name, sizeof(fn) - 1);
647 + snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
648 + snprintf (dest, destlen, tmp, fn);
652 + snprintf (tmp, sizeof (tmp), "%%%sc", fmt);
653 + if (folder->ff->nd->subscribed)
654 + snprintf (dest, destlen, tmp, ' ');
656 + snprintf (dest, destlen, tmp, folder->ff->new ? 'N' : 'u');
660 + snprintf (tmp, sizeof (tmp), "%%%sc", fmt);
661 + if (folder->ff->nd->deleted)
662 + snprintf (dest, destlen, tmp, 'D');
664 + snprintf (dest, destlen, tmp, folder->ff->nd->allowed ? ' ' : '-');
668 + if (flags & M_FORMAT_OPTIONAL)
670 + if (folder->ff->nd->unread != 0)
671 + mutt_FormatString (dest, destlen, col, ifstring, newsgroup_format_str,
674 + mutt_FormatString (dest, destlen, col, elsestring, newsgroup_format_str,
677 + else if (Context && Context->data == folder->ff->nd)
679 + snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
680 + snprintf (dest, destlen, tmp, Context->unread);
684 + snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
685 + snprintf (dest, destlen, tmp, folder->ff->nd->unread);
690 + if (Context && Context->data == folder->ff->nd)
692 + snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
693 + snprintf (dest, destlen, tmp, Context->new);
695 + else if (option (OPTMARKOLD) &&
696 + folder->ff->nd->lastCached >= folder->ff->nd->firstMessage &&
697 + folder->ff->nd->lastCached <= folder->ff->nd->lastMessage)
699 + snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
700 + snprintf (dest, destlen, tmp, folder->ff->nd->lastMessage - folder->ff->nd->lastCached);
704 + snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
705 + snprintf (dest, destlen, tmp, folder->ff->nd->unread);
710 + if (folder->ff->nd->desc != NULL)
712 + snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
713 + snprintf (dest, destlen, tmp, folder->ff->nd->desc);
717 + snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
718 + snprintf (dest, destlen, tmp, "");
724 +#endif /* USE_NNTP */
726 static void add_folder (MUTTMENU *m, struct browser_state *state,
727 - const char *name, const struct stat *s, int new)
728 + const char *name, const struct stat *s,
729 + void *data, int new)
731 if (state->entrylen == state->entrymax)
735 (state->entry)[state->entrylen].imap = 0;
738 + if (option (OPTNEWS))
739 + (state->entry)[state->entrylen].nd = (NNTP_DATA *) data;
745 menu->data = state->entry;
748 +/* get list of all files/newsgroups with mask */
749 static int examine_directory (MUTTMENU *menu, struct browser_state *state,
750 char *d, const char *prefix)
753 + if (option (OPTNEWS))
757 + NNTP_SERVER *news = CurrentNewsSrv;
759 +/* mutt_buffy_check (0); */
760 + init_state (state, menu);
762 + for (tmp = news->list; tmp; tmp = tmp->next)
764 + if (!(data = (NNTP_DATA *)tmp->data))
766 + if (prefix && *prefix && strncmp (prefix, data->group,
767 + strlen (prefix)) != 0)
769 + if (!((regexec (Mask.rx, data->group, 0, NULL, 0) == 0) ^ Mask.not))
771 + add_folder (menu, state, data->group, NULL, data, data->new);
775 +#endif /* USE_NNTP */
780 @@ -416,17 +568,40 @@
782 while (tmp && mutt_strcmp (buffer, tmp->path))
784 - add_folder (menu, state, de->d_name, &s, (tmp) ? tmp->new : 0);
785 + add_folder (menu, state, de->d_name, &s, NULL, (tmp) ? tmp->new : 0);
790 browser_sort (state);
794 +/* get list of mailboxes/subscribed newsgroups */
795 static int examine_mailboxes (MUTTMENU *menu, struct browser_state *state)
798 char buffer[LONG_STRING];
801 + if (option (OPTNEWS))
805 + NNTP_SERVER *news = CurrentNewsSrv;
807 +/* mutt_buffy_check (0); */
808 + init_state (state, menu);
810 + for (tmp = news->list; tmp; tmp = tmp->next)
812 + if ((data = (NNTP_DATA *) tmp->data) != NULL && (data->new ||
813 + (data->subscribed && (!option (OPTSHOWONLYUNREAD) || data->unread))))
814 + add_folder (menu, state, data->group, NULL, data, data->new);
820 BUFFY *tmp = Incoming;
822 struct mailbox_state mbox;
823 @@ -444,14 +619,21 @@
824 if (mx_is_imap (tmp->path))
826 imap_mailbox_state (tmp->path, &mbox);
827 - add_folder (menu, state, tmp->path, NULL, mbox.new);
828 + add_folder (menu, state, tmp->path, NULL, NULL, mbox.new);
833 if (mx_is_pop (tmp->path))
835 - add_folder (menu, state, tmp->path, NULL, tmp->new);
836 + add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
841 + if (mx_is_nntp (tmp->path))
843 + add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
847 @@ -480,15 +662,20 @@
848 strfcpy (buffer, NONULL(tmp->path), sizeof (buffer));
849 mutt_pretty_mailbox (buffer, sizeof (buffer));
851 - add_folder (menu, state, buffer, &s, tmp->new);
852 + add_folder (menu, state, buffer, &s, NULL, tmp->new);
854 while ((tmp = tmp->next));
856 browser_sort (state);
860 static int select_file_search (MUTTMENU *menu, regex_t *re, int n)
863 + if (option (OPTNEWS))
864 + return (regexec (re, ((struct folder_file *) menu->data)[n].desc, 0, NULL, 0));
866 return (regexec (re, ((struct folder_file *) menu->data)[n].name, 0, NULL, 0));
870 folder.ff = &((struct folder_file *) menu->data)[num];
874 + if (option (OPTNEWS))
875 + mutt_FormatString (s, slen, 0, NONULL(GroupFormat), newsgroup_format_str,
876 + (unsigned long) &folder, M_FORMAT_ARROWCURSOR);
879 mutt_FormatString (s, slen, 0, NONULL(FolderFormat), folder_format_str,
880 (unsigned long) &folder, M_FORMAT_ARROWCURSOR);
887 + if (option (OPTNEWS))
890 + snprintf (title, titlelen, _("Subscribed newsgroups"));
892 + snprintf (title, titlelen, _("Newsgroups on server [%s]"),
893 + CurrentNewsSrv->conn->account.host);
899 menu->is_mailbox_list = 1;
902 strfcpy (LastDirBackup, LastDir, sizeof (LastDirBackup));
905 + if (option (OPTNEWS))
908 + strfcpy (prefix, f, sizeof (prefix));
913 + /* default state for news reader mode is browse subscribed newsgroups */
915 + for (list = CurrentNewsSrv->list; list; list = list->next)
917 + NNTP_DATA *data = (NNTP_DATA *) list->data;
919 + if (data && data->subscribed)
931 mutt_expand_path (f, flen);
933 menu->tag = file_tag;
935 menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_FOLDER,
937 + (option (OPTNEWS)) ? FolderNewsHelp :
941 init_menu (&state, menu, title, sizeof (title), buffy);
942 @@ -825,7 +1057,11 @@
947 + if (buffy || option (OPTNEWS)) /* news have not path */
952 strfcpy (f, state.entry[menu->current].name, flen);
953 mutt_expand_path (f, flen);
954 @@ -883,14 +1119,6 @@
958 - case OP_BROWSER_SUBSCRIBE:
959 - imap_subscribe (state.entry[menu->current].name, 1);
962 - case OP_BROWSER_UNSUBSCRIBE:
963 - imap_subscribe (state.entry[menu->current].name, 0);
966 case OP_BROWSER_TOGGLE_LSUB:
967 if (option (OPTIMAPLSUB))
968 unset_option (OPTIMAPLSUB);
969 @@ -991,6 +1219,11 @@
971 case OP_CHANGE_DIRECTORY:
974 + if (option (OPTNEWS))
978 strfcpy (buf, LastDir, sizeof (buf));
980 if (!state.imap_browse)
981 @@ -1257,6 +1490,190 @@
983 mutt_error _("Error trying to view file");
990 + if (option (OPTNEWS))
992 + struct folder_file *f = &state.entry[menu->current];
995 + if (i == OP_CATCHUP)
996 + nd = mutt_newsgroup_catchup (CurrentNewsSrv, f->name);
998 + nd = mutt_newsgroup_uncatchup (CurrentNewsSrv, f->name);
1003 + struct folder_file ff;
1004 + char buffer[_POSIX_PATH_MAX + SHORT_STRING];
1007 + folder.ff->name = f->name;
1008 + folder.ff->st = NULL;
1009 + folder.ff->is_new = nd->new;
1010 + folder.ff->nd = nd;
1012 + mutt_FormatString (buffer, sizeof (buffer), 0, NONULL(GroupFormat),
1013 + newsgroup_format_str, (unsigned long) &folder,
1014 + M_FORMAT_ARROWCURSOR);
1015 + f->desc = safe_strdup (buffer); */
1016 + if (menu->current + 1 < menu->max)
1018 + menu->redraw = REDRAW_MOTION_RESYNCH;
1023 + case OP_LOAD_ACTIVE:
1024 + if (!option (OPTNEWS))
1031 + for (tmp = CurrentNewsSrv->list; tmp; tmp = tmp->next)
1033 + if ((data = (NNTP_DATA *)tmp->data))
1034 + data->deleted = 1;
1037 + nntp_get_active (CurrentNewsSrv);
1039 + destroy_state (&state);
1041 + examine_mailboxes (menu, &state);
1043 + examine_directory (menu, &state, NULL, NULL);
1044 + init_menu (&state, menu, title, sizeof (title), buffy);
1046 +#endif /* USE_NNTP */
1048 +#if defined USE_IMAP || defined USE_NNTP
1049 + case OP_BROWSER_SUBSCRIBE:
1050 + case OP_BROWSER_UNSUBSCRIBE:
1053 + case OP_SUBSCRIBE_PATTERN:
1054 + case OP_UNSUBSCRIBE_PATTERN:
1055 + if (option (OPTNEWS))
1057 + regex_t *rx = (regex_t *) safe_malloc (sizeof (regex_t));
1059 + int j = menu->current;
1061 + NNTP_SERVER *news = CurrentNewsSrv;
1063 + if (i == OP_SUBSCRIBE_PATTERN || i == OP_UNSUBSCRIBE_PATTERN)
1069 + if (i == OP_SUBSCRIBE_PATTERN)
1070 + snprintf (tmp, sizeof (tmp), _("Subscribe pattern: "));
1072 + snprintf (tmp, sizeof (tmp), _("Unsubscribe pattern: "));
1073 + if (mutt_get_field (tmp, buf, sizeof (buf), 0) != 0 || !buf[0])
1079 + if ((err = REGCOMP (rx, s, REG_NOSUB)) != 0)
1081 + regerror (err, rx, buf, sizeof (buf));
1084 + mutt_error ("%s", buf);
1087 + menu->redraw = REDRAW_FULL;
1090 + else if (!state.entrylen)
1092 + mutt_error _("No newsgroups match the mask");
1096 + for ( ; j < state.entrylen; j++)
1098 + struct folder_file *f = &state.entry[j];
1100 + if (i == OP_BROWSER_SUBSCRIBE || i == OP_BROWSER_UNSUBSCRIBE ||
1101 + regexec (rx, f->name, 0, NULL, 0) == 0)
1103 + if (i == OP_BROWSER_SUBSCRIBE || i == OP_SUBSCRIBE_PATTERN)
1104 + nd = mutt_newsgroup_subscribe (news, f->name);
1106 + nd = mutt_newsgroup_unsubscribe (news, f->name);
1110 + char buffer[_POSIX_PATH_MAX + SHORT_STRING];
1112 + folder.name = f->name;
1114 + folder.new = nd->new;
1117 + mutt_FormatString (buffer, sizeof (buffer), 0, NONULL(GroupFormat),
1118 + newsgroup_format_str, (unsigned long) &folder,
1119 + M_FORMAT_ARROWCURSOR);
1120 + f->desc = safe_strdup (buffer);
1123 + if (i == OP_BROWSER_SUBSCRIBE || i == OP_BROWSER_UNSUBSCRIBE)
1125 + if (menu->current + 1 < menu->max)
1127 + menu->redraw = REDRAW_MOTION_RESYNCH;
1131 + if (i == OP_SUBSCRIBE_PATTERN)
1133 + LIST *grouplist = NULL;
1136 + grouplist = news->list;
1137 + for (; grouplist; grouplist = grouplist->next)
1139 + nd = (NNTP_DATA *) grouplist->data;
1140 + if (nd && nd->group && !nd->subscribed)
1142 + if (regexec (rx, nd->group, 0, NULL, 0) == 0)
1144 + mutt_newsgroup_subscribe (news, nd->group);
1145 + add_folder (menu, &state, nd->group, NULL, nd, nd->new);
1149 + init_menu (&state, menu, title, sizeof (title), buffy);
1151 + mutt_newsrc_update (news);
1152 + nntp_clear_cacheindex (news);
1153 + if (i != OP_BROWSER_SUBSCRIBE && i != OP_BROWSER_UNSUBSCRIBE)
1159 +#endif /* USE_IMAP && USE_NNTP */
1160 +#endif /* USE_NNTP */
1163 + if (i == OP_BROWSER_SUBSCRIBE)
1164 + imap_subscribe (state.entry[menu->current].name, 1);
1166 + imap_subscribe (state.entry[menu->current].name, 0);
1168 +#endif /* USE_IMAP */
1172 Index: mutt-1.5.20/browser.h
1173 ===================================================================
1174 --- mutt-1.5.20.orig/browser.h 2009-01-04 20:34:12.000000000 -0200
1175 +++ mutt-1.5.20/browser.h 2009-10-13 22:56:13.114590793 -0300
1178 #define _BROWSER_H 1
1188 unsigned selectable : 1;
1189 unsigned inferiors : 1;
1194 unsigned tagged : 1;
1197 Index: mutt-1.5.20/buffy.c
1198 ===================================================================
1199 --- mutt-1.5.20.orig/buffy.c 2009-10-13 22:47:23.258524165 -0300
1200 +++ mutt-1.5.20/buffy.c 2009-10-13 22:56:13.148520101 -0300
1203 if (!Context || Context->magic != M_POP)
1206 + if (!Context || Context->magic != M_NNTP)
1208 /* check device ID and serial number instead of comparing paths */
1209 if (!Context || !Context->path || stat (Context->path, &contex_sb) != 0)
1211 @@ -345,6 +348,11 @@
1216 + if ((tmp->magic == M_NNTP) || mx_is_nntp (tmp->path))
1217 + tmp->magic = M_NNTP;
1220 if (stat (tmp->path, &sb) != 0 || (S_ISREG(sb.st_mode) && sb.st_size == 0) ||
1221 (!tmp->magic && (tmp->magic = mx_get_magic (tmp->path)) <= 0))
1223 @@ -362,25 +370,21 @@
1224 /* check to see if the folder is the currently selected folder
1226 if (!Context || !Context->path ||
1227 -#if defined USE_IMAP || defined USE_POP
1232 - tmp->magic == M_IMAP
1233 + || tmp->magic == M_IMAP
1239 - tmp->magic == M_POP
1241 - ) ? mutt_strcmp (tmp->path, Context->path) :
1242 + || tmp->magic == M_POP
1244 - (sb.st_dev != contex_sb.st_dev || sb.st_ino != contex_sb.st_ino)
1245 -#if defined USE_IMAP || defined USE_POP
1248 + || tmp->magic == M_NNTP
1252 + ) ? mutt_strcmp (tmp->path, Context->path) :
1253 + (sb.st_dev != contex_sb.st_dev || sb.st_ino != contex_sb.st_ino)
1259 Index: mutt-1.5.20/complete.c
1260 ===================================================================
1261 --- mutt-1.5.20.orig/complete.c 2009-01-04 20:38:16.000000000 -0200
1262 +++ mutt-1.5.20/complete.c 2009-10-13 22:56:13.164944270 -0300
1264 #include "mailbox.h"
1274 char filepart[_POSIX_PATH_MAX];
1276 char imap_path[LONG_STRING];
1279 dprint (2, (debugfile, "mutt_complete: completing %s\n", s));
1282 + if (option (OPTNEWS))
1284 + LIST *l = CurrentNewsSrv->list;
1286 + strfcpy (filepart, s, sizeof (filepart));
1289 + * special case to handle when there is no filepart yet.
1290 + * find the first subscribed newsgroup
1292 + if ((len = mutt_strlen (filepart)) == 0)
1294 + for (; l; l = l->next)
1296 + NNTP_DATA *data = (NNTP_DATA *)l->data;
1298 + if (data && data->subscribed)
1300 + strfcpy (filepart, data->group, sizeof (filepart));
1308 + for (; l; l = l->next)
1310 + NNTP_DATA *data = (NNTP_DATA *)l->data;
1312 + if (data && data->subscribed &&
1313 + mutt_strncmp (data->group, filepart, len) == 0)
1317 + for (i = 0; filepart[i] && data->group[i]; i++)
1319 + if (filepart[i] != data->group[i])
1329 + strfcpy (filepart, data->group, sizeof (filepart));
1335 + strcpy (s, filepart);
1337 + return (init ? 0 : -1);
1342 /* we can use '/' as a delimiter, imap_complete rewrites it */
1343 if (*s == '=' || *s == '+' || *s == '!')
1345 Index: mutt-1.5.20/compose.c
1346 ===================================================================
1347 --- mutt-1.5.20.orig/compose.c 2009-10-13 22:47:23.340522786 -0300
1348 +++ mutt-1.5.20/compose.c 2009-10-13 22:56:13.190519741 -0300
1350 #include "mailbox.h"
1352 #include "charset.h"
1356 #include "remailer.h"
1376 HDR_ATTACH = (HDR_FCC + 5) /* where to start printing the attachments */
1379 -#define HDR_XOFFSET 10
1380 -#define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
1381 +#define HDR_XOFFSET 14
1382 +#define TITLE_FMT "%14s" /* Used for Prompts, which are ASCII */
1383 #define W (COLS - HDR_XOFFSET - SidebarWidth)
1385 static char *Prompts[] =
1402 static struct mapping_t ComposeHelp[] = {
1408 +static struct mapping_t ComposeNewsHelp[] = {
1409 + { N_("Send"), OP_COMPOSE_SEND_MESSAGE },
1410 + { N_("Abort"), OP_EXIT },
1411 + { "Newsgroups", OP_COMPOSE_EDIT_NEWSGROUPS },
1412 + { "Subj", OP_COMPOSE_EDIT_SUBJECT },
1413 + { N_("Attach file"), OP_COMPOSE_ATTACH_FILE },
1414 + { N_("Descrip"), OP_COMPOSE_EDIT_DESCRIPTION },
1415 + { N_("Help"), OP_HELP },
1420 static void snd_entry (char *b, size_t blen, MUTTMENU *menu, int num)
1422 mutt_FormatString (b, blen, 0, NONULL (AttachFormat), mutt_attach_fmt,
1423 @@ -115,16 +149,16 @@
1424 if ((WithCrypto & APPLICATION_PGP) && (WithCrypto & APPLICATION_SMIME))
1427 - mvaddstr (HDR_CRYPT, SidebarWidth, "Security: ");
1428 + mvaddstr (HDR_CRYPT, SidebarWidth, " Security: ");
1429 else if (msg->security & APPLICATION_SMIME)
1430 - mvaddstr (HDR_CRYPT, SidebarWidth, " S/MIME: ");
1431 + mvaddstr (HDR_CRYPT, SidebarWidth, " S/MIME: ");
1432 else if (msg->security & APPLICATION_PGP)
1433 - mvaddstr (HDR_CRYPT, SidebarWidth, " PGP: ");
1434 + mvaddstr (HDR_CRYPT, SidebarWidth, " PGP: ");
1436 else if ((WithCrypto & APPLICATION_SMIME))
1437 - mvaddstr (HDR_CRYPT, SidebarWidth, " S/MIME: ");
1438 + mvaddstr (HDR_CRYPT, SidebarWidth, " S/MIME: ");
1439 else if ((WithCrypto & APPLICATION_PGP))
1440 - mvaddstr (HDR_CRYPT, SidebarWidth, " PGP: ");
1441 + mvaddstr (HDR_CRYPT, SidebarWidth, " PGP: ");
1445 @@ -252,9 +286,28 @@
1446 static void draw_envelope (HEADER *msg, char *fcc)
1448 draw_envelope_addr (HDR_FROM, msg->env->from);
1450 + if (!option (OPTNEWSSEND))
1453 draw_envelope_addr (HDR_TO, msg->env->to);
1454 draw_envelope_addr (HDR_CC, msg->env->cc);
1455 draw_envelope_addr (HDR_BCC, msg->env->bcc);
1460 + mvprintw (HDR_TO, SidebarWidth, TITLE_FMT , Prompts[HDR_NEWSGROUPS - 1]);
1461 + mutt_paddstr (W, NONULL (msg->env->newsgroups));
1462 + mvprintw (HDR_CC, SidebarWidth, TITLE_FMT , Prompts[HDR_FOLLOWUPTO - 1]);
1463 + mutt_paddstr (W, NONULL (msg->env->followup_to));
1464 + if (option (OPTXCOMMENTTO))
1466 + mvprintw (HDR_BCC, SidebarWidth, TITLE_FMT , Prompts[HDR_XCOMMENTTO - 1]);
1467 + mutt_paddstr (W, NONULL (msg->env->x_comment_to));
1471 mvprintw (HDR_SUBJECT, SidebarWidth, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
1472 mutt_paddstr (W, NONULL (msg->env->subject));
1473 draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
1474 @@ -507,6 +560,12 @@
1475 /* Sort, SortAux could be changed in mutt_index_menu() */
1476 int oldSort, oldSortAux;
1479 + int news = 0; /* is it a news article ? */
1481 + if (option (OPTNEWSSEND))
1485 mutt_attach_init (msg->content);
1486 idx = mutt_gen_attach_list (msg->content, -1, idx, &idxlen, &idxmax, 0, 1);
1487 @@ -517,10 +576,18 @@
1488 menu->make_entry = snd_entry;
1489 menu->tag = mutt_tag_attach;
1493 + menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_COMPOSE, ComposeNewsHelp);
1496 menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_COMPOSE, ComposeHelp);
1501 + unset_option (OPTNEWS); /* for any case */
1503 switch (op = mutt_menuLoop (menu))
1506 @@ -533,17 +600,87 @@
1507 mutt_message_hook (NULL, msg, M_SEND2HOOK);
1509 case OP_COMPOSE_EDIT_TO:
1514 menu->redraw = edit_address_list (HDR_TO, &msg->env->to);
1515 mutt_message_hook (NULL, msg, M_SEND2HOOK);
1517 case OP_COMPOSE_EDIT_BCC:
1522 menu->redraw = edit_address_list (HDR_BCC, &msg->env->bcc);
1523 mutt_message_hook (NULL, msg, M_SEND2HOOK);
1525 case OP_COMPOSE_EDIT_CC:
1530 menu->redraw = edit_address_list (HDR_CC, &msg->env->cc);
1531 mutt_message_hook (NULL, msg, M_SEND2HOOK);
1534 + case OP_COMPOSE_EDIT_NEWSGROUPS:
1537 + if (msg->env->newsgroups)
1538 + strfcpy (buf, msg->env->newsgroups, sizeof (buf));
1541 + if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) == 0 && buf[0])
1543 + FREE (&msg->env->newsgroups);
1544 + mutt_remove_trailing_ws (buf);
1545 + msg->env->newsgroups = safe_strdup (mutt_skip_whitespace (buf));
1546 + move (HDR_TO, HDR_XOFFSET);
1548 + if (msg->env->newsgroups)
1549 + printw ("%-*.*s", W, W, msg->env->newsgroups);
1554 + case OP_COMPOSE_EDIT_FOLLOWUP_TO:
1558 + if (msg->env->followup_to)
1559 + strfcpy (buf, msg->env->followup_to, sizeof (buf));
1560 + if (mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) == 0 && buf[0])
1562 + FREE (&msg->env->followup_to);
1563 + mutt_remove_trailing_ws (buf);
1564 + msg->env->followup_to = safe_strdup (mutt_skip_whitespace (buf));
1565 + move (HDR_CC, HDR_XOFFSET);
1567 + if (msg->env->followup_to)
1568 + printw ("%-*.*s", W, W, msg->env->followup_to);
1573 + case OP_COMPOSE_EDIT_X_COMMENT_TO:
1574 + if (news && option (OPTXCOMMENTTO))
1577 + if (msg->env->x_comment_to)
1578 + strfcpy (buf, msg->env->x_comment_to, sizeof (buf));
1579 + if (mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) == 0 && buf[0])
1581 + FREE (&msg->env->x_comment_to);
1582 + msg->env->x_comment_to = safe_strdup (buf);
1583 + move (HDR_BCC, HDR_XOFFSET);
1585 + if (msg->env->x_comment_to)
1586 + printw ("%-*.*s", W, W, msg->env->x_comment_to);
1591 case OP_COMPOSE_EDIT_SUBJECT:
1592 if (msg->env->subject)
1593 strfcpy (buf, msg->env->subject, sizeof (buf));
1597 case OP_COMPOSE_ATTACH_MESSAGE:
1599 + case OP_COMPOSE_ATTACH_NEWS_MESSAGE:
1604 @@ -713,7 +853,22 @@
1606 prompt = _("Open mailbox to attach message from");
1609 + unset_option (OPTNEWS);
1610 + if (op == OP_COMPOSE_ATTACH_NEWS_MESSAGE)
1612 + if (!(CurrentNewsSrv = mutt_select_newsserver (NewsServer)))
1615 + prompt = _("Open newsgroup to attach message from");
1616 + set_option (OPTNEWS);
1622 + if ((op == OP_COMPOSE_ATTACH_MESSAGE) ^ (Context->magic == M_NNTP))
1625 strfcpy (fname, NONULL (Context->path), sizeof (fname));
1626 mutt_pretty_mailbox (fname, sizeof (fname));
1627 @@ -722,6 +877,11 @@
1628 if (mutt_enter_fname (prompt, fname, sizeof (fname), &menu->redraw, 1) == -1 || !fname[0])
1632 + if (option (OPTNEWS))
1633 + nntp_expand_path (fname, sizeof (fname), &CurrentNewsSrv->conn->account);
1636 mutt_expand_path (fname, sizeof (fname));
1638 if (!mx_is_imap (fname))
1641 if (!mx_is_pop (fname))
1644 + if (!mx_is_nntp (fname) && !option (OPTNEWS))
1646 /* check to make sure the file exists and is readable */
1647 if (access (fname, R_OK) == -1)
1649 Index: mutt-1.5.20/configure.ac
1650 ===================================================================
1651 --- mutt-1.5.20.orig/configure.ac 2009-10-13 22:47:21.685521331 -0300
1652 +++ mutt-1.5.20/configure.ac 2009-10-13 22:56:13.215518221 -0300
1653 @@ -600,6 +600,14 @@
1654 MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS bcache.o"
1657 +AC_ARG_ENABLE(nntp, [ --enable-nntp Enable NNTP support],
1658 +[ if test x$enableval = xyes ; then
1659 + AC_DEFINE(USE_NNTP,1,[ Define if you want support for the NNTP protocol. ])
1660 + MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS nntp.o newsrc.o"
1665 dnl -- end socket dependencies --
1667 if test "$need_socket" = "yes"
1668 Index: mutt-1.5.20/curs_main.c
1669 ===================================================================
1670 --- mutt-1.5.20.orig/curs_main.c 2009-10-13 22:47:23.358585021 -0300
1671 +++ mutt-1.5.20/curs_main.c 2009-10-13 22:56:13.249523076 -0300
1675 #include "mutt_curses.h"
1677 #include "mutt_menu.h"
1678 #include "mailbox.h"
1679 #include "mapping.h"
1682 #include "mutt_crypt.h"
1691 @@ -428,12 +433,27 @@
1696 +struct mapping_t IndexNewsHelp[] = {
1697 + { N_("Quit"), OP_QUIT },
1698 + { N_("Del"), OP_DELETE },
1699 + { N_("Undel"), OP_UNDELETE },
1700 + { N_("Save"), OP_SAVE },
1701 + { N_("Post"), OP_POST },
1702 + { N_("Followup"), OP_FOLLOWUP },
1703 + { N_("Catchup"), OP_CATCHUP },
1704 + { N_("Help"), OP_HELP },
1709 /* This function handles the message index window as well as commands returned
1710 * from the pager (MENU_PAGER).
1712 int mutt_index_menu (void)
1714 char buf[LONG_STRING], helpstr[LONG_STRING];
1717 int done = 0; /* controls when to exit the "event" loop */
1719 @@ -454,7 +474,11 @@
1720 menu->make_entry = index_make_entry;
1721 menu->color = index_color;
1722 menu->current = ci_first_message ();
1723 - menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN, IndexHelp);
1724 + menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN,
1726 + (Context && (Context->magic == M_NNTP)) ? IndexNewsHelp :
1731 mutt_buffy_check(1); /* force the buffy check after we enter the folder */
1733 imap_disallow_reopen (Context);
1737 + unset_option (OPTNEWS); /* for any case */
1742 @@ -770,6 +797,120 @@
1743 menu_current_bottom (menu);
1747 + case OP_GET_MESSAGE:
1748 + case OP_GET_PARENT:
1750 + if (Context->magic == M_NNTP)
1754 + if (op == OP_GET_MESSAGE)
1757 + if (mutt_get_field (_("Enter Message-Id: "), buf, sizeof (buf), 0) != 0
1763 + LIST *ref = CURHDR->env->references;
1766 + mutt_error _("Article has no parent reference!");
1769 + strfcpy (buf, ref->data, sizeof (buf));
1771 + if (!Context->id_hash)
1772 + Context->id_hash = mutt_make_id_hash (Context);
1773 + if ((h = hash_find (Context->id_hash, buf)))
1775 + if (h->virtual != -1)
1777 + menu->current = h->virtual;
1778 + menu->redraw = REDRAW_MOTION_RESYNCH;
1780 + else if (h->collapsed)
1782 + mutt_uncollapse_thread (Context, h);
1783 + mutt_set_virtual (Context);
1784 + menu->current = h->virtual;
1785 + menu->redraw = REDRAW_MOTION_RESYNCH;
1788 + mutt_error _("Message not visible in limited view.");
1792 + if (nntp_check_msgid (Context, buf) == 0)
1794 + h = Context->hdrs[Context->msgcount-1];
1795 + mutt_sort_headers (Context, 0);
1796 + menu->current = h->virtual;
1797 + menu->redraw = REDRAW_FULL;
1800 + mutt_error (_("Article %s not found on server"), buf);
1805 + case OP_GET_CHILDREN:
1806 + case OP_RECONSTRUCT_THREAD:
1808 + if (Context->magic == M_NNTP)
1811 + int old = CURHDR->index, i;
1813 + if (!CURHDR->env->message_id)
1815 + mutt_error _("No Message-Id. Unable to perform operation");
1819 + if (!Context->id_hash)
1820 + Context->id_hash = mutt_make_id_hash (Context);
1821 + strfcpy (buf, CURHDR->env->message_id, sizeof (buf));
1823 + if (op == OP_RECONSTRUCT_THREAD)
1825 + LIST *ref = CURHDR->env->references;
1828 + nntp_check_msgid (Context, ref->data);
1829 + /* the last msgid in References is the root message */
1831 + strfcpy (buf, ref->data, sizeof (buf));
1835 + mutt_message _("Check for children of message...");
1836 + if (nntp_check_children (Context, buf) == 0)
1838 + mutt_sort_headers (Context, (op == OP_RECONSTRUCT_THREAD));
1839 + h = hash_find (Context->id_hash, buf);
1840 + /* if the root message was retrieved, move to it */
1842 + menu->current = h->virtual;
1843 + else /* try to restore old position */
1844 + for (i = 0; i < Context->msgcount; i++)
1845 + if (Context->hdrs[i]->index == old)
1847 + menu->current = Context->hdrs[i]->virtual;
1848 + /* As an added courtesy, recenter the menu
1849 + * with the current entry at the middle of the screen */
1850 + menu_check_recenter (menu);
1851 + menu_current_middle (menu);
1854 + menu->redraw = REDRAW_FULL;
1855 + mutt_clear_error ();
1863 @@ -866,11 +1007,33 @@
1867 + case OP_TOGGLE_READ:
1870 menu->oldcurrent = (Context->vcount && menu->current >= 0 && menu->current < Context->vcount) ?
1872 - if (mutt_pattern_func (M_LIMIT, _("Limit to messages matching: ")) == 0)
1873 + if (op == OP_TOGGLE_READ)
1875 + char buf[LONG_STRING];
1877 + if (!Context->pattern || strncmp (Context->pattern, "!~R!~D~s", 8) != 0)
1879 + snprintf (buf, sizeof (buf), "!~R!~D~s%s",
1880 + Context->pattern ? Context->pattern : ".*");
1881 + set_option (OPTHIDEREAD);
1885 + strfcpy (buf, Context->pattern + 8, sizeof(buf));
1886 + if (!*buf || strncmp (buf, ".*", 2) == 0)
1887 + snprintf (buf, sizeof(buf), "~A");
1888 + unset_option (OPTHIDEREAD);
1890 + FREE (&Context->pattern);
1891 + Context->pattern = safe_strdup (buf);
1893 + if ((op == OP_TOGGLE_READ && mutt_pattern_func (M_LIMIT, NULL) == 0) ||
1894 + mutt_pattern_func (M_LIMIT, _("Limit to messages matching: ")) == 0)
1896 if (menu->oldcurrent >= 0)
1898 @@ -1088,15 +1251,22 @@
1899 case OP_SIDEBAR_OPEN:
1900 case OP_MAIN_CHANGE_FOLDER:
1901 case OP_MAIN_NEXT_UNREAD_MAILBOX:
1904 - op = OP_MAIN_CHANGE_FOLDER_READONLY;
1906 - /* fallback to the readonly case */
1908 case OP_MAIN_CHANGE_FOLDER_READONLY:
1910 + case OP_MAIN_CHANGE_GROUP:
1911 + case OP_MAIN_CHANGE_GROUP_READONLY:
1912 + unset_option (OPTNEWS);
1914 + if (attach_msg || option (OPTREADONLY) ||
1916 + op == OP_MAIN_CHANGE_GROUP_READONLY ||
1918 + op == OP_MAIN_CHANGE_FOLDER_READONLY)
1919 + flags = M_READONLY;
1923 - if ((op == OP_MAIN_CHANGE_FOLDER_READONLY) || option (OPTREADONLY))
1925 cp = _("Open mailbox in read-only mode");
1927 cp = _("Open mailbox");
1928 @@ -1115,6 +1285,21 @@
1933 + if (op == OP_MAIN_CHANGE_GROUP ||
1934 + op == OP_MAIN_CHANGE_GROUP_READONLY)
1936 + set_option (OPTNEWS);
1937 + if (!(CurrentNewsSrv = mutt_select_newsserver (NewsServer)))
1940 + cp = _("Open newsgroup in read-only mode");
1942 + cp = _("Open newsgroup");
1947 mutt_buffy (buf, sizeof (buf));
1949 if ( op == OP_SIDEBAR_OPEN ) {
1950 @@ -1138,6 +1323,14 @@
1955 + if (option (OPTNEWS))
1957 + unset_option (OPTNEWS);
1958 + nntp_expand_path (buf, sizeof (buf), &CurrentNewsSrv->conn->account);
1962 mutt_expand_path (buf, sizeof (buf));
1964 if (mx_get_magic (buf) <= 0)
1965 @@ -1181,15 +1374,18 @@
1966 CurrentMenu = MENU_MAIN;
1967 mutt_folder_hook (buf);
1969 - if ((Context = mx_open_mailbox (buf,
1970 - (option (OPTREADONLY) || op == OP_MAIN_CHANGE_FOLDER_READONLY) ?
1971 - M_READONLY : 0, NULL)) != NULL)
1972 + if ((Context = mx_open_mailbox (buf, flags, NULL)) != NULL)
1974 menu->current = ci_first_message ();
1980 + /* mutt_buffy_check() must be done with mail-reader mode! */
1981 + menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MAIN,
1982 + (Context && (Context->magic == M_NNTP)) ? IndexNewsHelp : IndexHelp);
1984 mutt_clear_error ();
1985 mutt_buffy_check(1); /* force the buffy check after we have changed
1987 @@ -1560,6 +1756,15 @@
1989 CHECK_ACL(M_ACL_WRITE, _("flag message"));
1992 + if (Context->magic == M_NNTP)
1995 + mutt_error _("Can't change 'important' flag on NNTP server.");
2002 for (j = 0; j < Context->vcount; j++)
2003 @@ -1911,6 +2116,17 @@
2009 + if (Context && Context->magic == M_NNTP)
2011 + if (mutt_newsgroup_catchup (CurrentNewsSrv,
2012 + ((NNTP_DATA *)Context->data)->group))
2013 + menu->redraw = REDRAW_INDEX | REDRAW_STATUS;
2018 case OP_DISPLAY_ADDRESS:
2021 @@ -2038,6 +2254,15 @@
2022 menu->redraw = (tag ? REDRAW_INDEX : REDRAW_CURRENT) | REDRAW_STATUS;
2027 + if (Context->magic == M_NNTP)
2030 + mutt_error _("Can't edit message on newsserver.");
2035 MAYBE_REDRAW (menu->redraw);
2037 @@ -2110,6 +2335,41 @@
2038 menu->redraw = REDRAW_FULL;
2043 + case OP_FORWARD_TO_GROUP:
2051 + if (op != OP_FOLLOWUP || !CURHDR->env->followup_to ||
2052 + mutt_strcasecmp (CURHDR->env->followup_to, "poster") ||
2053 + query_quadoption (OPT_FOLLOWUPTOPOSTER,_("Reply by mail as poster prefers?")) != M_YES)
2055 + if (Context && Context->magic == M_NNTP &&
2056 + !((NNTP_DATA *)Context->data)->allowed &&
2057 + query_quadoption (OPT_TOMODERATED, _("Posting to this group not allowed, may be moderated. Continue?")) != M_YES)
2059 + if (op == OP_POST)
2060 + ci_send_message (SENDNEWS, NULL, NULL, Context, NULL);
2064 + if (op == OP_FOLLOWUP)
2065 + ci_send_message (SENDNEWS|SENDREPLY, NULL, NULL, Context,
2066 + tag ? NULL : CURHDR);
2068 + ci_send_message (SENDNEWS|SENDFORWARD, NULL, NULL, Context,
2069 + tag ? NULL : CURHDR);
2071 + menu->redraw = REDRAW_FULL;
2079 @@ -2187,6 +2447,12 @@
2081 CHECK_ACL(M_ACL_DELETE, _("undelete message(s)"));
2084 + /* Close all open NNTP connections */
2086 + nntp_logout_all ();
2089 rc = mutt_thread_set_flag (CURHDR, M_DELETE, 0,
2090 op == OP_UNDELETE_THREAD ? 0 : 1)
2091 + mutt_thread_set_flag (CURHDR, M_PURGED, 0,
2092 Index: mutt-1.5.20/doc/manual.xml.head
2093 ===================================================================
2094 --- mutt-1.5.20.orig/doc/manual.xml.head 2009-10-13 22:47:21.749524051 -0300
2095 +++ mutt-1.5.20/doc/manual.xml.head 2009-10-13 22:56:13.258524515 -0300
2096 @@ -1568,6 +1568,22 @@
2101 +<title>Reading news via NNTP</title>
2104 +If compiled with <emphasis>--enable-nntp</emphasis> option, Mutt can
2105 +read news from newsserver via NNTP. You can open a newsgroup with
2106 +function ``change-newsgroup'' (default: ``i''). Default newsserver
2107 +can be obtained from <emphasis>NNTPSERVER</emphasis> environment
2108 +variable. Like other news readers, info about subscribed newsgroups
2109 +is saved in file by <link linkend="newsrc">$newsrc</link>
2110 +variable. Article headers are cached and can be loaded from file when
2111 +newsgroup entered instead loading from newsserver.
2118 <sect1 id="forwarding-mail">
2119 Index: mutt-1.5.20/doc/mutt.man
2120 ===================================================================
2121 --- mutt-1.5.20.orig/doc/mutt.man 2009-10-13 22:47:23.143522859 -0300
2122 +++ mutt-1.5.20/doc/mutt.man 2009-10-13 22:56:13.282515076 -0300
2128 -[\-e \fIcmd\fP] [\-F \fIfile\fP] [\-m \fItype\fP] [\-f \fIfile\fP]
2130 ++ [\-e \fIcmd\fP] [\-F \fIfile\fP] [\-g \fIserver\fP] [\-m \fItype\fP] [\-f \fIfile\fP]
2134 @@ -101,6 +101,10 @@
2135 Specify which mailbox to load.
2136 .IP "-F \fImuttrc\fP"
2137 Specify an initialization file to read instead of ~/.muttrc
2138 +.IP "-g \fIserver\fP"
2139 +Start Mutt with a listing of subscribed newsgroups at specified newsserver.
2141 +Start Mutt with a listing of subscribed newsgroups.
2144 .IP "-H \fIdraft\fP"
2145 Index: mutt-1.5.20/functions.h
2146 ===================================================================
2147 --- mutt-1.5.20.orig/functions.h 2009-10-13 22:47:23.417527302 -0300
2148 +++ mutt-1.5.20/functions.h 2009-10-13 22:56:13.307603019 -0300
2150 { "break-thread", OP_MAIN_BREAK_THREAD, "#" },
2151 { "change-folder", OP_MAIN_CHANGE_FOLDER, "c" },
2152 { "change-folder-readonly", OP_MAIN_CHANGE_FOLDER_READONLY, "\033c" },
2154 + { "change-newsgroup", OP_MAIN_CHANGE_GROUP, "i" },
2155 + { "change-newsgroup-readonly",OP_MAIN_CHANGE_GROUP_READONLY, "\033i" },
2157 { "next-unread-mailbox", OP_MAIN_NEXT_UNREAD_MAILBOX, NULL },
2158 { "collapse-thread", OP_MAIN_COLLAPSE_THREAD, "\033v" },
2159 { "collapse-all", OP_MAIN_COLLAPSE_ALL, "\033V" },
2160 @@ -101,7 +105,15 @@
2161 { "edit", OP_EDIT_MESSAGE, "e" },
2162 { "edit-type", OP_EDIT_TYPE, "\005" },
2163 { "forward-message", OP_FORWARD_MESSAGE, "f" },
2164 - { "flag-message", OP_FLAG_MESSAGE, "F" },
2166 + { "forward-to-group", OP_FORWARD_TO_GROUP, "\033F" },
2167 + { "followup-message", OP_FOLLOWUP, "F" },
2168 + { "get-children", OP_GET_CHILDREN, NULL },
2169 + { "get-message", OP_GET_MESSAGE, "\007" },
2170 + { "get-parent", OP_GET_PARENT, "\033G" },
2171 + { "reconstruct-thread", OP_RECONSTRUCT_THREAD, NULL },
2173 + { "flag-message", OP_FLAG_MESSAGE, "\033f" },
2174 { "group-reply", OP_GROUP_REPLY, "g" },
2176 { "fetch-mail", OP_MAIN_FETCH_MAIL, "G" },
2178 { "sort-mailbox", OP_SORT, "o" },
2179 { "sort-reverse", OP_SORT_REVERSE, "O" },
2180 { "print-message", OP_PRINT, "p" },
2182 + { "post-message", OP_POST, "P" },
2184 { "previous-thread", OP_MAIN_PREV_THREAD, "\020" },
2185 { "previous-subthread", OP_MAIN_PREV_SUBTHREAD, "\033p" },
2186 { "recall-message", OP_RECALL_MESSAGE, "R" },
2187 @@ -147,6 +162,10 @@
2188 { "show-version", OP_VERSION, "V" },
2189 { "set-flag", OP_MAIN_SET_FLAG, "w" },
2190 { "clear-flag", OP_MAIN_CLEAR_FLAG, "W" },
2191 + { "toggle-read", OP_TOGGLE_READ, "X" },
2193 + { "catchup", OP_CATCHUP, "y" },
2195 { "display-message", OP_DISPLAY_MESSAGE, M_ENTER_S },
2196 { "buffy-list", OP_BUFFY_LIST, "." },
2197 { "sync-mailbox", OP_MAIN_SYNC_FOLDER, "$" },
2199 { "previous-new-then-unread", OP_MAIN_PREV_NEW_THEN_UNREAD, "\033\t" },
2200 { "next-unread", OP_MAIN_NEXT_UNREAD, NULL },
2201 { "previous-unread", OP_MAIN_PREV_UNREAD, NULL },
2202 - { "parent-message", OP_MAIN_PARENT_MESSAGE, "P" },
2203 + { "parent-message", OP_MAIN_PARENT_MESSAGE, NULL },
2206 { "extract-keys", OP_EXTRACT_KEYS, "\013" },
2207 @@ -183,6 +202,10 @@
2208 { "bounce-message", OP_BOUNCE_MESSAGE, "b" },
2209 { "change-folder", OP_MAIN_CHANGE_FOLDER, "c" },
2210 { "change-folder-readonly", OP_MAIN_CHANGE_FOLDER_READONLY, "\033c" },
2212 + { "change-newsgroup", OP_MAIN_CHANGE_GROUP, "i" },
2213 + { "change-newsgroup-readonly",OP_MAIN_CHANGE_GROUP_READONLY, "\033i" },
2215 { "next-unread-mailbox", OP_MAIN_NEXT_UNREAD_MAILBOX, NULL },
2216 { "copy-message", OP_COPY_MESSAGE, "C" },
2217 { "decode-copy", OP_DECODE_COPY, "\033C" },
2218 @@ -193,8 +216,12 @@
2219 { "clear-flag", OP_MAIN_CLEAR_FLAG, "W" },
2220 { "edit", OP_EDIT_MESSAGE, "e" },
2221 { "edit-type", OP_EDIT_TYPE, "\005" },
2223 + { "followup-message", OP_FOLLOWUP, "F" },
2224 + { "forward-to-group", OP_FORWARD_TO_GROUP, "\033F" },
2226 { "forward-message", OP_FORWARD_MESSAGE, "f" },
2227 - { "flag-message", OP_FLAG_MESSAGE, "F" },
2228 + { "flag-message", OP_FLAG_MESSAGE, "\033f" },
2229 { "group-reply", OP_GROUP_REPLY, "g" },
2231 { "imap-fetch-mail", OP_MAIN_IMAP_FETCH, NULL },
2233 { "next-thread", OP_MAIN_NEXT_THREAD, "\016" },
2234 { "next-subthread", OP_MAIN_NEXT_SUBTHREAD, "\033n" },
2235 { "print-message", OP_PRINT, "p" },
2237 + { "post-message", OP_POST, "P" },
2239 { "previous-thread", OP_MAIN_PREV_THREAD, "\020" },
2240 { "previous-subthread",OP_MAIN_PREV_SUBTHREAD, "\033p" },
2241 { "purge-message", OP_PURGE_MESSAGE, NULL },
2243 { "half-down", OP_HALF_DOWN, NULL },
2244 { "previous-line", OP_PREV_LINE, NULL },
2245 { "bottom", OP_PAGER_BOTTOM, NULL },
2246 - { "parent-message", OP_MAIN_PARENT_MESSAGE, "P" },
2247 + { "parent-message", OP_MAIN_PARENT_MESSAGE, NULL },
2251 @@ -287,6 +317,10 @@
2252 { "bounce-message", OP_BOUNCE_MESSAGE, "b" },
2253 { "display-toggle-weed", OP_DISPLAY_HEADERS, "h" },
2254 { "edit-type", OP_EDIT_TYPE, "\005" },
2256 + { "followup-message", OP_FOLLOWUP, "F" },
2257 + { "forward-to-group", OP_FORWARD_TO_GROUP, "\033F" },
2259 { "print-entry", OP_PRINT, "p" },
2260 { "save-entry", OP_SAVE, "s" },
2261 { "pipe-entry", OP_PIPE, "|" },
2263 struct binding_t OpCompose[] = { /* map: compose */
2264 { "attach-file", OP_COMPOSE_ATTACH_FILE, "a" },
2265 { "attach-message", OP_COMPOSE_ATTACH_MESSAGE, "A" },
2266 + { "attach-news-message",OP_COMPOSE_ATTACH_NEWS_MESSAGE,"\033a" },
2267 { "edit-bcc", OP_COMPOSE_EDIT_BCC, "b" },
2268 { "edit-cc", OP_COMPOSE_EDIT_CC, "c" },
2269 { "copy-file", OP_SAVE, "C" },
2270 @@ -331,6 +366,11 @@
2271 { "print-entry", OP_PRINT, "l" },
2272 { "edit-mime", OP_COMPOSE_EDIT_MIME, "m" },
2273 { "new-mime", OP_COMPOSE_NEW_MIME, "n" },
2275 + { "edit-newsgroups", OP_COMPOSE_EDIT_NEWSGROUPS, "N" },
2276 + { "edit-followup-to", OP_COMPOSE_EDIT_FOLLOWUP_TO, "o" },
2277 + { "edit-x-comment-to",OP_COMPOSE_EDIT_X_COMMENT_TO, "x" },
2279 { "postpone-message", OP_COMPOSE_POSTPONE_MESSAGE, "P" },
2280 { "edit-reply-to", OP_COMPOSE_EDIT_REPLY_TO, "r" },
2281 { "rename-file", OP_COMPOSE_RENAME_FILE, "R" },
2282 @@ -382,14 +422,25 @@
2283 { "select-new", OP_BROWSER_NEW_FILE, "N" },
2284 { "check-new", OP_CHECK_NEW, NULL },
2285 { "toggle-mailboxes", OP_TOGGLE_MAILBOXES, "\t" },
2287 + { "reload-active", OP_LOAD_ACTIVE, "g" },
2288 + { "subscribe-pattern", OP_SUBSCRIBE_PATTERN, "S" },
2289 + { "unsubscribe-pattern", OP_UNSUBSCRIBE_PATTERN, "U" },
2290 + { "catchup", OP_CATCHUP, "y" },
2291 + { "uncatchup", OP_UNCATCHUP, "Y" },
2293 { "view-file", OP_BROWSER_VIEW_FILE, " " },
2294 { "buffy-list", OP_BUFFY_LIST, "." },
2296 { "create-mailbox", OP_CREATE_MAILBOX, "C" },
2297 { "delete-mailbox", OP_DELETE_MAILBOX, "d" },
2298 { "rename-mailbox", OP_RENAME_MAILBOX, "r" },
2300 +#if defined USE_IMAP || defined USE_NNTP
2301 { "subscribe", OP_BROWSER_SUBSCRIBE, "s" },
2302 { "unsubscribe", OP_BROWSER_UNSUBSCRIBE, "u" },
2305 { "toggle-subscribed", OP_BROWSER_TOGGLE_LSUB, "T" },
2308 Index: mutt-1.5.20/globals.h
2309 ===================================================================
2310 --- mutt-1.5.20.orig/globals.h 2009-10-13 22:47:23.442838056 -0300
2311 +++ mutt-1.5.20/globals.h 2009-10-13 22:56:13.332768602 -0300
2315 WHERE char *Muttrc INITVAL (NULL);
2317 +WHERE char *NewsCacheDir;
2318 +WHERE char *GroupFormat;
2320 +WHERE char *NewsServer;
2321 +WHERE char *NntpUser;
2322 +WHERE char *NntpPass;
2323 +WHERE char *NewsRc;
2327 WHERE char *PagerFmt;
2328 @@ -192,6 +201,11 @@
2330 WHERE unsigned short Counter INITVAL (0);
2333 +WHERE short NewsPollTimeout;
2334 +WHERE short NntpContext;
2337 WHERE short ConnectTimeout;
2338 WHERE short HistSize;
2339 WHERE short MenuContext;
2340 Index: mutt-1.5.20/hash.c
2341 ===================================================================
2342 --- mutt-1.5.20.orig/hash.c 2009-03-31 03:52:43.000000000 -0300
2343 +++ mutt-1.5.20/hash.c 2009-10-13 22:56:13.367520878 -0300
2347 table->nelem = nelem;
2348 + table->curnelem = 0;
2349 table->table = safe_calloc (nelem, sizeof (struct hash_elem *));
2356 +HASH *hash_resize (HASH *ptr, int nelem, int lower)
2359 + struct hash_elem *elem, *tmp;
2362 + table = hash_create (nelem, lower);
2364 + for (i = 0; i < ptr->nelem; i++)
2366 + for (elem = ptr->table[i]; elem; )
2369 + elem = elem->next;
2370 + hash_insert (table, tmp->key, tmp->data, 1);
2374 + FREE (&ptr->table);
2379 /* table hash table to update
2380 * key key to hash on
2381 * data data to associate with `key'
2384 ptr->next = table->table[h];
2385 table->table[h] = ptr;
2386 + table->curnelem++;
2392 table->table[h] = ptr;
2394 + table->curnelem++;
2400 destroy (ptr->data);
2402 + table->curnelem--;
2406 Index: mutt-1.5.20/hash.h
2407 ===================================================================
2408 --- mutt-1.5.20.orig/hash.h 2009-03-31 03:52:43.000000000 -0300
2409 +++ mutt-1.5.20/hash.h 2009-10-13 22:56:13.391514411 -0300
2415 + int nelem, curnelem;
2416 struct hash_elem **table;
2417 unsigned int (*hash_string)(const unsigned char *, unsigned int);
2418 int (*cmp_string)(const char *, const char *);
2421 HASH *hash_create (int nelem, int lower);
2422 int hash_insert (HASH * table, const char *key, void *data, int allow_dup);
2423 +HASH *hash_resize (HASH * table, int nelem, int lower);
2424 void *hash_find_hash (const HASH * table, int hash, const char *key);
2425 void hash_delete_hash (HASH * table, int hash, const char *key, const void *data,
2426 void (*destroy) (void *));
2427 Index: mutt-1.5.20/hdrline.c
2428 ===================================================================
2429 --- mutt-1.5.20.orig/hdrline.c 2009-04-13 13:24:55.000000000 -0300
2430 +++ mutt-1.5.20/hdrline.c 2009-10-13 22:56:13.416618600 -0300
2432 * %E = number of messages in current thread
2433 * %f = entire from line
2434 * %F = like %n, unless from self
2435 + * %g = newsgroup name (if compiled with nntp support)
2437 * %l = number of lines in the message
2438 * %L = like %F, except `lists' are displayed first
2439 @@ -219,12 +220,14 @@
2441 * %O = like %L, except using address instead of name
2442 * %P = progress indicator for builtin pager
2443 + * %R = `x-comment-to:' field (if present and compiled with nntp support)
2445 * %S = short message status (e.g., N/O/D/!/r/-)
2446 * %t = `to:' field (recipients)
2448 * %u = user (login) name of author
2449 * %v = first name of author, unless from self
2450 + * %W = where user is (organization)
2451 * %X = number of MIME attachments
2452 * %y = `x-label:' field (if present)
2453 * %Y = `x-label:' field (if present, tree unfolded, and != parent's x-label)
2454 @@ -457,6 +460,12 @@
2460 + mutt_format_s (dest, destlen, prefix, hdr->env->newsgroups ? hdr->env->newsgroups : "");
2465 mutt_format_s (dest, destlen, prefix, hdr->env->message_id ? hdr->env->message_id : "<no.id>");
2467 @@ -548,6 +557,15 @@
2468 strfcpy(dest, NONULL(hfi->pager_progress), destlen);
2474 + mutt_format_s (dest, destlen, prefix, hdr->env->x_comment_to ? hdr->env->x_comment_to : "");
2475 + else if (!hdr->env->x_comment_to)
2482 if (flags & M_FORMAT_TREE && !hdr->collapsed)
2483 @@ -637,6 +655,13 @@
2484 mutt_format_s (dest, destlen, prefix, buf2);
2489 + mutt_format_s (dest, destlen, prefix, hdr->env->organization ? hdr->env->organization : "");
2490 + else if (!hdr->env->organization)
2497 Index: mutt-1.5.20/headers.c
2498 ===================================================================
2499 --- mutt-1.5.20.orig/headers.c 2009-04-30 02:36:17.000000000 -0300
2500 +++ mutt-1.5.20/headers.c 2009-10-13 22:56:13.450521021 -0300
2502 $edit_headers set, we remove References: as they're likely invalid;
2503 we can simply compare strings as we don't generate References for
2504 multiple Message-Ids in IRT anyways */
2506 + if (!option (OPTNEWSSEND))
2508 if (!n->in_reply_to || (msg->env->in_reply_to &&
2509 mutt_strcmp (n->in_reply_to->data,
2510 msg->env->in_reply_to->data) != 0))
2511 Index: mutt-1.5.20/init.c
2512 ===================================================================
2513 --- mutt-1.5.20.orig/init.c 2009-10-13 22:47:22.768524719 -0300
2514 +++ mutt-1.5.20/init.c 2009-10-13 22:56:13.455522384 -0300
2515 @@ -3089,6 +3089,28 @@
2517 Fqdn = safe_strdup(NONULL(Hostname));
2524 + if ((f = safe_fopen (SYSCONFDIR "/nntpserver", "r")))
2527 + fgets (buffer, sizeof (buffer), f);
2531 + while (*i && (*i != ' ') && (*i != '\t') && (*i != '\r') && (*i != '\n')) i++;
2533 + NewsServer = safe_strdup (p);
2537 + if ((p = getenv ("NNTPSERVER")))
2538 + NewsServer = safe_strdup (p);
2541 if ((p = getenv ("MAIL")))
2542 Spoolfile = safe_strdup (p);
2543 else if ((p = getenv ("MAILDIR")))
2544 Index: mutt-1.5.20/init.h
2545 ===================================================================
2546 --- mutt-1.5.20.orig/init.h 2009-10-13 22:47:24.022524691 -0300
2547 +++ mutt-1.5.20/init.h 2009-10-13 22:56:13.484539359 -0300
2548 @@ -176,6 +176,20 @@
2549 ** If \fIset\fP, Mutt will prompt you for carbon-copy (Cc) recipients before
2550 ** editing the body of an outgoing message.
2553 + { "ask_follow_up", DT_BOOL, R_NONE, OPTASKFOLLOWUP, 0 },
2556 + ** If set, Mutt will prompt you for follow-up groups before editing
2557 + ** the body of an outgoing message.
2559 + { "ask_x_comment_to", DT_BOOL, R_NONE, OPTASKXCOMMENTTO, 0 },
2562 + ** If set, Mutt will prompt you for x-comment-to field before editing
2563 + ** the body of an outgoing message.
2566 { "assumed_charset", DT_STR, R_NONE, UL &AssumedCharset, UL 0},
2569 @@ -328,6 +342,14 @@
2570 ** follow these menus. The option is \fIunset\fP by default because many
2571 ** visual terminals don't permit making the cursor invisible.
2574 + { "catchup_newsgroup", DT_QUAD, R_NONE, OPT_CATCHUP, M_ASKYES },
2577 + ** If this variable is \fIset\fP, Mutt will mark all articles in newsgroup
2578 + ** as read when you quit the newsgroup (catchup newsgroup).
2581 #if defined(USE_SSL)
2582 { "certificate_file", DT_PATH, R_NONE, UL &SslCertFile, UL "~/.mutt_certificates" },
2584 @@ -803,6 +825,16 @@
2585 ** sent to both the list and your address, resulting in two copies
2586 ** of the same email for you.
2589 + { "followup_to_poster", DT_QUAD, R_NONE, OPT_FOLLOWUPTOPOSTER, M_ASKYES },
2592 + ** If this variable is \fIset\fP and the keyword "poster" is present in
2593 + ** \fIFollowup-To\fP header, follow-up to newsgroup function is not
2594 + ** permitted. The message will be mailed to the submitter of the
2595 + ** message via mail.
2598 { "force_name", DT_BOOL, R_NONE, OPTFORCENAME, 0 },
2601 @@ -885,6 +917,27 @@
2602 ** a regular expression that will match the whole name so mutt will expand
2603 ** ``Franklin'' to ``Franklin, Steve''.
2606 + { "group_index_format", DT_STR, R_BOTH, UL &GroupFormat, UL "%4C %M%N %5s %-45.45f %d" },
2609 + ** This variable allows you to customize the newsgroup browser display to
2610 + ** your personal taste. This string is similar to ``$index_format'', but
2611 + ** has its own set of printf()-like sequences:
2614 + ** %C current newsgroup number
2615 + ** %d description of newsgroup (becomes from server)
2616 + ** %f newsgroup name
2617 + ** %M - if newsgroup not allowed for direct post (moderated for example)
2618 + ** %N N if newsgroup is new, u if unsubscribed, blank otherwise
2619 + ** %n number of new articles in newsgroup
2620 + ** %s number of unread articles in newsgroup
2621 + ** %>X right justify the rest of the string and pad with character "X"
2622 + ** %|X pad to the end of the line with character "X"
2626 { "hdr_format", DT_SYN, R_NONE, UL "index_format", 0 },
2629 @@ -1264,6 +1317,7 @@
2630 ** .dt %E .dd number of messages in current thread
2631 ** .dt %f .dd sender (address + real name), either From: or Return-Path:
2632 ** .dt %F .dd author name, or recipient name if the message is from you
2633 + ** .dt %g .dd newsgroup name (if compiled with nntp support)
2634 ** .dt %H .dd spam attribute(s) of this message
2635 ** .dt %i .dd message-id of the current message
2636 ** .dt %l .dd number of lines in the message (does not work with maildir,
2637 @@ -1279,12 +1333,14 @@
2638 ** stashed the message: list name or recipient name
2639 ** if not sent to a list
2640 ** .dt %P .dd progress indicator for the builtin pager (how much of the file has been displayed)
2641 + ** .dt %R .dd `x-comment-to:' field (if present and compiled with nntp support)
2642 ** .dt %s .dd subject of the message
2643 ** .dt %S .dd status of the message (``N''/``D''/``d''/``!''/``r''/\(as)
2644 ** .dt %t .dd ``To:'' field (recipients)
2645 ** .dt %T .dd the appropriate character from the $$to_chars string
2646 ** .dt %u .dd user (login) name of the author
2647 ** .dt %v .dd first name of the author, or the recipient if the message is from you
2648 + ** .dt %W .dd name of organization of author (`organization:' field)
2649 ** .dt %X .dd number of attachments
2650 ** (please see the ``$attachments'' section for possible speed effects)
2651 ** .dt %y .dd ``X-Label:'' field, if present
2652 @@ -1319,6 +1375,21 @@
2653 ** Note that these expandos are supported in
2654 ** ``$save-hook'', ``$fcc-hook'' and ``$fcc-save-hook'', too.
2657 + { "inews", DT_PATH, R_NONE, UL &Inews, UL "" },
2660 + ** If set, specifies the program and arguments used to deliver news posted
2661 + ** by Mutt. Otherwise, mutt posts article using current connection to
2662 + ** news server. The following printf-style sequence is understood:
2665 + ** %s newsserver name
2668 + ** Example: set inews="/usr/local/bin/inews -hS"
2671 { "ispell", DT_PATH, R_NONE, UL &Ispell, UL ISPELL },
2674 @@ -1542,6 +1613,15 @@
2675 ** menu, attachments which cannot be decoded in a reasonable manner will
2676 ** be attached to the newly composed message if this option is \fIset\fP.
2679 + { "mime_subject", DT_BOOL, R_NONE, OPTMIMESUBJECT, 1 },
2682 + ** If \fIunset\fP, 8-bit ``subject:'' line in article header will not be
2683 + ** encoded according to RFC2047 to base64. This is useful when message
2684 + ** is Usenet article, because MIME for news is nonstandard feature.
2688 { "mix_entry_format", DT_STR, R_NONE, UL &MixEntryFormat, UL "%4n %c %-16s %a" },
2690 @@ -1592,6 +1672,77 @@
2691 ** See also $$read_inc, $$write_inc and $$net_inc.
2695 + { "news_cache_dir", DT_PATH, R_NONE, UL &NewsCacheDir, UL "~/.mutt" },
2698 + ** This variable pointing to directory where Mutt will save cached news
2699 + ** articles headers in. If \fIunset\fP, headers will not be saved at all
2700 + ** and will be reloaded each time when you enter to newsgroup.
2702 + { "news_server", DT_STR, R_NONE, UL &NewsServer, 0 },
2705 + ** This variable specifies domain name or address of NNTP server. It
2706 + ** defaults to the newsserver specified in the environment variable
2707 + ** $$$NNTPSERVER or contained in the file /etc/nntpserver. You can also
2708 + ** specify username and an alternative port for each newsserver, ie:
2710 + ** [news[s]://][username[:password]@]newsserver[:port]
2712 + { "newsrc", DT_PATH, R_NONE, UL &NewsRc, UL "~/.newsrc" },
2715 + ** The file, containing info about subscribed newsgroups - names and
2716 + ** indexes of read articles. The following printf-style sequence
2720 + ** %s newsserver name
2723 + { "nntp_context", DT_NUM, R_NONE, UL &NntpContext, 1000 },
2726 + ** This variable defines number of articles which will be in index when
2727 + ** newsgroup entered. If active newsgroup have more articles than this
2728 + ** number, oldest articles will be ignored. Also controls how many
2729 + ** articles headers will be saved in cache when you quit newsgroup.
2731 + { "nntp_load_description", DT_BOOL, R_NONE, OPTLOADDESC, 1 },
2734 + ** This variable controls whether or not descriptions for each newsgroup
2735 + ** must be loaded when newsgroup is added to list (first time list
2736 + ** loading or new newsgroup adding).
2738 + { "nntp_user", DT_STR, R_NONE, UL &NntpUser, UL "" },
2741 + ** Your login name on the NNTP server. If \fIunset\fP and NNTP server requires
2742 + ** authentification, Mutt will prompt you for your account name when you
2743 + ** connect to newsserver.
2745 + { "nntp_pass", DT_STR, R_NONE, UL &NntpPass, UL "" },
2748 + ** Your password for NNTP account.
2750 + { "nntp_poll", DT_NUM, R_NONE, UL &NewsPollTimeout, 60 },
2753 + ** The time in seconds until any operations on newsgroup except post new
2754 + ** article will cause recheck for new news. If set to 0, Mutt will
2755 + ** recheck newsgroup on each operation in index (stepping, read article,
2758 + { "nntp_reconnect", DT_QUAD, R_NONE, OPT_NNTPRECONNECT, M_ASKYES },
2761 + ** Controls whether or not Mutt will try to reconnect to newsserver when
2762 + ** connection lost.
2765 { "pager", DT_PATH, R_NONE, UL &Pager, UL "builtin" },
2768 @@ -2117,6 +2268,16 @@
2769 { "post_indent_str", DT_SYN, R_NONE, UL "post_indent_string", 0 },
2773 + { "post_moderated", DT_QUAD, R_NONE, OPT_TOMODERATED, M_ASKYES },
2776 + ** If set to \fIyes\fP, Mutt will post article to newsgroup that have
2777 + ** not permissions to posting (e.g. moderated). \fBNote:\fP if newsserver
2778 + ** does not support posting to that newsgroup or totally read-only, that
2779 + ** posting will not have an effect.
2782 { "postpone", DT_QUAD, R_NONE, OPT_POSTPONE, M_ASKYES },
2785 @@ -2517,6 +2678,28 @@
2786 ** Command to use when spawning a subshell. By default, the user's login
2787 ** shell from \fC/etc/passwd\fP is used.
2790 + { "save_unsubscribed",DT_BOOL, R_NONE, OPTSAVEUNSUB, 0 },
2793 + ** When \fIset\fP, info about unsubscribed newsgroups will be saved into
2794 + ** ``newsrc'' file and into cache.
2796 + { "show_new_news", DT_BOOL, R_NONE, OPTSHOWNEWNEWS, 1 },
2799 + ** If \fIset\fP, newsserver will be asked for new newsgroups on entering
2800 + ** the browser. Otherwise, it will be done only once for a newsserver.
2801 + ** Also controls whether or not number of new articles of subscribed
2802 + ** newsgroups will be then checked.
2804 + { "show_only_unread", DT_BOOL, R_NONE, OPTSHOWONLYUNREAD, 0 },
2807 + ** If \fIset\fP, only subscribed newsgroups that contain unread articles
2808 + ** will be displayed in browser.
2811 { "sig_dashes", DT_BOOL, R_NONE, OPTSIGDASHES, 1 },
2814 @@ -3431,6 +3614,14 @@
2815 ** xterm_set_titles has been set. This string is identical in formatting
2816 ** to the one used by ``$$status_format''.
2819 + { "x_comment_to", DT_BOOL, R_NONE, OPTXCOMMENTTO, 0 },
2822 + ** If \fIset\fP, Mutt will add ``X-Comment-To:'' field (that contains full
2823 + ** name of original article author) to article that followuped to newsgroup.
2827 { NULL, 0, 0, 0, 0 }
2829 Index: mutt-1.5.20/keymap.c
2830 ===================================================================
2831 --- mutt-1.5.20.orig/keymap.c 2008-11-29 19:09:10.000000000 -0200
2832 +++ mutt-1.5.20/keymap.c 2009-10-13 22:56:13.487522722 -0300
2834 km_bindkey ("<enter>", MENU_MAIN, OP_DISPLAY_MESSAGE);
2836 km_bindkey ("x", MENU_PAGER, OP_EXIT);
2837 - km_bindkey ("i", MENU_PAGER, OP_EXIT);
2838 km_bindkey ("<backspace>", MENU_PAGER, OP_PREV_LINE);
2839 km_bindkey ("<pagedown>", MENU_PAGER, OP_NEXT_PAGE);
2840 km_bindkey ("<pageup>", MENU_PAGER, OP_PREV_PAGE);
2841 Index: mutt-1.5.20/mailbox.h
2842 ===================================================================
2843 --- mutt-1.5.20.orig/mailbox.h 2009-10-13 22:47:23.501550132 -0300
2844 +++ mutt-1.5.20/mailbox.h 2009-10-13 22:56:13.559516904 -0300
2847 int mx_is_pop (const char *);
2850 +int mx_is_nntp (const char *);
2853 int mx_access (const char*, int);
2854 int mx_check_empty (const char *);
2855 Index: mutt-1.5.20/main.c
2856 ===================================================================
2857 --- mutt-1.5.20.orig/main.c 2009-10-13 22:47:21.895521324 -0300
2858 +++ mutt-1.5.20/main.c 2009-10-13 22:56:13.576515194 -0300
2860 #include <stringprep.h>
2867 static const char *ReachingUs = N_("\
2868 To contact the developers, please mail to <mutt-dev@mutt.org>.\n\
2869 To report a bug, please visit http://bugs.mutt.org/.\n");
2871 " -e <command>\tspecify a command to be executed after initialization\n\
2872 -f <file>\tspecify which mailbox to read\n\
2873 -F <file>\tspecify an alternate muttrc file\n\
2874 + -g <server>\tspecify a newsserver (if compiled with NNTP)\n\
2875 + -G\t\tselect a newsgroup (if compiled with NNTP)\n\
2876 -H <file>\tspecify a draft file to read header and body from\n\
2877 -i <file>\tspecify a file which Mutt should include in the body\n\
2878 -m <type>\tspecify a default mailbox type\n\
2879 @@ -255,6 +261,12 @@
2893 #define M_NOSYSRC (1<<2) /* -n */
2894 #define M_RO (1<<3) /* -R */
2895 #define M_SELECT (1<<4) /* -y */
2897 +#define M_NEWS (1<<5) /* -g and -G */
2900 int main (int argc, char **argv)
2902 @@ -600,7 +615,11 @@
2903 argv[nargc++] = argv[optind];
2907 + if ((i = getopt (argc, argv, "+A:a:b:F:f:c:Dd:e:g:GH:s:i:hm:npQ:RvxyzZ")) != EOF)
2909 if ((i = getopt (argc, argv, "+A:a:b:F:f:c:Dd:e:H:s:i:hm:npQ:RvxyzZ")) != EOF)
2914 @@ -697,6 +716,20 @@
2919 + case 'g': /* Specify a newsserver */
2921 + char buf[LONG_STRING];
2923 + snprintf (buf, sizeof (buf), "set news_server=%s", optarg);
2924 + commands = mutt_add_list (commands, buf);
2927 + case 'G': /* List of newsgroups */
2928 + flags |= M_SELECT | M_NEWS;
2935 @@ -984,6 +1017,18 @@
2937 else if (flags & M_SELECT)
2940 + if (flags & M_NEWS)
2942 + set_option (OPTNEWS);
2943 + if(!(CurrentNewsSrv = mutt_select_newsserver (NewsServer)))
2945 + mutt_endwin (Errorbuf);
2952 mutt_endwin _("No incoming mailboxes defined.");
2954 @@ -999,6 +1044,15 @@
2957 strfcpy (folder, NONULL(Spoolfile), sizeof (folder));
2960 + if (option (OPTNEWS))
2962 + unset_option (OPTNEWS);
2963 + nntp_expand_path (folder, sizeof (folder), &CurrentNewsSrv->conn->account);
2967 mutt_expand_path (folder, sizeof (folder));
2969 mutt_str_replace (&CurrentFolder, folder);
2970 Index: mutt-1.5.20/mutt.h
2971 ===================================================================
2972 --- mutt-1.5.20.orig/mutt.h 2009-10-13 22:47:24.038524359 -0300
2973 +++ mutt-1.5.20/mutt.h 2009-10-13 22:56:13.610521274 -0300
2982 /* Options for Mailcap lookup */
2984 @@ -292,6 +295,12 @@
2987 OPT_VERIFYSIG, /* verify PGP signatures */
2990 + OPT_NNTPRECONNECT,
2992 + OPT_FOLLOWUPTOPOSTER,
2993 +#endif /* USE_NNTP */
2995 /* THIS MUST BE THE LAST VALUE. */
2998 #define SENDMAILX (1<<6)
2999 #define SENDKEY (1<<7)
3000 #define SENDRESEND (1<<8)
3001 +#define SENDNEWS (1<<9)
3003 /* flags to _mutt_select_file() */
3004 #define M_SEL_BUFFY (1<<0)
3019 + OPTMIMESUBJECT, /* encode subject line with RFC2047 */
3024 @@ -488,6 +503,16 @@
3028 + /* news options */
3032 + OPTSHOWONLYUNREAD,
3036 +#endif /* USE_NNTP */
3038 /* pseudo options */
3040 OPTAUXSORT, /* (pseudo) using auxillary sort function */
3042 OPTSORTSUBTHREADS, /* (pseudo) used when $sort_aux changes */
3043 OPTNEEDRESCORE, /* (pseudo) set when the `score' command is used */
3044 OPTATTACHMSG, /* (pseudo) used by attach-message */
3045 + OPTHIDEREAD, /* (pseudo) whether or not hide read messages */
3046 OPTKEEPQUIET, /* (pseudo) shut up the message and refresh
3047 * functions while we are executing an
3049 @@ -518,6 +544,12 @@
3050 OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */
3051 OPTUNBUFFEREDINPUT, /* (pseudo) don't use key buffer */
3054 + OPTNEWS, /* (pseudo) used to change reader mode */
3055 + OPTNEWSSEND, /* (pseudo) used to change behavior when posting */
3056 + OPTNEWSCACHE, /* (pseudo) used to indicate if news cache exist */
3062 @@ -596,6 +628,13 @@
3066 + char *organization;
3070 + char *followup_to;
3071 + char *x_comment_to;
3074 LIST *references; /* message references (in reverse order) */
3075 LIST *in_reply_to; /* in-reply-to header content */
3077 ENVELOPE *env; /* envelope information */
3078 BODY *content; /* list of MIME parts */
3084 char *tree; /* character string to print thread tree */
3085 struct thread *thread;
3087 int refno; /* message number on server */
3090 -#if defined USE_POP || defined USE_IMAP
3091 +#if defined USE_POP || defined USE_IMAP || defined USE_NNTP
3092 void *data; /* driver-specific data */
3095 Index: mutt-1.5.20/muttlib.c
3096 ===================================================================
3097 --- mutt-1.5.20.orig/muttlib.c 2009-10-13 22:47:23.687521495 -0300
3098 +++ mutt-1.5.20/muttlib.c 2009-10-13 22:56:13.627521191 -0300
3101 mutt_free_list (&(*h)->chain);
3103 -#if defined USE_POP || defined USE_IMAP
3104 +#if defined USE_POP || defined USE_IMAP || defined USE_NNTP
3107 FREE (h); /* __FREE_CHECKED__ */
3108 @@ -686,6 +686,13 @@
3109 FREE (&(*p)->supersedes);
3111 FREE (&(*p)->x_label);
3112 + FREE (&(*p)->organization);
3114 + FREE (&(*p)->newsgroups);
3115 + FREE (&(*p)->xref);
3116 + FREE (&(*p)->followup_to);
3117 + FREE (&(*p)->x_comment_to);
3120 mutt_buffer_free (&(*p)->spam);
3122 @@ -1517,6 +1524,14 @@
3127 + if (magic == M_NNTP)
3129 + mutt_error _("Can't save message to newsserver.");
3134 if (stat (s, st) != -1)
3137 Index: mutt-1.5.20/mx.c
3138 ===================================================================
3139 --- mutt-1.5.20.orig/mx.c 2009-10-13 22:47:23.729521403 -0300
3140 +++ mutt-1.5.20/mx.c 2009-10-13 22:56:13.644543289 -0300
3141 @@ -347,6 +347,22 @@
3146 +int mx_is_nntp (const char *p)
3148 + url_scheme_t scheme;
3153 + scheme = url_check_scheme (p);
3154 + if (scheme == U_NNTP || scheme == U_NNTPS)
3161 int mx_get_magic (const char *path)
3164 @@ -364,6 +380,11 @@
3166 #endif /* USE_POP */
3169 + if (mx_is_nntp (path))
3171 +#endif /* USE_NNTP */
3173 if (stat (path, &st) == -1)
3175 dprint (1, (debugfile, "mx_get_magic(): unable to stat %s: %s (errno %d).\n",
3176 @@ -691,6 +712,12 @@
3178 #endif /* USE_POP */
3182 + rc = nntp_open_mailbox (ctx);
3184 +#endif /* USE_NNTP */
3189 @@ -799,6 +826,12 @@
3190 rc = pop_sync_mailbox (ctx, index_hint);
3192 #endif /* USE_POP */
3196 + rc = nntp_sync_mailbox (ctx);
3198 +#endif /* USE_NNTP */
3202 @@ -879,6 +912,16 @@
3207 + if (ctx->magic == M_NNTP)
3211 + ret = nntp_close_mailbox (ctx);
3212 + mx_fastclose_mailbox (ctx);
3216 if (ctx->readonly || ctx->dontwrite)
3218 /* mailbox is readonly or we don't want to write */
3219 @@ -1455,6 +1498,11 @@
3221 return (pop_check_mailbox (ctx, index_hint));
3222 #endif /* USE_POP */
3226 + return (nntp_check_mailbox (ctx));
3227 +#endif /* USE_NNTP */
3231 @@ -1515,6 +1563,15 @@
3233 #endif /* USE_POP */
3238 + if (nntp_fetch_message (msg, ctx, msgno) != 0)
3242 +#endif /* USE_NNTP */
3245 dprint (1, (debugfile, "mx_open_message(): function not implemented for mailbox type %d.\n", ctx->magic));
3247 @@ -1596,6 +1653,9 @@
3249 || (*msg)->magic == M_POP
3252 + || (*msg)->magic == M_NNTP
3256 r = safe_fclose (&(*msg)->fp);
3257 Index: mutt-1.5.20/mx.h
3258 ===================================================================
3259 --- mutt-1.5.20.orig/mx.h 2009-10-13 22:47:22.647520918 -0300
3260 +++ mutt-1.5.20/mx.h 2009-10-13 22:56:13.677653487 -0300
3262 #ifdef USE_COMPRESSED
3270 WHERE short DefaultMagic INITVAL (M_MBOX);
3271 Index: mutt-1.5.20/newsrc.c
3272 ===================================================================
3273 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
3274 +++ mutt-1.5.20/newsrc.c 2009-10-13 22:56:13.694643758 -0300
3277 + * Copyright (C) 1998 Brandon Long <blong@fiction.net>
3278 + * Copyright (C) 1999 Andrej Gritsenko <andrej@lucky.net>
3279 + * Copyright (C) 2000-2009 Vsevolod Volkov <vvv@mutt.org.ua>
3281 + * This program is free software; you can redistribute it and/or modify
3282 + * it under the terms of the GNU General Public License as published by
3283 + * the Free Software Foundation; either version 2 of the License, or
3284 + * (at your option) any later version.
3286 + * This program is distributed in the hope that it will be useful,
3287 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3288 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3289 + * GNU General Public License for more details.
3291 + * You should have received a copy of the GNU General Public License
3292 + * along with this program; if not, write to the Free Software
3293 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3297 +# include "config.h"
3301 +#include "mutt_curses.h"
3305 +#include "mailbox.h"
3307 +#include "rfc822.h"
3308 +#include "rfc1524.h"
3309 +#include "rfc2047.h"
3311 +#include <unistd.h>
3312 +#include <string.h>
3314 +#include <stdlib.h>
3315 +#include <sys/stat.h>
3317 +void nntp_add_to_list (NNTP_SERVER *s, NNTP_DATA *d)
3324 + l = safe_calloc (1, sizeof (LIST));
3326 + s->tail->next = l;
3330 + l->data = (void *) d;
3333 +static int nntp_parse_newsrc_line (NNTP_SERVER *news, char *line)
3336 + char group[LONG_STRING];
3338 + char *p = line, *b, *h;
3348 + while (*p && (*p != ':' && *p != '!')) p++;
3351 + len = p + 1 - line;
3352 + if (len > sizeof (group))
3353 + len = sizeof (group);
3354 + strfcpy (group, line, len);
3355 + if ((data = (NNTP_DATA *)hash_find (news->newsgroups, group)) == NULL)
3357 + data = (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1);
3358 + data->group = (char *) data + sizeof (NNTP_DATA);
3359 + strcpy (data->group, group);
3360 + data->nserv = news;
3361 + data->deleted = 1;
3362 + if (news->newsgroups->nelem < news->newsgroups->curnelem * 2)
3363 + news->newsgroups = hash_resize (news->newsgroups, news->newsgroups->nelem * 2, 0);
3364 + hash_insert (news->newsgroups, data->group, data, 0);
3365 + nntp_add_to_list (news, data);
3368 + FREE ((void **) &data->entries);
3371 + data->entries = safe_calloc (x*2, sizeof (NEWSRC_ENTRY));
3375 + data->subscribed = 1;
3377 + data->subscribed = 0;
3384 + while (*p && *p != ',' && *p != '\n') p++;
3390 + if ((h = strchr(b, '-')))
3394 + data->entries[x].first = atoi(b);
3395 + data->entries[x].last = atoi(h);
3399 + data->entries[x].first = atoi(b);
3400 + data->entries[x].last = data->entries[x].first;
3403 + if (data->entries[x].last != 0)
3406 + if (x && !data->lastMessage)
3407 + data->lastMessage = data->entries[x-1].last;
3409 + mutt_newsgroup_stat (data);
3410 + dprint (2, (debugfile, "parse_line: Newsgroup %s\n", data->group));
3415 +static int slurp_newsrc (NNTP_SERVER *news)
3421 + news->stat = stat (news->newsrc, &sb);
3422 + news->size = sb.st_size;
3423 + news->mtime = sb.st_mtime;
3425 + if ((fp = safe_fopen (news->newsrc, "r")) == NULL)
3427 + /* hmm, should we use dotlock? */
3428 + if (mx_lock_file (news->newsrc, fileno (fp), 0, 0, 1))
3434 + buf = safe_malloc (sb.st_size + 1);
3435 + while (sb.st_size && fgets (buf, sb.st_size + 1, fp))
3436 + nntp_parse_newsrc_line (news, buf);
3439 + mx_unlock_file (news->newsrc, fileno (fp), 0);
3444 +void nntp_cache_expand (char *dst, const char *src)
3446 + snprintf (dst, _POSIX_PATH_MAX, "%s/%s", NewsCacheDir, src);
3447 + mutt_expand_path (dst, _POSIX_PATH_MAX);
3450 +/* Loads $news_cache_dir/.index into memory, loads newsserver data
3451 + * and newsgroup cache names */
3452 +static int nntp_parse_cacheindex (NNTP_SERVER *news)
3455 + char buf[HUGE_STRING], *cp;
3456 + char dir[_POSIX_PATH_MAX], file[_POSIX_PATH_MAX];
3461 + /* check is server name defined or not */
3462 + if (!news || !news->conn || !news->conn->account.host)
3464 + unset_option (OPTNEWSCACHE);
3465 + if (!NewsCacheDir || !*NewsCacheDir)
3468 + strfcpy (dir, NewsCacheDir, sizeof (dir));
3469 + mutt_expand_path (dir, sizeof(dir));
3471 + if (lstat (dir, &st) || (st.st_mode & S_IFDIR) == 0)
3473 + snprintf (buf, sizeof(buf), _("Directory %s not exist. Create it?"), dir);
3474 + if (mutt_yesorno (buf, M_YES) != M_YES || mkdir (dir, (S_IRWXU+S_IRWXG+
3477 + mutt_error _("Cache directory not created!");
3480 + mutt_clear_error();
3483 + set_option (OPTNEWSCACHE);
3485 + FREE (&news->cache);
3486 + snprintf (buf, sizeof(buf), "%s/.index", dir);
3487 + if (!(index = safe_fopen (buf, "a+")))
3490 + while (fgets (buf, sizeof(buf), index))
3492 + buf[strlen(buf) - 1] = 0; /* strip ending '\n' */
3493 + if (!mutt_strncmp (buf, "#: ", 3) &&
3494 + !mutt_strcasecmp (buf+3, news->conn->account.host))
3497 + while (fgets (buf, sizeof(buf), index))
3500 + while (*cp && *cp != ' ') cp++;
3501 + if (!*cp) continue;
3503 + if (!mutt_strcmp (buf, "#:"))
3505 + sscanf (cp + 1, "%s %d %d", file, &l, &m);
3506 + if (!mutt_strcmp (buf, "ALL"))
3508 + news->cache = safe_strdup (file);
3509 + news->newgroups_time = m;
3511 + else if (news->newsgroups)
3513 + if ((data = (NNTP_DATA *)hash_find (news->newsgroups, buf)) == NULL)
3515 + data = (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + strlen (buf) + 1);
3516 + data->group = (char *) data + sizeof (NNTP_DATA);
3517 + strcpy(data->group, buf);
3518 + data->nserv = news;
3519 + data->deleted = 1;
3520 + if (news->newsgroups->nelem < news->newsgroups->curnelem * 2)
3521 + news->newsgroups = hash_resize (news->newsgroups, news->newsgroups->nelem * 2, 0);
3522 + hash_insert (news->newsgroups, data->group, data, 0);
3523 + nntp_add_to_list (news, data);
3525 + data->cache = safe_strdup (file);
3527 + if (!data->firstMessage || data->lastMessage < m)
3529 + if (!data->firstMessage)
3530 + data->firstMessage = l;
3531 + if (data->lastMessage < m)
3532 + data->lastMessage = m;
3533 + data->lastCached = m;
3534 + if (t || !data->unread)
3535 + mutt_newsgroup_stat (data);
3543 +nntp_format_str (char *dest, size_t destlen, size_t col, char op, const char *src,
3544 + const char *fmt, const char *ifstring, const char *elsestring,
3545 + unsigned long data, format_flag flags)
3547 + char fn[SHORT_STRING], tmp[SHORT_STRING];
3552 + strncpy (fn, NewsServer, sizeof(fn) - 1);
3553 + mutt_strlower (fn);
3554 + snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
3555 + snprintf (dest, destlen, tmp, fn);
3561 +/* nntp_parse_url: given an NNPT URL, return host, port,
3562 + * username, password and newsgroup will recognise. */
3563 +int nntp_parse_url (const char *server, ACCOUNT *acct,
3564 + char *group, size_t group_len)
3572 + acct->port = NNTP_PORT;
3573 + acct->type = M_ACCT_TYPE_NNTP;
3575 + c = safe_strdup (server);
3576 + url_parse_ciss (&url, c);
3578 + if (url.scheme == U_NNTP || url.scheme == U_NNTPS)
3580 + if (url.scheme == U_NNTPS)
3582 + acct->flags |= M_ACCT_SSL;
3583 + acct->port = NNTP_SSL_PORT;
3588 + strfcpy (group, url.path, group_len);
3590 + ret = mutt_account_fromurl (acct, &url);
3597 +void nntp_expand_path (char *line, size_t len, ACCOUNT *acct)
3601 + url.path = safe_strdup (line);
3602 + mutt_account_tourl (acct, &url);
3603 + url_ciss_tostring (&url, line, len, 0);
3608 + * Automatically loads a newsrc into memory, if necessary.
3609 + * Checks the size/mtime of a newsrc file, if it doesn't match, load
3610 + * again. Hmm, if a system has broken mtimes, this might mean the file
3611 + * is reloaded every time, which we'd have to fix.
3613 + * a newsrc file is a line per newsgroup, with the newsgroup, then a
3614 + * ':' denoting subscribed or '!' denoting unsubscribed, then a
3615 + * comma separated list of article numbers and ranges.
3617 +NNTP_SERVER *mutt_select_newsserver (char *server)
3619 + char file[_POSIX_PATH_MAX];
3623 + NNTP_SERVER *serv;
3626 + if (!server || !*server)
3628 + mutt_error _("No newsserver defined!");
3632 + buf = p = safe_calloc (strlen (server) + 10, sizeof (char));
3633 + if (url_check_scheme (server) == U_UNKNOWN)
3635 + strcpy (buf, "news://");
3636 + p = strchr (buf, '\0');
3638 + strcpy (p, server);
3640 + if ((nntp_parse_url (buf, &acct, file, sizeof (file))) < 0 || *file)
3643 + mutt_error (_("%s is an invalid newsserver specification!"), server);
3648 + conn = mutt_conn_find (NULL, &acct);
3652 + mutt_FormatString (file, sizeof (file), 0, NONULL (NewsRc), nntp_format_str, 0, 0);
3653 + mutt_expand_path (file, sizeof (file));
3655 + serv = (NNTP_SERVER *)conn->data;
3660 + /* externally modified? */
3661 + if (serv->stat != stat (file, &sb) || (!serv->stat &&
3662 + (serv->size != sb.st_size || serv->mtime != sb.st_mtime)))
3664 + for (list = serv->list; list; list = list->next)
3666 + NNTP_DATA *data = (NNTP_DATA *) list->data;
3670 + data->subscribed = 0;
3675 + slurp_newsrc (serv);
3676 + nntp_clear_cacheindex (serv);
3679 + if (serv->status == NNTP_BYE)
3680 + serv->status = NNTP_NONE;
3681 + nntp_check_newgroups (serv, 0);
3685 + /* New newsserver */
3686 + serv = safe_calloc (1, sizeof (NNTP_SERVER));
3687 + serv->conn = conn;
3688 + serv->newsrc = safe_strdup (file);
3689 + serv->newsgroups = hash_create (1009, 0);
3690 + slurp_newsrc (serv); /* load .newsrc */
3691 + nntp_parse_cacheindex (serv); /* load .index */
3692 + if (option (OPTNEWSCACHE) && serv->cache && nntp_get_cache_all (serv) >= 0)
3693 + nntp_check_newgroups (serv, 1);
3694 + else if (nntp_get_active (serv) < 0)
3696 + hash_destroy (&serv->newsgroups, nntp_delete_data);
3697 + for (list = serv->list; list; list = list->next)
3698 + list->data = NULL;
3699 + mutt_free_list (&serv->list);
3700 + FREE (&serv->newsrc);
3701 + FREE (&serv->cache);
3705 + nntp_clear_cacheindex (serv);
3706 + conn->data = (void *)serv;
3712 + * full status flags are not supported by nntp, but we can fake some
3713 + * of them. This is how:
3714 + * Read = a read message number is in the .newsrc
3715 + * New = a message is new since we last read this newsgroup
3716 + * Old = anything else
3717 + * So, Read is marked as such in the newsrc, old is anything that is
3718 + * "skipped" in the newsrc, and new is anything not in the newsrc nor
3719 + * in the cache. By skipped, I mean before the last unread message
3721 +void nntp_get_status (CONTEXT *ctx, HEADER *h, char *group, int article)
3723 + NNTP_DATA *data = (NNTP_DATA *) ctx->data;
3727 + data = (NNTP_DATA *) hash_find (data->nserv->newsgroups, group);
3733 + dprint (3, (debugfile, "newsgroup %s not found\n", group));
3738 + for (x = 0; x < data->num; x++)
3740 + if ((article >= data->entries[x].first) &&
3741 + (article <= data->entries[x].last))
3743 + /* we cannot use mutt_set_flag() because mx_update_context()
3744 + didn't called yet */
3749 + /* If article was not cached yet, it is new! :) */
3750 + if (!data->cache || article > data->lastCached)
3752 + /* Old articles are articles which aren't read but an article after them
3753 + * has been cached */
3754 + if (option (OPTMARKOLD))
3758 +void mutt_newsgroup_stat (NNTP_DATA *data)
3761 + unsigned int first, last;
3764 + if (data->lastMessage == 0 || data->firstMessage > data->lastMessage)
3767 + data->unread = data->lastMessage - data->firstMessage + 1;
3768 + for (i = 0; i < data->num; i++)
3770 + first = data->entries[i].first;
3771 + if (first < data->firstMessage)
3772 + first = data->firstMessage;
3773 + last = data->entries[i].last;
3774 + if (last > data->lastMessage)
3775 + last = data->lastMessage;
3776 + if (first <= last)
3777 + data->unread -= last - first + 1;
3781 +static int puti (char *line, int num)
3785 + for (p = s; num; )
3787 + *p++ = '0' + num % 10;
3791 + *line++ = *--p, num++;
3796 +static void nntp_create_newsrc_line (NNTP_DATA *data, char **buf, char **pline, size_t *buflen)
3798 + char *line = *pline;
3799 + size_t len = *buflen - (*pline - *buf);
3802 + if (len < LONG_STRING * 10)
3807 + safe_realloc (buf, *buflen);
3808 + line = *buf + (*pline - line);
3810 + strcpy (line, data->group);
3811 + len -= strlen (line) + 1;
3812 + line += strlen (line);
3813 + *line++ = data->subscribed ? ':' : '!';
3817 + for (x = 0; x < data->num; x++)
3819 + if (len < LONG_STRING)
3825 + safe_realloc (buf, *buflen);
3826 + line = *buf + (*pline - line);
3835 + if (data->entries[x].first == data->entries[x].last)
3836 + snprintf (line, len, "%d%n", data->entries[x].first, &i);
3838 + snprintf (line, len, "%d-%d%n",
3839 + data->entries[x].first, data->entries[x].last, &i);
3843 + i = puti (line, data->entries[x].first);
3844 + line +=i; len -= i;
3845 + if (data->entries[x].first != data->entries[x].last)
3849 + i = puti (line, data->entries[x].last);
3850 + line +=i; len -= i;
3859 +void newsrc_gen_entries (CONTEXT *ctx)
3861 + NNTP_DATA *data = (NNTP_DATA *)ctx->data;
3863 + unsigned int last = 0, first = 1;
3864 + int save_sort = SORT_ORDER;
3866 + if (Sort != SORT_ORDER)
3869 + Sort = SORT_ORDER;
3870 + mutt_sort_headers (ctx, 0);
3875 + data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY));
3880 + * Set up to fake initial sequence from 1 to the article before the
3881 + * first article in our list
3886 + for (x = 0; x < ctx->msgcount; x++)
3888 + if (series) /* search for first unread */
3891 + * We don't actually check sequential order, since we mark
3892 + * "missing" entries as read/deleted
3894 + last = ctx->hdrs[x]->article_num;
3895 + if (last >= data->firstMessage && !ctx->hdrs[x]->deleted &&
3896 + !ctx->hdrs[x]->read)
3898 + if (data->num >= data->max)
3900 + data->max = data->max * 2;
3901 + safe_realloc (&data->entries,
3902 + data->max * sizeof (NEWSRC_ENTRY));
3904 + data->entries[data->num].first = first;
3905 + data->entries[data->num].last = last - 1;
3910 + else /* search for first read */
3912 + if (ctx->hdrs[x]->deleted || ctx->hdrs[x]->read)
3917 + last = ctx->hdrs[x]->article_num;
3920 + if (series && first <= data->lastLoaded)
3922 + if (data->num >= data->max)
3924 + data->max = data->max * 2;
3925 + safe_realloc (&data->entries,
3926 + data->max * sizeof (NEWSRC_ENTRY));
3928 + data->entries[data->num].first = first;
3929 + data->entries[data->num].last = data->lastLoaded;
3933 + if (save_sort != Sort)
3936 + mutt_sort_headers (ctx, 0);
3940 +static int mutt_update_list_file (char *filename, char *section,
3941 + char *key, char *line)
3945 + char buf[HUGE_STRING];
3946 + char tmpfile[_POSIX_PATH_MAX];
3948 + int ext = 0, done = 0, r = 0;
3950 + /* if file not exist, create it */
3951 + if ((ifp = safe_fopen (filename, "a")))
3953 + dprint (1, (debugfile, "Opening %s\n", filename));
3954 + if (!(ifp = safe_fopen (filename, "r")))
3956 + mutt_error (_("Unable to open %s for reading"), filename);
3959 + if (mx_lock_file (filename, fileno (ifp), 0, 0, 1))
3962 + mutt_error (_("Unable to lock %s"), filename);
3965 + snprintf (tmpfile, sizeof(tmpfile), "%s.tmp", filename);
3966 + dprint (1, (debugfile, "Opening %s\n", tmpfile));
3967 + if (!(ofp = fopen (tmpfile, "w")))
3970 + mutt_error (_("Unable to open %s for writing"), tmpfile);
3976 + while (r != EOF && !done && fgets (buf, sizeof (buf), ifp))
3978 + r = fputs (buf, ofp);
3980 + while (*c && *c != '\n') c++;
3981 + c[0] = 0; /* strip EOL */
3982 + if (!strncmp (buf, "#: ", 3) && !mutt_strcasecmp (buf+3, section))
3985 + if (r != EOF && !done)
3987 + snprintf (buf, sizeof(buf), "#: %s\n", section);
3988 + r = fputs (buf, ofp);
3993 + while (r != EOF && fgets (buf, sizeof (buf), ifp))
3998 + while (*c && (*c != '\r') && (*c != '\n')) c++;
4000 + if (*c != '\\') ext = 0;
4002 + else if ((section && !strncmp (buf, "#: ", 3)))
4004 + if (!done && line)
4006 + fputs (line, ofp);
4007 + fputc ('\n', ofp);
4009 + r = fputs (buf, ofp);
4013 + else if (key && !strncmp (buf, key, strlen(key)) &&
4014 + (!*key || buf[strlen(key)] == ' '))
4018 + while (*c && (*c != '\r') && (*c != '\n')) c++;
4020 + if (*c == '\\') ext = 1;
4021 + if (!done && line)
4023 + r = fputs (line, ofp);
4025 + r = fputc ('\n', ofp);
4031 + r = fputs (buf, ofp);
4035 + while (r != EOF && fgets (buf, sizeof (buf), ifp))
4036 + r = fputs (buf, ofp);
4038 + /* If there wasn't a line to replace, put it on the end of the file */
4039 + if (r != EOF && !done && line)
4041 + fputs (line, ofp);
4042 + r = fputc ('\n', ofp);
4044 + mx_unlock_file (filename, fileno (ifp), 0);
4050 + mutt_error (_("Can't write %s"), tmpfile);
4053 + if (rename (tmpfile, filename) < 0)
4056 + mutt_error (_("Can't rename %s to %s"), tmpfile, filename);
4062 +int mutt_newsrc_update (NNTP_SERVER *news)
4072 + llen = len = 10 * LONG_STRING;
4073 + line = buf = safe_calloc (1, len);
4074 + /* we will generate full newsrc here */
4075 + for (tmp = news->list; tmp; tmp = tmp->next)
4077 + data = (NNTP_DATA *) tmp->data;
4078 + if (!data || !data->rc)
4080 + nntp_create_newsrc_line (data, &buf, &line, &llen);
4082 + dprint (2, (debugfile, "Added to newsrc: %s\n", line));
4083 + line += strlen (line);
4085 + /* newrc being fully rewritten */
4086 + if (news->newsrc &&
4087 + (r = mutt_update_list_file (news->newsrc, NULL, "", buf)) == 0)
4091 + stat (news->newsrc, &st);
4092 + news->size = st.st_size;
4093 + news->mtime = st.st_mtime;
4099 +static FILE *mutt_mkname (char *s)
4101 + char buf[_POSIX_PATH_MAX], *pc;
4105 + nntp_cache_expand (buf, s);
4106 + if ((fp = safe_fopen (buf, "w")))
4109 + nntp_cache_expand (buf, "cache-XXXXXX");
4110 + pc = buf + strlen (buf) - 12; /* positioning to "cache-XXXXXX" */
4111 + if ((fd = mkstemp (buf)) == -1)
4113 + strcpy (s, pc); /* generated name */
4114 + return fdopen (fd, "w");
4117 +/* Updates info into .index file: ALL or about selected newsgroup */
4118 +static int nntp_update_cacheindex (NNTP_SERVER *serv, NNTP_DATA *data)
4120 + char buf[LONG_STRING], *key = "ALL";
4121 + char file[_POSIX_PATH_MAX];
4123 + if (!serv || !serv->conn || !serv->conn->account.host)
4126 + if (data && data->group)
4128 + key = data->group;
4129 + snprintf (buf, sizeof (buf), "%s %s %d %d", key, data->cache,
4130 + data->firstMessage, data->lastLoaded);
4134 + strfcpy (file, serv->cache, sizeof (file));
4135 + snprintf (buf, sizeof (buf), "ALL %s 0 %d", file, (int)serv->newgroups_time);
4137 + nntp_cache_expand (file, ".index");
4138 + return mutt_update_list_file (file, serv->conn->account.host, key, buf);
4141 +/* Remove cache files of unsubscribed newsgroups */
4142 +void nntp_clear_cacheindex (NNTP_SERVER *news)
4147 + if (option (OPTSAVEUNSUB) || !news)
4150 + for (tmp = news->list; tmp; tmp = tmp->next)
4152 + data = (NNTP_DATA *) tmp->data;
4153 + if (!data || data->subscribed || !data->cache)
4155 + nntp_delete_cache (data);
4156 + dprint (2, (debugfile, "Removed from .index: %s\n", data->group));
4161 +int nntp_save_cache_index (NNTP_SERVER *news)
4163 + char buf[HUGE_STRING];
4164 + char file[_POSIX_PATH_MAX];
4169 + if (!news || !news->newsgroups)
4171 + if (!option (OPTNEWSCACHE))
4176 + nntp_cache_expand (file, news->cache);
4178 + f = safe_fopen (file, "w");
4182 + strfcpy (buf, news->conn->account.host, sizeof(buf));
4183 + f = mutt_mkname (buf);
4184 + news->cache = safe_strdup (buf);
4185 + nntp_cache_expand (file, buf);
4190 + for (l = news->list; l; l = l->next)
4192 + if ((d = (NNTP_DATA *)l->data) && !d->deleted)
4195 + snprintf (buf, sizeof(buf), "%s %d %d %c %s\n", d->group,
4196 + d->lastMessage, d->firstMessage, d->allowed ? 'y' : 'n',
4199 + snprintf (buf, sizeof(buf), "%s %d %d %c\n", d->group,
4200 + d->lastMessage, d->firstMessage, d->allowed ? 'y' : 'n');
4201 + if (fputs (buf, f) == EOF)
4211 + if (nntp_update_cacheindex (news, NULL))
4219 +int nntp_save_cache_group (CONTEXT *ctx)
4221 + char buf[HUGE_STRING], addr[STRING];
4222 + char file[_POSIX_PATH_MAX];
4226 + int i = 0, save = SORT_ORDER;
4229 + if (!option (OPTNEWSCACHE))
4231 + if (!ctx || !ctx->data || ctx->magic != M_NNTP)
4234 + if (((NNTP_DATA *)ctx->data)->cache)
4236 + nntp_cache_expand (file, ((NNTP_DATA *)ctx->data)->cache);
4238 + f = safe_fopen (file, "w");
4242 + snprintf (buf, sizeof(buf), "%s-%s",
4243 + ((NNTP_DATA *)ctx->data)->nserv->conn->account.host,
4244 + ((NNTP_DATA *)ctx->data)->group);
4245 + f = mutt_mkname (buf);
4246 + ((NNTP_DATA *)ctx->data)->cache = safe_strdup (buf);
4247 + nntp_cache_expand (file, buf);
4252 + if (Sort != SORT_ORDER)
4255 + Sort = SORT_ORDER;
4256 + mutt_sort_headers (ctx, 0);
4259 + /* Save only $nntp_context messages... */
4260 + ((NNTP_DATA *)ctx->data)->lastCached = 0;
4261 + if (NntpContext && ctx->msgcount > NntpContext)
4262 + i = ctx->msgcount - NntpContext;
4263 + for (; i < ctx->msgcount; i++)
4265 + if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->article_num != prev)
4269 + rfc822_write_address (addr, sizeof(addr), h->env->from, 0);
4270 + tm = gmtime (&h->date_sent);
4271 + snprintf (buf, sizeof(buf),
4272 + "%d\t%s\t%s\t%d %s %d %02d:%02d:%02d GMT\t%s\t",
4273 + h->article_num, h->env->subject, addr, tm->tm_mday,
4274 + Months[tm->tm_mon], tm->tm_year+1900, tm->tm_hour, tm->tm_min,
4275 + tm->tm_sec, h->env->message_id);
4277 + if (h->env->references)
4278 + mutt_write_references (h->env->references, f, -10);
4279 + snprintf (buf, sizeof(buf), "\t%ld\t%d\tXref: %s\n", (long int) h->content->length,
4280 + (int) h->lines, NONULL(h->env->xref));
4281 + if (fputs (buf, f) == EOF)
4288 + prev = ctx->hdrs[i]->article_num;
4294 + mutt_sort_headers (ctx, 0);
4298 + if (nntp_update_cacheindex (((NNTP_DATA *)ctx->data)->nserv,
4299 + (NNTP_DATA *)ctx->data))
4304 + ((NNTP_DATA *)ctx->data)->lastCached = ((NNTP_DATA *)ctx->data)->lastLoaded;
4308 +void nntp_delete_cache (NNTP_DATA *data)
4310 + char buf[_POSIX_PATH_MAX];
4312 + if (!option (OPTNEWSCACHE) || !data || !data->cache || !data->nserv)
4315 + nntp_cache_expand (buf, data->cache);
4317 + FREE (&data->cache);
4318 + data->lastCached = 0;
4319 + nntp_cache_expand (buf, ".index");
4320 + mutt_update_list_file (buf, data->nserv->conn->account.host, data->group, NULL);
4323 +NNTP_DATA *mutt_newsgroup_subscribe (NNTP_SERVER *news, char *group)
4327 + if (!news || !news->newsgroups || !group || !*group)
4329 + if (!(data = (NNTP_DATA *)hash_find (news->newsgroups, group)))
4331 + data = (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1);
4332 + data->group = (char *) data + sizeof (NNTP_DATA);
4333 + strcpy (data->group, group);
4334 + data->nserv = news;
4335 + data->deleted = 1;
4336 + if (news->newsgroups->nelem < news->newsgroups->curnelem * 2)
4337 + news->newsgroups = hash_resize (news->newsgroups, news->newsgroups->nelem * 2, 0);
4338 + hash_insert (news->newsgroups, data->group, data, 0);
4339 + nntp_add_to_list (news, data);
4341 + if (!data->subscribed)
4343 + data->subscribed = 1;
4349 +NNTP_DATA *mutt_newsgroup_unsubscribe (NNTP_SERVER *news, char *group)
4353 + if (!news || !news->newsgroups || !group || !*group ||
4354 + !(data = (NNTP_DATA *)hash_find (news->newsgroups, group)))
4356 + if (data->subscribed)
4358 + data->subscribed = 0;
4359 + if (!option (OPTSAVEUNSUB))
4365 +NNTP_DATA *mutt_newsgroup_catchup (NNTP_SERVER *news, char *group)
4369 + if (!news || !news->newsgroups || !group || !*group ||
4370 + !(data = (NNTP_DATA *)hash_find (news->newsgroups, group)))
4374 + data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY));
4378 + data->entries[0].first = 1;
4380 + data->entries[0].last = data->lastMessage;
4381 + if (Context && Context->data == data)
4385 + for (x = 0; x < Context->msgcount; x++)
4386 + mutt_set_flag (Context, Context->hdrs[x], M_READ, 1);
4391 +NNTP_DATA *mutt_newsgroup_uncatchup (NNTP_SERVER *news, char *group)
4395 + if (!news || !news->newsgroups || !group || !*group ||
4396 + !(data = (NNTP_DATA *)hash_find (news->newsgroups, group)))
4400 + data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY));
4404 + data->entries[0].first = 1;
4405 + data->entries[0].last = data->firstMessage - 1;
4406 + if (Context && Context->data == data)
4410 + data->unread = Context->msgcount;
4411 + for (x = 0; x < Context->msgcount; x++)
4412 + mutt_set_flag (Context, Context->hdrs[x], M_READ, 0);
4415 + data->unread = data->lastMessage - data->entries[0].last;
4419 +/* this routine gives the first newsgroup with new messages */
4420 +void nntp_buffy (char *s)
4424 + for (list = CurrentNewsSrv->list; list; list = list->next)
4426 + NNTP_DATA *data = (NNTP_DATA *) list->data;
4428 + if (data && data->subscribed && data->unread)
4430 + if (Context && Context->magic == M_NNTP &&
4431 + !mutt_strcmp (data->group, ((NNTP_DATA *) Context->data)->group))
4433 + unsigned int i, unread = 0;
4435 + for (i = 0; i < Context->msgcount; i++)
4436 + if (!Context->hdrs[i]->read && !Context->hdrs[i]->deleted)
4441 + strcpy (s, data->group);
4446 Index: mutt-1.5.20/nntp.c
4447 ===================================================================
4448 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4449 +++ mutt-1.5.20/nntp.c 2009-10-13 22:56:13.713518349 -0300
4452 + * Copyright (C) 1998 Brandon Long <blong@fiction.net>
4453 + * Copyright (C) 1999 Andrej Gritsenko <andrej@lucky.net>
4454 + * Copyright (C) 2000-2007 Vsevolod Volkov <vvv@mutt.org.ua>
4456 + * This program is free software; you can redistribute it and/or modify
4457 + * it under the terms of the GNU General Public License as published by
4458 + * the Free Software Foundation; either version 2 of the License, or
4459 + * (at your option) any later version.
4461 + * This program is distributed in the hope that it will be useful,
4462 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4463 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4464 + * GNU General Public License for more details.
4466 + * You should have received a copy of the GNU General Public License
4467 + * along with this program; if not, write to the Free Software
4468 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
4472 +# include "config.h"
4476 +#include "mutt_curses.h"
4480 +#include "rfc1524.h"
4481 +#include "rfc2047.h"
4482 +#include "mailbox.h"
4493 +#include <unistd.h>
4494 +#include <string.h>
4496 +#include <stdlib.h>
4498 +static unsigned int _checked = 0;
4501 +static void nntp_error (const char *where, const char *msg)
4503 + dprint (1, (debugfile, "nntp_error(): unexpected response in %s: %s\n", where, msg));
4507 +static int nntp_auth (NNTP_SERVER *serv)
4509 + CONNECTION *conn = serv->conn;
4511 + unsigned char flags = conn->account.flags;
4513 + if (mutt_account_getuser (&conn->account) || !conn->account.user[0] ||
4514 + mutt_account_getpass (&conn->account) || !conn->account.pass[0])
4516 + conn->account.flags = flags;
4520 + mutt_message _("Logging in...");
4522 + snprintf (buf, sizeof (buf), "AUTHINFO USER %s\r\n", conn->account.user);
4523 + mutt_socket_write (conn, buf);
4524 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4526 + conn->account.flags = flags;
4531 + /* don't print the password unless we're at the ungodly debugging level */
4532 + if (debuglevel < M_SOCK_LOG_FULL)
4533 + dprint (M_SOCK_LOG_CMD, (debugfile, "> AUTHINFO PASS *\n"));
4535 + snprintf (buf, sizeof (buf), "AUTHINFO PASS %s\r\n", conn->account.pass);
4536 + mutt_socket_write_d (conn, buf, -1, M_SOCK_LOG_FULL);
4537 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4539 + conn->account.flags = flags;
4543 + if (mutt_strncmp ("281", buf, 3))
4545 + conn->account.flags = flags;
4546 + mutt_error _("Login failed.");
4554 +static int nntp_connect_error (NNTP_SERVER *serv)
4556 + serv->status = NNTP_NONE;
4557 + mutt_socket_close (serv->conn);
4558 + mutt_error _("Server closed connection!");
4563 +static int nntp_connect_and_auth (NNTP_SERVER *serv)
4565 + CONNECTION *conn = serv->conn;
4569 + serv->status = NNTP_NONE;
4571 + if (mutt_socket_open (conn) < 0)
4574 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4575 + return nntp_connect_error (serv);
4577 + if (!mutt_strncmp ("200", buf, 3))
4578 + mutt_message (_("Connected to %s. Posting ok."), conn->account.host);
4579 + else if (!mutt_strncmp ("201", buf, 3))
4580 + mutt_message (_("Connected to %s. Posting NOT ok."), conn->account.host);
4583 + mutt_socket_close (conn);
4584 + mutt_remove_trailing_ws (buf);
4585 + mutt_error ("%s", buf);
4592 + /* Tell INN to switch to mode reader if it isn't so. Ignore all
4593 + returned codes and messages. */
4594 + mutt_socket_write (conn, "MODE READER\r\n");
4595 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4596 + return nntp_connect_error (serv);
4598 + mutt_socket_write (conn, "STAT\r\n");
4599 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4600 + return nntp_connect_error (serv);
4602 + if (!(conn->account.flags & M_ACCT_USER) && mutt_strncmp ("480", buf, 3))
4604 + serv->status = NNTP_OK;
4608 + rc = nntp_auth (serv);
4610 + return nntp_connect_error (serv);
4613 + mutt_socket_close (conn);
4614 + serv->status = NNTP_BYE;
4619 + mutt_socket_close (conn);
4620 + mutt_error _("Login failed.");
4624 + serv->status = NNTP_OK;
4628 +static int nntp_attempt_features (NNTP_SERVER *serv)
4630 + char buf[LONG_STRING];
4631 + CONNECTION *conn = serv->conn;
4633 + mutt_socket_write (conn, "XOVER\r\n");
4634 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4635 + return nntp_connect_error (serv);
4636 + if (mutt_strncmp ("500", buf, 3))
4637 + serv->hasXOVER = 1;
4639 + mutt_socket_write (conn, "XPAT\r\n");
4640 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4641 + return nntp_connect_error (serv);
4642 + if (mutt_strncmp ("500", buf, 3))
4643 + serv->hasXPAT = 1;
4645 + mutt_socket_write (conn, "LISTGROUP\r\n");
4646 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4647 + return nntp_connect_error (serv);
4648 + if (mutt_strncmp ("500", buf, 3))
4649 + serv->hasLISTGROUP = 1;
4651 + mutt_socket_write (conn, "XGTITLE +\r\n");
4652 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4653 + return nntp_connect_error (serv);
4654 + if (mutt_strncmp ("500", buf, 3))
4655 + serv->hasXGTITLE = 1;
4657 + if (!mutt_strncmp ("282", buf, 3))
4661 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4662 + return nntp_connect_error (serv);
4663 + } while (!(buf[0] == '.' && buf[1] == '\0'));
4669 +static int nntp_open_connection (NNTP_SERVER *serv)
4671 + if (serv->status == NNTP_OK)
4673 + if (serv->status == NNTP_BYE)
4675 + if (nntp_connect_and_auth (serv) < 0)
4677 + if (nntp_attempt_features (serv) < 0)
4682 +static int nntp_reconnect (NNTP_SERVER *serv)
4684 + char buf[SHORT_STRING];
4686 + mutt_socket_close (serv->conn);
4690 + if (nntp_connect_and_auth (serv) == 0)
4693 + snprintf (buf, sizeof (buf), _("Connection to %s lost. Reconnect?"),
4694 + serv->conn->account.host);
4695 + if (query_quadoption (OPT_NNTPRECONNECT, buf) != M_YES)
4697 + serv->status = NNTP_BYE;
4703 +/* Send data from line[LONG_STRING] and receive answer to same line */
4704 +static int mutt_nntp_query (NNTP_DATA *data, char *line, size_t linelen)
4706 + char buf[LONG_STRING];
4709 + if (data->nserv->status == NNTP_BYE)
4716 + mutt_socket_write (data->nserv->conn, line);
4718 + else if (data->group)
4720 + snprintf (buf, sizeof (buf), "GROUP %s\r\n", data->group);
4721 + mutt_socket_write (data->nserv->conn, buf);
4725 + if (mutt_socket_readln (buf, sizeof (buf), data->nserv->conn) < 0)
4727 + if (nntp_reconnect (data->nserv) < 0)
4732 + snprintf (buf, sizeof (buf), "GROUP %s\r\n", data->group);
4733 + mutt_socket_write (data->nserv->conn, buf);
4734 + if (mutt_socket_readln (buf, sizeof (buf), data->nserv->conn) < 0)
4740 + else if ((!mutt_strncmp ("480", buf, 3)) && nntp_auth (data->nserv) < 0)
4744 + strfcpy (line, buf, linelen);
4749 + * This function calls funct(*line, *data) for each received line,
4750 + * funct(NULL, *data) if rewind(*data) needs, exits when fail or done.
4753 + * 1 - correct but not performed (may be, have to be continued),
4754 + * -1 - conection lost,
4755 + * -2 - invalid command or execution error,
4756 + * -3 - error in funct(*line, *data).
4758 +static int mutt_nntp_fetch (NNTP_DATA *nntp_data, char *query, char *msg,
4759 + int (*funct) (char *, void *), void *data, int tagged)
4761 + char buf[LONG_STRING];
4765 + size_t lenbuf = 0;
4770 + strfcpy (buf, query, sizeof (buf));
4771 + if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0)
4773 + if (buf[0] == '5')
4775 + if (buf[0] != '2')
4780 + inbuf = safe_malloc (sizeof (buf));
4784 + chunk = mutt_socket_readln_d (buf, sizeof (buf), nntp_data->nserv->conn,
4790 + if (!lenbuf && buf[0] == '.')
4792 + if (buf[1] == '\0')
4797 + if (buf[1] == '.')
4801 + strfcpy (inbuf + lenbuf, p, sizeof (buf));
4803 + if (chunk >= sizeof (buf))
4805 + lenbuf += strlen (p);
4810 + if (msg && ReadInc && (line % ReadInc == 0)) {
4812 + mutt_message (_("%s (tagged: %d) %d"), msg, tagged, line);
4814 + mutt_message ("%s %d", msg, line);
4817 + if (ret == 0 && funct (inbuf, data) < 0)
4822 + safe_realloc (&inbuf, lenbuf + sizeof (buf));
4825 + funct (NULL, data);
4831 +static int nntp_read_tempfile (char *line, void *file)
4833 + FILE *f = (FILE *)file;
4840 + if (fputc ('\n', f) == EOF)
4846 +static void nntp_parse_xref (CONTEXT *ctx, char *group, char *xref, HEADER *h)
4848 + register char *p, *b;
4849 + register char *colon = NULL;
4854 + /* skip to next word */
4856 + while (*b && ((*b == ' ') || (*b == '\t'))) b++;
4859 + /* skip to end of word */
4860 + while (*p && (*p != ' ') && (*p != '\t'))
4875 + nntp_get_status (ctx, h, b, atoi(colon));
4876 + if (h && h->article_num == 0 && mutt_strcmp (group, b) == 0)
4877 + h->article_num = atoi(colon);
4885 + * 1 if article not found
4886 + * -1 if read or write error on tempfile or socket
4888 +static int nntp_read_header (CONTEXT *ctx, const char *msgid, int article_num)
4890 + NNTP_DATA *nntp_data = ((NNTP_DATA *)ctx->data);
4892 + char buf[LONG_STRING];
4893 + char tempfile[_POSIX_PATH_MAX];
4895 + HEADER *h = ctx->hdrs[ctx->msgcount];
4897 + mutt_mktemp (tempfile);
4898 + if (!(f = safe_fopen (tempfile, "w+")))
4902 + snprintf (buf, sizeof (buf), "HEAD %d\r\n", article_num);
4904 + snprintf (buf, sizeof (buf), "HEAD %s\r\n", msgid);
4906 + ret = mutt_nntp_fetch (nntp_data, buf, NULL, nntp_read_tempfile, f, 0);
4911 + dprint(1, (debugfile, "nntp_read_header: %s\n", buf));
4914 + unlink (tempfile);
4915 + return (ret == -1 ? -1 : 1);
4918 + h->article_num = article_num;
4919 + h->env = mutt_read_rfc822_header (f, h, 0, 0);
4921 + unlink (tempfile);
4923 + if (h->env->xref != NULL)
4924 + nntp_parse_xref (ctx, nntp_data->group, h->env->xref, h);
4925 + else if (h->article_num == 0 && msgid)
4927 + snprintf (buf, sizeof (buf), "STAT %s\r\n", msgid);
4928 + if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) == 0)
4929 + h->article_num = atoi (buf + 4);
4935 +static int parse_description (char *line, void *n)
4937 +#define news ((NNTP_SERVER *) n)
4938 + register char *d = line;
4943 + while (*d && *d != '\t' && *d != ' ') d++;
4946 + while (*d && (*d == '\t' || *d == ' ')) d++;
4947 + dprint (2, (debugfile, "group: %s, desc: %s\n", line, d));
4948 + if ((data = (NNTP_DATA *) hash_find (news->newsgroups, line)) != NULL &&
4949 + mutt_strcmp (d, data->desc))
4951 + FREE (&data->desc);
4952 + data->desc = safe_strdup (d);
4958 +static void nntp_get_desc (NNTP_DATA *data, char *mask, char *msg)
4962 + if (!option (OPTLOADDESC) || !data || !data->nserv)
4965 + /* Get newsgroup description, if we can */
4966 + if (data->nserv->hasXGTITLE)
4967 + snprintf (buf, sizeof (buf), "XGTITLE %s\r\n", mask);
4969 + snprintf (buf, sizeof (buf), "LIST NEWSGROUPS %s\r\n", mask);
4970 + if (mutt_nntp_fetch (data, buf, msg, parse_description, data->nserv, 0) != 0)
4973 + nntp_error ("nntp_get_desc()", buf);
4979 + * XOVER returns a tab separated list of:
4980 + * id|subject|from|date|Msgid|references|bytes|lines|xref
4982 + * This has to duplicate some of the functionality of
4983 + * mutt_read_rfc822_header(), since it replaces the call to that (albeit with
4984 + * a limited number of headers which are "parsed" by placement in the list)
4986 +static int nntp_parse_xover (CONTEXT *ctx, char *buf, HEADER *hdr)
4988 + NNTP_DATA *nntp_data = (NNTP_DATA *) ctx->data;
4992 + hdr->env = mutt_new_envelope();
4993 + hdr->env->newsgroups = safe_strdup (nntp_data->group);
4994 + hdr->content = mutt_new_body();
4995 + hdr->content->type = TYPETEXT;
4996 + hdr->content->subtype = safe_strdup ("plain");
4997 + hdr->content->encoding = ENC7BIT;
4998 + hdr->content->disposition = DISPINLINE;
4999 + hdr->content->length = -1;
5002 + for (x = 0; !done && x < 9; x++)
5004 + /* if from file, need to skip newline character */
5005 + while (*p && *p != '\n' && *p != '\t') p++;
5013 + hdr->article_num = atoi (b);
5014 + nntp_get_status (ctx, hdr, NULL, hdr->article_num);
5017 + hdr->env->subject = safe_strdup (b);
5018 + /* Now we need to do the things which would normally be done in
5019 + * mutt_read_rfc822_header() */
5020 + if (hdr->env->subject)
5022 + regmatch_t pmatch[1];
5024 + rfc2047_decode (&hdr->env->subject);
5026 + if (regexec (ReplyRegexp.rx, hdr->env->subject, 1, pmatch, 0) == 0)
5027 + hdr->env->real_subj = hdr->env->subject + pmatch[0].rm_eo;
5029 + hdr->env->real_subj = hdr->env->subject;
5033 + rfc822_free_address (&hdr->env->from);
5034 + hdr->env->from = rfc822_parse_adrlist (hdr->env->from, b);
5035 + rfc2047_decode_adrlist (hdr->env->from);
5038 + hdr->date_sent = mutt_parse_date (b, hdr);
5039 + hdr->received = hdr->date_sent;
5042 + FREE (&hdr->env->message_id);
5043 + hdr->env->message_id = safe_strdup (b);
5046 + mutt_free_list (&hdr->env->references);
5047 + hdr->env->references = mutt_parse_references (b, 0);
5050 + hdr->content->length = atoi (b);
5053 + hdr->lines = atoi (b);
5057 + FREE (&hdr->env->xref);
5058 + b = b + 6; /* skips the "Xref: " */
5059 + hdr->env->xref = safe_strdup (b);
5060 + nntp_parse_xref (ctx, nntp_data->group, b, hdr);
5072 + unsigned int base;
5073 + unsigned int first;
5074 + unsigned int last;
5075 + unsigned short *messages;
5079 +#define fc ((FETCH_CONTEXT *) c)
5080 +static int nntp_fetch_numbers (char *line, void *c)
5086 + num = atoi (line);
5087 + if (num < fc->base || num > fc->last)
5089 + fc->messages[num - fc->base] = 1;
5093 +static int add_xover_line (char *line, void *c)
5095 + unsigned int num, total;
5096 + CONTEXT *ctx = fc->ctx;
5097 + NNTP_DATA *data = (NNTP_DATA *)ctx->data;
5102 + if (ctx->msgcount >= ctx->hdrmax)
5103 + mx_alloc_memory (ctx);
5104 + ctx->hdrs[ctx->msgcount] = mutt_new_header ();
5105 + ctx->hdrs[ctx->msgcount]->index = ctx->msgcount;
5107 + nntp_parse_xover (ctx, line, ctx->hdrs[ctx->msgcount]);
5108 + num = ctx->hdrs[ctx->msgcount]->article_num;
5110 + if (num >= fc->first && num <= fc->last && fc->messages[num - fc->base])
5113 + if (num > data->lastLoaded)
5114 + data->lastLoaded = num;
5115 + num = num - fc->first + 1;
5116 + total = fc->last - fc->first + 1;
5117 + if (!ctx->quiet && fc->msg && ReadInc && (num % ReadInc == 0))
5118 + mutt_message ("%s %d/%d", fc->msg, num, total);
5121 + mutt_free_header (&ctx->hdrs[ctx->msgcount]); /* skip it */
5127 +static int nntp_fetch_headers (CONTEXT *ctx, unsigned int first,
5128 + unsigned int last)
5130 + char buf[HUGE_STRING];
5131 + char *msg = _("Fetching message headers...");
5132 + NNTP_DATA *nntp_data = ((NNTP_DATA *)ctx->data);
5136 + unsigned int current;
5140 + /* if empty group or nothing to do */
5141 + if (!last || first > last)
5144 + /* fetch list of articles */
5148 + fc.messages = safe_calloc (last - first + 1, sizeof (unsigned short));
5149 + if (nntp_data->nserv->hasLISTGROUP)
5151 + mutt_message _("Fetching list of articles...");
5152 + snprintf (buf, sizeof (buf), "LISTGROUP %s\r\n", nntp_data->group);
5153 + if (mutt_nntp_fetch (nntp_data, buf, NULL, nntp_fetch_numbers, &fc, 0) != 0)
5155 + mutt_error (_("LISTGROUP command failed: %s"), buf);
5157 + nntp_error ("nntp_fetch_headers()", buf);
5159 + FREE (&fc.messages);
5165 + for (num = 0; num < last - first + 1; num++)
5166 + fc.messages[num] = 1;
5169 + /* CACHE: must be loaded xover cache here */
5170 + num = nntp_data->lastCached - first + 1;
5171 + if (option (OPTNEWSCACHE) && nntp_data->cache && num > 0)
5173 + nntp_cache_expand (buf, nntp_data->cache);
5174 + mutt_message _("Fetching headers from cache...");
5175 + if ((f = safe_fopen (buf, "r")))
5179 + /* counting number of lines */
5180 + while (fgets (buf, sizeof (buf), f) != NULL)
5183 + while (r > num && fgets (buf, sizeof (buf), f) != NULL)
5185 + oldmsgcount = ctx->msgcount;
5187 + fc.last = first + num - 1;
5189 + while (fgets (buf, sizeof (buf), f) != NULL)
5190 + add_xover_line (buf, &fc);
5192 + nntp_data->lastLoaded = fc.last;
5193 + first = fc.last + 1;
5194 + if (ctx->msgcount > oldmsgcount)
5195 + mx_update_context (ctx, ctx->msgcount - oldmsgcount);
5198 + nntp_delete_cache (nntp_data);
5200 + num = last - first + 1;
5203 + FREE (&fc.messages);
5208 + * Without XOVER, we have to fetch each article header and parse
5209 + * it. With XOVER, we ask for all of them
5211 + mutt_message (msg);
5212 + if (nntp_data->nserv->hasXOVER)
5214 + oldmsgcount = ctx->msgcount;
5218 + snprintf (buf, sizeof (buf), "XOVER %d-%d\r\n", first, last);
5219 + ret = mutt_nntp_fetch (nntp_data, buf, NULL, add_xover_line, &fc, 0);
5220 + if (ctx->msgcount > oldmsgcount)
5221 + mx_update_context (ctx, ctx->msgcount - oldmsgcount);
5224 + mutt_error (_("XOVER command failed: %s"), buf);
5226 + nntp_error ("nntp_fetch_headers()", buf);
5228 + FREE (&fc.messages);
5234 + for (current = first; current <= last; current++)
5238 + ret = current - first + 1;
5239 + mutt_message ("%s %d/%d", msg, ret, num);
5241 + if (!fc.messages[current - fc.base])
5244 + if (ctx->msgcount >= ctx->hdrmax)
5245 + mx_alloc_memory (ctx);
5246 + h = ctx->hdrs[ctx->msgcount] = mutt_new_header ();
5247 + h->index = ctx->msgcount;
5249 + ret = nntp_read_header (ctx, NULL, current);
5250 + if (ret == 0) /* Got article. Fetch next header */
5252 + nntp_get_status (ctx, h, NULL, h->article_num);
5254 + mx_update_context (ctx, 1);
5257 + mutt_free_header (&h); /* skip it */
5260 + FREE (&fc.messages);
5264 + if (current > nntp_data->lastLoaded)
5265 + nntp_data->lastLoaded = current;
5267 + FREE (&fc.messages);
5268 + nntp_data->lastLoaded = last;
5269 + mutt_clear_error ();
5274 + * currently, nntp "mailbox" is "newsgroup"
5276 +int nntp_open_mailbox (CONTEXT *ctx)
5278 + NNTP_DATA *nntp_data;
5279 + NNTP_SERVER *serv;
5280 + char buf[HUGE_STRING];
5281 + char server[LONG_STRING];
5283 + unsigned int first;
5286 + if (nntp_parse_url (ctx->path, &acct, buf, sizeof (buf)) < 0 || !*buf)
5288 + mutt_error (_("%s is an invalid newsgroup specification!"), ctx->path);
5294 + nntp_expand_path (server, sizeof (server), &acct);
5295 + if (!(serv = mutt_select_newsserver (server)) || serv->status != NNTP_OK)
5298 + CurrentNewsSrv = serv;
5300 + /* create NNTP-specific state struct if nof found in list */
5301 + if ((nntp_data = (NNTP_DATA *) hash_find (serv->newsgroups, buf)) == NULL)
5303 + nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + strlen (buf) + 1);
5304 + nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
5305 + strcpy (nntp_data->group, buf);
5306 + hash_insert (serv->newsgroups, nntp_data->group, nntp_data, 0);
5307 + nntp_add_to_list (serv, nntp_data);
5309 + ctx->data = nntp_data;
5310 + ctx->mx_close = nntp_fastclose_mailbox;
5311 + nntp_data->nserv = serv;
5313 + mutt_message (_("Selecting %s..."), nntp_data->group);
5315 + if (!nntp_data->desc)
5317 + nntp_get_desc (nntp_data, nntp_data->group, NULL);
5318 + if (nntp_data->desc)
5319 + nntp_save_cache_index (serv);
5323 + if (mutt_nntp_query (nntp_data, buf, sizeof(buf)) < 0)
5326 + nntp_error ("nntp_open_mailbox()", buf);
5331 + if (mutt_strncmp ("211", buf, 3))
5333 + LIST *l = serv->list;
5335 + /* GROUP command failed */
5336 + if (!mutt_strncmp ("411", buf, 3))
5338 + mutt_error (_("Newsgroup %s not found on server %s"),
5339 + nntp_data->group, serv->conn->account.host);
5341 + /* CACHE: delete cache and line from .index */
5342 + nntp_delete_cache (nntp_data);
5343 + hash_delete (serv->newsgroups, nntp_data->group, NULL, nntp_delete_data);
5344 + while (l && l->data != (void *) nntp_data) l = l->next;
5354 + sscanf (buf + 4, "%d %u %u %s", &count, &nntp_data->firstMessage,
5355 + &nntp_data->lastMessage, buf);
5357 + nntp_data->deleted = 0;
5359 + time (&serv->check_time);
5362 + * Check for max adding context. If it is greater than $nntp_context,
5363 + * strip off extra articles
5365 + first = nntp_data->firstMessage;
5366 + if (NntpContext && nntp_data->lastMessage - first + 1 > NntpContext)
5367 + first = nntp_data->lastMessage - NntpContext + 1;
5369 + nntp_data->lastLoaded = first - 1;
5370 + return nntp_fetch_headers (ctx, first, nntp_data->lastMessage);
5373 +int nntp_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno)
5375 + char buf[LONG_STRING];
5376 + char path[_POSIX_PATH_MAX];
5377 + NNTP_CACHE *cache;
5378 + char *m = _("Fetching message...");
5381 + /* see if we already have the message in our cache */
5382 + cache = &((NNTP_DATA *) ctx->data)->acache[ctx->hdrs[msgno]->index % NNTP_CACHE_LEN];
5384 + /* if everything is fine, assign msg->fp and return */
5385 + if (cache->path && cache->index == ctx->hdrs[msgno]->index &&
5386 + (msg->fp = fopen (cache->path, "r")))
5389 + /* clear the previous entry */
5390 + unlink (cache->path);
5391 + free (cache->path);
5395 + cache->index = ctx->hdrs[msgno]->index;
5396 + mutt_mktemp (path);
5397 + cache->path = safe_strdup (path);
5398 + if (!(msg->fp = safe_fopen (path, "w+")))
5400 + FREE (&cache->path);
5404 + if (ctx->hdrs[msgno]->article_num == 0)
5405 + snprintf (buf, sizeof (buf), "ARTICLE %s\r\n",
5406 + ctx->hdrs[msgno]->env->message_id);
5408 + snprintf (buf, sizeof (buf), "ARTICLE %d\r\n",
5409 + ctx->hdrs[msgno]->article_num);
5411 + ret = mutt_nntp_fetch ((NNTP_DATA *)ctx->data, buf, m, nntp_read_tempfile,
5412 + msg->fp, ctx->tagged);
5415 + mutt_error (_("Article %d not found on server"),
5416 + ctx->hdrs[msgno]->article_num);
5417 + dprint (1, (debugfile, "nntp_fetch_message: %s\n", buf));
5424 + FREE (&cache->path);
5428 + mutt_free_envelope (&ctx->hdrs[msgno]->env);
5429 + ctx->hdrs[msgno]->env = mutt_read_rfc822_header (msg->fp, ctx->hdrs[msgno], 0, 0);
5430 + /* fix content length */
5431 + fseek(msg->fp, 0, SEEK_END);
5432 + ctx->hdrs[msgno]->content->length = ftell (msg->fp) -
5433 + ctx->hdrs[msgno]->content->offset;
5435 + /* this is called in mutt before the open which fetches the message,
5436 + * which is probably wrong, but we just call it again here to handle
5437 + * the problem instead of fixing it.
5439 + mutt_parse_mime_message (ctx, ctx->hdrs[msgno]);
5441 + /* These would normally be updated in mx_update_context(), but the
5442 + * full headers aren't parsed with XOVER, so the information wasn't
5445 +#if defined(HAVE_PGP) || defined(HAVE_SMIME)
5446 + ctx->hdrs[msgno]->security = crypt_query (ctx->hdrs[msgno]->content);
5447 +#endif /* HAVE_PGP || HAVE_SMIME */
5449 + mutt_clear_error();
5456 +int nntp_post (const char *msg) {
5457 + char buf[LONG_STRING];
5460 + NNTP_DATA *nntp_data;
5462 + if (Context && Context->magic == M_NNTP)
5463 + nntp_data = (NNTP_DATA *)Context->data;
5466 + if (!(CurrentNewsSrv = mutt_select_newsserver (NewsServer)) ||
5467 + !CurrentNewsSrv->list || !CurrentNewsSrv->list->data)
5469 + mutt_error (_("Can't post article. No connection to news server."));
5472 + nntp_data = (NNTP_DATA *)CurrentNewsSrv->list->data;
5475 + if (!(f = safe_fopen (msg, "r")))
5477 + mutt_error (_("Can't post article. Unable to open %s"), msg);
5481 + strfcpy (buf, "POST\r\n", sizeof (buf));
5482 + if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0)
5484 + mutt_error (_("Can't post article. Connection to %s lost."),
5485 + nntp_data->nserv->conn->account.host);
5488 + if (buf[0] != '3')
5490 + mutt_error (_("Can't post article: %s"), buf);
5496 + while (fgets (buf + 1, sizeof (buf) - 2, f) != NULL)
5498 + len = strlen (buf);
5499 + if (buf[len - 1] == '\n')
5501 + buf[len - 1] = '\r';
5506 + if (buf[1] == '.')
5507 + mutt_socket_write_d (nntp_data->nserv->conn, buf, -1, M_SOCK_LOG_HDR);
5509 + mutt_socket_write_d (nntp_data->nserv->conn, buf + 1, -1, M_SOCK_LOG_HDR);
5513 + if (buf[strlen (buf) - 1] != '\n')
5514 + mutt_socket_write_d (nntp_data->nserv->conn, "\r\n", -1, M_SOCK_LOG_HDR);
5515 + mutt_socket_write_d (nntp_data->nserv->conn, ".\r\n", -1, M_SOCK_LOG_HDR);
5516 + if (mutt_socket_readln (buf, sizeof (buf), nntp_data->nserv->conn) < 0)
5518 + mutt_error (_("Can't post article. Connection to %s lost."),
5519 + nntp_data->nserv->conn->account.host);
5522 + if (buf[0] != '2')
5524 + mutt_error (_("Can't post article: %s"), buf);
5531 +/* nntp_logout_all: close all open connections. */
5532 +void nntp_logout_all (void)
5534 + char buf[LONG_STRING];
5537 + conn = mutt_socket_head ();
5541 + CONNECTION *next = conn->next;
5543 + if (conn->account.type == M_ACCT_TYPE_NNTP)
5545 + mutt_message (_("Closing connection to %s..."), conn->account.host);
5546 + mutt_socket_write (conn, "QUIT\r\n");
5547 + mutt_socket_readln (buf, sizeof (buf), conn);
5548 + mutt_clear_error ();
5549 + mutt_socket_close (conn);
5550 + mutt_socket_free (conn);
5557 +static void nntp_free_acache (NNTP_DATA *data)
5561 + for (i = 0; i < NNTP_CACHE_LEN; i++)
5563 + if (data->acache[i].path)
5565 + unlink (data->acache[i].path);
5566 + FREE (&data->acache[i].path);
5571 +void nntp_delete_data (void *p)
5573 + NNTP_DATA *data = (NNTP_DATA *)p;
5577 + FREE (&data->entries);
5578 + FREE (&data->desc);
5579 + FREE (&data->cache);
5580 + nntp_free_acache (data);
5584 +int nntp_sync_mailbox (CONTEXT *ctx)
5586 + NNTP_DATA *data = ctx->data;
5588 + /* CACHE: update cache and .index files */
5589 + if ((option (OPTSAVEUNSUB) || data->subscribed))
5590 + nntp_save_cache_group (ctx);
5591 + nntp_free_acache (data);
5593 + data->nserv->check_time = 0; /* next nntp_check_mailbox() will really check */
5597 +int nntp_fastclose_mailbox (CONTEXT *ctx)
5599 + NNTP_DATA *data = (NNTP_DATA *) ctx->data, *tmp;
5603 + nntp_free_acache (data);
5604 + if (!data->nserv || !data->nserv->newsgroups || !data->group)
5606 + nntp_save_cache_index (data->nserv);
5607 + if ((tmp = hash_find (data->nserv->newsgroups, data->group)) == NULL
5609 + nntp_delete_data (data);
5613 +/* commit changes and terminate connection */
5614 +int nntp_close_mailbox (CONTEXT *ctx)
5618 + mutt_message _("Quitting newsgroup...");
5621 + NNTP_DATA *data = (NNTP_DATA *) ctx->data;
5624 + if (data->nserv && data->nserv->conn && ctx->unread)
5626 + ret = query_quadoption (OPT_CATCHUP, _("Mark all articles read?"));
5628 + mutt_newsgroup_catchup (data->nserv, data->group);
5633 + nntp_sync_mailbox (ctx);
5634 + if (ctx->data && ((NNTP_DATA *)ctx->data)->nserv)
5636 + NNTP_SERVER *news;
5638 + news = ((NNTP_DATA *)ctx->data)->nserv;
5639 + newsrc_gen_entries (ctx);
5640 + ((NNTP_DATA *)ctx->data)->unread = ctx->unread;
5641 + mutt_newsrc_update (news);
5643 + mutt_clear_error();
5647 +/* use the GROUP command to poll for new mail */
5648 +static int _nntp_check_mailbox (CONTEXT *ctx, NNTP_DATA *nntp_data)
5650 + char buf[LONG_STRING];
5653 + if (nntp_data->nserv->check_time + NewsPollTimeout > time (NULL))
5657 + if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0)
5660 + nntp_error ("nntp_check_mailbox()", buf);
5664 + if (mutt_strncmp ("211", buf, 3))
5667 + if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0)
5670 + nntp_error ("nntp_check_mailbox()", buf);
5675 + if (!mutt_strncmp ("211", buf, 3))
5680 + sscanf (buf + 4, "%d %d %d", &count, &first, &last);
5681 + nntp_data->firstMessage = first;
5682 + nntp_data->lastMessage = last;
5683 + if (ctx && last > nntp_data->lastLoaded)
5685 + nntp_fetch_headers (ctx, nntp_data->lastLoaded + 1, last);
5686 + time (&nntp_data->nserv->check_time);
5689 + if (!last || (!nntp_data->rc && !nntp_data->lastCached))
5690 + nntp_data->unread = count;
5692 + mutt_newsgroup_stat (nntp_data);
5693 + /* active was renumbered? */
5694 + if (last < nntp_data->lastLoaded)
5696 + if (!nntp_data->max)
5698 + nntp_data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY));
5699 + nntp_data->max = 5;
5701 + nntp_data->lastCached = 0;
5702 + nntp_data->num = 1;
5703 + nntp_data->entries[0].first = 1;
5704 + nntp_data->entries[0].last = 0;
5708 + time (&nntp_data->nserv->check_time);
5712 +int nntp_check_mailbox (CONTEXT *ctx)
5714 + return _nntp_check_mailbox (ctx, (NNTP_DATA *)ctx->data);
5717 +static int add_group (char *buf, void *serv)
5719 +#define s ((NNTP_SERVER *) serv)
5720 + char group[LONG_STRING], mod, desc[HUGE_STRING];
5722 + NNTP_DATA *nntp_data;
5725 + _checked = n; /* _checked have N, where N = number of groups */
5726 + if (!buf) /* at EOF must be zerouth */
5733 + sscanf (buf, "%s %d %d %c %[^\n]", group, &last, &first, &mod, desc);
5736 + if ((nntp_data = (NNTP_DATA *) hash_find (s->newsgroups, group)) == NULL)
5739 + nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1);
5740 + nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
5741 + strcpy (nntp_data->group, group);
5742 + nntp_data->nserv = s;
5743 + if (s->newsgroups->nelem < s->newsgroups->curnelem * 2)
5744 + s->newsgroups = hash_resize (s->newsgroups, s->newsgroups->nelem * 2, 0);
5745 + hash_insert (s->newsgroups, nntp_data->group, nntp_data, 0);
5746 + nntp_add_to_list (s, nntp_data);
5748 + nntp_data->deleted = 0;
5749 + nntp_data->firstMessage = first;
5750 + nntp_data->lastMessage = last;
5752 + nntp_data->allowed = 1;
5754 + nntp_data->allowed = 0;
5755 + if (nntp_data->desc)
5756 + FREE (&nntp_data->desc);
5758 + nntp_data->desc = safe_strdup (desc);
5759 + if (nntp_data->rc || nntp_data->lastCached)
5760 + mutt_newsgroup_stat (nntp_data);
5761 + else if (nntp_data->lastMessage &&
5762 + nntp_data->firstMessage <= nntp_data->lastMessage)
5763 + nntp_data->unread = nntp_data->lastMessage - nntp_data->firstMessage + 1;
5765 + nntp_data->unread = 0;
5771 +int nntp_check_newgroups (NNTP_SERVER *serv, int force)
5773 + char buf[LONG_STRING];
5774 + char msg[SHORT_STRING];
5775 + NNTP_DATA nntp_data;
5780 + unsigned int count = 0;
5781 + unsigned int total = 0;
5783 + if (!serv || !serv->newgroups_time)
5786 + if (nntp_open_connection (serv) < 0)
5789 + /* check subscribed groups for new news */
5790 + if (option (OPTSHOWNEWNEWS))
5792 + mutt_message _("Checking for new messages...");
5793 + for (l = serv->list; l; l = l->next)
5795 + serv->check_time = 0; /* really check! */
5796 + if (l->data && ((NNTP_DATA *) l->data)->subscribed)
5797 + _nntp_check_mailbox (NULL, (NNTP_DATA *) l->data);
5803 + mutt_message _("Checking for new newsgroups...");
5804 + now = serv->newgroups_time;
5805 + time (&serv->newgroups_time);
5806 + t = gmtime (&now);
5807 + snprintf (buf, sizeof (buf), "NEWGROUPS %02d%02d%02d %02d%02d%02d GMT\r\n",
5808 + (t->tm_year % 100), t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min,
5810 + nntp_data.nserv = serv;
5811 + if (Context && Context->magic == M_NNTP)
5812 + nntp_data.group = ((NNTP_DATA *)Context->data)->group;
5814 + nntp_data.group = NULL;
5816 + if (mutt_nntp_fetch (&nntp_data, buf, _("Adding new newsgroups..."),
5817 + add_group, serv, 0) != 0)
5820 + nntp_error ("nntp_check_newgroups()", buf);
5825 + strfcpy (msg, _("Loading descriptions..."), sizeof (msg));
5826 + mutt_message (msg);
5828 + emp.next = l->next;
5830 + emp.next = serv->list;
5835 + ((NNTP_DATA *) l->data)->new = 1;
5842 + nntp_get_desc ((NNTP_DATA *) l->data, ((NNTP_DATA *) l->data)->group, NULL);
5844 + if (ReadInc && (count % ReadInc == 0))
5845 + mutt_message ("%s %d/%d", msg, count, total);
5848 + nntp_save_cache_index (serv);
5849 + mutt_clear_error ();
5853 +/* Load list of all newsgroups from cache ALL */
5854 +int nntp_get_cache_all (NNTP_SERVER *serv)
5856 + char buf[HUGE_STRING];
5859 + nntp_cache_expand (buf, serv->cache);
5860 + if ((f = safe_fopen (buf, "r")))
5864 + while (fgets (buf, sizeof(buf), f) != NULL)
5866 + if (ReadInc && (i % ReadInc == 0))
5867 + mutt_message (_("Loading list from cache... %d"), i);
5868 + add_group (buf, serv);
5871 + add_group (NULL, NULL);
5873 + mutt_clear_error ();
5878 + FREE (&serv->cache);
5883 +/* Load list of all newsgroups from active */
5884 +int nntp_get_active (NNTP_SERVER *serv)
5886 + char msg[SHORT_STRING];
5887 + NNTP_DATA nntp_data;
5890 + if (nntp_open_connection (serv) < 0)
5893 + snprintf (msg, sizeof(msg), _("Loading list of all newsgroups on server %s..."),
5894 + serv->conn->account.host);
5895 + mutt_message (msg);
5896 + time (&serv->newgroups_time);
5897 + nntp_data.nserv = serv;
5898 + nntp_data.group = NULL;
5900 + if (mutt_nntp_fetch (&nntp_data, "LIST\r\n", msg, add_group, serv, 0) < 0)
5903 + nntp_error ("nntp_get_active()", "LIST\r\n");
5908 + strfcpy (msg, _("Loading descriptions..."), sizeof (msg));
5909 + mutt_message (msg);
5910 + nntp_get_desc (&nntp_data, "*", msg);
5912 + for (tmp = serv->list; tmp; tmp = tmp->next)
5914 + NNTP_DATA *data = (NNTP_DATA *)tmp->data;
5916 + if (data && data->deleted && !data->rc)
5918 + nntp_delete_cache (data);
5919 + hash_delete (serv->newsgroups, data->group, NULL, nntp_delete_data);
5923 + nntp_save_cache_index (serv);
5925 + mutt_clear_error ();
5930 + * returns -1 if error ocurred while retrieving header,
5931 + * number of articles which ones exist in context on success.
5933 +int nntp_check_msgid (CONTEXT *ctx, const char *msgid)
5937 + /* if msgid is already in context, don't reload them */
5938 + if (hash_find (ctx->id_hash, msgid))
5940 + if (ctx->msgcount == ctx->hdrmax)
5941 + mx_alloc_memory (ctx);
5942 + ctx->hdrs[ctx->msgcount] = mutt_new_header ();
5943 + ctx->hdrs[ctx->msgcount]->index = ctx->msgcount;
5945 + mutt_message (_("Fetching %s from server..."), msgid);
5946 + ret = nntp_read_header (ctx, msgid, 0);
5947 + /* since nntp_read_header() may set read flag, we must reset it */
5948 + ctx->hdrs[ctx->msgcount]->read = 0;
5950 + mutt_free_header (&ctx->hdrs[ctx->msgcount]);
5954 + mx_update_context (ctx, 1);
5965 + unsigned int *child;
5968 +static int check_children (char *s, void *c)
5970 +#define cc ((CHILD_CONTEXT *) c)
5971 + unsigned int i, n;
5973 + if (!s || (n = atoi (s)) == 0)
5975 + for (i = 0; i < cc->ctx->msgcount; i++)
5976 + if (cc->ctx->hdrs[i]->article_num == n)
5978 + if (cc->num >= cc->max)
5979 + safe_realloc (&cc->child, sizeof (unsigned int) * (cc->max += 25));
5980 + cc->child[cc->num++] = n;
5986 +int nntp_check_children (CONTEXT *ctx, const char *msgid)
5988 + NNTP_DATA *nntp_data = (NNTP_DATA *)ctx->data;
5990 + int i, ret = 0, tmp = 0;
5993 + if (!nntp_data || !nntp_data->nserv || !nntp_data->nserv->conn ||
5994 + !nntp_data->nserv->conn->account.host)
5996 + if (nntp_data->firstMessage > nntp_data->lastLoaded)
5998 + if (!nntp_data->nserv->hasXPAT)
6000 + mutt_error (_("Server %s does not support this operation!"),
6001 + nntp_data->nserv->conn->account.host);
6005 + snprintf (buf, sizeof (buf), "XPAT References %d-%d *%s*\r\n",
6006 + nntp_data->firstMessage, nntp_data->lastLoaded, msgid);
6011 + cc.child = safe_malloc (sizeof (unsigned int) * 25);
6012 + if (mutt_nntp_fetch (nntp_data, buf, NULL, check_children, &cc, 0))
6017 + /* dont try to read the xover cache. check_children() already
6018 + * made sure that we dont have the article, so we need to visit
6019 + * the server. Reading the cache at this point is also bad
6020 + * because it would duplicate messages */
6021 + if (option (OPTNEWSCACHE))
6024 + unset_option (OPTNEWSCACHE);
6026 + for (i = 0; i < cc.num; i++)
6028 + if ((ret = nntp_fetch_headers (ctx, cc.child[i], cc.child[i])))
6030 + if (ctx->msgcount &&
6031 + ctx->hdrs[ctx->msgcount - 1]->article_num == cc.child[i])
6032 + ctx->hdrs[ctx->msgcount - 1]->read = 0;
6035 + set_option (OPTNEWSCACHE);
6039 Index: mutt-1.5.20/nntp.h
6040 ===================================================================
6041 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
6042 +++ mutt-1.5.20/nntp.h 2009-10-13 22:56:13.746871469 -0300
6045 + * Copyright (C) 1998 Brandon Long <blong@fiction.net>
6046 + * Copyright (C) 1999 Andrej Gritsenko <andrej@lucky.net>
6047 + * Copyright (C) 2000-2007 Vsevolod Volkov <vvv@mutt.org.ua>
6049 + * This program is free software; you can redistribute it and/or modify
6050 + * it under the terms of the GNU General Public License as published by
6051 + * the Free Software Foundation; either version 2 of the License, or
6052 + * (at your option) any later version.
6054 + * This program is distributed in the hope that it will be useful,
6055 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6056 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6057 + * GNU General Public License for more details.
6059 + * You should have received a copy of the GNU General Public License
6060 + * along with this program; if not, write to the Free Software
6061 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
6067 +#include "mutt_socket.h"
6068 +#include "mailbox.h"
6072 +#define NNTP_PORT 119
6073 +#define NNTP_SSL_PORT 563
6075 +/* number of entries in the hash table */
6076 +#define NNTP_CACHE_LEN 10
6093 + unsigned int hasXPAT : 1;
6094 + unsigned int hasXGTITLE : 1;
6095 + unsigned int hasXOVER : 1;
6096 + unsigned int hasLISTGROUP : 1;
6097 + unsigned int status : 3;
6103 + time_t newgroups_time;
6104 + time_t check_time;
6106 + LIST *list; /* list of newsgroups */
6107 + LIST *tail; /* last entry of list */
6113 + unsigned int index;
6119 + NEWSRC_ENTRY *entries;
6120 + unsigned int num; /* number of used entries */
6121 + unsigned int max; /* number of allocated entries */
6122 + unsigned int unread;
6123 + unsigned int firstMessage;
6124 + unsigned int lastMessage;
6125 + unsigned int lastLoaded;
6126 + unsigned int lastCached;
6127 + unsigned int subscribed : 1;
6128 + unsigned int rc : 1;
6129 + unsigned int new : 1;
6130 + unsigned int allowed : 1;
6131 + unsigned int deleted : 1;
6135 + NNTP_SERVER *nserv;
6136 + NNTP_CACHE acache[NNTP_CACHE_LEN];
6139 +/* internal functions */
6140 +int nntp_get_active (NNTP_SERVER *);
6141 +int nntp_get_cache_all (NNTP_SERVER *);
6142 +int nntp_save_cache_index (NNTP_SERVER *);
6143 +int nntp_check_newgroups (NNTP_SERVER *, int);
6144 +int nntp_save_cache_group (CONTEXT *);
6145 +int nntp_parse_url (const char *, ACCOUNT *, char *, size_t);
6146 +void newsrc_gen_entries (CONTEXT *);
6147 +void nntp_get_status (CONTEXT *, HEADER *, char *, int);
6148 +void mutt_newsgroup_stat (NNTP_DATA *);
6149 +void nntp_delete_cache (NNTP_DATA *);
6150 +void nntp_add_to_list (NNTP_SERVER *, NNTP_DATA *);
6151 +void nntp_cache_expand (char *, const char *);
6152 +void nntp_delete_data (void *);
6154 +/* exposed interface */
6155 +NNTP_SERVER *mutt_select_newsserver (char *);
6156 +NNTP_DATA *mutt_newsgroup_subscribe (NNTP_SERVER *, char *);
6157 +NNTP_DATA *mutt_newsgroup_unsubscribe (NNTP_SERVER *, char *);
6158 +NNTP_DATA *mutt_newsgroup_catchup (NNTP_SERVER *, char *);
6159 +NNTP_DATA *mutt_newsgroup_uncatchup (NNTP_SERVER *, char *);
6160 +void nntp_clear_cacheindex (NNTP_SERVER *);
6161 +int mutt_newsrc_update (NNTP_SERVER *);
6162 +int nntp_open_mailbox (CONTEXT *);
6163 +int nntp_sync_mailbox (CONTEXT *);
6164 +int nntp_check_mailbox (CONTEXT *);
6165 +int nntp_close_mailbox (CONTEXT *);
6166 +int nntp_fastclose_mailbox (CONTEXT *);
6167 +int nntp_fetch_message (MESSAGE *, CONTEXT *, int);
6168 +int nntp_post (const char *);
6169 +int nntp_check_msgid (CONTEXT *, const char *);
6170 +int nntp_check_children (CONTEXT *, const char *);
6171 +void nntp_buffy (char *);
6172 +void nntp_expand_path (char *, size_t, ACCOUNT *);
6173 +void nntp_logout_all ();
6174 +const char *nntp_format_str (char *, size_t, size_t, char, const char *, const char *,
6175 + const char *, const char *, unsigned long, format_flag);
6177 +NNTP_SERVER *CurrentNewsSrv INITVAL (NULL);
6179 +#endif /* _NNTP_H_ */
6180 Index: mutt-1.5.20/pager.c
6181 ===================================================================
6182 --- mutt-1.5.20.orig/pager.c 2009-10-13 22:47:23.749522711 -0300
6183 +++ mutt-1.5.20/pager.c 2009-10-13 22:56:13.752523891 -0300
6184 @@ -1060,6 +1060,11 @@
6194 static int format_line (struct line_t **lineInfo, int n, unsigned char *buf,
6195 int flags, ansi_attr *pa, int cnt,
6196 @@ -1515,6 +1520,16 @@
6201 +static struct mapping_t PagerNewsHelpExtra[] = {
6202 + { N_("Post"), OP_POST },
6203 + { N_("Followup"), OP_FOLLOWUP },
6204 + { N_("Del"), OP_DELETE },
6205 + { N_("Next"), OP_MAIN_NEXT_UNDELETED },
6212 /* This pager is actually not so simple as it once was. It now operates in
6213 @@ -1556,6 +1571,10 @@
6214 int old_PagerIndexLines; /* some people want to resize it
6215 * while inside the pager... */
6218 + char *followup_to;
6221 if (!(flags & M_SHOWCOLOR))
6222 flags |= M_SHOWFLAT;
6224 @@ -1595,7 +1614,11 @@
6225 if (IsHeader (extra))
6227 strfcpy (tmphelp, helpstr, sizeof (tmphelp));
6228 - mutt_compile_help (buffer, sizeof (buffer), MENU_PAGER, PagerHelpExtra);
6229 + mutt_compile_help (buffer, sizeof (buffer), MENU_PAGER,
6231 + (Context && (Context->magic == M_NNTP)) ? PagerNewsHelpExtra :
6234 snprintf (helpstr, sizeof (helpstr), "%s %s", tmphelp, buffer);
6237 @@ -2485,6 +2508,15 @@
6239 CHECK_ACL(M_ACL_WRITE, "flag message");
6242 + if (Context->magic == M_NNTP)
6245 + mutt_error _("Can't change 'important' flag on NNTP server.");
6250 mutt_set_flag (Context, extra->hdr, M_FLAG, !extra->hdr->flagged);
6251 redraw = REDRAW_STATUS | REDRAW_INDEX;
6252 if (option (OPTRESOLVE))
6253 @@ -2518,6 +2550,60 @@
6254 redraw = REDRAW_FULL;
6259 + CHECK_MODE(IsHeader (extra) && !IsAttach (extra));
6261 + if (extra->ctx && extra->ctx->magic == M_NNTP &&
6262 + !((NNTP_DATA *)extra->ctx->data)->allowed &&
6263 + query_quadoption (OPT_TOMODERATED,_("Posting to this group not allowed, may be moderated. Continue?")) != M_YES)
6265 + ci_send_message (SENDNEWS, NULL, NULL, extra->ctx, NULL);
6266 + redraw = REDRAW_FULL;
6269 + case OP_FORWARD_TO_GROUP:
6270 + CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
6272 + if (extra->ctx && extra->ctx->magic == M_NNTP &&
6273 + !((NNTP_DATA *)extra->ctx->data)->allowed &&
6274 + query_quadoption (OPT_TOMODERATED,_("Posting to this group not allowed, may be moderated. Continue?")) != M_YES)
6276 + if (IsMsgAttach (extra))
6277 + mutt_attach_forward (extra->fp, extra->hdr, extra->idx,
6278 + extra->idxlen, extra->bdy, SENDNEWS);
6280 + ci_send_message (SENDNEWS|SENDFORWARD, NULL, NULL, extra->ctx, extra->hdr);
6281 + redraw = REDRAW_FULL;
6285 + CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
6288 + if (IsMsgAttach (extra))
6289 + followup_to = extra->bdy->hdr->env->followup_to;
6291 + followup_to = extra->hdr->env->followup_to;
6293 + if (!followup_to || mutt_strcasecmp (followup_to, "poster") ||
6294 + query_quadoption (OPT_FOLLOWUPTOPOSTER,_("Reply by mail as poster prefers?")) != M_YES)
6296 + if (extra->ctx && extra->ctx->magic == M_NNTP &&
6297 + !((NNTP_DATA *)extra->ctx->data)->allowed &&
6298 + query_quadoption (OPT_TOMODERATED,_("Posting to this group not allowed, may be moderated. Continue?")) != M_YES)
6300 + if (IsMsgAttach (extra))
6301 + mutt_attach_reply (extra->fp, extra->hdr, extra->idx,
6302 + extra->idxlen, extra->bdy, SENDNEWS|SENDREPLY);
6304 + ci_send_message (SENDNEWS|SENDREPLY, NULL, NULL,
6305 + extra->ctx, extra->hdr);
6306 + redraw = REDRAW_FULL;
6312 CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
6314 @@ -2564,7 +2650,7 @@
6316 if (IsMsgAttach (extra))
6317 mutt_attach_forward (extra->fp, extra->hdr, extra->idx,
6318 - extra->idxlen, extra->bdy);
6319 + extra->idxlen, extra->bdy, 0);
6321 ci_send_message (SENDFORWARD, NULL, NULL, extra->ctx, extra->hdr);
6322 redraw = REDRAW_FULL;
6323 Index: mutt-1.5.20/parse.c
6324 ===================================================================
6325 --- mutt-1.5.20.orig/parse.c 2009-06-01 13:29:32.000000000 -0300
6326 +++ mutt-1.5.20/parse.c 2009-10-13 22:56:13.765522883 -0300
6331 -static LIST *mutt_parse_references (char *s, int in_reply_to)
6332 +LIST *mutt_parse_references (char *s, int in_reply_to)
6334 LIST *t, *lst = NULL;
6336 @@ -1067,6 +1067,17 @@
6337 e->from = rfc822_parse_adrlist (e->from, p);
6341 + else if (!mutt_strcasecmp (line+1, "ollowup-to"))
6343 + if (!e->followup_to)
6345 + mutt_remove_trailing_ws (p);
6346 + e->followup_to = safe_strdup (mutt_skip_whitespace (p));
6354 @@ -1149,6 +1160,27 @@
6360 + if (!mutt_strcasecmp (line + 1, "ewsgroups"))
6362 + FREE (&e->newsgroups);
6363 + mutt_remove_trailing_ws (p);
6364 + e->newsgroups = safe_strdup (mutt_skip_whitespace (p));
6371 + /* field `Organization:' saves only for pager! */
6372 + if (!mutt_strcasecmp (line + 1, "rganization"))
6374 + if (!e->organization && mutt_strcasecmp (p, "unknown"))
6375 + e->organization = safe_strdup (p);
6380 if (!ascii_strcasecmp (line + 1, "eferences"))
6382 @@ -1257,6 +1289,20 @@
6383 e->x_label = safe_strdup(p);
6387 + else if (!mutt_strcasecmp (line + 1, "-comment-to"))
6389 + if (!e->x_comment_to)
6390 + e->x_comment_to = safe_strdup (p);
6393 + else if (!mutt_strcasecmp (line + 1, "ref"))
6396 + e->xref = safe_strdup (p);
6403 Index: mutt-1.5.20/pattern.c
6404 ===================================================================
6405 --- mutt-1.5.20.orig/pattern.c 2009-10-13 22:47:22.827523530 -0300
6406 +++ mutt-1.5.20/pattern.c 2009-10-13 22:56:13.797724275 -0300
6408 { 'U', M_UNREAD, 0, NULL },
6409 { 'v', M_COLLAPSED, 0, NULL },
6410 { 'V', M_CRYPT_VERIFIED, 0, NULL },
6412 + { 'w', M_NEWSGROUPS, 0, eat_regexp },
6414 { 'x', M_REFERENCE, 0, eat_regexp },
6415 { 'X', M_MIMEATTACH, 0, eat_range },
6416 { 'y', M_XLABEL, 0, eat_regexp },
6417 @@ -1210,6 +1213,10 @@
6419 case M_UNREFERENCED:
6420 return (pat->not ^ (h->thread && !h->thread->child));
6422 + case M_NEWSGROUPS:
6423 + return (pat->not ^ (h->env->newsgroups && patmatch (pat, h->env->newsgroups) == 0));
6426 mutt_error (_("error: unknown op %d (report this error)."), pat->op);
6428 @@ -1291,6 +1298,7 @@
6429 progress_t progress;
6431 strfcpy (buf, NONULL (Context->pattern), sizeof (buf));
6432 + if (prompt || op != M_LIMIT)
6433 if (mutt_get_field (prompt, buf, sizeof (buf), M_PATTERN | M_CLEAR) != 0 || !buf[0])
6436 Index: mutt-1.5.20/po/POTFILES.in
6437 ===================================================================
6438 --- mutt-1.5.20.orig/po/POTFILES.in 2009-10-13 22:47:22.090589056 -0300
6439 +++ mutt-1.5.20/po/POTFILES.in 2009-10-13 22:56:13.823519855 -0300
6449 Index: mutt-1.5.20/postpone.c
6450 ===================================================================
6451 --- mutt-1.5.20.orig/postpone.c 2009-10-13 22:47:21.303522531 -0300
6452 +++ mutt-1.5.20/postpone.c 2009-10-13 22:56:13.848514288 -0300
6453 @@ -124,15 +124,26 @@
6455 if (LastModify < st.st_mtime)
6458 + int optnews = option (OPTNEWS);
6460 LastModify = st.st_mtime;
6462 if (access (Postponed, R_OK | F_OK) != 0)
6463 return (PostCount = 0);
6466 + unset_option (OPTNEWS);
6468 if (mx_open_mailbox (Postponed, M_NOSORT | M_QUIET, &ctx) == NULL)
6471 PostCount = ctx.msgcount;
6472 mx_fastclose_mailbox (&ctx);
6475 + set_option (OPTNEWS);
6480 Index: mutt-1.5.20/protos.h
6481 ===================================================================
6482 --- mutt-1.5.20.orig/protos.h 2009-06-12 20:38:52.000000000 -0300
6483 +++ mutt-1.5.20/protos.h 2009-10-13 22:56:13.874522797 -0300
6485 HASH *mutt_make_subj_hash (CONTEXT *);
6487 LIST *mutt_make_references(ENVELOPE *e);
6488 +LIST *mutt_parse_references (char *, int);
6490 char *mutt_read_rfc822_line (FILE *, char *, size_t *);
6491 ENVELOPE *mutt_read_rfc822_header (FILE *, HEADER *, short, short);
6492 Index: mutt-1.5.20/recvattach.c
6493 ===================================================================
6494 --- mutt-1.5.20.orig/recvattach.c 2009-05-18 21:11:35.000000000 -0300
6495 +++ mutt-1.5.20/recvattach.c 2009-10-13 22:56:13.907516666 -0300
6496 @@ -1110,6 +1110,15 @@
6501 + if (Context->magic == M_NNTP)
6504 + mutt_error _("Can't delete attachment from newsserver.");
6509 if (WithCrypto && hdr->security & ~PGP_TRADITIONAL_CHECKED)
6512 @@ -1201,10 +1210,33 @@
6513 case OP_FORWARD_MESSAGE:
6515 mutt_attach_forward (fp, hdr, idx, idxlen,
6516 - menu->tagprefix ? NULL : idx[menu->current]->content);
6517 + menu->tagprefix ? NULL : idx[menu->current]->content, 0);
6518 menu->redraw = REDRAW_FULL;
6522 + case OP_FORWARD_TO_GROUP:
6524 + mutt_attach_forward (fp, hdr, idx, idxlen,
6525 + menu->tagprefix ? NULL : idx[menu->current]->content, SENDNEWS);
6526 + menu->redraw = REDRAW_FULL;
6532 + if (!idx[menu->current]->content->hdr->env->followup_to ||
6533 + mutt_strcasecmp (idx[menu->current]->content->hdr->env->followup_to, "poster") ||
6534 + query_quadoption (OPT_FOLLOWUPTOPOSTER,_("Reply by mail as poster prefers?")) != M_YES)
6536 + mutt_attach_reply (fp, hdr, idx, idxlen,
6537 + menu->tagprefix ? NULL : idx[menu->current]->content,
6538 + SENDNEWS|SENDREPLY);
6539 + menu->redraw = REDRAW_FULL;
6545 case OP_GROUP_REPLY:
6547 Index: mutt-1.5.20/recvcmd.c
6548 ===================================================================
6549 --- mutt-1.5.20.orig/recvcmd.c 2009-06-12 14:24:17.000000000 -0300
6550 +++ mutt-1.5.20/recvcmd.c 2009-10-13 22:56:13.932668530 -0300
6552 static void attach_forward_bodies (FILE * fp, HEADER * hdr,
6553 ATTACHPTR ** idx, short idxlen,
6556 + short nattach, int flags)
6559 short mime_fwd_all = 0;
6563 /* now that we have the template, send it. */
6564 - ci_send_message (0, tmphdr, tmpbody, NULL, parent);
6565 + ci_send_message (flags, tmphdr, tmpbody, NULL, parent);
6572 static void attach_forward_msgs (FILE * fp, HEADER * hdr,
6573 - ATTACHPTR ** idx, short idxlen, BODY * cur)
6574 + ATTACHPTR ** idx, short idxlen, BODY * cur, int flags)
6576 HEADER *curhdr = NULL;
6578 @@ -679,23 +679,23 @@
6580 mutt_free_header (&tmphdr);
6582 - ci_send_message (0, tmphdr, *tmpbody ? tmpbody : NULL,
6583 + ci_send_message (flags, tmphdr, *tmpbody ? tmpbody : NULL,
6588 void mutt_attach_forward (FILE * fp, HEADER * hdr,
6589 - ATTACHPTR ** idx, short idxlen, BODY * cur)
6590 + ATTACHPTR ** idx, short idxlen, BODY * cur, int flags)
6595 if (check_all_msg (idx, idxlen, cur, 0) == 0)
6596 - attach_forward_msgs (fp, hdr, idx, idxlen, cur);
6597 + attach_forward_msgs (fp, hdr, idx, idxlen, cur, flags);
6600 nattach = count_tagged (idx, idxlen);
6601 - attach_forward_bodies (fp, hdr, idx, idxlen, cur, nattach);
6602 + attach_forward_bodies (fp, hdr, idx, idxlen, cur, nattach, flags);
6606 @@ -753,28 +753,40 @@
6612 + if ((flags & SENDNEWS))
6614 - if (mutt_fetch_recips (env, curenv, flags) == -1)
6616 + /* in case followup set Newsgroups: with Followup-To: if it present */
6617 + if (!env->newsgroups && curenv &&
6618 + mutt_strcasecmp (curenv->followup_to, "poster"))
6619 + env->newsgroups = safe_strdup (curenv->followup_to);
6624 - for (i = 0; i < idxlen; i++)
6627 - if (idx[i]->content->tagged
6628 - && mutt_fetch_recips (env, idx[i]->content->hdr->env, flags) == -1)
6629 + if (mutt_fetch_recips (env, curenv, flags) == -1)
6634 + for (i = 0; i < idxlen; i++)
6636 + if (idx[i]->content->tagged
6637 + && mutt_fetch_recips (env, idx[i]->content->hdr->env, flags) == -1)
6642 + if ((flags & SENDLISTREPLY) && !env->to)
6644 + mutt_error _("No mailing lists found!");
6648 + mutt_fix_reply_recipients (env);
6651 - if ((flags & SENDLISTREPLY) && !env->to)
6653 - mutt_error _("No mailing lists found!");
6657 - mutt_fix_reply_recipients (env);
6658 mutt_make_misc_reply_headers (env, Context, curhdr, curenv);
6661 @@ -835,6 +847,13 @@
6662 char prefix[SHORT_STRING];
6666 + if (flags & SENDNEWS)
6667 + set_option (OPTNEWSSEND);
6669 + unset_option (OPTNEWSSEND);
6672 if (check_all_msg (idx, idxlen, cur, 0) == -1)
6674 nattach = count_tagged (idx, idxlen);
6675 Index: mutt-1.5.20/rfc1524.c
6676 ===================================================================
6677 --- mutt-1.5.20.orig/rfc1524.c 2009-05-30 14:20:08.000000000 -0300
6678 +++ mutt-1.5.20/rfc1524.c 2009-10-13 22:56:13.967520110 -0300
6679 @@ -569,13 +569,13 @@
6683 -int mutt_rename_file (char *oldfile, char *newfile)
6684 +int _mutt_rename_file (char *oldfile, char *newfile, int overwrite)
6688 if (access (oldfile, F_OK) != 0)
6690 - if (access (newfile, F_OK) == 0)
6691 + if (!overwrite && access (newfile, F_OK) == 0)
6693 if ((ofp = fopen (oldfile,"r")) == NULL)
6696 mutt_unlink (oldfile);
6700 +int mutt_rename_file (char *oldfile, char *newfile)
6702 + return _mutt_rename_file (oldfile, newfile, 0);
6704 Index: mutt-1.5.20/rfc1524.h
6705 ===================================================================
6706 --- mutt-1.5.20.orig/rfc1524.h 2008-11-11 17:55:47.000000000 -0200
6707 +++ mutt-1.5.20/rfc1524.h 2009-10-13 22:56:13.991619985 -0300
6709 int rfc1524_expand_filename (char *, char *, char *, size_t);
6710 int rfc1524_mailcap_lookup (BODY *, char *, rfc1524_entry *, int);
6711 int mutt_rename_file (char *, char *);
6712 +int _mutt_rename_file (char *, char *, int);
6714 #endif /* _RFC1524_H */
6715 Index: mutt-1.5.20/send.c
6716 ===================================================================
6717 --- mutt-1.5.20.orig/send.c 2009-06-12 20:38:52.000000000 -0300
6718 +++ mutt-1.5.20/send.c 2009-10-13 22:56:14.017518007 -0300
6720 #include <sys/types.h>
6729 #include "remailer.h"
6731 @@ -213,17 +218,51 @@
6735 -static int edit_envelope (ENVELOPE *en)
6736 +static int edit_envelope (ENVELOPE *en, int flags)
6738 char buf[HUGE_STRING];
6739 LIST *uh = UserHeader;
6741 - if (edit_address (&en->to, "To: ") == -1 || en->to == NULL)
6743 - if (option (OPTASKCC) && edit_address (&en->cc, "Cc: ") == -1)
6745 - if (option (OPTASKBCC) && edit_address (&en->bcc, "Bcc: ") == -1)
6748 + if (option (OPTNEWSSEND))
6750 + if (en->newsgroups)
6751 + strfcpy (buf, en->newsgroups, sizeof (buf));
6754 + if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) != 0)
6756 + FREE (&en->newsgroups);
6757 + en->newsgroups = safe_strdup (buf);
6759 + if (en->followup_to)
6760 + strfcpy (buf, en->followup_to, sizeof (buf));
6763 + if (option (OPTASKFOLLOWUP) && mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) != 0)
6765 + FREE (&en->followup_to);
6766 + en->followup_to = safe_strdup (buf);
6768 + if (en->x_comment_to)
6769 + strfcpy (buf, en->x_comment_to, sizeof (buf));
6772 + if (option (OPTXCOMMENTTO) && option (OPTASKXCOMMENTTO) && mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) != 0)
6774 + FREE (&en->x_comment_to);
6775 + en->x_comment_to = safe_strdup (buf);
6780 + if (edit_address (&en->to, "To: ") == -1 || en->to == NULL)
6782 + if (option (OPTASKCC) && edit_address (&en->cc, "Cc: ") == -1)
6784 + if (option (OPTASKBCC) && edit_address (&en->bcc, "Bcc: ") == -1)
6790 @@ -259,6 +298,14 @@
6795 +char *nntp_get_header (const char *s)
6798 + return safe_strdup (s);
6802 static void process_user_recips (ENVELOPE *env)
6804 LIST *uh = UserHeader;
6805 @@ -271,6 +318,14 @@
6806 env->cc = rfc822_parse_adrlist (env->cc, uh->data + 3);
6807 else if (ascii_strncasecmp ("bcc:", uh->data, 4) == 0)
6808 env->bcc = rfc822_parse_adrlist (env->bcc, uh->data + 4);
6810 + else if (ascii_strncasecmp ("newsgroups:", uh->data, 11) == 0)
6811 + env->newsgroups = nntp_get_header (uh->data + 11);
6812 + else if (ascii_strncasecmp ("followup-to:", uh->data, 12) == 0)
6813 + env->followup_to = nntp_get_header (uh->data + 12);
6814 + else if (ascii_strncasecmp ("x-comment-to:", uh->data, 13) == 0)
6815 + env->x_comment_to = nntp_get_header (uh->data + 13);
6820 @@ -309,6 +364,12 @@
6821 else if (ascii_strncasecmp ("to:", uh->data, 3) != 0 &&
6822 ascii_strncasecmp ("cc:", uh->data, 3) != 0 &&
6823 ascii_strncasecmp ("bcc:", uh->data, 4) != 0 &&
6825 + ascii_strncasecmp ("newsgroups:", uh->data, 11) != 0 &&
6826 + ascii_strncasecmp ("followup-to:", uh->data, 12) != 0 &&
6827 + ascii_strncasecmp ("x-comment-to:", uh->data, 13) != 0 &&
6829 + ascii_strncasecmp ("supersedes:", uh->data, 11) != 0 &&
6830 ascii_strncasecmp ("subject:", uh->data, 8) != 0 &&
6831 ascii_strncasecmp ("return-path:", uh->data, 12) != 0)
6833 @@ -657,6 +718,10 @@
6838 + if (option (OPTNEWSSEND) && option (OPTXCOMMENTTO) && curenv->from)
6839 + env->x_comment_to = safe_strdup (mutt_get_name (curenv->from));
6844 @@ -719,6 +784,16 @@
6846 if (flags & SENDREPLY)
6849 + if ((flags & SENDNEWS))
6851 + /* in case followup set Newsgroups: with Followup-To: if it present */
6852 + if (!env->newsgroups && curenv &&
6853 + mutt_strcasecmp (curenv->followup_to, "poster"))
6854 + env->newsgroups = safe_strdup (curenv->followup_to);
6861 @@ -865,7 +940,18 @@
6862 * it hasn't already been set
6865 - if (option (OPTFOLLOWUPTO) && !e->mail_followup_to)
6866 + if (!option (OPTFOLLOWUPTO))
6869 + if (option (OPTNEWSSEND))
6871 + if (!e->followup_to && e->newsgroups && (strrchr (e->newsgroups, ',')))
6872 + e->followup_to = safe_strdup (e->newsgroups);
6877 + if (!e->mail_followup_to)
6879 if (mutt_is_list_cc (0, e->to, e->cc))
6881 @@ -1026,6 +1112,9 @@
6886 + if (!option (OPTNEWSSEND))
6887 +#endif /* USE_NNTP */
6889 return mutt_smtp_send (msg->env->from, msg->env->to, msg->env->cc,
6890 msg->env->bcc, tempfile,
6891 @@ -1137,6 +1226,13 @@
6896 + if (flags & SENDNEWS)
6897 + set_option (OPTNEWSSEND);
6899 + unset_option (OPTNEWSSEND);
6902 if (!flags && !msg && quadoption (OPT_RECALL) != M_NO &&
6903 mutt_num_postponed (1))
6905 @@ -1167,6 +1263,22 @@
6907 if ((flags = mutt_get_postponed (ctx, msg, &cur, fcc, sizeof (fcc))) < 0)
6911 + * If postponed message is a news article, it have
6912 + * a "Newsgroups:" header line, then set appropriate flag.
6914 + if (msg->env->newsgroups)
6916 + flags |= SENDNEWS;
6917 + set_option (OPTNEWSSEND);
6921 + flags &= ~SENDNEWS;
6922 + unset_option (OPTNEWSSEND);
6927 if (flags & (SENDPOSTPONED|SENDRESEND))
6928 @@ -1278,11 +1390,16 @@
6929 if (flags & SENDREPLY)
6930 mutt_fix_reply_recipients (msg->env);
6933 + if ((flags & SENDNEWS) && ctx && ctx->magic == M_NNTP && !msg->env->newsgroups)
6934 + msg->env->newsgroups = safe_strdup (((NNTP_DATA *)ctx->data)->group);
6937 if (! (flags & SENDMAILX) &&
6938 ! (option (OPTAUTOEDIT) && option (OPTEDITHDRS)) &&
6939 ! ((flags & SENDREPLY) && option (OPTFASTREPLY)))
6941 - if (edit_envelope (msg->env) == -1)
6942 + if (edit_envelope (msg->env, flags) == -1)
6946 @@ -1539,6 +1656,11 @@
6951 + if (flags & SENDNEWS)
6952 + mutt_message _("Article not posted.");
6955 mutt_message _("Mail not sent.");
6958 @@ -1571,6 +1693,9 @@
6963 + if (!(flags & SENDNEWS))
6965 if (!has_recips (msg->env->to) && !has_recips (msg->env->cc) &&
6966 !has_recips (msg->env->bcc))
6968 @@ -1604,6 +1729,19 @@
6969 mutt_error _("No subject specified.");
6973 + if ((flags & SENDNEWS) && !msg->env->subject)
6975 + mutt_error _("No subject specified.");
6979 + if ((flags & SENDNEWS) && !msg->env->newsgroups)
6981 + mutt_error _("No newsgroup specified.");
6986 if (msg->content->next)
6987 msg->content = mutt_make_multipart (msg->content);
6988 @@ -1810,7 +1948,12 @@
6991 else if (!option (OPTNOCURSES) && ! (flags & SENDMAILX))
6992 - mutt_message (i == 0 ? _("Mail sent.") : _("Sending in background."));
6993 + mutt_message (i != 0 ? _("Sending in background.") :
6995 + (flags & SENDNEWS) ? _("Article posted.") : _("Mail sent."));
7000 if (WithCrypto && (msg->security & ENCRYPT))
7002 Index: mutt-1.5.20/sendlib.c
7003 ===================================================================
7004 --- mutt-1.5.20.orig/sendlib.c 2009-06-14 12:46:11.000000000 -0300
7005 +++ mutt-1.5.20/sendlib.c 2009-10-13 22:56:14.021525314 -0300
7007 #include <sys/wait.h>
7014 #ifdef HAVE_SYSEXITS_H
7015 #include <sysexits.h>
7016 #else /* Make sure EX_OK is defined <philiph@pobox.com> */
7017 @@ -1529,6 +1533,14 @@
7020 int refcnt = 0, refmax = 0;
7021 + int multiline = 1;
7030 for ( ; (trim == 0 || refcnt < trim) && r ; r = r->next)
7032 @@ -1539,9 +1551,11 @@
7034 while (refcnt-- > 0)
7037 + if (multiline || space)
7040 fputs (ref[refcnt]->data, f);
7042 + if (multiline && refcnt >= 1)
7046 @@ -1868,6 +1882,9 @@
7047 mutt_write_address_list (env->to, fp, 4, 0);
7051 + if (!option (OPTNEWSSEND))
7053 fputs ("To: \n", fp);
7056 @@ -1876,6 +1893,9 @@
7057 mutt_write_address_list (env->cc, fp, 4, 0);
7061 + if (!option (OPTNEWSSEND))
7063 fputs ("Cc: \n", fp);
7066 @@ -1887,8 +1907,28 @@
7071 + if (!option (OPTNEWSSEND))
7073 fputs ("Bcc: \n", fp);
7076 + if (env->newsgroups)
7077 + fprintf (fp, "Newsgroups: %s\n", env->newsgroups);
7078 + else if (mode == 1 && option (OPTNEWSSEND))
7079 + fputs ("Newsgroups: \n", fp);
7081 + if (env->followup_to)
7082 + fprintf (fp, "Followup-To: %s\n", env->followup_to);
7083 + else if (mode == 1 && option (OPTNEWSSEND))
7084 + fputs ("Followup-To: \n", fp);
7086 + if (env->x_comment_to)
7087 + fprintf (fp, "X-Comment-To: %s\n", env->x_comment_to);
7088 + else if (mode == 1 && option (OPTNEWSSEND) && option (OPTXCOMMENTTO))
7089 + fputs ("X-Comment-To: \n", fp);
7093 mutt_write_one_header (fp, "Subject", env->subject, NULL, 0, 0);
7095 @@ -1907,6 +1947,9 @@
7096 fputs ("Reply-To: \n", fp);
7098 if (env->mail_followup_to)
7100 + if (!option (OPTNEWSSEND))
7103 fputs ("Mail-Followup-To: ", fp);
7104 mutt_write_address_list (env->mail_followup_to, fp, 18, 0);
7105 @@ -2245,11 +2288,30 @@
7106 const char *msg, /* file containing message */
7107 int eightbit) /* message contains 8bit chars */
7109 - char *ps = NULL, *path = NULL, *s = safe_strdup (Sendmail), *childout = NULL;
7110 + char *ps = NULL, *path = NULL, *s = NULL, *childout = NULL;
7112 size_t argslen = 0, argsmax = 0;
7116 + if (option (OPTNEWSSEND))
7118 + char cmd[LONG_STRING];
7120 + mutt_FormatString (cmd, sizeof (cmd), 0, NONULL (Inews), nntp_format_str, 0, 0);
7123 + i = nntp_post (msg);
7128 + s = safe_strdup (cmd);
7132 + s = safe_strdup (Sendmail);
7136 while ((ps = strtok (ps, " ")))
7137 @@ -2273,6 +2335,10 @@
7142 + if (!option (OPTNEWSSEND))
7145 if (eightbit && option (OPTUSE8BITMIME))
7146 args = add_option (args, &argslen, &argsmax, "-B8BITMIME");
7148 @@ -2304,6 +2370,9 @@
7149 args = add_args (args, &argslen, &argsmax, to);
7150 args = add_args (args, &argslen, &argsmax, cc);
7151 args = add_args (args, &argslen, &argsmax, bcc);
7156 if (argslen == argsmax)
7157 safe_realloc (&args, sizeof (char *) * (++argsmax));
7158 @@ -2384,6 +2453,9 @@
7159 rfc2047_encode_string (&env->x_label);
7163 + if (!option (OPTNEWSSEND) || option (OPTMIMESUBJECT))
7166 rfc2047_encode_string (&env->subject);
7168 @@ -2504,6 +2576,10 @@
7170 rfc822_write_address (resent_from, sizeof (resent_from), from, 0);
7173 + unset_option (OPTNEWSSEND);
7176 ret = _mutt_bounce_message (fp, h, to, resent_from, from);
7178 rfc822_free_address (&from);
7179 Index: mutt-1.5.20/sort.c
7180 ===================================================================
7181 --- mutt-1.5.20.orig/sort.c 2008-11-11 17:55:47.000000000 -0200
7182 +++ mutt-1.5.20/sort.c 2009-10-13 22:56:14.084521485 -0300
7183 @@ -151,6 +151,15 @@
7184 HEADER **ha = (HEADER **) a;
7185 HEADER **hb = (HEADER **) b;
7188 + if ((*ha)->article_num && (*hb)->article_num)
7190 + int result = (*ha)->article_num - (*hb)->article_num;
7191 + AUXSORT(result,a,b);
7192 + return (SORTCODE (result));
7196 /* no need to auxsort because you will never have equality here */
7197 return (SORTCODE ((*ha)->index - (*hb)->index));
7199 Index: mutt-1.5.20/url.c
7200 ===================================================================
7201 --- mutt-1.5.20.orig/url.c 2009-10-13 22:47:22.706521389 -0300
7202 +++ mutt-1.5.20/url.c 2009-10-13 22:56:14.101522297 -0300
7204 { "imaps", U_IMAPS },
7207 + { "news", U_NNTP },
7208 + { "newss", U_NNTPS },
7209 { "mailto", U_MAILTO },
7211 { "smtps", U_SMTPS },
7212 Index: mutt-1.5.20/url.h
7213 ===================================================================
7214 --- mutt-1.5.20.orig/url.h 2008-11-11 17:55:47.000000000 -0200
7215 +++ mutt-1.5.20/url.h 2009-10-13 22:56:14.143520205 -0300
7225 Index: mutt-1.5.20/Makefile.am
7226 ===================================================================
7227 --- mutt-1.5.20.orig/Makefile.am 2009-10-13 22:47:23.561990081 -0300
7228 +++ mutt-1.5.20/Makefile.am 2009-10-13 22:56:14.160520228 -0300
7230 mutt_idna.c mutt_sasl.c mutt_socket.c mutt_ssl.c mutt_ssl_gnutls.c \
7231 mutt_tunnel.c pgp.c pgpinvoke.c pgpkey.c pgplib.c pgpmicalg.c \
7232 pgppacket.c pop.c pop_auth.c pop_lib.c remailer.c resize.c sha1.c \
7234 smime.c smtp.c utf8.c wcwidth.c \
7235 bcache.h browser.h hcache.h mbyte.h mutt_idna.h remailer.h url.h
7238 mutt_regex.h mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h \
7239 mx.h pager.h pgp.h pop.h protos.h rfc1524.h rfc2047.h \
7240 rfc2231.h rfc822.h rfc3676.h sha1.h sort.h mime.types VERSION prepare \
7241 + nntp.h ChangeLog.nntp \
7242 _regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \
7243 mbyte.h lib.h extlib.c pgpewrap.c smime_keys.pl pgplib.h \
7244 README.SSL smime.h \
7245 Index: mutt-1.5.20/doc/Muttrc
7246 ===================================================================
7247 --- mutt-1.5.20.orig/doc/Muttrc 2009-10-13 22:47:23.846518611 -0300
7248 +++ mutt-1.5.20/doc/Muttrc 2009-10-13 22:56:14.165523331 -0300
7249 @@ -281,6 +281,28 @@
7250 # of the value as shown above if included.
7253 +# set ask_follow_up=no
7255 +# Name: ask_follow_up
7260 +# If set, Mutt will prompt you for follow-up groups before editing
7261 +# the body of an outgoing message.
7264 +# set ask_x_comment_to=no
7266 +# Name: ask_x_comment_to
7271 +# If set, Mutt will prompt you for x-comment-to field before editing
7272 +# the body of an outgoing message.
7275 # set attach_format="%u%D%I %t%4n %T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] "
7277 # Name: attach_format
7278 @@ -466,6 +488,17 @@
7279 # set certificate_file=~/.mutt/certificates
7282 +# set catchup_newsgroup=ask-yes
7284 +# Name: catchup_newsgroup
7289 +# If this variable is set, Mutt will mark all articles in newsgroup
7290 +# as read when you quit the newsgroup (catchup newsgroup).
7296 @@ -1141,6 +1174,19 @@
7297 # of the same email for you.
7300 +# set followup_to_poster=ask-yes
7302 +# Name: followup_to_poster
7307 +# If this variable is set and the keyword "poster" is present in
7308 +# Followup-To header, follow-up to newsgroup function is not
7309 +# permitted. The message will be mailed to the submitter of the
7310 +# message via mail.
7316 @@ -1251,6 +1297,28 @@
7317 # ``Franklin'' to ``Franklin, Steve''.
7320 +# set group_index_format="%4C %M%N %5s %-45.45f %d"
7322 +# Name: group_index_format
7324 +# Default: "%4C %M%N %5s %-45.45f %d"
7327 +# This variable allows you to customize the newsgroup browser display to
7328 +# your personal taste. This string is similar to ``index_format'', but
7329 +# has its own set of printf()-like sequences:
7331 +# %C current newsgroup number
7332 +# %d description of newsgroup (becomes from server)
7333 +# %f newsgroup name
7334 +# %M - if newsgroup not allowed for direct post (moderated for example)
7335 +# %N N if newsgroup is new, u if unsubscribed, blank otherwise
7336 +# %n number of new articles in newsgroup
7337 +# %s number of unread articles in newsgroup
7338 +# %>X right justify the rest of the string and pad with character "X"
7339 +# %|X pad to the end of the line with character "X"
7345 @@ -1799,6 +1867,7 @@
7346 # %E number of messages in current thread
7347 # %f sender (address + real name), either From: or Return-Path:
7348 # %F author name, or recipient name if the message is from you
7349 +# %g newsgroup name (if compiled with nntp support)
7350 # %H spam attribute(s) of this message
7351 # %i message-id of the current message
7352 # %l number of lines in the message (does not work with maildir,
7353 @@ -1814,12 +1883,14 @@
7354 # stashed the message: list name or recipient name
7355 # if not sent to a list
7356 # %P progress indicator for the builtin pager (how much of the file has been displayed)
7357 +# %R `x-comment-to:' field (if present and compiled with nntp support)
7358 # %s subject of the message
7359 # %S status of the message (``N''/``D''/``d''/``!''/``r''/*)
7360 # %t ``To:'' field (recipients)
7361 # %T the appropriate character from the $to_chars string
7362 # %u user (login) name of the author
7363 # %v first name of the author, or the recipient if the message is from you
7364 +# %W name of organization of author (`organization:' field)
7365 # %X number of attachments
7366 # (please see the ``attachments'' section for possible speed effects)
7367 # %y ``X-Label:'' field, if present
7368 @@ -1855,6 +1926,22 @@
7369 # ``save-hook'', ``fcc-hook'' and ``fcc-save-hook'', too.
7379 +# If set, specifies the program and arguments used to deliver news posted
7380 +# by Mutt. Otherwise, mutt posts article using current connection to
7381 +# news server. The following printf-style sequence is understood:
7383 +# %s newsserver name
7385 +# Example: set inews="/usr/local/bin/inews -hS"
7388 # set ispell="ispell"
7391 @@ -2208,6 +2295,18 @@
7392 # be attached to the newly composed message if this option is set.
7395 +# set mime_subject=yes
7397 +# Name: mime_subject
7402 +# If unset, 8-bit ``subject:'' line in article header will not be
7403 +# encoded according to RFC2047 to base64. This is useful when message
7404 +# is Usenet article, because MIME for news is nonstandard feature.
7407 # set mix_entry_format="%4n %c %-16s %a"
7409 # Name: mix_entry_format
7410 @@ -2274,6 +2373,118 @@
7411 # See also $read_inc, $write_inc and $net_inc.
7414 +# set news_cache_dir="~/.mutt"
7416 +# Name: news_cache_dir
7418 +# Default: "~/.mutt"
7421 +# This variable pointing to directory where Mutt will save cached news
7422 +# articles headers in. If unset, headers will not be saved at all
7423 +# and will be reloaded each time when you enter to newsgroup.
7426 +# set news_server=""
7428 +# Name: news_server
7433 +# This variable specifies domain name or address of NNTP server. It
7434 +# defaults to the newsserver specified in the environment variable
7435 +# $NNTPSERVER or contained in the file /etc/nntpserver. You can also
7436 +# specify username and an alternative port for each newsserver, ie:
7438 +# [news[s]://][username[:password]@]newsserver[:port]
7441 +# set newsrc="~/.newsrc"
7445 +# Default: "~/.newsrc"
7448 +# The file, containing info about subscribed newsgroups - names and
7449 +# indexes of read articles. The following printf-style sequence
7452 +# %s newsserver name
7455 +# set nntp_context=1000
7457 +# Name: nntp_context
7462 +# This variable defines number of articles which will be in index when
7463 +# newsgroup entered. If active newsgroup have more articles than this
7464 +# number, oldest articles will be ignored. Also controls how many
7465 +# articles headers will be saved in cache when you quit newsgroup.
7468 +# set nntp_load_description=yes
7470 +# Name: nntp_load_description
7475 +# This variable controls whether or not descriptions for each newsgroup
7476 +# must be loaded when newsgroup is added to list (first time list
7477 +# loading or new newsgroup adding).
7487 +# Your login name on the NNTP server. If unset and NNTP server requires
7488 +# authentification, Mutt will prompt you for your account name when you
7489 +# connect to newsserver.
7499 +# Your password for NNTP account.
7509 +# The time in seconds until any operations on newsgroup except post new
7510 +# article will cause recheck for new news. If set to 0, Mutt will
7511 +# recheck newsgroup on each operation in index (stepping, read article,
7515 +# set nntp_reconnect=ask-yes
7517 +# Name: nntp_reconnect
7522 +# Controls whether or not Mutt will try to reconnect to newsserver when
7526 # set pager="builtin"
7529 @@ -2989,6 +3200,19 @@
7530 # string after the inclusion of a message which is being replied to.
7533 +# set post_moderated=ask-yes
7535 +# Name: post_moderated
7540 +# If set to yes, Mutt will post article to newsgroup that have
7541 +# not permissions to posting (e.g. moderated). Note: if newsserver
7542 +# does not support posting to that newsgroup or totally read-only, that
7543 +# posting will not have an effect.
7546 # set postpone=ask-yes
7549 @@ -3563,6 +3787,41 @@
7550 # shell from /etc/passwd is used.
7553 +# set save_unsubscribed=no
7555 +# Name: save_unsubscribed
7560 +# When set, info about unsubscribed newsgroups will be saved into
7561 +# ``newsrc'' file and into cache.
7564 +# set show_new_news=yes
7566 +# Name: show_new_news
7571 +# If set, newsserver will be asked for new newsgroups on entering
7572 +# the browser. Otherwise, it will be done only once for a newsserver.
7573 +# Also controls whether or not number of new articles of subscribed
7574 +# newsgroups will be then checked.
7577 +# set show_only_unread=no
7579 +# Name: show_only_unread
7584 +# If set, only subscribed newsgroups that contain unread articles
7585 +# will be displayed in browser.
7588 # set sig_dashes=yes
7591 @@ -4768,3 +5027,14 @@
7592 # ``tuning'' section of the manual for performance considerations.
7595 +# set x_comment_to=no
7597 +# Name: x_comment_to
7602 +# If set, Mutt will add ``X-Comment-To:'' field (that contains full
7603 +# name of original article author) to article that followuped to newsgroup.