Version: 0.95.1v1 By: Brandon Long (blong@fiction.net) NNTP Mailbox Support ============================================ This patch is based on the imap mailbox support, and as such is very alpha software. Don't complain if it does something bad, including corrupting your newsrc file or other nasties, but let me know so I can fix it. Before anyone asks, yes I use to believe that mail and news were separate. Now, I've refined my opinion. There are newsgroups I read like I read mailing lists, and some mailing lists I read as if they were newsgroups. This support is meant to be for using mutt to read newsgroups as if they were mailing lists. Don't expect uudecoding and scoring to ever be added. On the other hand, you can probably use the limit command to do a small but decent killing. On the other hand, Michael has already added scoring to the regular mutt, so I don't have to :) This patch adds support to mutt for handling NNTP "mailboxes", ie newsgroups. It has no newsgroup browse feature. You specify an NNTP mailbox using the following format: [news.server.name]news.group.name ie, [news.or.intel.com]pdx.general or [news.alt.net]comp.os.linux.announce This is based on the imap code where you specify a mailbox with {imap.server.name}mailbox Additionally, you can specify a port number with a colon, ie: [news.local.net:5000]alternative.group This patch adds the commands followup-message (bound to ESC f) and post-message (bound to P) to the index menu. Currently, it uses inews to post messages, the location of inews can be set with the $nntp_inews variable. The NNTPSERVER environment variable will be set when openning news mailbox to the server of that mailbox. This version supports XOVER, and should be quite fast, but there is a limited amount of information available about an article when using XOVER, so some things might not work so well. Let me know of any problems or unexpected behavior. Mutt should automatically detect XOVER support, and fall back to grabbing the full article header if its unavailable. XOVER is a lot faster over slow connections. Mutt will cache 10 articles in your temp directory, so you can go back and forth between the last couple articles without re-fetching the articles from the server. This is the same as the imap code, and could probably use a little work. The only way to currently change this number is by changing the define NNTP_CACHE_LEN in nntp.c This version does support password protected nntp servers. It should prompt automatically when a server requires a password. You can set a default username and password in your muttrc file using the nntp_user and nntp_pass variables, but they don't work perfectly yet. The newsrc code is very alpha, if you don't want to trust it (can't say I blame you), you can specify a different newsrc file with the nntp_newsrc variable. Also, you can then specify different newsrc files for different servers using folder-hook commands, such as: folder-hook \[news.cso.uiuc.edu\] set newsrc = ~/.newsrc-news.cso.uiuc.edu folder-hook \[news.or.intel.com\] set newsrc = ~/.newsrc-news.or.intel.com Or, this patch also adds the server-hook command, so you can use instead: server-hook news.cso.uiuc.edu set newsrc = ~/.newsrc-news.cso.uiuc.edu server-hook news.or.intel.com set newsrc = ~/.newsrc-news.or.intel.com The benefit of this is that the server hooks can be evaluated at different times from the folder hooks. This will be used more when the buffy code is expanded to handle newsgroups. You probably also want to set nosmart_wrap because of some of the headers, and probably also want to ignore the path header. This code also supports something I've wanted in a newsreader, and never seen, what I call context. The variable nntp_context controls the number of messages mutt will fetch for the index display. The default is 100. This means that if there are 50 unread messages in the folder, mutt will still grab 100 messages, so you have the context in which the new messages exist. Users of slow connections might want to set this to a smaller number or to 0. Currently, the error recovery isn't overly good. If the nntp server closes its connection, for instance, you'll probably be kicked out of your mailbox. This is alpha, after all... This version contains support for The Xref header. I'm guessing on the format, but it should work. In order to do this, the entire newsrc file is cached in memory. Mutt should automatically update the newsrc file data in memory if the disk version changes. There is some preliminary locking support in there as well, but I'm unsure if it does what I want it to, so still beware of corrupted newsrc files. Compiling/Installing -------------------- To compile mutt with nntp support, you need to apply the patch. cd into the mutt-0.84 directory, and do the following: gzunzip -c patch-0.84.bl.mx_nntp.3 | patch -p1 Then, configure mutt with the --enable-nntp argument. This patch also allows you to compile with imap support using the --enable-imap argument. configure will look for the inews program, which you need to post. This patch also contains a version of inews taken from nn, and modified to compile with the mutt distribution in the inews support directory. If configure doesn't find inews, you can modify the config.h file to point to it, or just set the inews variable in your muttrc. Compile and install as normal. Versions ------------- 0.84v1 - First Version - Basic support for reading NNTP and NNTP authentication - XOVER support 0.84v2 - Improved overall handling - Added ability to post and follow-up - added --enable-nntp and --enable-imap options to configure 0.84v3 - added newsrc support - configure now checks for libnsl and libsocket if compiling with imap or nntp 0.84v4 - added support for checking the newsgroup for new mail - separated out the index and article_id because new mail check needs the index to make sense - added support for having IMAP/NNTP mailboxes in the browser - clear cache on mailbox sync - when posting, "Message posted." - when fetching the article, update the bits in HEADER which would normally be updated in mx_update_context() (ie, pgp/mailcap) - duh, "...." is not an end of response from the server 0.85v1 - moved to mutt 0.85 - hmm, somehow missed correcting a #ifdef in mutt.h which would cause NNTP to only compile if you were compiling IMAP as well 0.87.9v1 - moved to mutt 0.87.9 dev version 0.88.12v1 - moved to mutt 0.88.12 dev version - renamed inews config var to nntp_inews for consistency with other nntp vars - v2r is now an array of ints, not shorts - mutt_parse_date() now returns the date 0.88.14v1 - moved to mutt 0.88.14 dev version - grab real_subj from XOVER - mx_close_message() for M_NNTP file descriptor leak fixed 0.90.1v1 - moved mutt 0.90.1 dev version 0.90.3v1 - moved mutt 0.90.3 dev version - moved newsrc handling code into a new file, newsrc.c - to support nntp buffy and the cross references, we now read the entire newsrc into memory. We use the new hashing code for quicker lookups as well. nntp buffy is not yet supported - cross references should now be working, anyone have a pointer to the actual xref header format? Currently, I'm guessing) - added server-hooks which can then be used in more places (like in nntp/imap buffy). Folder hooks require openning a folder, which isn't very useful if you aren't openning a folder. Perhaps buffy-hook would have been better, is there a need for this in the non imap/nntp code? 0.90.11v1 - updated to mutt 0.90.11 dev version - semantics of mutt_rename_file() changed, now returns zero on pass - fixed bug (do rfc2047 decoding of from: on xover) - when parsing xref header, don't use the server listed in the header, it might not be the same hostname you used to connect - increase size of buf for reading XOVER lines to HUGE_STRING 0.92.1v1 0.92.13v2 0.94.2v1 0.94.12v1 - now use the mutt_socket code added for imap (this version actually contains a fix to the mutt_socket code) - in nntp_open_mailbox(), use setenv/putenv to set NNTPSERVER to the hostname of the server you are accessing - add support for hostname:port server defn 0.94.15v1 - Now use the User-Agent: header instead of X-Newsreader: as suggested by grandson of rfc1036 - fixes from Vikas Agnihotri for blank groups and misplaced close() - fixes to handle new compose menu handling - support the Followup-To: header - Newgroups browser from Vikas Agnihotri - Cancel articles with cancel-message 0.95.1v1 - Updated for 0.95.1 - Bug fixes in nntp and newsrc code ToDo: - Change newsgroup browser for other uses - mail and post? - BUG: "Mailbox is unchanged." message when closing NNTP box Known Bugs ----------- If you are using XOVER, not all of the information is being retrieved, most notably information on multipart messages and PGP/MIME messages, so you might have to view the message twice for it to work correctly. The "fix" for this to make sure mx_open_message() is called before certain checks are made. This is not a problem with IMAP or when not using XOVER, as the entire header of the message is fetched and parsed. This might be fixed, but I'm not sure I got all of the cases.