]> Nishi Git Mirror - libw3.git/commitdiff
pop3 support
authornishi <nishi@d27a3e52-49c5-7645-884c-6793ebffc270>
Sat, 27 Jan 2024 00:53:00 +0000 (00:53 +0000)
committernishi <nishi@d27a3e52-49c5-7645-884c-6793ebffc270>
Sat, 27 Jan 2024 00:53:00 +0000 (00:53 +0000)
git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@100 d27a3e52-49c5-7645-884c-6793ebffc270

Library/Core.c
Library/DNS.c
Library/Gopher.c
Library/Makefile
Library/POP3.c [new file with mode: 0644]
Library/URL.c
Library/W3POP3.h [new file with mode: 0644]

index 2dfac35b42d01581e09f38fe51b7f855d8b0a8d1..6e921fe47acb37a38e78f31b5b942af550be3268 100644 (file)
@@ -5,8 +5,8 @@
 #include "W3Util.h"
 
 #include "W3File.h"
-#include "W3HTTP.h"
 #include "W3Gopher.h"
+#include "W3HTTP.h"
 
 #include <ctype.h>
 #include <stdbool.h>
@@ -71,7 +71,7 @@ struct W3* W3_Create(const char* protocol, const char* hostname, int port) {
 #ifdef SSL_SUPPORT
                } else if(strcmp(protocol, "https") == 0) {
 #endif
-               }else if(strcmp(protocol, "gopher") == 0){
+               } else if(strcmp(protocol, "gopher") == 0) {
                } else {
                        __W3_Debug("Protocol", "Not suppported");
                        W3_Free(w3);
@@ -109,11 +109,11 @@ void W3_Set_Path(struct W3* w3, const char* path) {
 void W3_Send_Request(struct W3* w3) {
        if(strcmp(w3->protocol, "http") == 0
 #ifdef SSL_SUPPORT
-                       || strcmp(w3->protocol, "https") == 0
+          || strcmp(w3->protocol, "https") == 0
 #endif
        ) {
                __W3_HTTP_Request(w3);
-       }else if(strcmp(w3->protocol, "gopher") == 0){
+       } else if(strcmp(w3->protocol, "gopher") == 0) {
                __W3_Gopher_Request(w3);
        } else if(strcmp(w3->protocol, "file") == 0) {
                __W3_File_Request(w3);
index c04a5e2978de41235d293f851b120671ff9fb8f4..4efabfbc0092f86337213d7ffc5a8edb168750f6 100644 (file)
@@ -7,8 +7,8 @@
 #include <string.h>
 
 #ifdef __MINGW32__
-#include <winsock2.h>
 #include <windows.h>
+#include <winsock2.h>
 #include <ws2tcpip.h>
 #else
 #include <netdb.h>
index 03dca5db61ed1c66842c2eff330bff32e3e0ecb9..d9746c3ff2031a5e3680d91d19787eaa35255a1e 100644 (file)
@@ -4,15 +4,15 @@
 #include "W3Core.h"
 #include "W3Util.h"
 
-#include <string.h>
 #include <stdlib.h>
+#include <string.h>
 
 void __W3_Gopher_Request(struct W3* w3) {
        __W3_Debug("LibW3-Gopher", "Sending the request");
        __W3_Auto_Write(w3, w3->path, strlen(w3->path));
        __W3_Auto_Write(w3, "\r\n", 2);
        char* buf = malloc(w3->readsize);
-       while(true){
+       while(true) {
                int len = __W3_Auto_Read(w3, buf, w3->readsize);
                if(len <= 0) break;
                void* funcptr = __W3_Get_Event(w3, "data");
@@ -20,6 +20,6 @@ void __W3_Gopher_Request(struct W3* w3) {
                        void (*func)(struct W3*, char*, size_t) = (void (*)(struct W3*, char*, size_t))funcptr;
                        func(w3, buf, len);
                }
-       }       
+       }
        free(buf);
 }
index d9977e559f792b08b54754737e712ea392f47400..19b112b4b34335730a17cef022e1cc28d178ee3a 100644 (file)
@@ -1,7 +1,7 @@
 # $Id$
 .PHONY: clean install
 
-OBJS = ./Core.o ./Util.o ./DNS.o ./HTTP.o ./Gopher.o ./File.o ./URL.o
+OBJS = ./Core.o ./Util.o ./DNS.o ./HTTP.o ./Gopher.o ./POP3.o ./File.o ./URL.o
 
 ifeq ($(WINDOWS),YES)
 ./w3.dll: $(OBJS)
diff --git a/Library/POP3.c b/Library/POP3.c
new file mode 100644 (file)
index 0000000..8891e11
--- /dev/null
@@ -0,0 +1,10 @@
+/* $Id$ */
+#include "W3POP3.h"
+
+#include "W3Core.h"
+#include "W3Util.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+void __W3_POP3_Request(struct W3* w3) {}
index f7e62c9b6b45529fc0ceb215ec38582239e6d3de..59ebdc993d3b545d88cb712f882abbba84d3e6b4 100644 (file)
@@ -58,10 +58,9 @@ struct W3URL* W3_Parse_URL(const char* _url) {
                                        r->port = 80;
                                } else if(strcmp(r->protocol, "https") == 0) {
                                        r->port = 443;
-                               }else if(strcmp(r->protocol, "gopher") == 0) {
+                               } else if(strcmp(r->protocol, "gopher") == 0) {
                                        r->port = 70;
                                }
-
                        }
                        r->host = __W3_Strdup(url + start);
                        str = malloc(strlen(r->host) + 64);
diff --git a/Library/W3POP3.h b/Library/W3POP3.h
new file mode 100644 (file)
index 0000000..56acb79
--- /dev/null
@@ -0,0 +1,17 @@
+/* $Id$ */
+#ifndef __W3POP3_H__
+#define __W3POP3_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "W3Core.h"
+
+void __W3_POP3_Request(struct W3* w3);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif