Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 'tin', Thunderbird and force-adding of subreddits #16

Merged
merged 2 commits into from Apr 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 42 additions & 0 deletions README.md
Expand Up @@ -25,6 +25,8 @@ Now type the usual `./configure`, and `make`.

# Usage

## General usage with slrn

`$ ./nntpit -D -p 8119`

Now connect your newsreader; if you use slrn, you would do this:
Expand All @@ -41,6 +43,46 @@ Press `a` to add a group, and type the name of the subreddit you want to subscri

It should populate a list of articles and comments for you to read.

## Usage with other clients

Some clients need the server to be first taught about the subreddits you want to
read so they can be added to the database. You only need to specify them
on the command line one time:

`$ ./nntpit -D -p 8119 retrocomputing usenet classicusenet`

### Usage with tin

Start tin:

`$ tin -r -g localhost -p 8119`

The groups list will be empty at first, but don't worry: that's normal.

Press `S` to add a group, and type the name of the subreddit you want to subscribe to
(eg 'usenet' for /r/usenet).

### Usage with Thunderbird

Start Thunderbird, go to menu -> Account Settings -> Account Actions -> Add
Other Account. The Account Wizard appears.

Select Newsgroup account, Next, your name and email address can be whatever
as they aren't used (but must look like an email address), Next. Newsgroup
Server should be 'localhost', Next, Account name can be whatever you like,
Next, Finish.

The account with your given name should appear in the Account Settings
sidebar. Click on Server Settings and change the port number to 8119.
Close the account settings window.

In the main folders window the account should show in the sidebar. Click on
it, click 'Manage newsgroup subscriptions'. The subreddits that nntpit
knows about should be shown. Tick the ones you want to read and click OK.

The subreddits should now appear in the sidebar and you can click to open
each one up and read the messages.

# Reporting Bugs

If you're using slrn, please include the `--debug` and the nntpit `-D` log.
Expand Down
18 changes: 14 additions & 4 deletions nntpit.c
Expand Up @@ -134,7 +134,7 @@ usage(p)
char const *p;
{
fprintf(stderr,
"usage: %s [-VDhIS] [-t <threads>] [-l <host>] [-p <port>]\n"
"usage: %s [-VDhIS] [-t <threads>] [-l <host>] [-p <port>] [subreddit] [subreddit] ...\n"
"\n"
" -V print version and exit\n"
" -h print this text\n"
Expand All @@ -144,6 +144,7 @@ usage(p)
" -l <host> address to listen on (default: localhost)\n"
" -p <port> port to listen on (default: 119)\n"
" -t <threads> number of processing threads (default: 1)\n"
" [subreddit] optionally force-add these subs to the database\n"
, p);
}

Expand Down Expand Up @@ -224,9 +225,17 @@ int main(int argc, char **argv)
if (!port)
port = strdup("119");

if (argv[0]) {
usage(progname);
return 1;
while (argc > 0) {
if (argv[0]) {
if (debug) fprintf(stderr, "Fetching extra sub '%s'... ", argv[0]);
if (fetch_subreddit_json(spool, newsrc, argv[0]) == 0) {
if (debug) fprintf(stderr, "the fetch worked\n");
} else {
fprintf(stderr,"Failed to fetch subreddit '%s'\n", argv[0]);
}
}
argc--;
argv++;
}

main_loop = ev_loop_new(ev_supported_backends());
Expand Down Expand Up @@ -923,6 +932,7 @@ void client_read(struct ev_loop *loop, ev_io *w, int revents)
client_printf(cl,
"101 Capability list:\r\n"
"VERSION 2\r\n"
"READER\r\n"
"IMPLEMENTATION nntpit %s\r\n", PACKAGE_VERSION);
if (do_ihave)
client_send(cl, "IHAVE\r\n");
Expand Down