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 2010-02-22 20:00:43.437695887 -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 2010-02-22 19:59:29.000000000 -0300
392 +++ mutt-1.5.20/OPS 2010-02-22 20:00:43.437695887 -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 2010-02-22 19:59:29.000000000 -0300
494 +++ mutt-1.5.20/account.c 2010-02-22 20:00:43.437695887 -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 2010-02-22 20:00:43.437695887 -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 2010-02-22 20:00:43.438696967 -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 2010-02-22 19:59:29.000000000 -0300
576 +++ mutt-1.5.20/browser.c 2010-02-22 20:00:43.438696967 -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 2010-02-22 20:00:43.438696967 -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 2010-02-22 19:59:29.000000000 -0300
1200 +++ mutt-1.5.20/buffy.c 2010-02-22 20:00:43.439697129 -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 2010-02-22 20:00:43.439697129 -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 2010-02-22 19:59:29.000000000 -0300
1348 +++ mutt-1.5.20/compose.c 2010-02-22 20:00:43.439697129 -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 2010-02-22 19:59:29.000000000 -0300
1652 +++ mutt-1.5.20/configure.ac 2010-02-22 20:00:43.440696509 -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 2010-02-22 19:59:29.000000000 -0300
1671 +++ mutt-1.5.20/curs_main.c 2010-02-22 20:00:43.441696938 -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 2010-02-22 19:59:29.000000000 -0300
2095 +++ mutt-1.5.20/doc/manual.xml.head 2010-02-22 20:00:43.443696373 -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 2010-02-22 19:59:29.000000000 -0300
2122 +++ mutt-1.5.20/doc/mutt.man 2010-02-22 20:00:43.443696373 -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 2010-02-22 19:59:29.000000000 -0300
2148 +++ mutt-1.5.20/functions.h 2010-02-22 20:00:43.443696373 -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 2010-02-22 19:59:29.000000000 -0300
2311 +++ mutt-1.5.20/globals.h 2010-02-22 20:00:43.444821897 -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 2010-02-22 20:00:43.444821897 -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 2010-02-22 20:00:43.444821897 -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 2010-02-22 20:00:43.444821897 -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/init.c
2498 ===================================================================
2499 --- mutt-1.5.20.orig/init.c 2010-02-22 19:59:29.000000000 -0300
2500 +++ mutt-1.5.20/init.c 2010-02-22 20:00:43.445641176 -0300
2501 @@ -3093,6 +3093,28 @@
2503 Fqdn = safe_strdup(NONULL(Hostname));
2510 + if ((f = safe_fopen (SYSCONFDIR "/nntpserver", "r")))
2513 + fgets (buffer, sizeof (buffer), f);
2517 + while (*i && (*i != ' ') && (*i != '\t') && (*i != '\r') && (*i != '\n')) i++;
2519 + NewsServer = safe_strdup (p);
2523 + if ((p = getenv ("NNTPSERVER")))
2524 + NewsServer = safe_strdup (p);
2527 if ((p = getenv ("MAIL")))
2528 Spoolfile = safe_strdup (p);
2529 else if ((p = getenv ("MAILDIR")))
2530 Index: mutt-1.5.20/init.h
2531 ===================================================================
2532 --- mutt-1.5.20.orig/init.h 2010-02-22 19:59:29.000000000 -0300
2533 +++ mutt-1.5.20/init.h 2010-02-22 20:00:43.446821937 -0300
2534 @@ -176,6 +176,20 @@
2535 ** If \fIset\fP, Mutt will prompt you for carbon-copy (Cc) recipients before
2536 ** editing the body of an outgoing message.
2539 + { "ask_follow_up", DT_BOOL, R_NONE, OPTASKFOLLOWUP, 0 },
2542 + ** If set, Mutt will prompt you for follow-up groups before editing
2543 + ** the body of an outgoing message.
2545 + { "ask_x_comment_to", DT_BOOL, R_NONE, OPTASKXCOMMENTTO, 0 },
2548 + ** If set, Mutt will prompt you for x-comment-to field before editing
2549 + ** the body of an outgoing message.
2552 { "assumed_charset", DT_STR, R_NONE, UL &AssumedCharset, UL 0},
2555 @@ -328,6 +342,14 @@
2556 ** follow these menus. The option is \fIunset\fP by default because many
2557 ** visual terminals don't permit making the cursor invisible.
2560 + { "catchup_newsgroup", DT_QUAD, R_NONE, OPT_CATCHUP, M_ASKYES },
2563 + ** If this variable is \fIset\fP, Mutt will mark all articles in newsgroup
2564 + ** as read when you quit the newsgroup (catchup newsgroup).
2567 #if defined(USE_SSL)
2568 { "certificate_file", DT_PATH, R_NONE, UL &SslCertFile, UL "~/.mutt_certificates" },
2570 @@ -803,6 +825,16 @@
2571 ** sent to both the list and your address, resulting in two copies
2572 ** of the same email for you.
2575 + { "followup_to_poster", DT_QUAD, R_NONE, OPT_FOLLOWUPTOPOSTER, M_ASKYES },
2578 + ** If this variable is \fIset\fP and the keyword "poster" is present in
2579 + ** \fIFollowup-To\fP header, follow-up to newsgroup function is not
2580 + ** permitted. The message will be mailed to the submitter of the
2581 + ** message via mail.
2584 { "force_name", DT_BOOL, R_NONE, OPTFORCENAME, 0 },
2587 @@ -885,6 +917,27 @@
2588 ** a regular expression that will match the whole name so mutt will expand
2589 ** ``Franklin'' to ``Franklin, Steve''.
2592 + { "group_index_format", DT_STR, R_BOTH, UL &GroupFormat, UL "%4C %M%N %5s %-45.45f %d" },
2595 + ** This variable allows you to customize the newsgroup browser display to
2596 + ** your personal taste. This string is similar to ``$index_format'', but
2597 + ** has its own set of printf()-like sequences:
2600 + ** %C current newsgroup number
2601 + ** %d description of newsgroup (becomes from server)
2602 + ** %f newsgroup name
2603 + ** %M - if newsgroup not allowed for direct post (moderated for example)
2604 + ** %N N if newsgroup is new, u if unsubscribed, blank otherwise
2605 + ** %n number of new articles in newsgroup
2606 + ** %s number of unread articles in newsgroup
2607 + ** %>X right justify the rest of the string and pad with character "X"
2608 + ** %|X pad to the end of the line with character "X"
2612 { "hdr_format", DT_SYN, R_NONE, UL "index_format", 0 },
2615 @@ -1264,6 +1317,7 @@
2616 ** .dt %E .dd number of messages in current thread
2617 ** .dt %f .dd sender (address + real name), either From: or Return-Path:
2618 ** .dt %F .dd author name, or recipient name if the message is from you
2619 + ** .dt %g .dd newsgroup name (if compiled with nntp support)
2620 ** .dt %H .dd spam attribute(s) of this message
2621 ** .dt %i .dd message-id of the current message
2622 ** .dt %l .dd number of lines in the message (does not work with maildir,
2623 @@ -1279,12 +1333,14 @@
2624 ** stashed the message: list name or recipient name
2625 ** if not sent to a list
2626 ** .dt %P .dd progress indicator for the builtin pager (how much of the file has been displayed)
2627 + ** .dt %R .dd `x-comment-to:' field (if present and compiled with nntp support)
2628 ** .dt %s .dd subject of the message
2629 ** .dt %S .dd status of the message (``N''/``D''/``d''/``!''/``r''/\(as)
2630 ** .dt %t .dd ``To:'' field (recipients)
2631 ** .dt %T .dd the appropriate character from the $$to_chars string
2632 ** .dt %u .dd user (login) name of the author
2633 ** .dt %v .dd first name of the author, or the recipient if the message is from you
2634 + ** .dt %W .dd name of organization of author (`organization:' field)
2635 ** .dt %X .dd number of attachments
2636 ** (please see the ``$attachments'' section for possible speed effects)
2637 ** .dt %y .dd ``X-Label:'' field, if present
2638 @@ -1319,6 +1375,21 @@
2639 ** Note that these expandos are supported in
2640 ** ``$save-hook'', ``$fcc-hook'' and ``$fcc-save-hook'', too.
2643 + { "inews", DT_PATH, R_NONE, UL &Inews, UL "" },
2646 + ** If set, specifies the program and arguments used to deliver news posted
2647 + ** by Mutt. Otherwise, mutt posts article using current connection to
2648 + ** news server. The following printf-style sequence is understood:
2651 + ** %s newsserver name
2654 + ** Example: set inews="/usr/local/bin/inews -hS"
2657 { "ispell", DT_PATH, R_NONE, UL &Ispell, UL ISPELL },
2660 @@ -1542,6 +1613,15 @@
2661 ** menu, attachments which cannot be decoded in a reasonable manner will
2662 ** be attached to the newly composed message if this option is \fIset\fP.
2665 + { "mime_subject", DT_BOOL, R_NONE, OPTMIMESUBJECT, 1 },
2668 + ** If \fIunset\fP, 8-bit ``subject:'' line in article header will not be
2669 + ** encoded according to RFC2047 to base64. This is useful when message
2670 + ** is Usenet article, because MIME for news is nonstandard feature.
2674 { "mix_entry_format", DT_STR, R_NONE, UL &MixEntryFormat, UL "%4n %c %-16s %a" },
2676 @@ -1592,6 +1672,77 @@
2677 ** See also $$read_inc, $$write_inc and $$net_inc.
2681 + { "news_cache_dir", DT_PATH, R_NONE, UL &NewsCacheDir, UL "~/.mutt" },
2684 + ** This variable pointing to directory where Mutt will save cached news
2685 + ** articles headers in. If \fIunset\fP, headers will not be saved at all
2686 + ** and will be reloaded each time when you enter to newsgroup.
2688 + { "news_server", DT_STR, R_NONE, UL &NewsServer, 0 },
2691 + ** This variable specifies domain name or address of NNTP server. It
2692 + ** defaults to the newsserver specified in the environment variable
2693 + ** $$$NNTPSERVER or contained in the file /etc/nntpserver. You can also
2694 + ** specify username and an alternative port for each newsserver, ie:
2696 + ** [news[s]://][username[:password]@]newsserver[:port]
2698 + { "newsrc", DT_PATH, R_NONE, UL &NewsRc, UL "~/.newsrc" },
2701 + ** The file, containing info about subscribed newsgroups - names and
2702 + ** indexes of read articles. The following printf-style sequence
2706 + ** %s newsserver name
2709 + { "nntp_context", DT_NUM, R_NONE, UL &NntpContext, 1000 },
2712 + ** This variable defines number of articles which will be in index when
2713 + ** newsgroup entered. If active newsgroup have more articles than this
2714 + ** number, oldest articles will be ignored. Also controls how many
2715 + ** articles headers will be saved in cache when you quit newsgroup.
2717 + { "nntp_load_description", DT_BOOL, R_NONE, OPTLOADDESC, 1 },
2720 + ** This variable controls whether or not descriptions for each newsgroup
2721 + ** must be loaded when newsgroup is added to list (first time list
2722 + ** loading or new newsgroup adding).
2724 + { "nntp_user", DT_STR, R_NONE, UL &NntpUser, UL "" },
2727 + ** Your login name on the NNTP server. If \fIunset\fP and NNTP server requires
2728 + ** authentification, Mutt will prompt you for your account name when you
2729 + ** connect to newsserver.
2731 + { "nntp_pass", DT_STR, R_NONE, UL &NntpPass, UL "" },
2734 + ** Your password for NNTP account.
2736 + { "nntp_poll", DT_NUM, R_NONE, UL &NewsPollTimeout, 60 },
2739 + ** The time in seconds until any operations on newsgroup except post new
2740 + ** article will cause recheck for new news. If set to 0, Mutt will
2741 + ** recheck newsgroup on each operation in index (stepping, read article,
2744 + { "nntp_reconnect", DT_QUAD, R_NONE, OPT_NNTPRECONNECT, M_ASKYES },
2747 + ** Controls whether or not Mutt will try to reconnect to newsserver when
2748 + ** connection lost.
2751 { "pager", DT_PATH, R_NONE, UL &Pager, UL "builtin" },
2754 @@ -2117,6 +2268,16 @@
2755 { "post_indent_str", DT_SYN, R_NONE, UL "post_indent_string", 0 },
2759 + { "post_moderated", DT_QUAD, R_NONE, OPT_TOMODERATED, M_ASKYES },
2762 + ** If set to \fIyes\fP, Mutt will post article to newsgroup that have
2763 + ** not permissions to posting (e.g. moderated). \fBNote:\fP if newsserver
2764 + ** does not support posting to that newsgroup or totally read-only, that
2765 + ** posting will not have an effect.
2768 { "postpone", DT_QUAD, R_NONE, OPT_POSTPONE, M_ASKYES },
2771 @@ -2517,6 +2678,28 @@
2772 ** Command to use when spawning a subshell. By default, the user's login
2773 ** shell from \fC/etc/passwd\fP is used.
2776 + { "save_unsubscribed",DT_BOOL, R_NONE, OPTSAVEUNSUB, 0 },
2779 + ** When \fIset\fP, info about unsubscribed newsgroups will be saved into
2780 + ** ``newsrc'' file and into cache.
2782 + { "show_new_news", DT_BOOL, R_NONE, OPTSHOWNEWNEWS, 1 },
2785 + ** If \fIset\fP, newsserver will be asked for new newsgroups on entering
2786 + ** the browser. Otherwise, it will be done only once for a newsserver.
2787 + ** Also controls whether or not number of new articles of subscribed
2788 + ** newsgroups will be then checked.
2790 + { "show_only_unread", DT_BOOL, R_NONE, OPTSHOWONLYUNREAD, 0 },
2793 + ** If \fIset\fP, only subscribed newsgroups that contain unread articles
2794 + ** will be displayed in browser.
2797 { "sig_dashes", DT_BOOL, R_NONE, OPTSIGDASHES, 1 },
2800 @@ -3426,6 +3609,14 @@
2801 ** xterm_set_titles has been set. This string is identical in formatting
2802 ** to the one used by ``$$status_format''.
2805 + { "x_comment_to", DT_BOOL, R_NONE, OPTXCOMMENTTO, 0 },
2808 + ** If \fIset\fP, Mutt will add ``X-Comment-To:'' field (that contains full
2809 + ** name of original article author) to article that followuped to newsgroup.
2813 { NULL, 0, 0, 0, 0 }
2815 Index: mutt-1.5.20/keymap.c
2816 ===================================================================
2817 --- mutt-1.5.20.orig/keymap.c 2008-11-29 19:09:10.000000000 -0200
2818 +++ mutt-1.5.20/keymap.c 2010-02-22 20:00:43.447717311 -0300
2820 km_bindkey ("<enter>", MENU_MAIN, OP_DISPLAY_MESSAGE);
2822 km_bindkey ("x", MENU_PAGER, OP_EXIT);
2823 - km_bindkey ("i", MENU_PAGER, OP_EXIT);
2824 km_bindkey ("<backspace>", MENU_PAGER, OP_PREV_LINE);
2825 km_bindkey ("<pagedown>", MENU_PAGER, OP_NEXT_PAGE);
2826 km_bindkey ("<pageup>", MENU_PAGER, OP_PREV_PAGE);
2827 Index: mutt-1.5.20/mailbox.h
2828 ===================================================================
2829 --- mutt-1.5.20.orig/mailbox.h 2010-02-22 19:59:29.000000000 -0300
2830 +++ mutt-1.5.20/mailbox.h 2010-02-22 20:00:43.447717311 -0300
2833 int mx_is_pop (const char *);
2836 +int mx_is_nntp (const char *);
2839 int mx_access (const char*, int);
2840 int mx_check_empty (const char *);
2841 Index: mutt-1.5.20/main.c
2842 ===================================================================
2843 --- mutt-1.5.20.orig/main.c 2010-02-22 19:59:29.000000000 -0300
2844 +++ mutt-1.5.20/main.c 2010-02-22 20:00:43.447717311 -0300
2846 #include <stringprep.h>
2853 static const char *ReachingUs = N_("\
2854 To contact the developers, please mail to <mutt-dev@mutt.org>.\n\
2855 To report a bug, please visit http://bugs.mutt.org/.\n");
2857 " -e <command>\tspecify a command to be executed after initialization\n\
2858 -f <file>\tspecify which mailbox to read\n\
2859 -F <file>\tspecify an alternate muttrc file\n\
2860 + -g <server>\tspecify a newsserver (if compiled with NNTP)\n\
2861 + -G\t\tselect a newsgroup (if compiled with NNTP)\n\
2862 -H <file>\tspecify a draft file to read header and body from\n\
2863 -i <file>\tspecify a file which Mutt should include in the body\n\
2864 -m <type>\tspecify a default mailbox type\n\
2865 @@ -255,6 +261,12 @@
2879 #define M_NOSYSRC (1<<2) /* -n */
2880 #define M_RO (1<<3) /* -R */
2881 #define M_SELECT (1<<4) /* -y */
2883 +#define M_NEWS (1<<5) /* -g and -G */
2886 int main (int argc, char **argv)
2888 @@ -600,7 +615,11 @@
2889 argv[nargc++] = argv[optind];
2893 + if ((i = getopt (argc, argv, "+A:a:b:F:f:c:Dd:e:g:GH:s:i:hm:npQ:RvxyzZ")) != EOF)
2895 if ((i = getopt (argc, argv, "+A:a:b:F:f:c:Dd:e:H:s:i:hm:npQ:RvxyzZ")) != EOF)
2900 @@ -697,6 +716,20 @@
2905 + case 'g': /* Specify a newsserver */
2907 + char buf[LONG_STRING];
2909 + snprintf (buf, sizeof (buf), "set news_server=%s", optarg);
2910 + commands = mutt_add_list (commands, buf);
2913 + case 'G': /* List of newsgroups */
2914 + flags |= M_SELECT | M_NEWS;
2921 @@ -984,6 +1017,18 @@
2923 else if (flags & M_SELECT)
2926 + if (flags & M_NEWS)
2928 + set_option (OPTNEWS);
2929 + if(!(CurrentNewsSrv = mutt_select_newsserver (NewsServer)))
2931 + mutt_endwin (Errorbuf);
2938 mutt_endwin _("No incoming mailboxes defined.");
2940 @@ -999,6 +1044,15 @@
2943 strfcpy (folder, NONULL(Spoolfile), sizeof (folder));
2946 + if (option (OPTNEWS))
2948 + unset_option (OPTNEWS);
2949 + nntp_expand_path (folder, sizeof (folder), &CurrentNewsSrv->conn->account);
2953 mutt_expand_path (folder, sizeof (folder));
2955 mutt_str_replace (&CurrentFolder, folder);
2956 Index: mutt-1.5.20/mutt.h
2957 ===================================================================
2958 --- mutt-1.5.20.orig/mutt.h 2010-02-22 19:59:29.000000000 -0300
2959 +++ mutt-1.5.20/mutt.h 2010-02-22 20:00:43.448821494 -0300
2968 /* Options for Mailcap lookup */
2970 @@ -292,6 +295,12 @@
2973 OPT_VERIFYSIG, /* verify PGP signatures */
2976 + OPT_NNTPRECONNECT,
2978 + OPT_FOLLOWUPTOPOSTER,
2979 +#endif /* USE_NNTP */
2981 /* THIS MUST BE THE LAST VALUE. */
2984 #define SENDMAILX (1<<6)
2985 #define SENDKEY (1<<7)
2986 #define SENDRESEND (1<<8)
2987 +#define SENDNEWS (1<<9)
2989 /* flags to _mutt_select_file() */
2990 #define M_SEL_BUFFY (1<<0)
3005 + OPTMIMESUBJECT, /* encode subject line with RFC2047 */
3010 @@ -488,6 +503,16 @@
3014 + /* news options */
3018 + OPTSHOWONLYUNREAD,
3022 +#endif /* USE_NNTP */
3024 /* pseudo options */
3026 OPTAUXSORT, /* (pseudo) using auxillary sort function */
3028 OPTSORTSUBTHREADS, /* (pseudo) used when $sort_aux changes */
3029 OPTNEEDRESCORE, /* (pseudo) set when the `score' command is used */
3030 OPTATTACHMSG, /* (pseudo) used by attach-message */
3031 + OPTHIDEREAD, /* (pseudo) whether or not hide read messages */
3032 OPTKEEPQUIET, /* (pseudo) shut up the message and refresh
3033 * functions while we are executing an
3035 @@ -518,6 +544,12 @@
3036 OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */
3037 OPTUNBUFFEREDINPUT, /* (pseudo) don't use key buffer */
3040 + OPTNEWS, /* (pseudo) used to change reader mode */
3041 + OPTNEWSSEND, /* (pseudo) used to change behavior when posting */
3042 + OPTNEWSCACHE, /* (pseudo) used to indicate if news cache exist */
3048 @@ -596,6 +628,13 @@
3052 + char *organization;
3056 + char *followup_to;
3057 + char *x_comment_to;
3060 LIST *references; /* message references (in reverse order) */
3061 LIST *in_reply_to; /* in-reply-to header content */
3063 ENVELOPE *env; /* envelope information */
3064 BODY *content; /* list of MIME parts */
3070 char *tree; /* character string to print thread tree */
3071 struct thread *thread;
3073 int refno; /* message number on server */
3076 -#if defined USE_POP || defined USE_IMAP
3077 +#if defined USE_POP || defined USE_IMAP || defined USE_NNTP
3078 void *data; /* driver-specific data */
3081 Index: mutt-1.5.20/muttlib.c
3082 ===================================================================
3083 --- mutt-1.5.20.orig/muttlib.c 2010-02-22 19:59:29.000000000 -0300
3084 +++ mutt-1.5.20/muttlib.c 2010-02-22 20:00:43.448821494 -0300
3087 mutt_free_list (&(*h)->chain);
3089 -#if defined USE_POP || defined USE_IMAP
3090 +#if defined USE_POP || defined USE_IMAP || defined USE_NNTP
3093 FREE (h); /* __FREE_CHECKED__ */
3094 @@ -689,6 +689,13 @@
3095 FREE (&(*p)->supersedes);
3097 FREE (&(*p)->x_label);
3098 + FREE (&(*p)->organization);
3100 + FREE (&(*p)->newsgroups);
3101 + FREE (&(*p)->xref);
3102 + FREE (&(*p)->followup_to);
3103 + FREE (&(*p)->x_comment_to);
3106 mutt_buffer_free (&(*p)->spam);
3108 @@ -1525,6 +1532,14 @@
3113 + if (magic == M_NNTP)
3115 + mutt_error _("Can't save message to newsserver.");
3120 if (stat (s, st) != -1)
3123 Index: mutt-1.5.20/mx.c
3124 ===================================================================
3125 --- mutt-1.5.20.orig/mx.c 2010-02-22 19:59:29.000000000 -0300
3126 +++ mutt-1.5.20/mx.c 2010-02-22 20:00:43.449821278 -0300
3127 @@ -347,6 +347,22 @@
3132 +int mx_is_nntp (const char *p)
3134 + url_scheme_t scheme;
3139 + scheme = url_check_scheme (p);
3140 + if (scheme == U_NNTP || scheme == U_NNTPS)
3147 int mx_get_magic (const char *path)
3150 @@ -364,6 +380,11 @@
3152 #endif /* USE_POP */
3155 + if (mx_is_nntp (path))
3157 +#endif /* USE_NNTP */
3159 if (stat (path, &st) == -1)
3161 dprint (1, (debugfile, "mx_get_magic(): unable to stat %s: %s (errno %d).\n",
3162 @@ -691,6 +712,12 @@
3164 #endif /* USE_POP */
3168 + rc = nntp_open_mailbox (ctx);
3170 +#endif /* USE_NNTP */
3175 @@ -799,6 +826,12 @@
3176 rc = pop_sync_mailbox (ctx, index_hint);
3178 #endif /* USE_POP */
3182 + rc = nntp_sync_mailbox (ctx);
3184 +#endif /* USE_NNTP */
3188 @@ -879,6 +912,16 @@
3193 + if (ctx->magic == M_NNTP)
3197 + ret = nntp_close_mailbox (ctx);
3198 + mx_fastclose_mailbox (ctx);
3202 if (ctx->readonly || ctx->dontwrite)
3204 /* mailbox is readonly or we don't want to write */
3205 @@ -1455,6 +1498,11 @@
3207 return (pop_check_mailbox (ctx, index_hint));
3208 #endif /* USE_POP */
3212 + return (nntp_check_mailbox (ctx));
3213 +#endif /* USE_NNTP */
3217 @@ -1515,6 +1563,15 @@
3219 #endif /* USE_POP */
3224 + if (nntp_fetch_message (msg, ctx, msgno) != 0)
3228 +#endif /* USE_NNTP */
3231 dprint (1, (debugfile, "mx_open_message(): function not implemented for mailbox type %d.\n", ctx->magic));
3233 @@ -1596,6 +1653,9 @@
3235 || (*msg)->magic == M_POP
3238 + || (*msg)->magic == M_NNTP
3242 r = safe_fclose (&(*msg)->fp);
3243 Index: mutt-1.5.20/mx.h
3244 ===================================================================
3245 --- mutt-1.5.20.orig/mx.h 2010-02-22 19:59:29.000000000 -0300
3246 +++ mutt-1.5.20/mx.h 2010-02-22 20:00:43.449821278 -0300
3248 #ifdef USE_COMPRESSED
3256 WHERE short DefaultMagic INITVAL (M_MBOX);
3257 Index: mutt-1.5.20/newsrc.c
3258 ===================================================================
3259 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
3260 +++ mutt-1.5.20/newsrc.c 2010-02-22 20:00:43.450822836 -0300
3263 + * Copyright (C) 1998 Brandon Long <blong@fiction.net>
3264 + * Copyright (C) 1999 Andrej Gritsenko <andrej@lucky.net>
3265 + * Copyright (C) 2000-2009 Vsevolod Volkov <vvv@mutt.org.ua>
3267 + * This program is free software; you can redistribute it and/or modify
3268 + * it under the terms of the GNU General Public License as published by
3269 + * the Free Software Foundation; either version 2 of the License, or
3270 + * (at your option) any later version.
3272 + * This program is distributed in the hope that it will be useful,
3273 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3274 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3275 + * GNU General Public License for more details.
3277 + * You should have received a copy of the GNU General Public License
3278 + * along with this program; if not, write to the Free Software
3279 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3283 +# include "config.h"
3287 +#include "mutt_curses.h"
3291 +#include "mailbox.h"
3293 +#include "rfc822.h"
3294 +#include "rfc1524.h"
3295 +#include "rfc2047.h"
3297 +#include <unistd.h>
3298 +#include <string.h>
3300 +#include <stdlib.h>
3301 +#include <sys/stat.h>
3303 +void nntp_add_to_list (NNTP_SERVER *s, NNTP_DATA *d)
3310 + l = safe_calloc (1, sizeof (LIST));
3312 + s->tail->next = l;
3316 + l->data = (void *) d;
3319 +static int nntp_parse_newsrc_line (NNTP_SERVER *news, char *line)
3322 + char group[LONG_STRING];
3324 + char *p = line, *b, *h;
3334 + while (*p && (*p != ':' && *p != '!')) p++;
3337 + len = p + 1 - line;
3338 + if (len > sizeof (group))
3339 + len = sizeof (group);
3340 + strfcpy (group, line, len);
3341 + if ((data = (NNTP_DATA *)hash_find (news->newsgroups, group)) == NULL)
3343 + data = (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1);
3344 + data->group = (char *) data + sizeof (NNTP_DATA);
3345 + strcpy (data->group, group);
3346 + data->nserv = news;
3347 + data->deleted = 1;
3348 + if (news->newsgroups->nelem < news->newsgroups->curnelem * 2)
3349 + news->newsgroups = hash_resize (news->newsgroups, news->newsgroups->nelem * 2, 0);
3350 + hash_insert (news->newsgroups, data->group, data, 0);
3351 + nntp_add_to_list (news, data);
3354 + FREE ((void **) &data->entries);
3357 + data->entries = safe_calloc (x*2, sizeof (NEWSRC_ENTRY));
3361 + data->subscribed = 1;
3363 + data->subscribed = 0;
3370 + while (*p && *p != ',' && *p != '\n') p++;
3376 + if ((h = strchr(b, '-')))
3380 + data->entries[x].first = atoi(b);
3381 + data->entries[x].last = atoi(h);
3385 + data->entries[x].first = atoi(b);
3386 + data->entries[x].last = data->entries[x].first;
3389 + if (data->entries[x].last != 0)
3392 + if (x && !data->lastMessage)
3393 + data->lastMessage = data->entries[x-1].last;
3395 + mutt_newsgroup_stat (data);
3396 + dprint (2, (debugfile, "parse_line: Newsgroup %s\n", data->group));
3401 +static int slurp_newsrc (NNTP_SERVER *news)
3407 + news->stat = stat (news->newsrc, &sb);
3408 + news->size = sb.st_size;
3409 + news->mtime = sb.st_mtime;
3411 + if ((fp = safe_fopen (news->newsrc, "r")) == NULL)
3413 + /* hmm, should we use dotlock? */
3414 + if (mx_lock_file (news->newsrc, fileno (fp), 0, 0, 1))
3420 + buf = safe_malloc (sb.st_size + 1);
3421 + while (sb.st_size && fgets (buf, sb.st_size + 1, fp))
3422 + nntp_parse_newsrc_line (news, buf);
3425 + mx_unlock_file (news->newsrc, fileno (fp), 0);
3430 +void nntp_cache_expand (char *dst, const char *src)
3432 + snprintf (dst, _POSIX_PATH_MAX, "%s/%s", NewsCacheDir, src);
3433 + mutt_expand_path (dst, _POSIX_PATH_MAX);
3436 +/* Loads $news_cache_dir/.index into memory, loads newsserver data
3437 + * and newsgroup cache names */
3438 +static int nntp_parse_cacheindex (NNTP_SERVER *news)
3441 + char buf[HUGE_STRING], *cp;
3442 + char dir[_POSIX_PATH_MAX], file[_POSIX_PATH_MAX];
3447 + /* check is server name defined or not */
3448 + if (!news || !news->conn || !news->conn->account.host)
3450 + unset_option (OPTNEWSCACHE);
3451 + if (!NewsCacheDir || !*NewsCacheDir)
3454 + strfcpy (dir, NewsCacheDir, sizeof (dir));
3455 + mutt_expand_path (dir, sizeof(dir));
3457 + if (lstat (dir, &st) || (st.st_mode & S_IFDIR) == 0)
3459 + snprintf (buf, sizeof(buf), _("Directory %s not exist. Create it?"), dir);
3460 + if (mutt_yesorno (buf, M_YES) != M_YES || mkdir (dir, (S_IRWXU+S_IRWXG+
3463 + mutt_error _("Cache directory not created!");
3466 + mutt_clear_error();
3469 + set_option (OPTNEWSCACHE);
3471 + FREE (&news->cache);
3472 + snprintf (buf, sizeof(buf), "%s/.index", dir);
3473 + if (!(index = safe_fopen (buf, "a+")))
3476 + while (fgets (buf, sizeof(buf), index))
3478 + buf[strlen(buf) - 1] = 0; /* strip ending '\n' */
3479 + if (!mutt_strncmp (buf, "#: ", 3) &&
3480 + !mutt_strcasecmp (buf+3, news->conn->account.host))
3483 + while (fgets (buf, sizeof(buf), index))
3486 + while (*cp && *cp != ' ') cp++;
3487 + if (!*cp) continue;
3489 + if (!mutt_strcmp (buf, "#:"))
3491 + sscanf (cp + 1, "%s %d %d", file, &l, &m);
3492 + if (!mutt_strcmp (buf, "ALL"))
3494 + news->cache = safe_strdup (file);
3495 + news->newgroups_time = m;
3497 + else if (news->newsgroups)
3499 + if ((data = (NNTP_DATA *)hash_find (news->newsgroups, buf)) == NULL)
3501 + data = (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + strlen (buf) + 1);
3502 + data->group = (char *) data + sizeof (NNTP_DATA);
3503 + strcpy(data->group, buf);
3504 + data->nserv = news;
3505 + data->deleted = 1;
3506 + if (news->newsgroups->nelem < news->newsgroups->curnelem * 2)
3507 + news->newsgroups = hash_resize (news->newsgroups, news->newsgroups->nelem * 2, 0);
3508 + hash_insert (news->newsgroups, data->group, data, 0);
3509 + nntp_add_to_list (news, data);
3511 + data->cache = safe_strdup (file);
3513 + if (!data->firstMessage || data->lastMessage < m)
3515 + if (!data->firstMessage)
3516 + data->firstMessage = l;
3517 + if (data->lastMessage < m)
3518 + data->lastMessage = m;
3519 + data->lastCached = m;
3520 + if (t || !data->unread)
3521 + mutt_newsgroup_stat (data);
3529 +nntp_format_str (char *dest, size_t destlen, size_t col, char op, const char *src,
3530 + const char *fmt, const char *ifstring, const char *elsestring,
3531 + unsigned long data, format_flag flags)
3533 + char fn[SHORT_STRING], tmp[SHORT_STRING];
3538 + strncpy (fn, NewsServer, sizeof(fn) - 1);
3539 + mutt_strlower (fn);
3540 + snprintf (tmp, sizeof (tmp), "%%%ss", fmt);
3541 + snprintf (dest, destlen, tmp, fn);
3547 +/* nntp_parse_url: given an NNPT URL, return host, port,
3548 + * username, password and newsgroup will recognise. */
3549 +int nntp_parse_url (const char *server, ACCOUNT *acct,
3550 + char *group, size_t group_len)
3558 + acct->port = NNTP_PORT;
3559 + acct->type = M_ACCT_TYPE_NNTP;
3561 + c = safe_strdup (server);
3562 + url_parse_ciss (&url, c);
3564 + if (url.scheme == U_NNTP || url.scheme == U_NNTPS)
3566 + if (url.scheme == U_NNTPS)
3568 + acct->flags |= M_ACCT_SSL;
3569 + acct->port = NNTP_SSL_PORT;
3574 + strfcpy (group, url.path, group_len);
3576 + ret = mutt_account_fromurl (acct, &url);
3583 +void nntp_expand_path (char *line, size_t len, ACCOUNT *acct)
3587 + url.path = safe_strdup (line);
3588 + mutt_account_tourl (acct, &url);
3589 + url_ciss_tostring (&url, line, len, 0);
3594 + * Automatically loads a newsrc into memory, if necessary.
3595 + * Checks the size/mtime of a newsrc file, if it doesn't match, load
3596 + * again. Hmm, if a system has broken mtimes, this might mean the file
3597 + * is reloaded every time, which we'd have to fix.
3599 + * a newsrc file is a line per newsgroup, with the newsgroup, then a
3600 + * ':' denoting subscribed or '!' denoting unsubscribed, then a
3601 + * comma separated list of article numbers and ranges.
3603 +NNTP_SERVER *mutt_select_newsserver (char *server)
3605 + char file[_POSIX_PATH_MAX];
3609 + NNTP_SERVER *serv;
3612 + if (!server || !*server)
3614 + mutt_error _("No newsserver defined!");
3618 + buf = p = safe_calloc (strlen (server) + 10, sizeof (char));
3619 + if (url_check_scheme (server) == U_UNKNOWN)
3621 + strcpy (buf, "news://");
3622 + p = strchr (buf, '\0');
3624 + strcpy (p, server);
3626 + if ((nntp_parse_url (buf, &acct, file, sizeof (file))) < 0 || *file)
3629 + mutt_error (_("%s is an invalid newsserver specification!"), server);
3634 + conn = mutt_conn_find (NULL, &acct);
3638 + mutt_FormatString (file, sizeof (file), 0, NONULL (NewsRc), nntp_format_str, 0, 0);
3639 + mutt_expand_path (file, sizeof (file));
3641 + serv = (NNTP_SERVER *)conn->data;
3646 + /* externally modified? */
3647 + if (serv->stat != stat (file, &sb) || (!serv->stat &&
3648 + (serv->size != sb.st_size || serv->mtime != sb.st_mtime)))
3650 + for (list = serv->list; list; list = list->next)
3652 + NNTP_DATA *data = (NNTP_DATA *) list->data;
3656 + data->subscribed = 0;
3661 + slurp_newsrc (serv);
3662 + nntp_clear_cacheindex (serv);
3665 + if (serv->status == NNTP_BYE)
3666 + serv->status = NNTP_NONE;
3667 + nntp_check_newgroups (serv, 0);
3671 + /* New newsserver */
3672 + serv = safe_calloc (1, sizeof (NNTP_SERVER));
3673 + serv->conn = conn;
3674 + serv->newsrc = safe_strdup (file);
3675 + serv->newsgroups = hash_create (1009, 0);
3676 + slurp_newsrc (serv); /* load .newsrc */
3677 + nntp_parse_cacheindex (serv); /* load .index */
3678 + if (option (OPTNEWSCACHE) && serv->cache && nntp_get_cache_all (serv) >= 0)
3679 + nntp_check_newgroups (serv, 1);
3680 + else if (nntp_get_active (serv) < 0)
3682 + hash_destroy (&serv->newsgroups, nntp_delete_data);
3683 + for (list = serv->list; list; list = list->next)
3684 + list->data = NULL;
3685 + mutt_free_list (&serv->list);
3686 + FREE (&serv->newsrc);
3687 + FREE (&serv->cache);
3691 + nntp_clear_cacheindex (serv);
3692 + conn->data = (void *)serv;
3698 + * full status flags are not supported by nntp, but we can fake some
3699 + * of them. This is how:
3700 + * Read = a read message number is in the .newsrc
3701 + * New = a message is new since we last read this newsgroup
3702 + * Old = anything else
3703 + * So, Read is marked as such in the newsrc, old is anything that is
3704 + * "skipped" in the newsrc, and new is anything not in the newsrc nor
3705 + * in the cache. By skipped, I mean before the last unread message
3707 +void nntp_get_status (CONTEXT *ctx, HEADER *h, char *group, int article)
3709 + NNTP_DATA *data = (NNTP_DATA *) ctx->data;
3713 + data = (NNTP_DATA *) hash_find (data->nserv->newsgroups, group);
3719 + dprint (3, (debugfile, "newsgroup %s not found\n", group));
3724 + for (x = 0; x < data->num; x++)
3726 + if ((article >= data->entries[x].first) &&
3727 + (article <= data->entries[x].last))
3729 + /* we cannot use mutt_set_flag() because mx_update_context()
3730 + didn't called yet */
3735 + /* If article was not cached yet, it is new! :) */
3736 + if (!data->cache || article > data->lastCached)
3738 + /* Old articles are articles which aren't read but an article after them
3739 + * has been cached */
3740 + if (option (OPTMARKOLD))
3744 +void mutt_newsgroup_stat (NNTP_DATA *data)
3747 + unsigned int first, last;
3750 + if (data->lastMessage == 0 || data->firstMessage > data->lastMessage)
3753 + data->unread = data->lastMessage - data->firstMessage + 1;
3754 + for (i = 0; i < data->num; i++)
3756 + first = data->entries[i].first;
3757 + if (first < data->firstMessage)
3758 + first = data->firstMessage;
3759 + last = data->entries[i].last;
3760 + if (last > data->lastMessage)
3761 + last = data->lastMessage;
3762 + if (first <= last)
3763 + data->unread -= last - first + 1;
3767 +static int puti (char *line, int num)
3771 + for (p = s; num; )
3773 + *p++ = '0' + num % 10;
3777 + *line++ = *--p, num++;
3782 +static void nntp_create_newsrc_line (NNTP_DATA *data, char **buf, char **pline, size_t *buflen)
3784 + char *line = *pline;
3785 + size_t len = *buflen - (*pline - *buf);
3788 + if (len < LONG_STRING * 10)
3793 + safe_realloc (buf, *buflen);
3794 + line = *buf + (*pline - line);
3796 + strcpy (line, data->group);
3797 + len -= strlen (line) + 1;
3798 + line += strlen (line);
3799 + *line++ = data->subscribed ? ':' : '!';
3803 + for (x = 0; x < data->num; x++)
3805 + if (len < LONG_STRING)
3811 + safe_realloc (buf, *buflen);
3812 + line = *buf + (*pline - line);
3821 + if (data->entries[x].first == data->entries[x].last)
3822 + snprintf (line, len, "%d%n", data->entries[x].first, &i);
3824 + snprintf (line, len, "%d-%d%n",
3825 + data->entries[x].first, data->entries[x].last, &i);
3829 + i = puti (line, data->entries[x].first);
3830 + line +=i; len -= i;
3831 + if (data->entries[x].first != data->entries[x].last)
3835 + i = puti (line, data->entries[x].last);
3836 + line +=i; len -= i;
3845 +void newsrc_gen_entries (CONTEXT *ctx)
3847 + NNTP_DATA *data = (NNTP_DATA *)ctx->data;
3849 + unsigned int last = 0, first = 1;
3850 + int save_sort = SORT_ORDER;
3852 + if (Sort != SORT_ORDER)
3855 + Sort = SORT_ORDER;
3856 + mutt_sort_headers (ctx, 0);
3861 + data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY));
3866 + * Set up to fake initial sequence from 1 to the article before the
3867 + * first article in our list
3872 + for (x = 0; x < ctx->msgcount; x++)
3874 + if (series) /* search for first unread */
3877 + * We don't actually check sequential order, since we mark
3878 + * "missing" entries as read/deleted
3880 + last = ctx->hdrs[x]->article_num;
3881 + if (last >= data->firstMessage && !ctx->hdrs[x]->deleted &&
3882 + !ctx->hdrs[x]->read)
3884 + if (data->num >= data->max)
3886 + data->max = data->max * 2;
3887 + safe_realloc (&data->entries,
3888 + data->max * sizeof (NEWSRC_ENTRY));
3890 + data->entries[data->num].first = first;
3891 + data->entries[data->num].last = last - 1;
3896 + else /* search for first read */
3898 + if (ctx->hdrs[x]->deleted || ctx->hdrs[x]->read)
3903 + last = ctx->hdrs[x]->article_num;
3906 + if (series && first <= data->lastLoaded)
3908 + if (data->num >= data->max)
3910 + data->max = data->max * 2;
3911 + safe_realloc (&data->entries,
3912 + data->max * sizeof (NEWSRC_ENTRY));
3914 + data->entries[data->num].first = first;
3915 + data->entries[data->num].last = data->lastLoaded;
3919 + if (save_sort != Sort)
3922 + mutt_sort_headers (ctx, 0);
3926 +static int mutt_update_list_file (char *filename, char *section,
3927 + char *key, char *line)
3931 + char buf[HUGE_STRING];
3932 + char tmpfile[_POSIX_PATH_MAX];
3934 + int ext = 0, done = 0, r = 0;
3936 + /* if file not exist, create it */
3937 + if ((ifp = safe_fopen (filename, "a")))
3939 + dprint (1, (debugfile, "Opening %s\n", filename));
3940 + if (!(ifp = safe_fopen (filename, "r")))
3942 + mutt_error (_("Unable to open %s for reading"), filename);
3945 + if (mx_lock_file (filename, fileno (ifp), 0, 0, 1))
3948 + mutt_error (_("Unable to lock %s"), filename);
3951 + snprintf (tmpfile, sizeof(tmpfile), "%s.tmp", filename);
3952 + dprint (1, (debugfile, "Opening %s\n", tmpfile));
3953 + if (!(ofp = fopen (tmpfile, "w")))
3956 + mutt_error (_("Unable to open %s for writing"), tmpfile);
3962 + while (r != EOF && !done && fgets (buf, sizeof (buf), ifp))
3964 + r = fputs (buf, ofp);
3966 + while (*c && *c != '\n') c++;
3967 + c[0] = 0; /* strip EOL */
3968 + if (!strncmp (buf, "#: ", 3) && !mutt_strcasecmp (buf+3, section))
3971 + if (r != EOF && !done)
3973 + snprintf (buf, sizeof(buf), "#: %s\n", section);
3974 + r = fputs (buf, ofp);
3979 + while (r != EOF && fgets (buf, sizeof (buf), ifp))
3984 + while (*c && (*c != '\r') && (*c != '\n')) c++;
3986 + if (*c != '\\') ext = 0;
3988 + else if ((section && !strncmp (buf, "#: ", 3)))
3990 + if (!done && line)
3992 + fputs (line, ofp);
3993 + fputc ('\n', ofp);
3995 + r = fputs (buf, ofp);
3999 + else if (key && !strncmp (buf, key, strlen(key)) &&
4000 + (!*key || buf[strlen(key)] == ' '))
4004 + while (*c && (*c != '\r') && (*c != '\n')) c++;
4006 + if (*c == '\\') ext = 1;
4007 + if (!done && line)
4009 + r = fputs (line, ofp);
4011 + r = fputc ('\n', ofp);
4017 + r = fputs (buf, ofp);
4021 + while (r != EOF && fgets (buf, sizeof (buf), ifp))
4022 + r = fputs (buf, ofp);
4024 + /* If there wasn't a line to replace, put it on the end of the file */
4025 + if (r != EOF && !done && line)
4027 + fputs (line, ofp);
4028 + r = fputc ('\n', ofp);
4030 + mx_unlock_file (filename, fileno (ifp), 0);
4036 + mutt_error (_("Can't write %s"), tmpfile);
4039 + if (rename (tmpfile, filename) < 0)
4042 + mutt_error (_("Can't rename %s to %s"), tmpfile, filename);
4048 +int mutt_newsrc_update (NNTP_SERVER *news)
4058 + llen = len = 10 * LONG_STRING;
4059 + line = buf = safe_calloc (1, len);
4060 + /* we will generate full newsrc here */
4061 + for (tmp = news->list; tmp; tmp = tmp->next)
4063 + data = (NNTP_DATA *) tmp->data;
4064 + if (!data || !data->rc)
4066 + nntp_create_newsrc_line (data, &buf, &line, &llen);
4068 + dprint (2, (debugfile, "Added to newsrc: %s\n", line));
4069 + line += strlen (line);
4071 + /* newrc being fully rewritten */
4072 + if (news->newsrc &&
4073 + (r = mutt_update_list_file (news->newsrc, NULL, "", buf)) == 0)
4077 + stat (news->newsrc, &st);
4078 + news->size = st.st_size;
4079 + news->mtime = st.st_mtime;
4085 +static FILE *mutt_mkname (char *s)
4087 + char buf[_POSIX_PATH_MAX], *pc;
4091 + nntp_cache_expand (buf, s);
4092 + if ((fp = safe_fopen (buf, "w")))
4095 + nntp_cache_expand (buf, "cache-XXXXXX");
4096 + pc = buf + strlen (buf) - 12; /* positioning to "cache-XXXXXX" */
4097 + if ((fd = mkstemp (buf)) == -1)
4099 + strcpy (s, pc); /* generated name */
4100 + return fdopen (fd, "w");
4103 +/* Updates info into .index file: ALL or about selected newsgroup */
4104 +static int nntp_update_cacheindex (NNTP_SERVER *serv, NNTP_DATA *data)
4106 + char buf[LONG_STRING], *key = "ALL";
4107 + char file[_POSIX_PATH_MAX];
4109 + if (!serv || !serv->conn || !serv->conn->account.host)
4112 + if (data && data->group)
4114 + key = data->group;
4115 + snprintf (buf, sizeof (buf), "%s %s %d %d", key, data->cache,
4116 + data->firstMessage, data->lastLoaded);
4120 + strfcpy (file, serv->cache, sizeof (file));
4121 + snprintf (buf, sizeof (buf), "ALL %s 0 %d", file, (int)serv->newgroups_time);
4123 + nntp_cache_expand (file, ".index");
4124 + return mutt_update_list_file (file, serv->conn->account.host, key, buf);
4127 +/* Remove cache files of unsubscribed newsgroups */
4128 +void nntp_clear_cacheindex (NNTP_SERVER *news)
4133 + if (option (OPTSAVEUNSUB) || !news)
4136 + for (tmp = news->list; tmp; tmp = tmp->next)
4138 + data = (NNTP_DATA *) tmp->data;
4139 + if (!data || data->subscribed || !data->cache)
4141 + nntp_delete_cache (data);
4142 + dprint (2, (debugfile, "Removed from .index: %s\n", data->group));
4147 +int nntp_save_cache_index (NNTP_SERVER *news)
4149 + char buf[HUGE_STRING];
4150 + char file[_POSIX_PATH_MAX];
4155 + if (!news || !news->newsgroups)
4157 + if (!option (OPTNEWSCACHE))
4162 + nntp_cache_expand (file, news->cache);
4164 + f = safe_fopen (file, "w");
4168 + strfcpy (buf, news->conn->account.host, sizeof(buf));
4169 + f = mutt_mkname (buf);
4170 + news->cache = safe_strdup (buf);
4171 + nntp_cache_expand (file, buf);
4176 + for (l = news->list; l; l = l->next)
4178 + if ((d = (NNTP_DATA *)l->data) && !d->deleted)
4181 + snprintf (buf, sizeof(buf), "%s %d %d %c %s\n", d->group,
4182 + d->lastMessage, d->firstMessage, d->allowed ? 'y' : 'n',
4185 + snprintf (buf, sizeof(buf), "%s %d %d %c\n", d->group,
4186 + d->lastMessage, d->firstMessage, d->allowed ? 'y' : 'n');
4187 + if (fputs (buf, f) == EOF)
4197 + if (nntp_update_cacheindex (news, NULL))
4205 +int nntp_save_cache_group (CONTEXT *ctx)
4207 + char buf[HUGE_STRING], addr[STRING];
4208 + char file[_POSIX_PATH_MAX];
4212 + int i = 0, save = SORT_ORDER;
4215 + if (!option (OPTNEWSCACHE))
4217 + if (!ctx || !ctx->data || ctx->magic != M_NNTP)
4220 + if (((NNTP_DATA *)ctx->data)->cache)
4222 + nntp_cache_expand (file, ((NNTP_DATA *)ctx->data)->cache);
4224 + f = safe_fopen (file, "w");
4228 + snprintf (buf, sizeof(buf), "%s-%s",
4229 + ((NNTP_DATA *)ctx->data)->nserv->conn->account.host,
4230 + ((NNTP_DATA *)ctx->data)->group);
4231 + f = mutt_mkname (buf);
4232 + ((NNTP_DATA *)ctx->data)->cache = safe_strdup (buf);
4233 + nntp_cache_expand (file, buf);
4238 + if (Sort != SORT_ORDER)
4241 + Sort = SORT_ORDER;
4242 + mutt_sort_headers (ctx, 0);
4245 + /* Save only $nntp_context messages... */
4246 + ((NNTP_DATA *)ctx->data)->lastCached = 0;
4247 + if (NntpContext && ctx->msgcount > NntpContext)
4248 + i = ctx->msgcount - NntpContext;
4249 + for (; i < ctx->msgcount; i++)
4251 + if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->article_num != prev)
4255 + rfc822_write_address (addr, sizeof(addr), h->env->from, 0);
4256 + tm = gmtime (&h->date_sent);
4257 + snprintf (buf, sizeof(buf),
4258 + "%d\t%s\t%s\t%d %s %d %02d:%02d:%02d GMT\t%s\t",
4259 + h->article_num, h->env->subject, addr, tm->tm_mday,
4260 + Months[tm->tm_mon], tm->tm_year+1900, tm->tm_hour, tm->tm_min,
4261 + tm->tm_sec, h->env->message_id);
4263 + if (h->env->references)
4264 + mutt_write_references (h->env->references, f, -10);
4265 + snprintf (buf, sizeof(buf), "\t%ld\t%d\tXref: %s\n", (long int) h->content->length,
4266 + (int) h->lines, NONULL(h->env->xref));
4267 + if (fputs (buf, f) == EOF)
4274 + prev = ctx->hdrs[i]->article_num;
4280 + mutt_sort_headers (ctx, 0);
4284 + if (nntp_update_cacheindex (((NNTP_DATA *)ctx->data)->nserv,
4285 + (NNTP_DATA *)ctx->data))
4290 + ((NNTP_DATA *)ctx->data)->lastCached = ((NNTP_DATA *)ctx->data)->lastLoaded;
4294 +void nntp_delete_cache (NNTP_DATA *data)
4296 + char buf[_POSIX_PATH_MAX];
4298 + if (!option (OPTNEWSCACHE) || !data || !data->cache || !data->nserv)
4301 + nntp_cache_expand (buf, data->cache);
4303 + FREE (&data->cache);
4304 + data->lastCached = 0;
4305 + nntp_cache_expand (buf, ".index");
4306 + mutt_update_list_file (buf, data->nserv->conn->account.host, data->group, NULL);
4309 +NNTP_DATA *mutt_newsgroup_subscribe (NNTP_SERVER *news, char *group)
4313 + if (!news || !news->newsgroups || !group || !*group)
4315 + if (!(data = (NNTP_DATA *)hash_find (news->newsgroups, group)))
4317 + data = (NNTP_DATA *) safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1);
4318 + data->group = (char *) data + sizeof (NNTP_DATA);
4319 + strcpy (data->group, group);
4320 + data->nserv = news;
4321 + data->deleted = 1;
4322 + if (news->newsgroups->nelem < news->newsgroups->curnelem * 2)
4323 + news->newsgroups = hash_resize (news->newsgroups, news->newsgroups->nelem * 2, 0);
4324 + hash_insert (news->newsgroups, data->group, data, 0);
4325 + nntp_add_to_list (news, data);
4327 + if (!data->subscribed)
4329 + data->subscribed = 1;
4335 +NNTP_DATA *mutt_newsgroup_unsubscribe (NNTP_SERVER *news, char *group)
4339 + if (!news || !news->newsgroups || !group || !*group ||
4340 + !(data = (NNTP_DATA *)hash_find (news->newsgroups, group)))
4342 + if (data->subscribed)
4344 + data->subscribed = 0;
4345 + if (!option (OPTSAVEUNSUB))
4351 +NNTP_DATA *mutt_newsgroup_catchup (NNTP_SERVER *news, char *group)
4355 + if (!news || !news->newsgroups || !group || !*group ||
4356 + !(data = (NNTP_DATA *)hash_find (news->newsgroups, group)))
4360 + data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY));
4364 + data->entries[0].first = 1;
4366 + data->entries[0].last = data->lastMessage;
4367 + if (Context && Context->data == data)
4371 + for (x = 0; x < Context->msgcount; x++)
4372 + mutt_set_flag (Context, Context->hdrs[x], M_READ, 1);
4377 +NNTP_DATA *mutt_newsgroup_uncatchup (NNTP_SERVER *news, char *group)
4381 + if (!news || !news->newsgroups || !group || !*group ||
4382 + !(data = (NNTP_DATA *)hash_find (news->newsgroups, group)))
4386 + data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY));
4390 + data->entries[0].first = 1;
4391 + data->entries[0].last = data->firstMessage - 1;
4392 + if (Context && Context->data == data)
4396 + data->unread = Context->msgcount;
4397 + for (x = 0; x < Context->msgcount; x++)
4398 + mutt_set_flag (Context, Context->hdrs[x], M_READ, 0);
4401 + data->unread = data->lastMessage - data->entries[0].last;
4405 +/* this routine gives the first newsgroup with new messages */
4406 +void nntp_buffy (char *s)
4410 + for (list = CurrentNewsSrv->list; list; list = list->next)
4412 + NNTP_DATA *data = (NNTP_DATA *) list->data;
4414 + if (data && data->subscribed && data->unread)
4416 + if (Context && Context->magic == M_NNTP &&
4417 + !mutt_strcmp (data->group, ((NNTP_DATA *) Context->data)->group))
4419 + unsigned int i, unread = 0;
4421 + for (i = 0; i < Context->msgcount; i++)
4422 + if (!Context->hdrs[i]->read && !Context->hdrs[i]->deleted)
4427 + strcpy (s, data->group);
4432 Index: mutt-1.5.20/nntp.c
4433 ===================================================================
4434 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4435 +++ mutt-1.5.20/nntp.c 2010-02-22 20:00:43.450822836 -0300
4438 + * Copyright (C) 1998 Brandon Long <blong@fiction.net>
4439 + * Copyright (C) 1999 Andrej Gritsenko <andrej@lucky.net>
4440 + * Copyright (C) 2000-2007 Vsevolod Volkov <vvv@mutt.org.ua>
4442 + * This program is free software; you can redistribute it and/or modify
4443 + * it under the terms of the GNU General Public License as published by
4444 + * the Free Software Foundation; either version 2 of the License, or
4445 + * (at your option) any later version.
4447 + * This program is distributed in the hope that it will be useful,
4448 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4449 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4450 + * GNU General Public License for more details.
4452 + * You should have received a copy of the GNU General Public License
4453 + * along with this program; if not, write to the Free Software
4454 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
4458 +# include "config.h"
4462 +#include "mutt_curses.h"
4466 +#include "rfc1524.h"
4467 +#include "rfc2047.h"
4468 +#include "mailbox.h"
4479 +#include <unistd.h>
4480 +#include <string.h>
4482 +#include <stdlib.h>
4484 +static unsigned int _checked = 0;
4487 +static void nntp_error (const char *where, const char *msg)
4489 + dprint (1, (debugfile, "nntp_error(): unexpected response in %s: %s\n", where, msg));
4493 +static int nntp_auth (NNTP_SERVER *serv)
4495 + CONNECTION *conn = serv->conn;
4497 + unsigned char flags = conn->account.flags;
4499 + if (mutt_account_getuser (&conn->account) || !conn->account.user[0] ||
4500 + mutt_account_getpass (&conn->account) || !conn->account.pass[0])
4502 + conn->account.flags = flags;
4506 + mutt_message _("Logging in...");
4508 + snprintf (buf, sizeof (buf), "AUTHINFO USER %s\r\n", conn->account.user);
4509 + mutt_socket_write (conn, buf);
4510 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4512 + conn->account.flags = flags;
4517 + /* don't print the password unless we're at the ungodly debugging level */
4518 + if (debuglevel < M_SOCK_LOG_FULL)
4519 + dprint (M_SOCK_LOG_CMD, (debugfile, "> AUTHINFO PASS *\n"));
4521 + snprintf (buf, sizeof (buf), "AUTHINFO PASS %s\r\n", conn->account.pass);
4522 + mutt_socket_write_d (conn, buf, -1, M_SOCK_LOG_FULL);
4523 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4525 + conn->account.flags = flags;
4529 + if (mutt_strncmp ("281", buf, 3))
4531 + conn->account.flags = flags;
4532 + mutt_error _("Login failed.");
4540 +static int nntp_connect_error (NNTP_SERVER *serv)
4542 + serv->status = NNTP_NONE;
4543 + mutt_socket_close (serv->conn);
4544 + mutt_error _("Server closed connection!");
4549 +static int nntp_connect_and_auth (NNTP_SERVER *serv)
4551 + CONNECTION *conn = serv->conn;
4555 + serv->status = NNTP_NONE;
4557 + if (mutt_socket_open (conn) < 0)
4560 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4561 + return nntp_connect_error (serv);
4563 + if (!mutt_strncmp ("200", buf, 3))
4564 + mutt_message (_("Connected to %s. Posting ok."), conn->account.host);
4565 + else if (!mutt_strncmp ("201", buf, 3))
4566 + mutt_message (_("Connected to %s. Posting NOT ok."), conn->account.host);
4569 + mutt_socket_close (conn);
4570 + mutt_remove_trailing_ws (buf);
4571 + mutt_error ("%s", buf);
4578 + /* Tell INN to switch to mode reader if it isn't so. Ignore all
4579 + returned codes and messages. */
4580 + mutt_socket_write (conn, "MODE READER\r\n");
4581 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4582 + return nntp_connect_error (serv);
4584 + mutt_socket_write (conn, "STAT\r\n");
4585 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4586 + return nntp_connect_error (serv);
4588 + if (!(conn->account.flags & M_ACCT_USER) && mutt_strncmp ("480", buf, 3))
4590 + serv->status = NNTP_OK;
4594 + rc = nntp_auth (serv);
4596 + return nntp_connect_error (serv);
4599 + mutt_socket_close (conn);
4600 + serv->status = NNTP_BYE;
4605 + mutt_socket_close (conn);
4606 + mutt_error _("Login failed.");
4610 + serv->status = NNTP_OK;
4614 +static int nntp_attempt_features (NNTP_SERVER *serv)
4616 + char buf[LONG_STRING];
4617 + CONNECTION *conn = serv->conn;
4619 + mutt_socket_write (conn, "XOVER\r\n");
4620 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4621 + return nntp_connect_error (serv);
4622 + if (mutt_strncmp ("500", buf, 3))
4623 + serv->hasXOVER = 1;
4625 + mutt_socket_write (conn, "XPAT\r\n");
4626 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4627 + return nntp_connect_error (serv);
4628 + if (mutt_strncmp ("500", buf, 3))
4629 + serv->hasXPAT = 1;
4631 + mutt_socket_write (conn, "LISTGROUP\r\n");
4632 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4633 + return nntp_connect_error (serv);
4634 + if (mutt_strncmp ("500", buf, 3))
4635 + serv->hasLISTGROUP = 1;
4637 + mutt_socket_write (conn, "XGTITLE +\r\n");
4638 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4639 + return nntp_connect_error (serv);
4640 + if (mutt_strncmp ("500", buf, 3))
4641 + serv->hasXGTITLE = 1;
4643 + if (!mutt_strncmp ("282", buf, 3))
4647 + if (mutt_socket_readln (buf, sizeof (buf), conn) < 0)
4648 + return nntp_connect_error (serv);
4649 + } while (!(buf[0] == '.' && buf[1] == '\0'));
4655 +static int nntp_open_connection (NNTP_SERVER *serv)
4657 + if (serv->status == NNTP_OK)
4659 + if (serv->status == NNTP_BYE)
4661 + if (nntp_connect_and_auth (serv) < 0)
4663 + if (nntp_attempt_features (serv) < 0)
4668 +static int nntp_reconnect (NNTP_SERVER *serv)
4670 + char buf[SHORT_STRING];
4672 + mutt_socket_close (serv->conn);
4676 + if (nntp_connect_and_auth (serv) == 0)
4679 + snprintf (buf, sizeof (buf), _("Connection to %s lost. Reconnect?"),
4680 + serv->conn->account.host);
4681 + if (query_quadoption (OPT_NNTPRECONNECT, buf) != M_YES)
4683 + serv->status = NNTP_BYE;
4689 +/* Send data from line[LONG_STRING] and receive answer to same line */
4690 +static int mutt_nntp_query (NNTP_DATA *data, char *line, size_t linelen)
4692 + char buf[LONG_STRING];
4695 + if (data->nserv->status == NNTP_BYE)
4702 + mutt_socket_write (data->nserv->conn, line);
4704 + else if (data->group)
4706 + snprintf (buf, sizeof (buf), "GROUP %s\r\n", data->group);
4707 + mutt_socket_write (data->nserv->conn, buf);
4711 + if (mutt_socket_readln (buf, sizeof (buf), data->nserv->conn) < 0)
4713 + if (nntp_reconnect (data->nserv) < 0)
4718 + snprintf (buf, sizeof (buf), "GROUP %s\r\n", data->group);
4719 + mutt_socket_write (data->nserv->conn, buf);
4720 + if (mutt_socket_readln (buf, sizeof (buf), data->nserv->conn) < 0)
4726 + else if ((!mutt_strncmp ("480", buf, 3)) && nntp_auth (data->nserv) < 0)
4730 + strfcpy (line, buf, linelen);
4735 + * This function calls funct(*line, *data) for each received line,
4736 + * funct(NULL, *data) if rewind(*data) needs, exits when fail or done.
4739 + * 1 - correct but not performed (may be, have to be continued),
4740 + * -1 - conection lost,
4741 + * -2 - invalid command or execution error,
4742 + * -3 - error in funct(*line, *data).
4744 +static int mutt_nntp_fetch (NNTP_DATA *nntp_data, char *query, char *msg,
4745 + int (*funct) (char *, void *), void *data, int tagged)
4747 + char buf[LONG_STRING];
4751 + size_t lenbuf = 0;
4756 + strfcpy (buf, query, sizeof (buf));
4757 + if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0)
4759 + if (buf[0] == '5')
4761 + if (buf[0] != '2')
4766 + inbuf = safe_malloc (sizeof (buf));
4770 + chunk = mutt_socket_readln_d (buf, sizeof (buf), nntp_data->nserv->conn,
4776 + if (!lenbuf && buf[0] == '.')
4778 + if (buf[1] == '\0')
4783 + if (buf[1] == '.')
4787 + strfcpy (inbuf + lenbuf, p, sizeof (buf));
4789 + if (chunk >= sizeof (buf))
4791 + lenbuf += strlen (p);
4796 + if (msg && ReadInc && (line % ReadInc == 0)) {
4798 + mutt_message (_("%s (tagged: %d) %d"), msg, tagged, line);
4800 + mutt_message ("%s %d", msg, line);
4803 + if (ret == 0 && funct (inbuf, data) < 0)
4808 + safe_realloc (&inbuf, lenbuf + sizeof (buf));
4811 + funct (NULL, data);
4817 +static int nntp_read_tempfile (char *line, void *file)
4819 + FILE *f = (FILE *)file;
4826 + if (fputc ('\n', f) == EOF)
4832 +static void nntp_parse_xref (CONTEXT *ctx, char *group, char *xref, HEADER *h)
4834 + register char *p, *b;
4835 + register char *colon = NULL;
4840 + /* skip to next word */
4842 + while (*b && ((*b == ' ') || (*b == '\t'))) b++;
4845 + /* skip to end of word */
4846 + while (*p && (*p != ' ') && (*p != '\t'))
4861 + nntp_get_status (ctx, h, b, atoi(colon));
4862 + if (h && h->article_num == 0 && mutt_strcmp (group, b) == 0)
4863 + h->article_num = atoi(colon);
4871 + * 1 if article not found
4872 + * -1 if read or write error on tempfile or socket
4874 +static int nntp_read_header (CONTEXT *ctx, const char *msgid, int article_num)
4876 + NNTP_DATA *nntp_data = ((NNTP_DATA *)ctx->data);
4878 + char buf[LONG_STRING];
4879 + char tempfile[_POSIX_PATH_MAX];
4881 + HEADER *h = ctx->hdrs[ctx->msgcount];
4883 + mutt_mktemp (tempfile);
4884 + if (!(f = safe_fopen (tempfile, "w+")))
4888 + snprintf (buf, sizeof (buf), "HEAD %d\r\n", article_num);
4890 + snprintf (buf, sizeof (buf), "HEAD %s\r\n", msgid);
4892 + ret = mutt_nntp_fetch (nntp_data, buf, NULL, nntp_read_tempfile, f, 0);
4897 + dprint(1, (debugfile, "nntp_read_header: %s\n", buf));
4900 + unlink (tempfile);
4901 + return (ret == -1 ? -1 : 1);
4904 + h->article_num = article_num;
4905 + h->env = mutt_read_rfc822_header (f, h, 0, 0);
4907 + unlink (tempfile);
4909 + if (h->env->xref != NULL)
4910 + nntp_parse_xref (ctx, nntp_data->group, h->env->xref, h);
4911 + else if (h->article_num == 0 && msgid)
4913 + snprintf (buf, sizeof (buf), "STAT %s\r\n", msgid);
4914 + if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) == 0)
4915 + h->article_num = atoi (buf + 4);
4921 +static int parse_description (char *line, void *n)
4923 +#define news ((NNTP_SERVER *) n)
4924 + register char *d = line;
4929 + while (*d && *d != '\t' && *d != ' ') d++;
4932 + while (*d && (*d == '\t' || *d == ' ')) d++;
4933 + dprint (2, (debugfile, "group: %s, desc: %s\n", line, d));
4934 + if ((data = (NNTP_DATA *) hash_find (news->newsgroups, line)) != NULL &&
4935 + mutt_strcmp (d, data->desc))
4937 + FREE (&data->desc);
4938 + data->desc = safe_strdup (d);
4944 +static void nntp_get_desc (NNTP_DATA *data, char *mask, char *msg)
4948 + if (!option (OPTLOADDESC) || !data || !data->nserv)
4951 + /* Get newsgroup description, if we can */
4952 + if (data->nserv->hasXGTITLE)
4953 + snprintf (buf, sizeof (buf), "XGTITLE %s\r\n", mask);
4955 + snprintf (buf, sizeof (buf), "LIST NEWSGROUPS %s\r\n", mask);
4956 + if (mutt_nntp_fetch (data, buf, msg, parse_description, data->nserv, 0) != 0)
4959 + nntp_error ("nntp_get_desc()", buf);
4965 + * XOVER returns a tab separated list of:
4966 + * id|subject|from|date|Msgid|references|bytes|lines|xref
4968 + * This has to duplicate some of the functionality of
4969 + * mutt_read_rfc822_header(), since it replaces the call to that (albeit with
4970 + * a limited number of headers which are "parsed" by placement in the list)
4972 +static int nntp_parse_xover (CONTEXT *ctx, char *buf, HEADER *hdr)
4974 + NNTP_DATA *nntp_data = (NNTP_DATA *) ctx->data;
4978 + hdr->env = mutt_new_envelope();
4979 + hdr->env->newsgroups = safe_strdup (nntp_data->group);
4980 + hdr->content = mutt_new_body();
4981 + hdr->content->type = TYPETEXT;
4982 + hdr->content->subtype = safe_strdup ("plain");
4983 + hdr->content->encoding = ENC7BIT;
4984 + hdr->content->disposition = DISPINLINE;
4985 + hdr->content->length = -1;
4988 + for (x = 0; !done && x < 9; x++)
4990 + /* if from file, need to skip newline character */
4991 + while (*p && *p != '\n' && *p != '\t') p++;
4999 + hdr->article_num = atoi (b);
5000 + nntp_get_status (ctx, hdr, NULL, hdr->article_num);
5003 + hdr->env->subject = safe_strdup (b);
5004 + /* Now we need to do the things which would normally be done in
5005 + * mutt_read_rfc822_header() */
5006 + if (hdr->env->subject)
5008 + regmatch_t pmatch[1];
5010 + rfc2047_decode (&hdr->env->subject);
5012 + if (regexec (ReplyRegexp.rx, hdr->env->subject, 1, pmatch, 0) == 0)
5013 + hdr->env->real_subj = hdr->env->subject + pmatch[0].rm_eo;
5015 + hdr->env->real_subj = hdr->env->subject;
5019 + rfc822_free_address (&hdr->env->from);
5020 + hdr->env->from = rfc822_parse_adrlist (hdr->env->from, b);
5021 + rfc2047_decode_adrlist (hdr->env->from);
5024 + hdr->date_sent = mutt_parse_date (b, hdr);
5025 + hdr->received = hdr->date_sent;
5028 + FREE (&hdr->env->message_id);
5029 + hdr->env->message_id = safe_strdup (b);
5032 + mutt_free_list (&hdr->env->references);
5033 + hdr->env->references = mutt_parse_references (b, 0);
5036 + hdr->content->length = atoi (b);
5039 + hdr->lines = atoi (b);
5043 + FREE (&hdr->env->xref);
5044 + b = b + 6; /* skips the "Xref: " */
5045 + hdr->env->xref = safe_strdup (b);
5046 + nntp_parse_xref (ctx, nntp_data->group, b, hdr);
5058 + unsigned int base;
5059 + unsigned int first;
5060 + unsigned int last;
5061 + unsigned short *messages;
5065 +#define fc ((FETCH_CONTEXT *) c)
5066 +static int nntp_fetch_numbers (char *line, void *c)
5072 + num = atoi (line);
5073 + if (num < fc->base || num > fc->last)
5075 + fc->messages[num - fc->base] = 1;
5079 +static int add_xover_line (char *line, void *c)
5081 + unsigned int num, total;
5082 + CONTEXT *ctx = fc->ctx;
5083 + NNTP_DATA *data = (NNTP_DATA *)ctx->data;
5088 + if (ctx->msgcount >= ctx->hdrmax)
5089 + mx_alloc_memory (ctx);
5090 + ctx->hdrs[ctx->msgcount] = mutt_new_header ();
5091 + ctx->hdrs[ctx->msgcount]->index = ctx->msgcount;
5093 + nntp_parse_xover (ctx, line, ctx->hdrs[ctx->msgcount]);
5094 + num = ctx->hdrs[ctx->msgcount]->article_num;
5096 + if (num >= fc->first && num <= fc->last && fc->messages[num - fc->base])
5099 + if (num > data->lastLoaded)
5100 + data->lastLoaded = num;
5101 + num = num - fc->first + 1;
5102 + total = fc->last - fc->first + 1;
5103 + if (!ctx->quiet && fc->msg && ReadInc && (num % ReadInc == 0))
5104 + mutt_message ("%s %d/%d", fc->msg, num, total);
5107 + mutt_free_header (&ctx->hdrs[ctx->msgcount]); /* skip it */
5113 +static int nntp_fetch_headers (CONTEXT *ctx, unsigned int first,
5114 + unsigned int last)
5116 + char buf[HUGE_STRING];
5117 + char *msg = _("Fetching message headers...");
5118 + NNTP_DATA *nntp_data = ((NNTP_DATA *)ctx->data);
5122 + unsigned int current;
5126 + /* if empty group or nothing to do */
5127 + if (!last || first > last)
5130 + /* fetch list of articles */
5134 + fc.messages = safe_calloc (last - first + 1, sizeof (unsigned short));
5135 + if (nntp_data->nserv->hasLISTGROUP)
5137 + mutt_message _("Fetching list of articles...");
5138 + snprintf (buf, sizeof (buf), "LISTGROUP %s\r\n", nntp_data->group);
5139 + if (mutt_nntp_fetch (nntp_data, buf, NULL, nntp_fetch_numbers, &fc, 0) != 0)
5141 + mutt_error (_("LISTGROUP command failed: %s"), buf);
5143 + nntp_error ("nntp_fetch_headers()", buf);
5145 + FREE (&fc.messages);
5151 + for (num = 0; num < last - first + 1; num++)
5152 + fc.messages[num] = 1;
5155 + /* CACHE: must be loaded xover cache here */
5156 + num = nntp_data->lastCached - first + 1;
5157 + if (option (OPTNEWSCACHE) && nntp_data->cache && num > 0)
5159 + nntp_cache_expand (buf, nntp_data->cache);
5160 + mutt_message _("Fetching headers from cache...");
5161 + if ((f = safe_fopen (buf, "r")))
5165 + /* counting number of lines */
5166 + while (fgets (buf, sizeof (buf), f) != NULL)
5169 + while (r > num && fgets (buf, sizeof (buf), f) != NULL)
5171 + oldmsgcount = ctx->msgcount;
5173 + fc.last = first + num - 1;
5175 + while (fgets (buf, sizeof (buf), f) != NULL)
5176 + add_xover_line (buf, &fc);
5178 + nntp_data->lastLoaded = fc.last;
5179 + first = fc.last + 1;
5180 + if (ctx->msgcount > oldmsgcount)
5181 + mx_update_context (ctx, ctx->msgcount - oldmsgcount);
5184 + nntp_delete_cache (nntp_data);
5186 + num = last - first + 1;
5189 + FREE (&fc.messages);
5194 + * Without XOVER, we have to fetch each article header and parse
5195 + * it. With XOVER, we ask for all of them
5197 + mutt_message (msg);
5198 + if (nntp_data->nserv->hasXOVER)
5200 + oldmsgcount = ctx->msgcount;
5204 + snprintf (buf, sizeof (buf), "XOVER %d-%d\r\n", first, last);
5205 + ret = mutt_nntp_fetch (nntp_data, buf, NULL, add_xover_line, &fc, 0);
5206 + if (ctx->msgcount > oldmsgcount)
5207 + mx_update_context (ctx, ctx->msgcount - oldmsgcount);
5210 + mutt_error (_("XOVER command failed: %s"), buf);
5212 + nntp_error ("nntp_fetch_headers()", buf);
5214 + FREE (&fc.messages);
5220 + for (current = first; current <= last; current++)
5224 + ret = current - first + 1;
5225 + mutt_message ("%s %d/%d", msg, ret, num);
5227 + if (!fc.messages[current - fc.base])
5230 + if (ctx->msgcount >= ctx->hdrmax)
5231 + mx_alloc_memory (ctx);
5232 + h = ctx->hdrs[ctx->msgcount] = mutt_new_header ();
5233 + h->index = ctx->msgcount;
5235 + ret = nntp_read_header (ctx, NULL, current);
5236 + if (ret == 0) /* Got article. Fetch next header */
5238 + nntp_get_status (ctx, h, NULL, h->article_num);
5240 + mx_update_context (ctx, 1);
5243 + mutt_free_header (&h); /* skip it */
5246 + FREE (&fc.messages);
5250 + if (current > nntp_data->lastLoaded)
5251 + nntp_data->lastLoaded = current;
5253 + FREE (&fc.messages);
5254 + nntp_data->lastLoaded = last;
5255 + mutt_clear_error ();
5260 + * currently, nntp "mailbox" is "newsgroup"
5262 +int nntp_open_mailbox (CONTEXT *ctx)
5264 + NNTP_DATA *nntp_data;
5265 + NNTP_SERVER *serv;
5266 + char buf[HUGE_STRING];
5267 + char server[LONG_STRING];
5269 + unsigned int first;
5272 + if (nntp_parse_url (ctx->path, &acct, buf, sizeof (buf)) < 0 || !*buf)
5274 + mutt_error (_("%s is an invalid newsgroup specification!"), ctx->path);
5280 + nntp_expand_path (server, sizeof (server), &acct);
5281 + if (!(serv = mutt_select_newsserver (server)) || serv->status != NNTP_OK)
5284 + CurrentNewsSrv = serv;
5286 + /* create NNTP-specific state struct if nof found in list */
5287 + if ((nntp_data = (NNTP_DATA *) hash_find (serv->newsgroups, buf)) == NULL)
5289 + nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + strlen (buf) + 1);
5290 + nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
5291 + strcpy (nntp_data->group, buf);
5292 + hash_insert (serv->newsgroups, nntp_data->group, nntp_data, 0);
5293 + nntp_add_to_list (serv, nntp_data);
5295 + ctx->data = nntp_data;
5296 + ctx->mx_close = nntp_fastclose_mailbox;
5297 + nntp_data->nserv = serv;
5299 + mutt_message (_("Selecting %s..."), nntp_data->group);
5301 + if (!nntp_data->desc)
5303 + nntp_get_desc (nntp_data, nntp_data->group, NULL);
5304 + if (nntp_data->desc)
5305 + nntp_save_cache_index (serv);
5309 + if (mutt_nntp_query (nntp_data, buf, sizeof(buf)) < 0)
5312 + nntp_error ("nntp_open_mailbox()", buf);
5317 + if (mutt_strncmp ("211", buf, 3))
5319 + LIST *l = serv->list;
5321 + /* GROUP command failed */
5322 + if (!mutt_strncmp ("411", buf, 3))
5324 + mutt_error (_("Newsgroup %s not found on server %s"),
5325 + nntp_data->group, serv->conn->account.host);
5327 + /* CACHE: delete cache and line from .index */
5328 + nntp_delete_cache (nntp_data);
5329 + hash_delete (serv->newsgroups, nntp_data->group, NULL, nntp_delete_data);
5330 + while (l && l->data != (void *) nntp_data) l = l->next;
5340 + sscanf (buf + 4, "%d %u %u %s", &count, &nntp_data->firstMessage,
5341 + &nntp_data->lastMessage, buf);
5343 + nntp_data->deleted = 0;
5345 + time (&serv->check_time);
5348 + * Check for max adding context. If it is greater than $nntp_context,
5349 + * strip off extra articles
5351 + first = nntp_data->firstMessage;
5352 + if (NntpContext && nntp_data->lastMessage - first + 1 > NntpContext)
5353 + first = nntp_data->lastMessage - NntpContext + 1;
5355 + nntp_data->lastLoaded = first - 1;
5356 + return nntp_fetch_headers (ctx, first, nntp_data->lastMessage);
5359 +int nntp_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno)
5361 + char buf[LONG_STRING];
5362 + char path[_POSIX_PATH_MAX];
5363 + NNTP_CACHE *cache;
5364 + char *m = _("Fetching message...");
5367 + /* see if we already have the message in our cache */
5368 + cache = &((NNTP_DATA *) ctx->data)->acache[ctx->hdrs[msgno]->index % NNTP_CACHE_LEN];
5370 + /* if everything is fine, assign msg->fp and return */
5371 + if (cache->path && cache->index == ctx->hdrs[msgno]->index &&
5372 + (msg->fp = fopen (cache->path, "r")))
5375 + /* clear the previous entry */
5376 + unlink (cache->path);
5377 + free (cache->path);
5381 + cache->index = ctx->hdrs[msgno]->index;
5382 + mutt_mktemp (path);
5383 + cache->path = safe_strdup (path);
5384 + if (!(msg->fp = safe_fopen (path, "w+")))
5386 + FREE (&cache->path);
5390 + if (ctx->hdrs[msgno]->article_num == 0)
5391 + snprintf (buf, sizeof (buf), "ARTICLE %s\r\n",
5392 + ctx->hdrs[msgno]->env->message_id);
5394 + snprintf (buf, sizeof (buf), "ARTICLE %d\r\n",
5395 + ctx->hdrs[msgno]->article_num);
5397 + ret = mutt_nntp_fetch ((NNTP_DATA *)ctx->data, buf, m, nntp_read_tempfile,
5398 + msg->fp, ctx->tagged);
5401 + mutt_error (_("Article %d not found on server"),
5402 + ctx->hdrs[msgno]->article_num);
5403 + dprint (1, (debugfile, "nntp_fetch_message: %s\n", buf));
5410 + FREE (&cache->path);
5414 + mutt_free_envelope (&ctx->hdrs[msgno]->env);
5415 + ctx->hdrs[msgno]->env = mutt_read_rfc822_header (msg->fp, ctx->hdrs[msgno], 0, 0);
5416 + /* fix content length */
5417 + fseek(msg->fp, 0, SEEK_END);
5418 + ctx->hdrs[msgno]->content->length = ftell (msg->fp) -
5419 + ctx->hdrs[msgno]->content->offset;
5421 + /* this is called in mutt before the open which fetches the message,
5422 + * which is probably wrong, but we just call it again here to handle
5423 + * the problem instead of fixing it.
5425 + mutt_parse_mime_message (ctx, ctx->hdrs[msgno]);
5427 + /* These would normally be updated in mx_update_context(), but the
5428 + * full headers aren't parsed with XOVER, so the information wasn't
5431 +#if defined(HAVE_PGP) || defined(HAVE_SMIME)
5432 + ctx->hdrs[msgno]->security = crypt_query (ctx->hdrs[msgno]->content);
5433 +#endif /* HAVE_PGP || HAVE_SMIME */
5435 + mutt_clear_error();
5442 +int nntp_post (const char *msg) {
5443 + char buf[LONG_STRING];
5446 + NNTP_DATA *nntp_data;
5448 + if (Context && Context->magic == M_NNTP)
5449 + nntp_data = (NNTP_DATA *)Context->data;
5452 + if (!(CurrentNewsSrv = mutt_select_newsserver (NewsServer)) ||
5453 + !CurrentNewsSrv->list || !CurrentNewsSrv->list->data)
5455 + mutt_error (_("Can't post article. No connection to news server."));
5458 + nntp_data = (NNTP_DATA *)CurrentNewsSrv->list->data;
5461 + if (!(f = safe_fopen (msg, "r")))
5463 + mutt_error (_("Can't post article. Unable to open %s"), msg);
5467 + strfcpy (buf, "POST\r\n", sizeof (buf));
5468 + if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0)
5470 + mutt_error (_("Can't post article. Connection to %s lost."),
5471 + nntp_data->nserv->conn->account.host);
5474 + if (buf[0] != '3')
5476 + mutt_error (_("Can't post article: %s"), buf);
5482 + while (fgets (buf + 1, sizeof (buf) - 2, f) != NULL)
5484 + len = strlen (buf);
5485 + if (buf[len - 1] == '\n')
5487 + buf[len - 1] = '\r';
5492 + if (buf[1] == '.')
5493 + mutt_socket_write_d (nntp_data->nserv->conn, buf, -1, M_SOCK_LOG_HDR);
5495 + mutt_socket_write_d (nntp_data->nserv->conn, buf + 1, -1, M_SOCK_LOG_HDR);
5499 + if (buf[strlen (buf) - 1] != '\n')
5500 + mutt_socket_write_d (nntp_data->nserv->conn, "\r\n", -1, M_SOCK_LOG_HDR);
5501 + mutt_socket_write_d (nntp_data->nserv->conn, ".\r\n", -1, M_SOCK_LOG_HDR);
5502 + if (mutt_socket_readln (buf, sizeof (buf), nntp_data->nserv->conn) < 0)
5504 + mutt_error (_("Can't post article. Connection to %s lost."),
5505 + nntp_data->nserv->conn->account.host);
5508 + if (buf[0] != '2')
5510 + mutt_error (_("Can't post article: %s"), buf);
5517 +/* nntp_logout_all: close all open connections. */
5518 +void nntp_logout_all (void)
5520 + char buf[LONG_STRING];
5523 + conn = mutt_socket_head ();
5527 + CONNECTION *next = conn->next;
5529 + if (conn->account.type == M_ACCT_TYPE_NNTP)
5531 + mutt_message (_("Closing connection to %s..."), conn->account.host);
5532 + mutt_socket_write (conn, "QUIT\r\n");
5533 + mutt_socket_readln (buf, sizeof (buf), conn);
5534 + mutt_clear_error ();
5535 + mutt_socket_close (conn);
5536 + mutt_socket_free (conn);
5543 +static void nntp_free_acache (NNTP_DATA *data)
5547 + for (i = 0; i < NNTP_CACHE_LEN; i++)
5549 + if (data->acache[i].path)
5551 + unlink (data->acache[i].path);
5552 + FREE (&data->acache[i].path);
5557 +void nntp_delete_data (void *p)
5559 + NNTP_DATA *data = (NNTP_DATA *)p;
5563 + FREE (&data->entries);
5564 + FREE (&data->desc);
5565 + FREE (&data->cache);
5566 + nntp_free_acache (data);
5570 +int nntp_sync_mailbox (CONTEXT *ctx)
5572 + NNTP_DATA *data = ctx->data;
5574 + /* CACHE: update cache and .index files */
5575 + if ((option (OPTSAVEUNSUB) || data->subscribed))
5576 + nntp_save_cache_group (ctx);
5577 + nntp_free_acache (data);
5579 + data->nserv->check_time = 0; /* next nntp_check_mailbox() will really check */
5583 +int nntp_fastclose_mailbox (CONTEXT *ctx)
5585 + NNTP_DATA *data = (NNTP_DATA *) ctx->data, *tmp;
5589 + nntp_free_acache (data);
5590 + if (!data->nserv || !data->nserv->newsgroups || !data->group)
5592 + nntp_save_cache_index (data->nserv);
5593 + if ((tmp = hash_find (data->nserv->newsgroups, data->group)) == NULL
5595 + nntp_delete_data (data);
5599 +/* commit changes and terminate connection */
5600 +int nntp_close_mailbox (CONTEXT *ctx)
5604 + mutt_message _("Quitting newsgroup...");
5607 + NNTP_DATA *data = (NNTP_DATA *) ctx->data;
5610 + if (data->nserv && data->nserv->conn && ctx->unread)
5612 + ret = query_quadoption (OPT_CATCHUP, _("Mark all articles read?"));
5614 + mutt_newsgroup_catchup (data->nserv, data->group);
5619 + nntp_sync_mailbox (ctx);
5620 + if (ctx->data && ((NNTP_DATA *)ctx->data)->nserv)
5622 + NNTP_SERVER *news;
5624 + news = ((NNTP_DATA *)ctx->data)->nserv;
5625 + newsrc_gen_entries (ctx);
5626 + ((NNTP_DATA *)ctx->data)->unread = ctx->unread;
5627 + mutt_newsrc_update (news);
5629 + mutt_clear_error();
5633 +/* use the GROUP command to poll for new mail */
5634 +static int _nntp_check_mailbox (CONTEXT *ctx, NNTP_DATA *nntp_data)
5636 + char buf[LONG_STRING];
5639 + if (nntp_data->nserv->check_time + NewsPollTimeout > time (NULL))
5643 + if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0)
5646 + nntp_error ("nntp_check_mailbox()", buf);
5650 + if (mutt_strncmp ("211", buf, 3))
5653 + if (mutt_nntp_query (nntp_data, buf, sizeof (buf)) < 0)
5656 + nntp_error ("nntp_check_mailbox()", buf);
5661 + if (!mutt_strncmp ("211", buf, 3))
5666 + sscanf (buf + 4, "%d %d %d", &count, &first, &last);
5667 + nntp_data->firstMessage = first;
5668 + nntp_data->lastMessage = last;
5669 + if (ctx && last > nntp_data->lastLoaded)
5671 + nntp_fetch_headers (ctx, nntp_data->lastLoaded + 1, last);
5672 + time (&nntp_data->nserv->check_time);
5675 + if (!last || (!nntp_data->rc && !nntp_data->lastCached))
5676 + nntp_data->unread = count;
5678 + mutt_newsgroup_stat (nntp_data);
5679 + /* active was renumbered? */
5680 + if (last < nntp_data->lastLoaded)
5682 + if (!nntp_data->max)
5684 + nntp_data->entries = safe_calloc (5, sizeof (NEWSRC_ENTRY));
5685 + nntp_data->max = 5;
5687 + nntp_data->lastCached = 0;
5688 + nntp_data->num = 1;
5689 + nntp_data->entries[0].first = 1;
5690 + nntp_data->entries[0].last = 0;
5694 + time (&nntp_data->nserv->check_time);
5698 +int nntp_check_mailbox (CONTEXT *ctx)
5700 + return _nntp_check_mailbox (ctx, (NNTP_DATA *)ctx->data);
5703 +static int add_group (char *buf, void *serv)
5705 +#define s ((NNTP_SERVER *) serv)
5706 + char group[LONG_STRING], mod, desc[HUGE_STRING];
5708 + NNTP_DATA *nntp_data;
5711 + _checked = n; /* _checked have N, where N = number of groups */
5712 + if (!buf) /* at EOF must be zerouth */
5719 + sscanf (buf, "%s %d %d %c %[^\n]", group, &last, &first, &mod, desc);
5722 + if ((nntp_data = (NNTP_DATA *) hash_find (s->newsgroups, group)) == NULL)
5725 + nntp_data = safe_calloc (1, sizeof (NNTP_DATA) + strlen (group) + 1);
5726 + nntp_data->group = (char *) nntp_data + sizeof (NNTP_DATA);
5727 + strcpy (nntp_data->group, group);
5728 + nntp_data->nserv = s;
5729 + if (s->newsgroups->nelem < s->newsgroups->curnelem * 2)
5730 + s->newsgroups = hash_resize (s->newsgroups, s->newsgroups->nelem * 2, 0);
5731 + hash_insert (s->newsgroups, nntp_data->group, nntp_data, 0);
5732 + nntp_add_to_list (s, nntp_data);
5734 + nntp_data->deleted = 0;
5735 + nntp_data->firstMessage = first;
5736 + nntp_data->lastMessage = last;
5738 + nntp_data->allowed = 1;
5740 + nntp_data->allowed = 0;
5741 + if (nntp_data->desc)
5742 + FREE (&nntp_data->desc);
5744 + nntp_data->desc = safe_strdup (desc);
5745 + if (nntp_data->rc || nntp_data->lastCached)
5746 + mutt_newsgroup_stat (nntp_data);
5747 + else if (nntp_data->lastMessage &&
5748 + nntp_data->firstMessage <= nntp_data->lastMessage)
5749 + nntp_data->unread = nntp_data->lastMessage - nntp_data->firstMessage + 1;
5751 + nntp_data->unread = 0;
5757 +int nntp_check_newgroups (NNTP_SERVER *serv, int force)
5759 + char buf[LONG_STRING];
5760 + char msg[SHORT_STRING];
5761 + NNTP_DATA nntp_data;
5766 + unsigned int count = 0;
5767 + unsigned int total = 0;
5769 + if (!serv || !serv->newgroups_time)
5772 + if (nntp_open_connection (serv) < 0)
5775 + /* check subscribed groups for new news */
5776 + if (option (OPTSHOWNEWNEWS))
5778 + mutt_message _("Checking for new messages...");
5779 + for (l = serv->list; l; l = l->next)
5781 + serv->check_time = 0; /* really check! */
5782 + if (l->data && ((NNTP_DATA *) l->data)->subscribed)
5783 + _nntp_check_mailbox (NULL, (NNTP_DATA *) l->data);
5789 + mutt_message _("Checking for new newsgroups...");
5790 + now = serv->newgroups_time;
5791 + time (&serv->newgroups_time);
5792 + t = gmtime (&now);
5793 + snprintf (buf, sizeof (buf), "NEWGROUPS %02d%02d%02d %02d%02d%02d GMT\r\n",
5794 + (t->tm_year % 100), t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min,
5796 + nntp_data.nserv = serv;
5797 + if (Context && Context->magic == M_NNTP)
5798 + nntp_data.group = ((NNTP_DATA *)Context->data)->group;
5800 + nntp_data.group = NULL;
5802 + if (mutt_nntp_fetch (&nntp_data, buf, _("Adding new newsgroups..."),
5803 + add_group, serv, 0) != 0)
5806 + nntp_error ("nntp_check_newgroups()", buf);
5811 + strfcpy (msg, _("Loading descriptions..."), sizeof (msg));
5812 + mutt_message (msg);
5814 + emp.next = l->next;
5816 + emp.next = serv->list;
5821 + ((NNTP_DATA *) l->data)->new = 1;
5828 + nntp_get_desc ((NNTP_DATA *) l->data, ((NNTP_DATA *) l->data)->group, NULL);
5830 + if (ReadInc && (count % ReadInc == 0))
5831 + mutt_message ("%s %d/%d", msg, count, total);
5834 + nntp_save_cache_index (serv);
5835 + mutt_clear_error ();
5839 +/* Load list of all newsgroups from cache ALL */
5840 +int nntp_get_cache_all (NNTP_SERVER *serv)
5842 + char buf[HUGE_STRING];
5845 + nntp_cache_expand (buf, serv->cache);
5846 + if ((f = safe_fopen (buf, "r")))
5850 + while (fgets (buf, sizeof(buf), f) != NULL)
5852 + if (ReadInc && (i % ReadInc == 0))
5853 + mutt_message (_("Loading list from cache... %d"), i);
5854 + add_group (buf, serv);
5857 + add_group (NULL, NULL);
5859 + mutt_clear_error ();
5864 + FREE (&serv->cache);
5869 +/* Load list of all newsgroups from active */
5870 +int nntp_get_active (NNTP_SERVER *serv)
5872 + char msg[SHORT_STRING];
5873 + NNTP_DATA nntp_data;
5876 + if (nntp_open_connection (serv) < 0)
5879 + snprintf (msg, sizeof(msg), _("Loading list of all newsgroups on server %s..."),
5880 + serv->conn->account.host);
5881 + mutt_message (msg);
5882 + time (&serv->newgroups_time);
5883 + nntp_data.nserv = serv;
5884 + nntp_data.group = NULL;
5886 + if (mutt_nntp_fetch (&nntp_data, "LIST\r\n", msg, add_group, serv, 0) < 0)
5889 + nntp_error ("nntp_get_active()", "LIST\r\n");
5894 + strfcpy (msg, _("Loading descriptions..."), sizeof (msg));
5895 + mutt_message (msg);
5896 + nntp_get_desc (&nntp_data, "*", msg);
5898 + for (tmp = serv->list; tmp; tmp = tmp->next)
5900 + NNTP_DATA *data = (NNTP_DATA *)tmp->data;
5902 + if (data && data->deleted && !data->rc)
5904 + nntp_delete_cache (data);
5905 + hash_delete (serv->newsgroups, data->group, NULL, nntp_delete_data);
5909 + nntp_save_cache_index (serv);
5911 + mutt_clear_error ();
5916 + * returns -1 if error ocurred while retrieving header,
5917 + * number of articles which ones exist in context on success.
5919 +int nntp_check_msgid (CONTEXT *ctx, const char *msgid)
5923 + /* if msgid is already in context, don't reload them */
5924 + if (hash_find (ctx->id_hash, msgid))
5926 + if (ctx->msgcount == ctx->hdrmax)
5927 + mx_alloc_memory (ctx);
5928 + ctx->hdrs[ctx->msgcount] = mutt_new_header ();
5929 + ctx->hdrs[ctx->msgcount]->index = ctx->msgcount;
5931 + mutt_message (_("Fetching %s from server..."), msgid);
5932 + ret = nntp_read_header (ctx, msgid, 0);
5933 + /* since nntp_read_header() may set read flag, we must reset it */
5934 + ctx->hdrs[ctx->msgcount]->read = 0;
5936 + mutt_free_header (&ctx->hdrs[ctx->msgcount]);
5940 + mx_update_context (ctx, 1);
5951 + unsigned int *child;
5954 +static int check_children (char *s, void *c)
5956 +#define cc ((CHILD_CONTEXT *) c)
5957 + unsigned int i, n;
5959 + if (!s || (n = atoi (s)) == 0)
5961 + for (i = 0; i < cc->ctx->msgcount; i++)
5962 + if (cc->ctx->hdrs[i]->article_num == n)
5964 + if (cc->num >= cc->max)
5965 + safe_realloc (&cc->child, sizeof (unsigned int) * (cc->max += 25));
5966 + cc->child[cc->num++] = n;
5972 +int nntp_check_children (CONTEXT *ctx, const char *msgid)
5974 + NNTP_DATA *nntp_data = (NNTP_DATA *)ctx->data;
5976 + int i, ret = 0, tmp = 0;
5979 + if (!nntp_data || !nntp_data->nserv || !nntp_data->nserv->conn ||
5980 + !nntp_data->nserv->conn->account.host)
5982 + if (nntp_data->firstMessage > nntp_data->lastLoaded)
5984 + if (!nntp_data->nserv->hasXPAT)
5986 + mutt_error (_("Server %s does not support this operation!"),
5987 + nntp_data->nserv->conn->account.host);
5991 + snprintf (buf, sizeof (buf), "XPAT References %d-%d *%s*\r\n",
5992 + nntp_data->firstMessage, nntp_data->lastLoaded, msgid);
5997 + cc.child = safe_malloc (sizeof (unsigned int) * 25);
5998 + if (mutt_nntp_fetch (nntp_data, buf, NULL, check_children, &cc, 0))
6003 + /* dont try to read the xover cache. check_children() already
6004 + * made sure that we dont have the article, so we need to visit
6005 + * the server. Reading the cache at this point is also bad
6006 + * because it would duplicate messages */
6007 + if (option (OPTNEWSCACHE))
6010 + unset_option (OPTNEWSCACHE);
6012 + for (i = 0; i < cc.num; i++)
6014 + if ((ret = nntp_fetch_headers (ctx, cc.child[i], cc.child[i])))
6016 + if (ctx->msgcount &&
6017 + ctx->hdrs[ctx->msgcount - 1]->article_num == cc.child[i])
6018 + ctx->hdrs[ctx->msgcount - 1]->read = 0;
6021 + set_option (OPTNEWSCACHE);
6025 Index: mutt-1.5.20/nntp.h
6026 ===================================================================
6027 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
6028 +++ mutt-1.5.20/nntp.h 2010-02-22 20:00:43.451821024 -0300
6031 + * Copyright (C) 1998 Brandon Long <blong@fiction.net>
6032 + * Copyright (C) 1999 Andrej Gritsenko <andrej@lucky.net>
6033 + * Copyright (C) 2000-2007 Vsevolod Volkov <vvv@mutt.org.ua>
6035 + * This program is free software; you can redistribute it and/or modify
6036 + * it under the terms of the GNU General Public License as published by
6037 + * the Free Software Foundation; either version 2 of the License, or
6038 + * (at your option) any later version.
6040 + * This program is distributed in the hope that it will be useful,
6041 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6042 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6043 + * GNU General Public License for more details.
6045 + * You should have received a copy of the GNU General Public License
6046 + * along with this program; if not, write to the Free Software
6047 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
6053 +#include "mutt_socket.h"
6054 +#include "mailbox.h"
6058 +#define NNTP_PORT 119
6059 +#define NNTP_SSL_PORT 563
6061 +/* number of entries in the hash table */
6062 +#define NNTP_CACHE_LEN 10
6079 + unsigned int hasXPAT : 1;
6080 + unsigned int hasXGTITLE : 1;
6081 + unsigned int hasXOVER : 1;
6082 + unsigned int hasLISTGROUP : 1;
6083 + unsigned int status : 3;
6089 + time_t newgroups_time;
6090 + time_t check_time;
6092 + LIST *list; /* list of newsgroups */
6093 + LIST *tail; /* last entry of list */
6099 + unsigned int index;
6105 + NEWSRC_ENTRY *entries;
6106 + unsigned int num; /* number of used entries */
6107 + unsigned int max; /* number of allocated entries */
6108 + unsigned int unread;
6109 + unsigned int firstMessage;
6110 + unsigned int lastMessage;
6111 + unsigned int lastLoaded;
6112 + unsigned int lastCached;
6113 + unsigned int subscribed : 1;
6114 + unsigned int rc : 1;
6115 + unsigned int new : 1;
6116 + unsigned int allowed : 1;
6117 + unsigned int deleted : 1;
6121 + NNTP_SERVER *nserv;
6122 + NNTP_CACHE acache[NNTP_CACHE_LEN];
6125 +/* internal functions */
6126 +int nntp_get_active (NNTP_SERVER *);
6127 +int nntp_get_cache_all (NNTP_SERVER *);
6128 +int nntp_save_cache_index (NNTP_SERVER *);
6129 +int nntp_check_newgroups (NNTP_SERVER *, int);
6130 +int nntp_save_cache_group (CONTEXT *);
6131 +int nntp_parse_url (const char *, ACCOUNT *, char *, size_t);
6132 +void newsrc_gen_entries (CONTEXT *);
6133 +void nntp_get_status (CONTEXT *, HEADER *, char *, int);
6134 +void mutt_newsgroup_stat (NNTP_DATA *);
6135 +void nntp_delete_cache (NNTP_DATA *);
6136 +void nntp_add_to_list (NNTP_SERVER *, NNTP_DATA *);
6137 +void nntp_cache_expand (char *, const char *);
6138 +void nntp_delete_data (void *);
6140 +/* exposed interface */
6141 +NNTP_SERVER *mutt_select_newsserver (char *);
6142 +NNTP_DATA *mutt_newsgroup_subscribe (NNTP_SERVER *, char *);
6143 +NNTP_DATA *mutt_newsgroup_unsubscribe (NNTP_SERVER *, char *);
6144 +NNTP_DATA *mutt_newsgroup_catchup (NNTP_SERVER *, char *);
6145 +NNTP_DATA *mutt_newsgroup_uncatchup (NNTP_SERVER *, char *);
6146 +void nntp_clear_cacheindex (NNTP_SERVER *);
6147 +int mutt_newsrc_update (NNTP_SERVER *);
6148 +int nntp_open_mailbox (CONTEXT *);
6149 +int nntp_sync_mailbox (CONTEXT *);
6150 +int nntp_check_mailbox (CONTEXT *);
6151 +int nntp_close_mailbox (CONTEXT *);
6152 +int nntp_fastclose_mailbox (CONTEXT *);
6153 +int nntp_fetch_message (MESSAGE *, CONTEXT *, int);
6154 +int nntp_post (const char *);
6155 +int nntp_check_msgid (CONTEXT *, const char *);
6156 +int nntp_check_children (CONTEXT *, const char *);
6157 +void nntp_buffy (char *);
6158 +void nntp_expand_path (char *, size_t, ACCOUNT *);
6159 +void nntp_logout_all ();
6160 +const char *nntp_format_str (char *, size_t, size_t, char, const char *, const char *,
6161 + const char *, const char *, unsigned long, format_flag);
6163 +NNTP_SERVER *CurrentNewsSrv INITVAL (NULL);
6165 +#endif /* _NNTP_H_ */
6166 Index: mutt-1.5.20/pager.c
6167 ===================================================================
6168 --- mutt-1.5.20.orig/pager.c 2010-02-22 19:59:29.000000000 -0300
6169 +++ mutt-1.5.20/pager.c 2010-02-22 20:00:43.451821024 -0300
6170 @@ -1060,6 +1060,11 @@
6180 static int format_line (struct line_t **lineInfo, int n, unsigned char *buf,
6181 int flags, ansi_attr *pa, int cnt,
6182 @@ -1515,6 +1520,16 @@
6187 +static struct mapping_t PagerNewsHelpExtra[] = {
6188 + { N_("Post"), OP_POST },
6189 + { N_("Followup"), OP_FOLLOWUP },
6190 + { N_("Del"), OP_DELETE },
6191 + { N_("Next"), OP_MAIN_NEXT_UNDELETED },
6198 /* This pager is actually not so simple as it once was. It now operates in
6199 @@ -1556,6 +1571,10 @@
6200 int old_PagerIndexLines; /* some people want to resize it
6201 * while inside the pager... */
6204 + char *followup_to;
6207 if (!(flags & M_SHOWCOLOR))
6208 flags |= M_SHOWFLAT;
6210 @@ -1595,7 +1614,11 @@
6211 if (IsHeader (extra))
6213 strfcpy (tmphelp, helpstr, sizeof (tmphelp));
6214 - mutt_compile_help (buffer, sizeof (buffer), MENU_PAGER, PagerHelpExtra);
6215 + mutt_compile_help (buffer, sizeof (buffer), MENU_PAGER,
6217 + (Context && (Context->magic == M_NNTP)) ? PagerNewsHelpExtra :
6220 snprintf (helpstr, sizeof (helpstr), "%s %s", tmphelp, buffer);
6223 @@ -2485,6 +2508,15 @@
6225 CHECK_ACL(M_ACL_WRITE, "flag message");
6228 + if (Context->magic == M_NNTP)
6231 + mutt_error _("Can't change 'important' flag on NNTP server.");
6236 mutt_set_flag (Context, extra->hdr, M_FLAG, !extra->hdr->flagged);
6237 redraw = REDRAW_STATUS | REDRAW_INDEX;
6238 if (option (OPTRESOLVE))
6239 @@ -2518,6 +2550,60 @@
6240 redraw = REDRAW_FULL;
6245 + CHECK_MODE(IsHeader (extra) && !IsAttach (extra));
6247 + if (extra->ctx && extra->ctx->magic == M_NNTP &&
6248 + !((NNTP_DATA *)extra->ctx->data)->allowed &&
6249 + query_quadoption (OPT_TOMODERATED,_("Posting to this group not allowed, may be moderated. Continue?")) != M_YES)
6251 + ci_send_message (SENDNEWS, NULL, NULL, extra->ctx, NULL);
6252 + redraw = REDRAW_FULL;
6255 + case OP_FORWARD_TO_GROUP:
6256 + CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
6258 + if (extra->ctx && extra->ctx->magic == M_NNTP &&
6259 + !((NNTP_DATA *)extra->ctx->data)->allowed &&
6260 + query_quadoption (OPT_TOMODERATED,_("Posting to this group not allowed, may be moderated. Continue?")) != M_YES)
6262 + if (IsMsgAttach (extra))
6263 + mutt_attach_forward (extra->fp, extra->hdr, extra->idx,
6264 + extra->idxlen, extra->bdy, SENDNEWS);
6266 + ci_send_message (SENDNEWS|SENDFORWARD, NULL, NULL, extra->ctx, extra->hdr);
6267 + redraw = REDRAW_FULL;
6271 + CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
6274 + if (IsMsgAttach (extra))
6275 + followup_to = extra->bdy->hdr->env->followup_to;
6277 + followup_to = extra->hdr->env->followup_to;
6279 + if (!followup_to || mutt_strcasecmp (followup_to, "poster") ||
6280 + query_quadoption (OPT_FOLLOWUPTOPOSTER,_("Reply by mail as poster prefers?")) != M_YES)
6282 + if (extra->ctx && extra->ctx->magic == M_NNTP &&
6283 + !((NNTP_DATA *)extra->ctx->data)->allowed &&
6284 + query_quadoption (OPT_TOMODERATED,_("Posting to this group not allowed, may be moderated. Continue?")) != M_YES)
6286 + if (IsMsgAttach (extra))
6287 + mutt_attach_reply (extra->fp, extra->hdr, extra->idx,
6288 + extra->idxlen, extra->bdy, SENDNEWS|SENDREPLY);
6290 + ci_send_message (SENDNEWS|SENDREPLY, NULL, NULL,
6291 + extra->ctx, extra->hdr);
6292 + redraw = REDRAW_FULL;
6298 CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra));
6300 @@ -2564,7 +2650,7 @@
6302 if (IsMsgAttach (extra))
6303 mutt_attach_forward (extra->fp, extra->hdr, extra->idx,
6304 - extra->idxlen, extra->bdy);
6305 + extra->idxlen, extra->bdy, 0);
6307 ci_send_message (SENDFORWARD, NULL, NULL, extra->ctx, extra->hdr);
6308 redraw = REDRAW_FULL;
6309 Index: mutt-1.5.20/parse.c
6310 ===================================================================
6311 --- mutt-1.5.20.orig/parse.c 2009-06-01 13:29:32.000000000 -0300
6312 +++ mutt-1.5.20/parse.c 2010-02-22 20:00:43.452820965 -0300
6317 -static LIST *mutt_parse_references (char *s, int in_reply_to)
6318 +LIST *mutt_parse_references (char *s, int in_reply_to)
6320 LIST *t, *lst = NULL;
6322 @@ -1067,6 +1067,17 @@
6323 e->from = rfc822_parse_adrlist (e->from, p);
6327 + else if (!mutt_strcasecmp (line+1, "ollowup-to"))
6329 + if (!e->followup_to)
6331 + mutt_remove_trailing_ws (p);
6332 + e->followup_to = safe_strdup (mutt_skip_whitespace (p));
6340 @@ -1149,6 +1160,27 @@
6346 + if (!mutt_strcasecmp (line + 1, "ewsgroups"))
6348 + FREE (&e->newsgroups);
6349 + mutt_remove_trailing_ws (p);
6350 + e->newsgroups = safe_strdup (mutt_skip_whitespace (p));
6357 + /* field `Organization:' saves only for pager! */
6358 + if (!mutt_strcasecmp (line + 1, "rganization"))
6360 + if (!e->organization && mutt_strcasecmp (p, "unknown"))
6361 + e->organization = safe_strdup (p);
6366 if (!ascii_strcasecmp (line + 1, "eferences"))
6368 @@ -1257,6 +1289,20 @@
6369 e->x_label = safe_strdup(p);
6373 + else if (!mutt_strcasecmp (line + 1, "-comment-to"))
6375 + if (!e->x_comment_to)
6376 + e->x_comment_to = safe_strdup (p);
6379 + else if (!mutt_strcasecmp (line + 1, "ref"))
6382 + e->xref = safe_strdup (p);
6389 Index: mutt-1.5.20/pattern.c
6390 ===================================================================
6391 --- mutt-1.5.20.orig/pattern.c 2010-02-22 19:59:29.000000000 -0300
6392 +++ mutt-1.5.20/pattern.c 2010-02-22 20:00:43.452820965 -0300
6394 { 'U', M_UNREAD, 0, NULL },
6395 { 'v', M_COLLAPSED, 0, NULL },
6396 { 'V', M_CRYPT_VERIFIED, 0, NULL },
6398 + { 'w', M_NEWSGROUPS, 0, eat_regexp },
6400 { 'x', M_REFERENCE, 0, eat_regexp },
6401 { 'X', M_MIMEATTACH, 0, eat_range },
6402 { 'y', M_XLABEL, 0, eat_regexp },
6403 @@ -1210,6 +1213,10 @@
6405 case M_UNREFERENCED:
6406 return (pat->not ^ (h->thread && !h->thread->child));
6408 + case M_NEWSGROUPS:
6409 + return (pat->not ^ (h->env->newsgroups && patmatch (pat, h->env->newsgroups) == 0));
6412 mutt_error (_("error: unknown op %d (report this error)."), pat->op);
6414 @@ -1291,6 +1298,7 @@
6415 progress_t progress;
6417 strfcpy (buf, NONULL (Context->pattern), sizeof (buf));
6418 + if (prompt || op != M_LIMIT)
6419 if (mutt_get_field (prompt, buf, sizeof (buf), M_PATTERN | M_CLEAR) != 0 || !buf[0])
6422 Index: mutt-1.5.20/po/POTFILES.in
6423 ===================================================================
6424 --- mutt-1.5.20.orig/po/POTFILES.in 2010-02-22 19:59:29.000000000 -0300
6425 +++ mutt-1.5.20/po/POTFILES.in 2010-02-22 20:00:43.452820965 -0300
6435 Index: mutt-1.5.20/postpone.c
6436 ===================================================================
6437 --- mutt-1.5.20.orig/postpone.c 2010-02-22 19:59:29.000000000 -0300
6438 +++ mutt-1.5.20/postpone.c 2010-02-22 20:00:43.452820965 -0300
6439 @@ -124,15 +124,26 @@
6441 if (LastModify < st.st_mtime)
6444 + int optnews = option (OPTNEWS);
6446 LastModify = st.st_mtime;
6448 if (access (Postponed, R_OK | F_OK) != 0)
6449 return (PostCount = 0);
6452 + unset_option (OPTNEWS);
6454 if (mx_open_mailbox (Postponed, M_NOSORT | M_QUIET, &ctx) == NULL)
6457 PostCount = ctx.msgcount;
6458 mx_fastclose_mailbox (&ctx);
6461 + set_option (OPTNEWS);
6466 Index: mutt-1.5.20/protos.h
6467 ===================================================================
6468 --- mutt-1.5.20.orig/protos.h 2010-02-22 19:59:29.000000000 -0300
6469 +++ mutt-1.5.20/protos.h 2010-02-22 20:00:43.452820965 -0300
6471 HASH *mutt_make_subj_hash (CONTEXT *);
6473 LIST *mutt_make_references(ENVELOPE *e);
6474 +LIST *mutt_parse_references (char *, int);
6476 char *mutt_read_rfc822_line (FILE *, char *, size_t *);
6477 ENVELOPE *mutt_read_rfc822_header (FILE *, HEADER *, short, short);
6478 Index: mutt-1.5.20/recvattach.c
6479 ===================================================================
6480 --- mutt-1.5.20.orig/recvattach.c 2010-02-22 19:59:29.000000000 -0300
6481 +++ mutt-1.5.20/recvattach.c 2010-02-22 20:00:43.453821337 -0300
6482 @@ -1110,6 +1110,15 @@
6487 + if (Context->magic == M_NNTP)
6490 + mutt_error _("Can't delete attachment from newsserver.");
6495 if (WithCrypto && hdr->security & ~PGP_TRADITIONAL_CHECKED)
6498 @@ -1201,10 +1210,33 @@
6499 case OP_FORWARD_MESSAGE:
6501 mutt_attach_forward (fp, hdr, idx, idxlen,
6502 - menu->tagprefix ? NULL : idx[menu->current]->content);
6503 + menu->tagprefix ? NULL : idx[menu->current]->content, 0);
6504 menu->redraw = REDRAW_FULL;
6508 + case OP_FORWARD_TO_GROUP:
6510 + mutt_attach_forward (fp, hdr, idx, idxlen,
6511 + menu->tagprefix ? NULL : idx[menu->current]->content, SENDNEWS);
6512 + menu->redraw = REDRAW_FULL;
6518 + if (!idx[menu->current]->content->hdr->env->followup_to ||
6519 + mutt_strcasecmp (idx[menu->current]->content->hdr->env->followup_to, "poster") ||
6520 + query_quadoption (OPT_FOLLOWUPTOPOSTER,_("Reply by mail as poster prefers?")) != M_YES)
6522 + mutt_attach_reply (fp, hdr, idx, idxlen,
6523 + menu->tagprefix ? NULL : idx[menu->current]->content,
6524 + SENDNEWS|SENDREPLY);
6525 + menu->redraw = REDRAW_FULL;
6531 case OP_GROUP_REPLY:
6533 Index: mutt-1.5.20/recvcmd.c
6534 ===================================================================
6535 --- mutt-1.5.20.orig/recvcmd.c 2009-06-12 14:24:17.000000000 -0300
6536 +++ mutt-1.5.20/recvcmd.c 2010-02-22 20:00:43.453821337 -0300
6538 static void attach_forward_bodies (FILE * fp, HEADER * hdr,
6539 ATTACHPTR ** idx, short idxlen,
6542 + short nattach, int flags)
6545 short mime_fwd_all = 0;
6549 /* now that we have the template, send it. */
6550 - ci_send_message (0, tmphdr, tmpbody, NULL, parent);
6551 + ci_send_message (flags, tmphdr, tmpbody, NULL, parent);
6558 static void attach_forward_msgs (FILE * fp, HEADER * hdr,
6559 - ATTACHPTR ** idx, short idxlen, BODY * cur)
6560 + ATTACHPTR ** idx, short idxlen, BODY * cur, int flags)
6562 HEADER *curhdr = NULL;
6564 @@ -679,23 +679,23 @@
6566 mutt_free_header (&tmphdr);
6568 - ci_send_message (0, tmphdr, *tmpbody ? tmpbody : NULL,
6569 + ci_send_message (flags, tmphdr, *tmpbody ? tmpbody : NULL,
6574 void mutt_attach_forward (FILE * fp, HEADER * hdr,
6575 - ATTACHPTR ** idx, short idxlen, BODY * cur)
6576 + ATTACHPTR ** idx, short idxlen, BODY * cur, int flags)
6581 if (check_all_msg (idx, idxlen, cur, 0) == 0)
6582 - attach_forward_msgs (fp, hdr, idx, idxlen, cur);
6583 + attach_forward_msgs (fp, hdr, idx, idxlen, cur, flags);
6586 nattach = count_tagged (idx, idxlen);
6587 - attach_forward_bodies (fp, hdr, idx, idxlen, cur, nattach);
6588 + attach_forward_bodies (fp, hdr, idx, idxlen, cur, nattach, flags);
6592 @@ -753,28 +753,40 @@
6598 + if ((flags & SENDNEWS))
6600 - if (mutt_fetch_recips (env, curenv, flags) == -1)
6602 + /* in case followup set Newsgroups: with Followup-To: if it present */
6603 + if (!env->newsgroups && curenv &&
6604 + mutt_strcasecmp (curenv->followup_to, "poster"))
6605 + env->newsgroups = safe_strdup (curenv->followup_to);
6610 - for (i = 0; i < idxlen; i++)
6613 - if (idx[i]->content->tagged
6614 - && mutt_fetch_recips (env, idx[i]->content->hdr->env, flags) == -1)
6615 + if (mutt_fetch_recips (env, curenv, flags) == -1)
6620 + for (i = 0; i < idxlen; i++)
6622 + if (idx[i]->content->tagged
6623 + && mutt_fetch_recips (env, idx[i]->content->hdr->env, flags) == -1)
6628 + if ((flags & SENDLISTREPLY) && !env->to)
6630 + mutt_error _("No mailing lists found!");
6634 + mutt_fix_reply_recipients (env);
6637 - if ((flags & SENDLISTREPLY) && !env->to)
6639 - mutt_error _("No mailing lists found!");
6643 - mutt_fix_reply_recipients (env);
6644 mutt_make_misc_reply_headers (env, Context, curhdr, curenv);
6647 @@ -835,6 +847,13 @@
6648 char prefix[SHORT_STRING];
6652 + if (flags & SENDNEWS)
6653 + set_option (OPTNEWSSEND);
6655 + unset_option (OPTNEWSSEND);
6658 if (check_all_msg (idx, idxlen, cur, 0) == -1)
6660 nattach = count_tagged (idx, idxlen);
6661 Index: mutt-1.5.20/rfc1524.c
6662 ===================================================================
6663 --- mutt-1.5.20.orig/rfc1524.c 2009-05-30 14:20:08.000000000 -0300
6664 +++ mutt-1.5.20/rfc1524.c 2010-02-22 20:00:43.453821337 -0300
6665 @@ -569,13 +569,13 @@
6669 -int mutt_rename_file (char *oldfile, char *newfile)
6670 +int _mutt_rename_file (char *oldfile, char *newfile, int overwrite)
6674 if (access (oldfile, F_OK) != 0)
6676 - if (access (newfile, F_OK) == 0)
6677 + if (!overwrite && access (newfile, F_OK) == 0)
6679 if ((ofp = fopen (oldfile,"r")) == NULL)
6682 mutt_unlink (oldfile);
6686 +int mutt_rename_file (char *oldfile, char *newfile)
6688 + return _mutt_rename_file (oldfile, newfile, 0);
6690 Index: mutt-1.5.20/rfc1524.h
6691 ===================================================================
6692 --- mutt-1.5.20.orig/rfc1524.h 2008-11-11 17:55:47.000000000 -0200
6693 +++ mutt-1.5.20/rfc1524.h 2010-02-22 20:00:43.453821337 -0300
6695 int rfc1524_expand_filename (char *, char *, char *, size_t);
6696 int rfc1524_mailcap_lookup (BODY *, char *, rfc1524_entry *, int);
6697 int mutt_rename_file (char *, char *);
6698 +int _mutt_rename_file (char *, char *, int);
6700 #endif /* _RFC1524_H */
6701 Index: mutt-1.5.20/send.c
6702 ===================================================================
6703 --- mutt-1.5.20.orig/send.c 2010-02-22 19:59:29.000000000 -0300
6704 +++ mutt-1.5.20/send.c 2010-02-22 20:00:43.454823365 -0300
6706 #include <sys/types.h>
6715 #include "remailer.h"
6717 @@ -213,17 +218,51 @@
6721 -static int edit_envelope (ENVELOPE *en)
6722 +static int edit_envelope (ENVELOPE *en, int flags)
6724 char buf[HUGE_STRING];
6725 LIST *uh = UserHeader;
6727 - if (edit_address (&en->to, "To: ") == -1 || en->to == NULL)
6729 - if (option (OPTASKCC) && edit_address (&en->cc, "Cc: ") == -1)
6731 - if (option (OPTASKBCC) && edit_address (&en->bcc, "Bcc: ") == -1)
6734 + if (option (OPTNEWSSEND))
6736 + if (en->newsgroups)
6737 + strfcpy (buf, en->newsgroups, sizeof (buf));
6740 + if (mutt_get_field ("Newsgroups: ", buf, sizeof (buf), 0) != 0)
6742 + FREE (&en->newsgroups);
6743 + en->newsgroups = safe_strdup (buf);
6745 + if (en->followup_to)
6746 + strfcpy (buf, en->followup_to, sizeof (buf));
6749 + if (option (OPTASKFOLLOWUP) && mutt_get_field ("Followup-To: ", buf, sizeof (buf), 0) != 0)
6751 + FREE (&en->followup_to);
6752 + en->followup_to = safe_strdup (buf);
6754 + if (en->x_comment_to)
6755 + strfcpy (buf, en->x_comment_to, sizeof (buf));
6758 + if (option (OPTXCOMMENTTO) && option (OPTASKXCOMMENTTO) && mutt_get_field ("X-Comment-To: ", buf, sizeof (buf), 0) != 0)
6760 + FREE (&en->x_comment_to);
6761 + en->x_comment_to = safe_strdup (buf);
6766 + if (edit_address (&en->to, "To: ") == -1 || en->to == NULL)
6768 + if (option (OPTASKCC) && edit_address (&en->cc, "Cc: ") == -1)
6770 + if (option (OPTASKBCC) && edit_address (&en->bcc, "Bcc: ") == -1)
6776 @@ -259,6 +298,14 @@
6781 +char *nntp_get_header (const char *s)
6784 + return safe_strdup (s);
6788 static void process_user_recips (ENVELOPE *env)
6790 LIST *uh = UserHeader;
6791 @@ -271,6 +318,14 @@
6792 env->cc = rfc822_parse_adrlist (env->cc, uh->data + 3);
6793 else if (ascii_strncasecmp ("bcc:", uh->data, 4) == 0)
6794 env->bcc = rfc822_parse_adrlist (env->bcc, uh->data + 4);
6796 + else if (ascii_strncasecmp ("newsgroups:", uh->data, 11) == 0)
6797 + env->newsgroups = nntp_get_header (uh->data + 11);
6798 + else if (ascii_strncasecmp ("followup-to:", uh->data, 12) == 0)
6799 + env->followup_to = nntp_get_header (uh->data + 12);
6800 + else if (ascii_strncasecmp ("x-comment-to:", uh->data, 13) == 0)
6801 + env->x_comment_to = nntp_get_header (uh->data + 13);
6806 @@ -309,6 +364,12 @@
6807 else if (ascii_strncasecmp ("to:", uh->data, 3) != 0 &&
6808 ascii_strncasecmp ("cc:", uh->data, 3) != 0 &&
6809 ascii_strncasecmp ("bcc:", uh->data, 4) != 0 &&
6811 + ascii_strncasecmp ("newsgroups:", uh->data, 11) != 0 &&
6812 + ascii_strncasecmp ("followup-to:", uh->data, 12) != 0 &&
6813 + ascii_strncasecmp ("x-comment-to:", uh->data, 13) != 0 &&
6815 + ascii_strncasecmp ("supersedes:", uh->data, 11) != 0 &&
6816 ascii_strncasecmp ("subject:", uh->data, 8) != 0 &&
6817 ascii_strncasecmp ("return-path:", uh->data, 12) != 0)
6819 @@ -657,6 +718,10 @@
6824 + if (option (OPTNEWSSEND) && option (OPTXCOMMENTTO) && curenv->from)
6825 + env->x_comment_to = safe_strdup (mutt_get_name (curenv->from));
6830 @@ -719,6 +784,16 @@
6832 if (flags & SENDREPLY)
6835 + if ((flags & SENDNEWS))
6837 + /* in case followup set Newsgroups: with Followup-To: if it present */
6838 + if (!env->newsgroups && curenv &&
6839 + mutt_strcasecmp (curenv->followup_to, "poster"))
6840 + env->newsgroups = safe_strdup (curenv->followup_to);
6847 @@ -865,7 +940,18 @@
6848 * it hasn't already been set
6851 - if (option (OPTFOLLOWUPTO) && !e->mail_followup_to)
6852 + if (!option (OPTFOLLOWUPTO))
6855 + if (option (OPTNEWSSEND))
6857 + if (!e->followup_to && e->newsgroups && (strrchr (e->newsgroups, ',')))
6858 + e->followup_to = safe_strdup (e->newsgroups);
6863 + if (!e->mail_followup_to)
6865 if (mutt_is_list_cc (0, e->to, e->cc))
6867 @@ -1026,6 +1112,9 @@
6872 + if (!option (OPTNEWSSEND))
6873 +#endif /* USE_NNTP */
6875 return mutt_smtp_send (msg->env->from, msg->env->to, msg->env->cc,
6876 msg->env->bcc, tempfile,
6877 @@ -1137,6 +1226,13 @@
6882 + if (flags & SENDNEWS)
6883 + set_option (OPTNEWSSEND);
6885 + unset_option (OPTNEWSSEND);
6888 if (!flags && !msg && quadoption (OPT_RECALL) != M_NO &&
6889 mutt_num_postponed (1))
6891 @@ -1167,6 +1263,22 @@
6893 if ((flags = mutt_get_postponed (ctx, msg, &cur, fcc, sizeof (fcc))) < 0)
6897 + * If postponed message is a news article, it have
6898 + * a "Newsgroups:" header line, then set appropriate flag.
6900 + if (msg->env->newsgroups)
6902 + flags |= SENDNEWS;
6903 + set_option (OPTNEWSSEND);
6907 + flags &= ~SENDNEWS;
6908 + unset_option (OPTNEWSSEND);
6913 if (flags & (SENDPOSTPONED|SENDRESEND))
6914 @@ -1278,11 +1390,16 @@
6915 if (flags & SENDREPLY)
6916 mutt_fix_reply_recipients (msg->env);
6919 + if ((flags & SENDNEWS) && ctx && ctx->magic == M_NNTP && !msg->env->newsgroups)
6920 + msg->env->newsgroups = safe_strdup (((NNTP_DATA *)ctx->data)->group);
6923 if (! (flags & SENDMAILX) &&
6924 ! (option (OPTAUTOEDIT) && option (OPTEDITHDRS)) &&
6925 ! ((flags & SENDREPLY) && option (OPTFASTREPLY)))
6927 - if (edit_envelope (msg->env) == -1)
6928 + if (edit_envelope (msg->env, flags) == -1)
6932 @@ -1539,6 +1656,11 @@
6937 + if (flags & SENDNEWS)
6938 + mutt_message _("Article not posted.");
6941 mutt_message _("Mail not sent.");
6944 @@ -1571,6 +1693,9 @@
6949 + if (!(flags & SENDNEWS))
6951 if (!has_recips (msg->env->to) && !has_recips (msg->env->cc) &&
6952 !has_recips (msg->env->bcc))
6954 @@ -1604,6 +1729,19 @@
6955 mutt_error _("No subject specified.");
6959 + if ((flags & SENDNEWS) && !msg->env->subject)
6961 + mutt_error _("No subject specified.");
6965 + if ((flags & SENDNEWS) && !msg->env->newsgroups)
6967 + mutt_error _("No newsgroup specified.");
6972 if (msg->content->next)
6973 msg->content = mutt_make_multipart (msg->content);
6974 @@ -1810,7 +1948,12 @@
6977 else if (!option (OPTNOCURSES) && ! (flags & SENDMAILX))
6978 - mutt_message (i == 0 ? _("Mail sent.") : _("Sending in background."));
6979 + mutt_message (i != 0 ? _("Sending in background.") :
6981 + (flags & SENDNEWS) ? _("Article posted.") : _("Mail sent."));
6986 if (WithCrypto && (msg->security & ENCRYPT))
6988 Index: mutt-1.5.20/sendlib.c
6989 ===================================================================
6990 --- mutt-1.5.20.orig/sendlib.c 2010-02-22 19:59:29.000000000 -0300
6991 +++ mutt-1.5.20/sendlib.c 2010-02-22 20:00:43.455821566 -0300
6993 #include <sys/wait.h>
7000 #ifdef HAVE_SYSEXITS_H
7001 #include <sysexits.h>
7002 #else /* Make sure EX_OK is defined <philiph@pobox.com> */
7003 @@ -1529,6 +1533,14 @@
7006 int refcnt = 0, refmax = 0;
7007 + int multiline = 1;
7016 for ( ; (trim == 0 || refcnt < trim) && r ; r = r->next)
7018 @@ -1539,9 +1551,11 @@
7020 while (refcnt-- > 0)
7023 + if (multiline || space)
7026 fputs (ref[refcnt]->data, f);
7028 + if (multiline && refcnt >= 1)
7032 @@ -1868,6 +1882,9 @@
7033 mutt_write_address_list (env->to, fp, 4, 0);
7037 + if (!option (OPTNEWSSEND))
7039 fputs ("To: \n", fp);
7042 @@ -1876,6 +1893,9 @@
7043 mutt_write_address_list (env->cc, fp, 4, 0);
7047 + if (!option (OPTNEWSSEND))
7049 fputs ("Cc: \n", fp);
7051 if (env->bcc && should_write_bcc)
7052 @@ -1887,8 +1907,28 @@
7057 + if (!option (OPTNEWSSEND))
7059 fputs ("Bcc: \n", fp);
7062 + if (env->newsgroups)
7063 + fprintf (fp, "Newsgroups: %s\n", env->newsgroups);
7064 + else if (mode == 1 && option (OPTNEWSSEND))
7065 + fputs ("Newsgroups: \n", fp);
7067 + if (env->followup_to)
7068 + fprintf (fp, "Followup-To: %s\n", env->followup_to);
7069 + else if (mode == 1 && option (OPTNEWSSEND))
7070 + fputs ("Followup-To: \n", fp);
7072 + if (env->x_comment_to)
7073 + fprintf (fp, "X-Comment-To: %s\n", env->x_comment_to);
7074 + else if (mode == 1 && option (OPTNEWSSEND) && option (OPTXCOMMENTTO))
7075 + fputs ("X-Comment-To: \n", fp);
7079 mutt_write_one_header (fp, "Subject", env->subject, NULL, 0, 0);
7081 @@ -1907,6 +1947,9 @@
7082 fputs ("Reply-To: \n", fp);
7084 if (env->mail_followup_to)
7086 + if (!option (OPTNEWSSEND))
7089 fputs ("Mail-Followup-To: ", fp);
7090 mutt_write_address_list (env->mail_followup_to, fp, 18, 0);
7091 @@ -2245,11 +2288,30 @@
7092 const char *msg, /* file containing message */
7093 int eightbit) /* message contains 8bit chars */
7095 - char *ps = NULL, *path = NULL, *s = safe_strdup (Sendmail), *childout = NULL;
7096 + char *ps = NULL, *path = NULL, *s = NULL, *childout = NULL;
7098 size_t argslen = 0, argsmax = 0;
7102 + if (option (OPTNEWSSEND))
7104 + char cmd[LONG_STRING];
7106 + mutt_FormatString (cmd, sizeof (cmd), 0, NONULL (Inews), nntp_format_str, 0, 0);
7109 + i = nntp_post (msg);
7114 + s = safe_strdup (cmd);
7118 + s = safe_strdup (Sendmail);
7122 while ((ps = strtok (ps, " ")))
7123 @@ -2273,6 +2335,10 @@
7128 + if (!option (OPTNEWSSEND))
7131 if (eightbit && option (OPTUSE8BITMIME))
7132 args = add_option (args, &argslen, &argsmax, "-B8BITMIME");
7134 @@ -2304,6 +2370,9 @@
7135 args = add_args (args, &argslen, &argsmax, to);
7136 args = add_args (args, &argslen, &argsmax, cc);
7137 args = add_args (args, &argslen, &argsmax, bcc);
7142 if (argslen == argsmax)
7143 safe_realloc (&args, sizeof (char *) * (++argsmax));
7144 @@ -2384,6 +2453,9 @@
7145 rfc2047_encode_string (&env->x_label);
7149 + if (!option (OPTNEWSSEND) || option (OPTMIMESUBJECT))
7152 rfc2047_encode_string (&env->subject);
7154 @@ -2504,6 +2576,10 @@
7156 rfc822_write_address (resent_from, sizeof (resent_from), from, 0);
7159 + unset_option (OPTNEWSSEND);
7162 ret = _mutt_bounce_message (fp, h, to, resent_from, from);
7164 rfc822_free_address (&from);
7165 Index: mutt-1.5.20/sort.c
7166 ===================================================================
7167 --- mutt-1.5.20.orig/sort.c 2008-11-11 17:55:47.000000000 -0200
7168 +++ mutt-1.5.20/sort.c 2010-02-22 20:00:43.455821566 -0300
7169 @@ -151,6 +151,15 @@
7170 HEADER **ha = (HEADER **) a;
7171 HEADER **hb = (HEADER **) b;
7174 + if ((*ha)->article_num && (*hb)->article_num)
7176 + int result = (*ha)->article_num - (*hb)->article_num;
7177 + AUXSORT(result,a,b);
7178 + return (SORTCODE (result));
7182 /* no need to auxsort because you will never have equality here */
7183 return (SORTCODE ((*ha)->index - (*hb)->index));
7185 Index: mutt-1.5.20/url.c
7186 ===================================================================
7187 --- mutt-1.5.20.orig/url.c 2010-02-22 19:59:29.000000000 -0300
7188 +++ mutt-1.5.20/url.c 2010-02-22 20:00:43.455821566 -0300
7190 { "imaps", U_IMAPS },
7193 + { "news", U_NNTP },
7194 + { "newss", U_NNTPS },
7195 { "mailto", U_MAILTO },
7197 { "smtps", U_SMTPS },
7198 Index: mutt-1.5.20/url.h
7199 ===================================================================
7200 --- mutt-1.5.20.orig/url.h 2008-11-11 17:55:47.000000000 -0200
7201 +++ mutt-1.5.20/url.h 2010-02-22 20:00:43.455821566 -0300
7211 Index: mutt-1.5.20/Makefile.am
7212 ===================================================================
7213 --- mutt-1.5.20.orig/Makefile.am 2010-02-22 19:59:29.000000000 -0300
7214 +++ mutt-1.5.20/Makefile.am 2010-02-22 20:00:43.455821566 -0300
7216 mutt_idna.c mutt_sasl.c mutt_socket.c mutt_ssl.c mutt_ssl_gnutls.c \
7217 mutt_tunnel.c pgp.c pgpinvoke.c pgpkey.c pgplib.c pgpmicalg.c \
7218 pgppacket.c pop.c pop_auth.c pop_lib.c remailer.c resize.c sha1.c \
7220 smime.c smtp.c utf8.c wcwidth.c \
7221 bcache.h browser.h hcache.h mbyte.h mutt_idna.h remailer.h url.h
7224 mutt_regex.h mutt_sasl.h mutt_socket.h mutt_ssl.h mutt_tunnel.h \
7225 mx.h pager.h pgp.h pop.h protos.h rfc1524.h rfc2047.h \
7226 rfc2231.h rfc822.h rfc3676.h sha1.h sort.h mime.types VERSION prepare \
7227 + nntp.h ChangeLog.nntp \
7228 _regex.h OPS.MIX README.SECURITY remailer.c remailer.h browser.h \
7229 mbyte.h lib.h extlib.c pgpewrap.c smime_keys.pl pgplib.h \
7230 README.SSL smime.h \
7231 Index: mutt-1.5.20/doc/Muttrc
7232 ===================================================================
7233 --- mutt-1.5.20.orig/doc/Muttrc 2010-02-22 19:59:29.000000000 -0300
7234 +++ mutt-1.5.20/doc/Muttrc 2010-02-22 20:00:43.456821792 -0300
7235 @@ -281,6 +281,28 @@
7236 # of the value as shown above if included.
7239 +# set ask_follow_up=no
7241 +# Name: ask_follow_up
7246 +# If set, Mutt will prompt you for follow-up groups before editing
7247 +# the body of an outgoing message.
7250 +# set ask_x_comment_to=no
7252 +# Name: ask_x_comment_to
7257 +# If set, Mutt will prompt you for x-comment-to field before editing
7258 +# the body of an outgoing message.
7261 # set attach_format="%u%D%I %t%4n %T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] "
7263 # Name: attach_format
7264 @@ -466,6 +488,17 @@
7265 # set certificate_file=~/.mutt/certificates
7268 +# set catchup_newsgroup=ask-yes
7270 +# Name: catchup_newsgroup
7275 +# If this variable is set, Mutt will mark all articles in newsgroup
7276 +# as read when you quit the newsgroup (catchup newsgroup).
7282 @@ -1141,6 +1174,19 @@
7283 # of the same email for you.
7286 +# set followup_to_poster=ask-yes
7288 +# Name: followup_to_poster
7293 +# If this variable is set and the keyword "poster" is present in
7294 +# Followup-To header, follow-up to newsgroup function is not
7295 +# permitted. The message will be mailed to the submitter of the
7296 +# message via mail.
7302 @@ -1251,6 +1297,28 @@
7303 # ``Franklin'' to ``Franklin, Steve''.
7306 +# set group_index_format="%4C %M%N %5s %-45.45f %d"
7308 +# Name: group_index_format
7310 +# Default: "%4C %M%N %5s %-45.45f %d"
7313 +# This variable allows you to customize the newsgroup browser display to
7314 +# your personal taste. This string is similar to ``index_format'', but
7315 +# has its own set of printf()-like sequences:
7317 +# %C current newsgroup number
7318 +# %d description of newsgroup (becomes from server)
7319 +# %f newsgroup name
7320 +# %M - if newsgroup not allowed for direct post (moderated for example)
7321 +# %N N if newsgroup is new, u if unsubscribed, blank otherwise
7322 +# %n number of new articles in newsgroup
7323 +# %s number of unread articles in newsgroup
7324 +# %>X right justify the rest of the string and pad with character "X"
7325 +# %|X pad to the end of the line with character "X"
7331 @@ -1799,6 +1867,7 @@
7332 # %E number of messages in current thread
7333 # %f sender (address + real name), either From: or Return-Path:
7334 # %F author name, or recipient name if the message is from you
7335 +# %g newsgroup name (if compiled with nntp support)
7336 # %H spam attribute(s) of this message
7337 # %i message-id of the current message
7338 # %l number of lines in the message (does not work with maildir,
7339 @@ -1814,12 +1883,14 @@
7340 # stashed the message: list name or recipient name
7341 # if not sent to a list
7342 # %P progress indicator for the builtin pager (how much of the file has been displayed)
7343 +# %R `x-comment-to:' field (if present and compiled with nntp support)
7344 # %s subject of the message
7345 # %S status of the message (``N''/``D''/``d''/``!''/``r''/*)
7346 # %t ``To:'' field (recipients)
7347 # %T the appropriate character from the $to_chars string
7348 # %u user (login) name of the author
7349 # %v first name of the author, or the recipient if the message is from you
7350 +# %W name of organization of author (`organization:' field)
7351 # %X number of attachments
7352 # (please see the ``attachments'' section for possible speed effects)
7353 # %y ``X-Label:'' field, if present
7354 @@ -1855,6 +1926,22 @@
7355 # ``save-hook'', ``fcc-hook'' and ``fcc-save-hook'', too.
7365 +# If set, specifies the program and arguments used to deliver news posted
7366 +# by Mutt. Otherwise, mutt posts article using current connection to
7367 +# news server. The following printf-style sequence is understood:
7369 +# %s newsserver name
7371 +# Example: set inews="/usr/local/bin/inews -hS"
7374 # set ispell="ispell"
7377 @@ -2208,6 +2295,18 @@
7378 # be attached to the newly composed message if this option is set.
7381 +# set mime_subject=yes
7383 +# Name: mime_subject
7388 +# If unset, 8-bit ``subject:'' line in article header will not be
7389 +# encoded according to RFC2047 to base64. This is useful when message
7390 +# is Usenet article, because MIME for news is nonstandard feature.
7393 # set mix_entry_format="%4n %c %-16s %a"
7395 # Name: mix_entry_format
7396 @@ -2274,6 +2373,118 @@
7397 # See also $read_inc, $write_inc and $net_inc.
7400 +# set news_cache_dir="~/.mutt"
7402 +# Name: news_cache_dir
7404 +# Default: "~/.mutt"
7407 +# This variable pointing to directory where Mutt will save cached news
7408 +# articles headers in. If unset, headers will not be saved at all
7409 +# and will be reloaded each time when you enter to newsgroup.
7412 +# set news_server=""
7414 +# Name: news_server
7419 +# This variable specifies domain name or address of NNTP server. It
7420 +# defaults to the newsserver specified in the environment variable
7421 +# $NNTPSERVER or contained in the file /etc/nntpserver. You can also
7422 +# specify username and an alternative port for each newsserver, ie:
7424 +# [news[s]://][username[:password]@]newsserver[:port]
7427 +# set newsrc="~/.newsrc"
7431 +# Default: "~/.newsrc"
7434 +# The file, containing info about subscribed newsgroups - names and
7435 +# indexes of read articles. The following printf-style sequence
7438 +# %s newsserver name
7441 +# set nntp_context=1000
7443 +# Name: nntp_context
7448 +# This variable defines number of articles which will be in index when
7449 +# newsgroup entered. If active newsgroup have more articles than this
7450 +# number, oldest articles will be ignored. Also controls how many
7451 +# articles headers will be saved in cache when you quit newsgroup.
7454 +# set nntp_load_description=yes
7456 +# Name: nntp_load_description
7461 +# This variable controls whether or not descriptions for each newsgroup
7462 +# must be loaded when newsgroup is added to list (first time list
7463 +# loading or new newsgroup adding).
7473 +# Your login name on the NNTP server. If unset and NNTP server requires
7474 +# authentification, Mutt will prompt you for your account name when you
7475 +# connect to newsserver.
7485 +# Your password for NNTP account.
7495 +# The time in seconds until any operations on newsgroup except post new
7496 +# article will cause recheck for new news. If set to 0, Mutt will
7497 +# recheck newsgroup on each operation in index (stepping, read article,
7501 +# set nntp_reconnect=ask-yes
7503 +# Name: nntp_reconnect
7508 +# Controls whether or not Mutt will try to reconnect to newsserver when
7512 # set pager="builtin"
7515 @@ -2989,6 +3200,19 @@
7516 # string after the inclusion of a message which is being replied to.
7519 +# set post_moderated=ask-yes
7521 +# Name: post_moderated
7526 +# If set to yes, Mutt will post article to newsgroup that have
7527 +# not permissions to posting (e.g. moderated). Note: if newsserver
7528 +# does not support posting to that newsgroup or totally read-only, that
7529 +# posting will not have an effect.
7532 # set postpone=ask-yes
7535 @@ -3563,6 +3787,41 @@
7536 # shell from /etc/passwd is used.
7539 +# set save_unsubscribed=no
7541 +# Name: save_unsubscribed
7546 +# When set, info about unsubscribed newsgroups will be saved into
7547 +# ``newsrc'' file and into cache.
7550 +# set show_new_news=yes
7552 +# Name: show_new_news
7557 +# If set, newsserver will be asked for new newsgroups on entering
7558 +# the browser. Otherwise, it will be done only once for a newsserver.
7559 +# Also controls whether or not number of new articles of subscribed
7560 +# newsgroups will be then checked.
7563 +# set show_only_unread=no
7565 +# Name: show_only_unread
7570 +# If set, only subscribed newsgroups that contain unread articles
7571 +# will be displayed in browser.
7574 # set sig_dashes=yes
7577 @@ -4768,3 +5027,14 @@
7578 # ``tuning'' section of the manual for performance considerations.
7581 +# set x_comment_to=no
7583 +# Name: x_comment_to
7588 +# If set, Mutt will add ``X-Comment-To:'' field (that contains full
7589 +# name of original article author) to article that followuped to newsgroup.