[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2 Getting News

A newsreader is normally used for reading news. Gnus currently provides only two methods of getting news—it can read from an NNTP server, or it can read from a local spool.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2.1 NNTP

Subscribing to a foreign group from an NNTP server is rather easy. You just specify nntp as method and the address of the NNTP server as the, uhm, address.

If the NNTP server is located at a non-standard port, setting the third element of the select method to this port number should allow you to connect to the right port. You’ll have to edit the group info for that (see section Foreign Groups).

The name of the foreign group can be the same as a native group. In fact, you can subscribe to the same group from as many different servers you feel like. There will be no name collisions.

The following variables can be used to create a virtual nntp server:

nntp-server-opened-hook

is run after a connection has been made. It can be used to send commands to the NNTP server after it has been contacted. By default it sends the command MODE READER to the server with the nntp-send-mode-reader function. This function should always be present in this hook.

nntp-authinfo-function

This function will be used to send ‘AUTHINFO’ to the NNTP server. The default function is nntp-send-authinfo, which looks through your ‘~/.authinfo’ (or whatever you’ve set the nntp-authinfo-file variable to) for applicable entries. If none are found, it will prompt you for a login name and a password. The format of the ‘~/.authinfo’ file is (almost) the same as the ftp~/.netrc’ file, which is defined in the ftp manual page, but here are the salient facts:

  1. The file contains one or more line, each of which define one server.
  2. Each line may contain an arbitrary number of token/value pairs.

    The valid tokens include ‘machine’, ‘login’, ‘password’, ‘default’. In addition Gnus introduces two new tokens, not present in the original ‘.netrc’/ftp syntax, namely ‘port’ and ‘force’. (This is the only way the ‘.authinfo’ file format deviates from the ‘.netrc’ file format.) ‘port’ is used to indicate what port on the server the credentials apply to and ‘force’ is explained below.

Here’s an example file:

 
machine news.uio.no login larsi password geheimnis
machine nntp.ifi.uio.no login larsi force yes

The token/value pairs may appear in any order; ‘machine’ doesn’t have to be first, for instance.

In this example, both login name and password have been supplied for the former server, while the latter has only the login name listed, and the user will be prompted for the password. The latter also has the ‘force’ tag, which means that the authinfo will be sent to the nntp server upon connection; the default (i.e., when there is not ‘force’ tag) is to not send authinfo to the nntp server until the nntp server asks for it.

You can also add ‘default’ lines that will apply to all servers that don’t have matching ‘machine’ lines.

 
default force yes

This will force sending ‘AUTHINFO’ commands to all servers not previously mentioned.

Remember to not leave the ‘~/.authinfo’ file world-readable.

nntp-server-action-alist

This is a list of regexps to match on server types and actions to be taken when matches are made. For instance, if you want Gnus to beep every time you connect to innd, you could say something like:

 
(setq nntp-server-action-alist
      '(("innd" (ding))))

You probably don’t want to do that, though.

The default value is

 
'(("nntpd 1\\.5\\.11t"
   (remove-hook 'nntp-server-opened-hook
                'nntp-send-mode-reader)))

This ensures that Gnus doesn’t send the MODE READER command to nntpd 1.5.11t, since that command chokes that server, I’ve been told.

nntp-maximum-request

If the NNTP server doesn’t support NOV headers, this back end will collect headers by sending a series of head commands. To speed things up, the back end sends lots of these commands without waiting for reply, and then reads all the replies. This is controlled by the nntp-maximum-request variable, and is 400 by default. If your network is buggy, you should set this to 1.

nntp-connection-timeout

If you have lots of foreign nntp groups that you connect to regularly, you’re sure to have problems with NNTP servers not responding properly, or being too loaded to reply within reasonable time. This is can lead to awkward problems, which can be helped somewhat by setting nntp-connection-timeout. This is an integer that says how many seconds the nntp back end should wait for a connection before giving up. If it is nil, which is the default, no timeouts are done.

nntp-nov-is-evil

If the NNTP server does not support NOV, you could set this variable to t, but nntp usually checks automatically whether NOV can be used.

nntp-xover-commands

List of strings used as commands to fetch NOV lines from a server. The default value of this variable is ("XOVER" "XOVERVIEW").

nntp-nov-gap

nntp normally sends just one big request for NOV lines to the server. The server responds with one huge list of lines. However, if you have read articles 2–5000 in the group, and only want to read article 1 and 5001, that means that nntp will fetch 4999 NOV lines that you will not need. This variable says how big a gap between two consecutive articles is allowed to be before the XOVER request is split into several request. Note that if your network is fast, setting this variable to a really small number means that fetching will probably be slower. If this variable is nil, nntp will never split requests. The default is 5.

nntp-xref-number-is-evil

When Gnus refers to an article having the Message-ID that a user specifies or having the Message-ID of the parent article of the current one (see section Finding the Parent), Gnus sends a HEAD command to the NNTP server to know where it is, and the server returns the data containing the pairs of a group and an article number in the Xref header. Gnus normally uses the article number to refer to the article if the data shows that that article is in the current group, while it uses the Message-ID otherwise. However, some news servers, e.g., ones running Diablo, run multiple engines having the same articles but article numbers are not kept synchronized between them. In that case, the article number that appears in the Xref header varies by which engine is chosen, so you cannot refer to the parent article that is in the current group, for instance. If you connect to such a server, set this variable to a non-nil value, and Gnus never uses article numbers. For example:

 
(setq gnus-select-method
      '(nntp "newszilla"
             (nntp-address "newszilla.example.com")
             (nntp-xref-number-is-evil t)
             …))

The default value of this server variable is nil.

nntp-prepare-server-hook

A hook run before attempting to connect to an NNTP server.

nntp-record-commands

If non-nil, nntp will log all commands it sends to the NNTP server (along with a timestamp) in the ‘*nntp-log*’ buffer. This is useful if you are debugging a Gnus/NNTP connection that doesn’t seem to work.

nntp-open-connection-function

It is possible to customize how the connection to the nntp server will be opened. If you specify an nntp-open-connection-function parameter, Gnus will use that function to establish the connection. Seven pre-made functions are supplied. These functions can be grouped in two categories: direct connection functions (four pre-made), and indirect ones (three pre-made).

nntp-never-echoes-commands

Non-nil means the nntp server never echoes commands. It is reported that some nntps server doesn’t echo commands. So, you may want to set this to non-nil in the method for such a server setting nntp-open-connection-function to nntp-open-ssl-stream for example. The default value is nil. Note that the nntp-open-connection-functions-never-echo-commands variable overrides the nil value of this variable.

nntp-open-connection-functions-never-echo-commands

List of functions that never echo commands. Add or set a function which you set to nntp-open-connection-function to this list if it does not echo commands. Note that a non-nil value of the nntp-never-echoes-commands variable overrides this variable. The default value is (nntp-open-network-stream).

nntp-prepare-post-hook

A hook run just before posting an article. If there is no Message-ID header in the article and the news server provides the recommended ID, it will be added to the article before running this hook. It is useful to make Cancel-Lock headers even if you inhibit Gnus to add a Message-ID header, you could say:

 
(add-hook 'nntp-prepare-post-hook 'canlock-insert-header)

Note that not all servers support the recommended ID. This works for INN versions 2.3.0 and later, for instance.

nntp-server-list-active-group

If nil, then always use ‘GROUP’ instead of ‘LIST ACTIVE’. This is usually slower, but on misconfigured servers that don’t update their active files often, this can help.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2.1.1 Direct Functions

These functions are called direct because they open a direct connection between your machine and the NNTP server. The behavior of these functions is also affected by commonly understood variables (see section Common Variables).

nntp-open-network-stream

This is the default, and simply connects to some port or other on the remote system. If both Emacs and the server supports it, the connection will be upgraded to an encrypted STARTTLS connection automatically.

network-only

The same as the above, but don’t do automatic STARTTLS upgrades.

nntp-open-tls-stream

Opens a connection to a server over a secure channel. To use this you must have GnuTLS installed. You then define a server as follows:

 
;; "nntps" is port 563 and is predefined in our ‘/etc/services
;; however, ‘gnutls-cli -p’ doesn't like named ports.
;;
(nntp "snews.bar.com"
      (nntp-open-connection-function nntp-open-tls-stream)
      (nntp-port-number 563)
      (nntp-address "snews.bar.com"))
nntp-open-ssl-stream

Opens a connection to a server over a secure channel. To use this you must have OpenSSL installed. You then define a server as follows:

 
;; "snews" is port 563 and is predefined in our ‘/etc/services
;; however, ‘openssl s_client -port’ doesn't like named ports.
;;
(nntp "snews.bar.com"
      (nntp-open-connection-function nntp-open-ssl-stream)
      (nntp-port-number 563)
      (nntp-address "snews.bar.com"))
nntp-open-netcat-stream

Opens a connection to an NNTP server using the netcat program. You might wonder why this function exists, since we have the default nntp-open-network-stream which would do the job. (One of) the reason(s) is that if you are behind a firewall but have direct connections to the outside world thanks to a command wrapper like runsocks, you can use it like this:

 
(nntp "socksified"
      (nntp-pre-command "runsocks")
      (nntp-open-connection-function nntp-open-netcat-stream)
      (nntp-address "the.news.server"))

With the default method, you would need to wrap your whole Emacs session, which is not a good idea.

nntp-open-telnet-stream

Like nntp-open-netcat-stream, but uses telnet rather than netcat. telnet is a bit less robust because of things like line-end-conversion, but sometimes netcat is simply not available. The previous example would turn into:

 
(nntp "socksified"
      (nntp-pre-command "runsocks")
      (nntp-open-connection-function nntp-open-telnet-stream)
      (nntp-address "the.news.server")
      (nntp-end-of-line "\n"))

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2.1.2 Indirect Functions

These functions are called indirect because they connect to an intermediate host before actually connecting to the NNTP server. All of these functions and related variables are also said to belong to the “via” family of connection: they’re all prefixed with “via” to make things cleaner. The behavior of these functions is also affected by commonly understood variables (see section Common Variables).

nntp-open-via-rlogin-and-netcat

Does an ‘rlogin’ on a remote system, and then uses netcat to connect to the real NNTP server from there. This is useful for instance if you need to connect to a firewall machine first.

nntp-open-via-rlogin-and-netcat-specific variables:

nntp-via-rlogin-command

Command used to log in on the intermediate host. The default is ‘rsh’, but ‘ssh’ is a popular alternative.

nntp-via-rlogin-command-switches

List of strings to be used as the switches to nntp-via-rlogin-command. The default is nil. If you use ‘ssh’ for nntp-via-rlogin-command, you may set this to ‘("-C")’ in order to compress all data connections.

nntp-open-via-rlogin-and-telnet

Does essentially the same, but uses telnet instead of ‘netcat’ to connect to the real NNTP server from the intermediate host. telnet is a bit less robust because of things like line-end-conversion, but sometimes netcat is simply not available.

nntp-open-via-rlogin-and-telnet-specific variables:

nntp-telnet-command

Command used to connect to the real NNTP server from the intermediate host. The default is ‘telnet’.

nntp-telnet-switches

List of strings to be used as the switches to the nntp-telnet-command command. The default is ("-8").

nntp-via-rlogin-command

Command used to log in on the intermediate host. The default is ‘rsh’, but ‘ssh’ is a popular alternative.

nntp-via-rlogin-command-switches

List of strings to be used as the switches to nntp-via-rlogin-command. If you use ‘ssh’, you may need to set this to ‘("-t" "-e" "none")’ or ‘("-C" "-t" "-e" "none")’ if the telnet command requires a pseudo-tty allocation on an intermediate host. The default is nil.

Note that you may want to change the value for nntp-end-of-line to ‘\n’ (see section Common Variables).

nntp-open-via-telnet-and-telnet

Does essentially the same, but uses ‘telnet’ instead of ‘rlogin’ to connect to the intermediate host.

nntp-open-via-telnet-and-telnet-specific variables:

nntp-via-telnet-command

Command used to telnet the intermediate host. The default is ‘telnet’.

nntp-via-telnet-switches

List of strings to be used as the switches to the nntp-via-telnet-command command. The default is ‘("-8")’.

nntp-via-user-password

Password to use when logging in on the intermediate host.

nntp-via-envuser

If non-nil, the intermediate telnet session (client and server both) will support the ENVIRON option and not prompt for login name. This works for Solaris telnet, for instance.

nntp-via-shell-prompt

Regexp matching the shell prompt on the intermediate host. The default is ‘bash\\|\$ *\r?$\\|> *\r?’.

Note that you may want to change the value for nntp-end-of-line to ‘\n’ (see section Common Variables).

Here are some additional variables that are understood by all the above functions:

nntp-via-user-name

User name to use when connecting to the intermediate host.

nntp-via-address

Address of the intermediate host to connect to.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2.1.3 Common Variables

The following variables affect the behavior of all, or several of the pre-made connection functions. When not specified, all functions are affected (the values of the following variables will be used as the default if each virtual nntp server doesn’t specify those server variables individually).

nntp-pre-command

A command wrapper to use when connecting through a non native connection function (all except nntp-open-network-stream, nntp-open-tls-stream, and nntp-open-ssl-stream). This is where you would put a ‘SOCKS’ wrapper for instance.

nntp-address

The address of the NNTP server.

nntp-port-number

Port number to connect to the NNTP server. The default is ‘nntp’. If you use NNTP over TLS/SSL, you may want to use integer ports rather than named ports (i.e., use ‘563’ instead of ‘snews’ or ‘nntps’), because external TLS/SSL tools may not work with named ports.

nntp-end-of-line

String to use as end-of-line marker when talking to the NNTP server. This is ‘\r\n’ by default, but should be ‘\n’ when using a non native telnet connection function.

nntp-netcat-command

Command to use when connecting to the NNTP server through ‘netcat’. This is not for an intermediate host. This is just for the real NNTP server. The default is ‘nc’.

nntp-netcat-switches

A list of switches to pass to nntp-netcat-command. The default is ‘()’.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.2.2 News Spool

Subscribing to a foreign group from the local spool is extremely easy, and might be useful, for instance, to speed up reading groups that contain very big articles—‘alt.binaries.pictures.furniture’, for instance.

Anyway, you just specify nnspool as the method and "" (or anything else) as the address.

If you have access to a local spool, you should probably use that as the native select method (see section Finding the News). It is normally faster than using an nntp select method, but might not be. It depends. You just have to try to find out what’s best at your site.

nnspool-inews-program

Program used to post an article.

nnspool-inews-switches

Parameters given to the inews program when posting an article.

nnspool-spool-directory

Where nnspool looks for the articles. This is normally ‘/usr/spool/news/’.

nnspool-nov-directory

Where nnspool will look for NOV files. This is normally
/usr/spool/news/over.view/’.

nnspool-lib-dir

Where the news lib dir is (‘/usr/lib/news/’ by default).

nnspool-active-file

The name of the active file.

nnspool-newsgroups-file

The name of the group descriptions file.

nnspool-history-file

The name of the news history file.

nnspool-active-times-file

The name of the active date file.

nnspool-nov-is-evil

If non-nil, nnspool won’t try to use any NOV files that it finds.

nnspool-sift-nov-with-sed

If non-nil, which is the default, use sed to get the relevant portion from the overview file. If nil, nnspool will load the entire file into a buffer and process it there.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

This document was generated on January 25, 2015 using texi2html 1.82.