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

Example/pop3-list/pop3-list.c
Library/POP3.c

index 2f4f480d22618b440723af158afe43d7170e5787..dbb3ead7f97b47a2179665f7e921adff389935c7 100644 (file)
@@ -25,7 +25,7 @@ void list_handler(struct W3* w3, bool ok, char* data) {
 void login_handler(struct W3* w3) {
        printf("Logged in\n");
        W3_Set_Method(w3, "RETR");
-       W3_Set_Path(w3, "18");
+       W3_Set_Path(w3, "98");
        W3_POP3_Send_Request(w3);
 }
 
index ff7d508f2c6e4b6b589bce32bbb96035c9eaeb7b..64747018c13f9ed1b4abc964d7ddfb45663181fd 100644 (file)
@@ -40,11 +40,11 @@ void __W3_POP3_Request(struct W3* w3) {
                        char c = buf[i];
                        bool newl = false;
                        if(newl_cond & (1 << 1)) {
-                               if(c == '\n' && !(newl_cond & (1 << 4))){
-                                       if(!(newl_cond & (1 << 2))){
+                               if(c == '\n' && !(newl_cond & (1 << 4))) {
+                                       if(!(newl_cond & (1 << 2))) {
                                                newl_cond |= (1 << 2);
                                        }
-                               }else if(c == '\n' && newl_cond & (1 << 4) && !(newl_cond & (1 << 5))){
+                               } else if(c == '\n' && newl_cond & (1 << 4) && !(newl_cond & (1 << 5))) {
                                        newl_cond |= (1 << 5);
                                        char* oct = __W3_Concat(octets_n, " octets");
                                        __W3_Debug("LibW3-POP3", oct);
@@ -53,15 +53,15 @@ void __W3_POP3_Request(struct W3* w3) {
                                        free(octets_n);
                                        octets_n = malloc(1);
                                        octets_n[0] = 0;
-                               }else if(!(newl_cond & (1 << 2))){
-                                       if(c == ' ' & !(newl_cond & (1 << 4))){
-                                               if(newl_cond & (1 << 3)){
+                               } else if(!(newl_cond & (1 << 2))) {
+                                       if(c == ' ' & !(newl_cond & (1 << 4))) {
+                                               if(newl_cond & (1 << 3)) {
                                                        newl_cond |= (1 << 4);
-                                               }else{
+                                               } else {
                                                        newl_cond |= (1 << 3);
                                                }
-                                       }else if(newl_cond & (1 << 3)){
-                                               if(newl_cond & (1 << 5)){
+                                       } else if(newl_cond & (1 << 3)) {
+                                               if(newl_cond & (1 << 5)) {
                                                        int readlen = (len - i) > octets ? octets : (len - i);
                                                        octets -= readlen;
                                                        void* funcptr = __W3_Get_Event(w3, "pop3data");
@@ -73,13 +73,14 @@ void __W3_POP3_Request(struct W3* w3) {
                                                                func(w3, true, buffer);
                                                                free(buffer);
                                                        }
-                                                       if(octets == 0){
+                                                       printf("%d\n", octets);
+                                                       if(octets == 0) {
                                                                __W3_Debug("LibW3-POP3", "Received all");
                                                                newl_cond &= ~(1 << 1);
                                                        }
                                                        i += readlen;
-                                               }else if(newl_cond & (1 << 4)){
-                                               }else{
+                                               } else if(newl_cond & (1 << 4)) {
+                                               } else {
                                                        char* tmp = octets_n;
                                                        cbuf[0] = c;
                                                        octets_n = __W3_Concat(tmp, cbuf);
@@ -89,8 +90,8 @@ void __W3_POP3_Request(struct W3* w3) {
                                }
                                newl = true;
                                continue;
-                       }else if(newl_cond & 1) {
-                               if(c == '\n'){
+                       } else if(newl_cond & 1) {
+                               if(c == '\n') {
                                        newl = true;
                                }
                        } else if(c == '.' && !(newl_cond & 1)) {