From: Art Cancro Date: Thu, 6 Feb 2014 16:57:18 +0000 (-0500) Subject: MODE READER X-Git-Tag: v9.01~122^2~33 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=2ffa7f5d58eec15aa17f6b7372740f0e15d81d64 MODE READER --- diff --git a/citadel/modules/nntp/serv_nntp.c b/citadel/modules/nntp/serv_nntp.c index 398e63dcc..863685960 100644 --- a/citadel/modules/nntp/serv_nntp.c +++ b/citadel/modules/nntp/serv_nntp.c @@ -234,10 +234,11 @@ void nntp_starttls(void) void nntp_capabilities(void) { cprintf("101 Capability list:\r\n"); + cprintf("IMPLEMENTATION Citadel v%d.%02d\r\n", (REV_LEVEL/100), (REV_LEVEL%100)); cprintf("VERSION 2\r\n"); cprintf("READER\r\n"); + cprintf("MODE-READER\r\n"); cprintf("LIST ACTIVE NEWSGROUPS\r\n"); - cprintf("IMPLEMENTATION Citadel v%d.%02d\r\n", (REV_LEVEL/100), (REV_LEVEL%100)); #ifdef HAVE_OPENSSL cprintf("STARTTLS\r\n"); #endif @@ -551,14 +552,6 @@ void nntp_help(void) { } - -struct listgroup_range { - long lo; - long hi; -}; - - - /* * back end for the LISTGROUP command , called for each message number */ @@ -662,6 +655,25 @@ void nntp_group(const char *cmd) { } +/* + * Implements the MODE command + */ +void nntp_mode(const char *cmd) { + + char which_mode[16]; + + extract_token(which_mode, cmd, 1, ' ', sizeof which_mode); + + if (!strcasecmp(which_mode, "reader")) { + cprintf("201 Reader mode FIXME implement posting and change to 200\r\n"); + } + else { + cprintf("501 unknown mode\r\n"); + } +} + + + /* * Main command loop for NNTP server sessions. */ @@ -720,6 +732,10 @@ void nntp_command_loop(void) nntp_group(ChrPtr(Cmd)); } + else if (!strcasecmp(cmdname, "mode")) { + nntp_mode(ChrPtr(Cmd)); + } + else { cprintf("500 I'm afraid I can't do that.\r\n"); } @@ -774,9 +790,3 @@ CTDL_MODULE_INIT(nntp) /* return our module name for the log */ return "nntp"; } - - - - - - diff --git a/citadel/modules/nntp/serv_nntp.h b/citadel/modules/nntp/serv_nntp.h index 6877bbfc1..31295ce16 100644 --- a/citadel/modules/nntp/serv_nntp.h +++ b/citadel/modules/nntp/serv_nntp.h @@ -27,5 +27,14 @@ struct nntp_list_data { }; +/* + * data passed between nntp_listgroup() and nntp_listgroup_backend() + */ +struct listgroup_range { + long lo; + long hi; +}; + + int wildmat(const char *text, const char *p);