Rev 4540 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4540 | Rev 4645 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | { |
31 | { |
32 | case SEND_NSTAT: |
32 | case SEND_NSTAT: |
33 | SetMailBoxStatus(NULL, "Counting mail, awaiting answer..."); |
33 | SetMailBoxStatus(NULL, "Counting mail, awaiting answer..."); |
34 | request_len = GetRequest("STAT", NULL); |
34 | request_len = GetRequest("STAT", NULL); |
35 | Send(socketnum, #request, request_len, 0); |
35 | Send(socketnum, #request, request_len, 0); |
36 | if (EAX == 0xffffffff) { debug("Error sending STAT. Retry..."w); break;} |
36 | if (EAX == 0xffffffff) { debugln("Error sending STAT. Retry..."w); break;} |
37 | aim = GET_ANSWER_NSTAT; |
37 | aim = GET_ANSWER_NSTAT; |
38 | break; |
38 | break; |
Line 39... | Line 39... | ||
39 | 39 | ||
40 | case GET_ANSWER_NSTAT: |
40 | case GET_ANSWER_NSTAT: |
41 | ticks = Receive(socketnum, #immbuffer, BUFFERSIZE, 0); |
41 | ticks = Receive(socketnum, #immbuffer, BUFFERSIZE, 0); |
Line 42... | Line 42... | ||
42 | if ((ticks == 0xffffff) || (ticks < 2)) break; |
42 | if ((ticks == 0xffffff) || (ticks < 2)) break; |
43 | 43 | ||
44 | if (immbuffer[ticks-2]=='\n') |
44 | if (immbuffer[ticks-2]=='\n') |
45 | { |
45 | { |
46 | debug(#immbuffer); |
46 | debugln(#immbuffer); |
47 | if (strstr(#immbuffer,"+OK")) |
47 | if (strstr(#immbuffer,"+OK")) |
48 | { |
48 | { |
49 | strcpyb(#immbuffer, #param, "+OK ", " "); |
49 | strcpyb(#immbuffer, #param, "+OK ", " "); |
50 | mail_list.count = atoi(#param); |
50 | mail_list.count = atoi(#param); |
51 | free(listbuffer); |
51 | free(listbuffer); |
52 | listbuffer = mem_Alloc(30*mail_list.count); //24* original |
52 | listbuffer = mem_Alloc(30*mail_list.count); //24* original |
53 | listpointer = listbuffer; |
53 | listpointer = listbuffer; |
54 | aim = SEND_NLIST; |
54 | aim = SEND_NLIST; |
55 | debug("Receiving mail list..."); |
55 | debugln("Receiving mail list..."); |
56 | } |
56 | } |
57 | else |
57 | else |
58 | { |
58 | { |
Line 63... | Line 63... | ||
63 | 63 | ||
64 | case SEND_NLIST: |
64 | case SEND_NLIST: |
65 | WriteText(5, Form.cheight-11, 0x80, sc.work_text, "Send LIST, awaiting answer..."); |
65 | WriteText(5, Form.cheight-11, 0x80, sc.work_text, "Send LIST, awaiting answer..."); |
66 | request_len = GetRequest("LIST", NULL); |
66 | request_len = GetRequest("LIST", NULL); |
67 | Send(socketnum, #request, request_len, 0); |
67 | Send(socketnum, #request, request_len, 0); |
68 | if (EAX == 0xffffffff) {debug("Error while sending LIST. Retry..."); break;} |
68 | if (EAX == 0xffffffff) {debugln("Error while sending LIST. Retry..."); break;} |
69 | else aim = GET_ANSWER_NLIST; |
69 | else aim = GET_ANSWER_NLIST; |
Line 70... | Line 70... | ||
70 | break; |
70 | break; |
71 | 71 | ||
Line 76... | Line 76... | ||
76 | 76 | ||
77 | if (listpointer - listbuffer < 5) break; |
77 | if (listpointer - listbuffer < 5) break; |
78 | if (strncmp(listpointer-5,"\n.\n",5)==0) // note that c-- assembles "\n.\n" to 0x0d, 0x0a, 0x2e, 0x0d, 0x0a |
78 | if (strncmp(listpointer-5,"\n.\n",5)==0) // note that c-- assembles "\n.\n" to 0x0d, 0x0a, 0x2e, 0x0d, 0x0a |
79 | { |
79 | { |
80 | aim = SEND_RETR; |
80 | aim = SEND_RETR; |
81 | debug("goto SEND_RETR"); |
81 | debugln("goto SEND_RETR"); |
Line 82... | Line 82... | ||
82 | DrawMailBox(); |
82 | DrawMailBox(); |
83 | 83 | ||
84 | *listpointer='\0'; |
84 | *listpointer='\0'; |
Line 100... | Line 100... | ||
100 | mailsize = atr.GetSize(mail_list.current+1) + 1024; |
100 | mailsize = atr.GetSize(mail_list.current+1) + 1024; |
101 | free(mailstart); |
101 | free(mailstart); |
102 | mailstart = malloc(mailsize); |
102 | mailstart = malloc(mailsize); |
103 | if (!mailstart) |
103 | if (!mailstart) |
104 | { |
104 | { |
105 | debug("alloc error!"); |
105 | debugln("alloc error!"); |
106 | aim=NULL; |
106 | aim=NULL; |
107 | break; |
107 | break; |
108 | } |
108 | } |
109 | mailend = mailstart; |
109 | mailend = mailstart; |
110 | aim = GET_ANSWER_RETR; |
110 | aim = GET_ANSWER_RETR; |
111 | debug("goto GET_ANSWER_RETR"); |
111 | debugln("goto GET_ANSWER_RETR"); |
112 | break; |
112 | break; |
Line 113... | Line 113... | ||
113 | 113 | ||
114 | case GET_ANSWER_RETR: |
114 | case GET_ANSWER_RETR: |
115 | ticks = Receive(socketnum, mailend, mailsize + mailstart - mailend, MSG_DONTWAIT); |
115 | ticks = Receive(socketnum, mailend, mailsize + mailstart - mailend, MSG_DONTWAIT); |
116 | if (ticks == 0xffffffff) break; |
116 | if (ticks == 0xffffffff) break; |
117 | mailend += ticks; |
117 | mailend += ticks; |
118 | if (mailsize + mailstart - mailend - 2 < 0) |
118 | if (mailsize + mailstart - mailend - 2 < 0) |
119 | { |
119 | { |
120 | debug("Resizing buffer"); |
120 | debugln("Resizing buffer"); |
121 | mailsize += 4096; |
121 | mailsize += 4096; |
122 | mailstart = realloc(mailstart, mailsize); |
122 | mailstart = realloc(mailstart, mailsize); |
123 | if (!mailstart) { StopConnect("Realloc error!"); break;} |
123 | if (!mailstart) { StopConnect("Realloc error!"); break;} |
124 | } |
124 | } |
Line 355... | Line 355... | ||
355 | } |
355 | } |
Line 356... | Line 356... | ||
356 | 356 | ||
357 | void DrawLetter() { |
357 | void DrawLetter() { |
358 | pre_text = 2; |
358 | pre_text = 2; |
- | 359 | bufsize = strlen(mdata); |
|
359 | bufsize = strlen(mdata); |
360 | WB1.Prepare(bufsize, mdata); |
360 | if (bufsize) WB1.ParseHTML(mdata); |
361 | if (bufsize) WB1.Parse(); |
Line 361... | Line 362... | ||
361 | } |
362 | } |
362 | 363 |