From: Art Cancro Date: Wed, 5 Mar 2014 19:37:01 +0000 (-0500) Subject: Implemented the NNTP DATE command. X-Git-Tag: v9.01~122^2~13 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=5e549537216ea1b602dd979d75838519412b5252 Implemented the NNTP DATE command. --- diff --git a/citadel/modules/nntp/serv_nntp.c b/citadel/modules/nntp/serv_nntp.c index 198261005..f32ce1d73 100644 --- a/citadel/modules/nntp/serv_nntp.c +++ b/citadel/modules/nntp/serv_nntp.c @@ -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 // @@ -949,6 +968,10 @@ void nntp_command_loop(void) nntp_help(); } + else if (!strcasecmp(cmdname, "date")) { + nntp_date(); + } + else if (!strcasecmp(cmdname, "capabilities")) { nntp_capabilities(); }