From ac5baebc10229cbe637fe05f0eac3f877107fbd4 Mon Sep 17 00:00:00 2001 From: nishi Date: Sat, 27 Jan 2024 13:40:16 +0000 Subject: [PATCH] reformat git-svn-id: file:///raid/svn-main/nishi-libw3/trunk@118 d27a3e52-49c5-7645-884c-6793ebffc270 --- Example/pop3-list/pop3-list.c | 2 +- Library/POP3.c | 29 +++++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/Example/pop3-list/pop3-list.c b/Example/pop3-list/pop3-list.c index 2f4f480..dbb3ead 100644 --- a/Example/pop3-list/pop3-list.c +++ b/Example/pop3-list/pop3-list.c @@ -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); } diff --git a/Library/POP3.c b/Library/POP3.c index ff7d508..6474701 100644 --- a/Library/POP3.c +++ b/Library/POP3.c @@ -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)) { -- 2.43.0