From 0adb29d5fa73df9c3760478405aaf71fa37054c4 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 19 Mar 2014 16:28:06 -0400 Subject: [PATCH] Implemented the range handling code for XOVER --- citadel/modules/nntp/serv_nntp.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/citadel/modules/nntp/serv_nntp.c b/citadel/modules/nntp/serv_nntp.c index 78043d3fa..e4897d6c3 100644 --- a/citadel/modules/nntp/serv_nntp.c +++ b/citadel/modules/nntp/serv_nntp.c @@ -966,9 +966,35 @@ void nntp_last_next(const char *cmd) { void nntp_xover(const char *cmd) { if (CtdlAccessCheck(ac_logged_in_or_guest)) return; - // citnntp *nntpstate = (citnntp *) CC->session_specific_data; + citnntp *nntpstate = (citnntp *) CC->session_specific_data; + char range[256]; + long lowest = (-1) ; + long highest = (-1) ; + + extract_token(range, cmd, 1, ' ', sizeof range); + lowest = atol(range); + if (lowest <= 0) { + lowest = nntpstate->current_article_number; + highest = nntpstate->current_article_number; + } + else { + char *dash = strchr(range, '-'); + if (dash != NULL) { + ++dash; + highest = atol(dash); + if (highest == 0) { + highest = LONG_MAX; + } + if (highest < lowest) { + highest = lowest; + } + } + else { + highest = lowest; + } + } - cprintf("500 not implemented yet FIXME\r\n"); + cprintf("500 not implemented yet FIXME lowest=%ld highest=%ld\r\n", lowest, highest); } -- 2.30.2