From ea31b9422250ccb22214ac024e308d0dba1cd5ce Mon Sep 17 00:00:00 2001 From: nishi Date: Thu, 15 Feb 2024 05:27:49 +0000 Subject: [PATCH] nntp-list git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@223 d27a3e52-49c5-7645-884c-6793ebffc270 --- Example/nntp-list/nntp-list.c | 12 ++++++++++++ Library/NNTP.c | 13 +++++++++++++ Makefile | 3 +++ W3Version.h.p | 2 +- 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Example/nntp-list/nntp-list.c b/Example/nntp-list/nntp-list.c index dbb7c0a..9bcc035 100644 --- a/Example/nntp-list/nntp-list.c +++ b/Example/nntp-list/nntp-list.c @@ -24,6 +24,18 @@ void resp_handler(struct W3* w3, int status, char* data) { if(status == 200) { W3_Set_Method(w3, "LIST"); W3_NNTP_Send_Request(w3); + }else if(status == 215){ + W3_Set_Method(w3, "GROUP"); + W3_Set_Path(w3, w3url->path + 1); + W3_NNTP_Send_Request(w3); + }else if(status == 211){ + W3_Set_Method(w3, "HEAD"); + W3_NNTP_Send_Request(w3); + }else if(status == 221){ + W3_Set_Method(w3, "BODY"); + W3_NNTP_Send_Request(w3); + }else if(status == 222){ + W3_NNTP_Disconnect(w3); } } diff --git a/Library/NNTP.c b/Library/NNTP.c index 1468861..e5a6b68 100644 --- a/Library/NNTP.c +++ b/Library/NNTP.c @@ -92,9 +92,22 @@ void W3_NNTP_Send_Request(struct W3* w3){ if(strcasecmp(w3->method, "LIST") == 0){ (*(int*)w3->generic) |= 1; __W3_Auto_Write(w3, "LIST\r\n", 6); + }else if(strcasecmp(w3->method, "HEAD") == 0){ + (*(int*)w3->generic) |= 1; + __W3_Auto_Write(w3, "HEAD\r\n", 6); + }else if(strcasecmp(w3->method, "BODY") == 0){ + (*(int*)w3->generic) |= 1; + __W3_Auto_Write(w3, "BODY\r\n", 6); + }else if(strcasecmp(w3->method, "GROUP") == 0){ + __W3_Auto_Write(w3, "GROUP ", 6); + __W3_Auto_Write(w3, w3->path, strlen(w3->path)); + __W3_Auto_Write(w3, "\r\n", 2); } + + } void W3_NNTP_Disconnect(struct W3* w3){ + __W3_Auto_Write(w3, "QUIT\r\n", 6); } diff --git a/Makefile b/Makefile index d1c0e5b..9775f47 100644 --- a/Makefile +++ b/Makefile @@ -146,6 +146,7 @@ ifeq ($(TCL),YES) mkdir -p w3-$(VERSION)/Example/tclw3/bin mkdir -p w3-$(VERSION)/Example/tclw3/lib endif + mkdir -p w3-$(VERSION)/Example/nntp-list mkdir -p w3-$(VERSION)/Example/ftp-list mkdir -p w3-$(VERSION)/Example/pop3-list mkdir -p w3-$(VERSION)/Example/interactive @@ -159,6 +160,7 @@ ifeq ($(WINDOWS),YES) cp ./Example/pop3-list/pop3-list.exe w3-$(VERSION)/Example/pop3-list/ cp ./Example/w3b/w3b.exe w3-$(VERSION)/Example/w3b/ cp ./Example/ftp-list/ftp-list.exe w3-$(VERSION)/Example/ftp-list/ + cp ./Example/nntp-list/nntp-list.exe w3-$(VERSION)/Example/nntp-list/ ifeq ($(TCL),YES) cp ./Example/tclw3/tclw3.exe w3-$(VERSION)/Example/tclw3/bin/ cp /usr/$(MINGW)/sys-root/mingw/bin/tcl86.dll w3-$(VERSION)/Example/tclw3/bin/ @@ -174,6 +176,7 @@ else cp ./Example/pop3-list/pop3-list w3-$(VERSION)/Example/pop3-list/ cp ./Example/w3b/w3b w3-$(VERSION)/Example/w3b/ cp ./Example/ftp-list/ftp-list w3-$(VERSION)/Example/ftp-list/ + cp ./Example/nntp-list/nntp-list w3-$(VERSION)/Example/nntp-list/ ifeq ($(TCL),YES) cp ./Example/tclw3/tclw3 w3-$(VERSION)/Example/tclw3/bin/ endif diff --git a/W3Version.h.p b/W3Version.h.p index 3392348..2862178 100644 --- a/W3Version.h.p +++ b/W3Version.h.p @@ -6,7 +6,7 @@ extern "C" { #endif -#define LIBW3_VERSION "2.12F" \ +#define LIBW3_VERSION "2.12G" \ SUFFIX #ifdef __cplusplus -- 2.43.0