Skeleton nntp_xover() checked in. It seems that some clients make use of the XOVER...
[citadel.git] / citadel / modules / nntp / serv_nntp.c
index 198261005328147f5f2e03695377f99c9ab74425..26b0ccd4f9a7bc55e22846353e7d0800d15a4fba 100644 (file)
@@ -531,6 +531,25 @@ void nntp_help(void) {
 }
 
 
+//
+// Implement DATE command.
+//
+void nntp_date(void) {
+       time_t now;
+       struct tm nowLocal;
+       struct tm nowUtc;
+       char tsFromUtc[32];
+
+       now = time(NULL);
+       localtime_r(&now, &nowLocal);
+       gmtime_r(&now, &nowUtc);
+
+       strftime(tsFromUtc, sizeof(tsFromUtc), "%Y%m%d%H%M%S", &nowUtc);
+
+       cprintf("111 %s\r\n", tsFromUtc);
+}
+
+
 //
 // back end for the LISTGROUP command , called for each message number
 //
@@ -921,6 +940,18 @@ void nntp_last_next(const char *cmd) {
 }
 
 
+//
+// XOVER is used by some clients, even if we don't offer it
+//
+void nntp_xover(const char *cmd) {
+       if (CtdlAccessCheck(ac_logged_in_or_guest)) return;
+
+       // citnntp *nntpstate = (citnntp *) CC->session_specific_data;
+
+       cprintf("500 not implemented yet FIXME\r\n");
+}
+
+
 // 
 // Main command loop for NNTP server sessions.
 //
@@ -949,6 +980,10 @@ void nntp_command_loop(void)
                nntp_help();
        }
 
+       else if (!strcasecmp(cmdname, "date")) {
+               nntp_date();
+       }
+
        else if (!strcasecmp(cmdname, "capabilities")) {
                nntp_capabilities();
        }
@@ -999,6 +1034,10 @@ void nntp_command_loop(void)
                nntp_last_next(ChrPtr(Cmd));
        }
 
+       else if (!strcasecmp(cmdname, "xover")) {
+               nntp_xover(ChrPtr(Cmd));
+       }
+
        else {
                cprintf("500 I'm afraid I can't do that.\r\n");
        }