]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/nntp/serv_nntp.c
skeleton nntp_group()
[citadel.git] / citadel / modules / nntp / serv_nntp.c
index 82c8f2034eb1e1bcbcc4f2cd3679d9c134a415a5..094475ed4c59e5c726a0415b1c25d337f19c9384 100644 (file)
@@ -231,12 +231,6 @@ void nntp_starttls(void)
 }
 
 
-void nntp_noop(void)
-{
-       cprintf("250 NOOP\r\n");
-}
-
-
 void nntp_capabilities(void)
 {
        cprintf("101 Capability list:\r\n");
@@ -547,6 +541,35 @@ void nntp_list(const char *cmd) {
 }
 
 
+/*
+ * Implement HELP command.
+ */
+void nntp_help(void) {
+       cprintf("100 This is the Citadel NNTP service.\r\n");
+       cprintf("RTFM http://www.ietf.org/rfc/rfc3977.txt\r\n");
+       cprintf(".\r\n");
+}
+
+
+/*
+ * Implements the GROUP command
+ */
+void nntp_group(const char *cmd) {
+       /*
+        * HACK: this works because the 5XX series error codes from citadel
+        * protocol will also be considered error codes by an NNTP client
+        */
+       if (CtdlAccessCheck(ac_logged_in_or_guest)) return;
+
+       char requested_group[1024];
+       char requested_room[ROOMNAMELEN];
+       extract_token(requested_group, cmd, 1, ' ', sizeof requested_group);
+       newsgroup_to_room(requested_room, requested_group, sizeof requested_room);
+
+       cprintf("599 FIXME screw you and your %s\r\n", requested_room);
+}
+
+
 /* 
  * Main command loop for NNTP server sessions.
  */
@@ -573,6 +596,10 @@ void nntp_command_loop(void)
                nntp_quit();
        }
 
+       else if (!strcasecmp(cmdname, "help")) {
+               nntp_help();
+       }
+
        else if (!strcasecmp(cmdname, "capabilities")) {
                nntp_capabilities();
        }
@@ -581,10 +608,6 @@ void nntp_command_loop(void)
                nntp_starttls();
        }
 
-       else if (!strcasecmp(cmdname, "noop")) {
-               nntp_noop();
-       }
-
        else if (!strcasecmp(cmdname, "authinfo")) {
                nntp_authinfo(ChrPtr(Cmd));
        }
@@ -597,6 +620,10 @@ void nntp_command_loop(void)
                nntp_list(ChrPtr(Cmd));
        }
 
+       else if (!strcasecmp(cmdname, "group")) {
+               nntp_group(ChrPtr(Cmd));
+       }
+
        else {
                cprintf("500 I'm afraid I can't do that.\r\n");
        }