Rev 3368 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3368 | leency | 1 | //Leency & SoUrcerer, LGPL |
2 | |||
3 | #define LIST_INFO_H 59 |
||
4 | int status_bar_h = 15; |
||
5 | |||
3412 | leency | 6 | llist mail_list; |
7 | llist letter_view; |
||
3368 | leency | 8 | scroll_bar scroll1 = { 17,200,210, LIST_INFO_H-3,18,0,115,15,0,0xCCCccc,0xD2CED0,0x555555,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
9 | scroll_bar scroll2 = { 17,200,210, LIST_INFO_H,18,0,115,15,0,0xCCCccc,0xD2CED0,0x555555,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; |
||
10 | |||
3412 | leency | 11 | struct letter_attr |
12 | { |
||
13 | char adress[64]; |
||
14 | char header[256]; |
||
15 | byte m_type; |
||
16 | int size; |
||
17 | void CreateMailsArray(); |
||
18 | void SetMailsSizes(); |
||
19 | int GetLetterSize(int N); |
||
20 | }; |
||
21 | letter_attr atr; |
||
22 | dword mails_db; |
||
3368 | leency | 23 | |
24 | |||
25 | char from[256]; |
||
26 | char to[256]; |
||
27 | char date[256]; |
||
28 | char subj[256]; |
||
29 | dword mdata; |
||
30 | |||
31 | char *listbuffer; |
||
32 | char *listpointer; |
||
33 | |||
34 | char *mailbuffer; |
||
35 | char *mailpointer; |
||
36 | |||
37 | |||
38 | enum { |
||
39 | GET_MAIL = 20, |
||
40 | SEND_MAIL, |
||
41 | DELETE_LETTER, |
||
42 | SAVE_LETTER, |
||
43 | STOP_LOADING, |
||
44 | EXIT_MAIL, |
||
45 | CHANGE_CHARSET, |
||
46 | CLOSE_CHANGE_CHARSET |
||
47 | }; |
||
48 | |||
49 | |||
50 | void MailBoxLoop() |
||
51 | { |
||
52 | int key, id; |
||
53 | mouse m; |
||
54 | int panels_drag = 0; |
||
55 | char socket_char; |
||
56 | int letter_size; |
||
57 | dword line_col, text_col; |
||
58 | |||
59 | mail_list.h = Form.cheight/4; |
||
60 | mail_list.ClearList(); |
||
61 | SetMailBoxStatus( NULL , NULL); |
||
62 | cur_charset = 0; |
||
63 | |||
64 | goto _MB_DRAW; |
||
65 | |||
66 | loop() |
||
67 | { |
||
68 | WaitEventTimeout(2); |
||
69 | switch(EAX & 0xFF) |
||
70 | { |
||
71 | case evMouse: |
||
72 | IF (GetProcessSlot(Form.ID)-GetActiveProcess()!=0) break; |
||
73 | m.get(); |
||
74 | |||
75 | if (!m.lkm) panels_drag=0; |
||
76 | if (m.lkm) && (m.y>mail_list.y+mail_list.h-1) && (m.y |
||
77 | && (!scroll1.delta2) && (!scroll2.delta2) panels_drag = 1; |
||
78 | if (panels_drag) |
||
79 | { |
||
80 | if (m.y |
||
81 | mail_list.h = m.y - mail_list.y-2; |
||
82 | DrawMailBox(); |
||
83 | break; |
||
84 | } |
||
85 | |||
86 | if (!mail_list.count) break; |
||
87 | if (!panels_drag) { scrollbar_v_mouse (#scroll1); scrollbar_v_mouse (#scroll2); } |
||
88 | |||
89 | if (mail_list.first <> scroll1.position) |
||
90 | { |
||
91 | mail_list.first = scroll1.position; |
||
92 | DrawMailList(); |
||
93 | break; |
||
94 | }; |
||
95 | if (letter_view.first <> scroll2.position) |
||
96 | { |
||
97 | letter_view.first = scroll2.position; |
||
98 | DrawLetter(); |
||
99 | break; |
||
100 | }; |
||
101 | |||
102 | if (mail_list.y+mail_list.h + 10 > m.y) |
||
103 | { |
||
104 | if (mail_list.MouseScroll(m.vert)) DrawMailList(); |
||
105 | } |
||
106 | else |
||
107 | { |
||
108 | if (letter_view.MouseScroll(m.vert)) DrawLetter(); |
||
109 | } |
||
110 | |||
111 | break; |
||
112 | case evButton: |
||
113 | id = GetButtonID(); |
||
114 | if (id==1) SaveAndExit(); |
||
115 | if (id==GET_MAIL) aim = SEND_NSTAT; |
||
116 | if (id==SAVE_LETTER) |
||
117 | { |
||
118 | if (!mailbuffer) break; |
||
119 | WriteFile(strlen(mailbuffer), mailbuffer, "mail.txt"); |
||
120 | pause(10); |
||
121 | RunProgram("tinypad", "mail.txt"); |
||
122 | } |
||
123 | if (id==STOP_LOADING) |
||
124 | { |
||
125 | StopLoading(); |
||
126 | DrawStatusBar(); |
||
127 | DrawMailList(); |
||
128 | } |
||
129 | if (id==EXIT_MAIL) |
||
130 | { |
||
131 | StopLoading(); |
||
132 | LoginBoxLoop(); |
||
133 | } |
||
134 | if (id==CHANGE_CHARSET) |
||
135 | { |
||
136 | DefineButton(0,0,Form.cwidth,Form.cheight, CLOSE_CHANGE_CHARSET+BT_HIDE+BT_NOFRAME); |
||
137 | DrawRectangle(Form.cwidth-100, Form.cheight-status_bar_h- 70, 70, 82, sc.work_graph); |
||
138 | DrawRectangle3D(Form.cwidth-99, Form.cheight-status_bar_h- 69, 68, 80, 0xFFFfff, sc.work); |
||
139 | for (id=0; id<5; id++) |
||
140 | { |
||
141 | if (cur_charset==id+1) { line_col=sc.work_button; text_col=sc.work_button_text; } |
||
142 | else { line_col=sc.work; text_col=sc.work_text; } |
||
143 | DrawBar(Form.cwidth-98, id*16+Form.cheight-status_bar_h- 68, 67, 16, line_col); |
||
144 | DrawCaptButton(Form.cwidth-100, id*16+Form.cheight-status_bar_h- 68, 70,16, 10+id+BT_HIDE, |
||
145 | 0, text_col, charsets[id+1]); |
||
146 | } |
||
147 | } |
||
148 | if (id==CLOSE_CHANGE_CHARSET) goto _MB_DRAW; |
||
149 | |||
150 | if (id>=30) |
||
151 | { |
||
152 | if (aim) break; |
||
153 | mail_list.current = mail_list.first + id - 30; |
||
154 | DrawMailList(); |
||
155 | aim = SEND_RETR; |
||
156 | } |
||
157 | |||
158 | break; |
||
159 | case evKey: |
||
160 | key = GetKey(); |
||
161 | |||
162 | if (key == 177){ //down |
||
163 | if (aim) break; |
||
164 | if (mail_list.current >= mail_list.count-1) break; |
||
165 | mail_list.current++ ; |
||
166 | if (mail_list.current >= mail_list.first + mail_list.visible) mail_list.first++ ; |
||
167 | DrawMailList(); |
||
168 | aim = SEND_RETR; |
||
169 | } |
||
170 | if (key == 178){ //up |
||
171 | if (aim) break; |
||
172 | if (mail_list.current<=0) break; |
||
173 | mail_list.current-- ; |
||
174 | if (mail_list.current < mail_list.first) mail_list.first-- ; |
||
175 | DrawMailList(); |
||
176 | aim = SEND_RETR; |
||
177 | } |
||
178 | if (key == 180){ //home |
||
179 | if (aim) break; |
||
180 | mail_list.first = mail_list.current = 0; |
||
181 | DrawMailList(); |
||
182 | aim = SEND_RETR; |
||
183 | } |
||
184 | if (key == 181){ //end |
||
185 | if (aim) break; |
||
186 | mail_list.first = mail_list.count - mail_list.visible; |
||
187 | mail_list.current = mail_list.count - 1; |
||
188 | DrawMailList(); |
||
189 | aim = SEND_RETR; |
||
190 | } |
||
191 | |||
192 | break; |
||
193 | case evReDraw: _MB_DRAW: |
||
194 | if !(DefineWindow(MAILBOX_HEADER)) break; |
||
195 | scroll1.bckg_col = scroll2.bckg_col = 0xBBBbbb; |
||
196 | scroll1.frnt_col = scroll2.frnt_col = sc.work; |
||
197 | scroll1.line_col = scroll2.line_col = sc.work_graph; |
||
198 | DrawToolbar(); |
||
199 | DrawMailBox(); |
||
200 | |||
201 | break; |
||
202 | default: |
||
203 | if (aim == SEND_NSTAT) |
||
204 | { |
||
205 | debug("Counting mail, awaiting answer..."); |
||
206 | request_len = GetRequest("STAT", NULL); |
||
207 | WriteSocket(socket,request_len,#request); |
||
208 | if (EAX == 0xffffffff) { debug("Error sending STAT. Retry..."w); break;} |
||
209 | aim = GET_ANSWER_NSTAT; |
||
210 | } |
||
211 | |||
212 | if (aim == GET_ANSWER_NSTAT) |
||
213 | { |
||
214 | if (!PollSocket(socket)) break; |
||
215 | socket_char=ReadSocket(socket); |
||
216 | immputc(socket_char); |
||
217 | |||
218 | if (socket_char=='\n') |
||
219 | { |
||
220 | debug("GOT::"); |
||
221 | debug(#immbuffer); |
||
222 | if (strstr(#immbuffer,"+OK")) |
||
223 | { |
||
224 | mail_list.count = GetMailCount(); |
||
225 | debug("Letters:"); |
||
226 | debug(itoa(mail_list.count)); |
||
227 | listbuffer = free(listbuffer); |
||
228 | listbuffer = mem_Alloc(30*mail_list.count); //24* original |
||
229 | listpointer = listbuffer; |
||
230 | aim = SEND_NLIST; |
||
231 | debug("Recieving mail list..."); |
||
232 | immfree(); |
||
233 | } |
||
234 | else |
||
235 | { |
||
236 | notify("Sorry, can't recieve your mail"); |
||
237 | immfree(); |
||
238 | aim=NULL; //aim = SEND_NLIST; |
||
239 | } |
||
240 | } |
||
241 | } |
||
242 | |||
243 | if (aim == SEND_NLIST) |
||
244 | { |
||
245 | WriteText(5, Form.cheight-11, 0x80, sc.work_text, "Send LIST, awaiting answer..."); |
||
246 | request_len = GetRequest("LIST", NULL); |
||
247 | WriteSocket(socket,request_len,#request); |
||
248 | if (EAX == 0xffffffff) {debug("Error while sending LIST. Retry..."); break;} |
||
249 | aim = GET_ANSWER_NLIST; |
||
250 | } |
||
251 | |||
252 | if (aim == GET_ANSWER_NLIST) |
||
253 | { |
||
254 | ticks = PollSocket(socket); |
||
255 | if (!ticks) break; |
||
256 | for (;ticks>0;ticks--) |
||
257 | { |
||
258 | socket_char=ReadSocket(socket); |
||
259 | listputc(socket_char); |
||
260 | |||
261 | if (socket_char=='.') //this way of checking end of message IS BAD |
||
262 | { |
||
263 | aim = SEND_RETR; |
||
264 | debug("Got mail list"); |
||
265 | DrawMailBox(); |
||
266 | |||
3412 | leency | 267 | atr.CreateMailsArray(); |
268 | atr.SetMailsSizes(); |
||
3368 | leency | 269 | } |
270 | } |
||
271 | } |
||
272 | if (aim == SEND_RETR) |
||
273 | { |
||
274 | from = to = date = subj = cur_charset = NULL; |
||
275 | letter_view.ClearList(); |
||
276 | DrawMailBox(); |
||
277 | debug("Send RETR, awaiting answer..."); |
||
278 | request_len = GetRequest("RETR", itoa(mail_list.current+1)); |
||
279 | WriteSocket(socket,request_len,#request); |
||
280 | if (EAX == 0xffffffff) { notify("Error while trying to get letter from server"); aim=NULL; break;} |
||
281 | |||
282 | mailbuffer = free(mailbuffer); |
||
3412 | leency | 283 | letter_size = atr.GetLetterSize(mail_list.current+1) + 1024; |
3368 | leency | 284 | mailbuffer = malloc(letter_size); |
285 | mailpointer = mailbuffer; |
||
286 | aim = GET_ANSWER_RETR; |
||
287 | } |
||
288 | if (aim == GET_ANSWER_RETR) |
||
289 | { |
||
290 | ticks=PollSocket(socket); |
||
291 | if (!ticks) break; |
||
292 | |||
293 | for (;ticks>0;ticks--) |
||
294 | { |
||
295 | socket_char=ReadSocket(socket); |
||
296 | //debugch(socket_char); |
||
297 | *mailpointer=socket_char; |
||
298 | mailpointer++; |
||
299 | *mailpointer='\0'; |
||
300 | if (!aim) continue; |
||
301 | |||
302 | if (letter_size + mailbuffer - mailpointer - 2 < 0) |
||
303 | { |
||
304 | debug("Buffer overflow!!1 Realloc..."w); |
||
305 | letter_size += 4096; |
||
306 | mailbuffer = realloc(mailbuffer, letter_size); |
||
307 | if (!mailbuffer) {debug("Relloc error!"); aim=NULL; break;} |
||
308 | } |
||
309 | |||
310 | if (letter_size>5000) |
||
311 | { |
||
312 | id = mailpointer - mailbuffer * 100 ; |
||
313 | id /= letter_size - 1024; |
||
314 | if (id!=cur_st_percent) SetMailBoxStatus( id , NULL); |
||
315 | } |
||
316 | |||
317 | ParceMail(); |
||
318 | } |
||
319 | } |
||
320 | |||
321 | } |
||
322 | } |
||
323 | } |
||
324 | |||
325 | |||
326 | void DrawMailBox() |
||
327 | { |
||
328 | DrawMailList(); |
||
329 | DrawLetterInfo(); |
||
330 | DrawLetter(); |
||
331 | DrawStatusBar(); |
||
332 | } |
||
333 | |||
334 | |||
335 | void DrawToolbar() |
||
336 | { |
||
337 | #define BUT_Y 7 |
||
338 | #define BUT_H 22 |
||
339 | #define BUT_W 74 |
||
340 | #define BUT_SPACE 11 |
||
341 | int toolbar_w = BUT_Y + BUT_H + BUT_Y + 3; |
||
342 | mail_list.SetSizes(0, toolbar_w, Form.cwidth - scroll1.size_x - 1, mail_list.h, 60,18); |
||
343 | |||
344 | DrawBar(0,0, Form.cwidth,toolbar_w-3, sc.work); |
||
3412 | leency | 345 | DrawCaptButton(10 , BUT_Y, BUT_W, BUT_H, GET_MAIL, sc.work_button, sc.work_button_text,"Get mail"); |
346 | DrawCaptButton(BUT_W+BUT_SPACE + 10, BUT_Y, BUT_W, BUT_H, SEND_MAIL, sc.work_button, sc.work_button_text,"Send Email"); |
||
347 | DrawCaptButton(BUT_W+BUT_SPACE*2 + 10, BUT_Y, BUT_W, BUT_H, DELETE_LETTER, sc.work_button, sc.work_button_text,"Delete"); |
||
348 | DrawCaptButton(BUT_W+BUT_SPACE*3 + 10, BUT_Y, BUT_W, BUT_H, SAVE_LETTER, sc.work_button, sc.work_button_text,"Save"); |
||
349 | DrawCaptButton(Form.cwidth-BUT_W - 10, BUT_Y, BUT_W, BUT_H, EXIT_MAIL, sc.work_button, sc.work_button_text,"< Exit"); |
||
3368 | leency | 350 | |
351 | DrawBar(0, mail_list.y-3, mail_list.w,1, sc.work_graph); |
||
352 | DrawBar(0, mail_list.y-2, mail_list.w,1, 0xdfdfdf); |
||
353 | DrawBar(0, mail_list.y-1, mail_list.w,1, 0xf0f0f0); |
||
354 | } |
||
355 | |||
356 | |||
357 | void DrawMailList() |
||
358 | { |
||
359 | int i, on_y; |
||
360 | mail_list.visible = mail_list.h / mail_list.line_h; |
||
361 | |||
362 | for (i=30; i<150; i++) DeleteButton(i); |
||
363 | for (i=0; (i |
||
364 | { |
||
365 | on_y = i*mail_list.line_h + mail_list.y; |
||
366 | if (mail_list.current==mail_list.first+i) |
||
367 | { |
||
368 | DrawBar(0, on_y, mail_list.w, mail_list.line_h-1, 0xEEEeee); |
||
369 | WriteText(strlen(itoa(i+mail_list.first+1))*6 + 42, on_y+5, 0x80, 0, #subj); |
||
370 | PutMailDirectionImage(strlen(itoa(i+mail_list.first+1))*6 + 18, mail_list.line_h-12/2+ on_y, #to, #from); |
||
371 | } |
||
372 | else |
||
373 | { |
||
374 | DrawBar(0, on_y, mail_list.w, mail_list.line_h-1, 0xFFFfff); |
||
375 | PutMailDirectionImage(strlen(itoa(i+mail_list.first+1))*6 + 18, mail_list.line_h-12/2+ on_y, NULL, NULL); |
||
376 | } |
||
377 | DefineButton(0, on_y, mail_list.w-1, mail_list.line_h, 30+i+BT_HIDE+BT_NOFRAME); |
||
378 | DrawBar(0, on_y + mail_list.line_h-1, mail_list.w, 1, 0xCCCccc); |
||
379 | WriteText(10, on_y+5, 0x80, 0, itoa(i+mail_list.first+1)); |
||
3412 | leency | 380 | WriteText(mail_list.w - 40, on_y+5, 0x80, 0, ConvertMemSize(atr.GetLetterSize(i+mail_list.first+1))); |
3368 | leency | 381 | } |
382 | DrawBar(0, i*mail_list.line_h + mail_list.y, mail_list.w, -i*mail_list.line_h+mail_list.h, 0xFFFfff); |
||
383 | DrawScroller1(); |
||
384 | } |
||
385 | |||
386 | |||
387 | void PutMailDirectionImage(int x,y, to_str, from_str) |
||
388 | { |
||
389 | char mail_direction=0; |
||
390 | if (strstri(to_str, #email_text)) mail_direction = 1; |
||
391 | if (strstri(from_str, #email_text)) mail_direction = 2; |
||
392 | _PutImage(x, y, 18,12, sizeof(in_out_mail)/3*mail_direction + #in_out_mail); |
||
393 | } |
||
394 | |||
395 | |||
396 | void DrawLetterInfo() |
||
397 | { |
||
398 | int lt_y = mail_list.y+mail_list.h; |
||
399 | |||
400 | DrawBar(0, lt_y, mail_list.w, 1, sc.work_graph); |
||
401 | DrawBar(0, lt_y+1, Form.cwidth, 1, LBUMP); |
||
402 | DrawBar(0, lt_y+2, Form.cwidth, LIST_INFO_H-4, sc.work); |
||
403 | WriteText(mail_list.w-30/2, lt_y, 0x80, 0x888888, "= = ="); |
||
404 | WriteText(mail_list.w-30/2, lt_y+1, 0x80, 0xEeeeee, "= = ="); |
||
405 | DrawBar(0, lt_y+LIST_INFO_H-2, mail_list.w, 1, sc.work_graph); //bottom |
||
406 | DrawBar(0, lt_y+LIST_INFO_H-1, mail_list.w, 1, 0xdfdfdf); |
||
407 | DrawBar(0, lt_y+LIST_INFO_H , mail_list.w, 1, 0xf0f0f0); |
||
408 | |||
409 | WriteTextB(10, lt_y+8 , 0x80, sc.work_text, "From:"); |
||
410 | WriteText(45, lt_y+8 , 0x80, sc.work_text, #from); |
||
411 | |||
412 | WriteTextB(10, lt_y+20 , 0x80, sc.work_text, "To:"); |
||
413 | WriteText(45, lt_y+20 , 0x80, sc.work_text, #to); |
||
414 | |||
415 | WriteTextB(10, lt_y+32, 0x80, sc.work_text, "Date:"); |
||
416 | WriteText(45, lt_y+32, 0x80, sc.work_text, #date); |
||
417 | |||
418 | WriteTextB(10, lt_y+44, 0x80, sc.work_text, "Subject:"); |
||
419 | WriteText(66, lt_y+44, 0x80, sc.work_text, #subj); |
||
420 | } |
||
421 | |||
422 | void DrawLetter() |
||
423 | { |
||
424 | int i=0; |
||
425 | dword cur_line, next_line, line_text; |
||
426 | cur_line = mdata; |
||
427 | |||
428 | letter_view.SetSizes(0, mail_list.y+mail_list.h+LIST_INFO_H+1, Form.cwidth - scroll2.size_x - 1, |
||
429 | Form.cheight - mail_list.y - mail_list.h - LIST_INFO_H - 1 - status_bar_h, 60, 12); |
||
430 | |||
431 | if (mailbuffer) && (!aim) |
||
432 | { |
||
433 | for ( ; i < letter_view.first; i++) cur_line = GetNextLine(cur_line); |
||
434 | |||
435 | for (i=0; i < letter_view.h / letter_view.line_h; i++) |
||
436 | { |
||
437 | next_line = GetNextLine(cur_line); |
||
438 | line_text = CopyBetweenOffsets(cur_line, next_line); |
||
439 | cur_line = next_line; |
||
440 | if (cur_line >= mailpointer) || (cur_line==1) break; |
||
441 | DrawBar(letter_view.x, i*letter_view.line_h + letter_view.y, letter_view.w, letter_view.line_h, 0xFFFfff); |
||
442 | if (line_text) { WriteText(letter_view.x+5, i*letter_view.line_h+letter_view.y+3, 0x80, 0, line_text); free(line_text);} |
||
443 | } |
||
444 | } |
||
445 | DrawBar(letter_view.x, i*letter_view.line_h + letter_view.y, letter_view.w, -i*letter_view.line_h + letter_view.h-1, 0xFFFfff); |
||
446 | DrawBar(letter_view.x, letter_view.y + letter_view.h-1, letter_view.w, 1, sc.work_graph); |
||
447 | DrawScroller2(); |
||
448 | } |
||
449 | |||
450 | void DrawScroller1() |
||
451 | { |
||
452 | scroll1.max_area = mail_list.count; |
||
453 | scroll1.cur_area = mail_list.visible; |
||
454 | scroll1.position = mail_list.first; |
||
455 | |||
456 | scroll1.all_redraw=1; |
||
457 | scroll1.start_x = mail_list.x + mail_list.w; |
||
458 | scroll1.start_y = mail_list.y - 3; |
||
459 | scroll1.size_y = mail_list.h + 4; |
||
460 | scrollbar_v_draw(#scroll1); |
||
461 | } |
||
462 | |||
463 | void DrawScroller2() |
||
464 | { |
||
465 | scroll2.max_area = letter_view.count; |
||
466 | scroll2.cur_area = letter_view.visible; |
||
467 | scroll2.position = letter_view.first; |
||
468 | |||
469 | scroll2.all_redraw=1; |
||
470 | scroll2.start_x = letter_view.x + letter_view.w; |
||
471 | scroll2.start_y = letter_view.y - 3; |
||
472 | scroll2.size_y = letter_view.h + 3; |
||
473 | scrollbar_v_draw(#scroll2); |
||
474 | } |
||
475 | |||
476 | |||
477 | |||
478 | void DrawStatusBar() |
||
479 | { |
||
480 | int st_y = Form.cheight -status_bar_h; |
||
481 | DrawBar(0, st_y, Form.cwidth, status_bar_h, sc.work); |
||
482 | if (aim) { |
||
483 | SetMailBoxStatus(cur_st_percent, cur_st_text); |
||
484 | DrawCaptButton(240, st_y+1, 36, status_bar_h-3, STOP_LOADING, sc.work_button, sc.work_button_text,"Stop"); |
||
485 | } |
||
486 | DrawCaptButton(Form.cwidth - 100, st_y+1, 70, status_bar_h-2, CHANGE_CHARSET+BT_HIDE, sc.work, sc.work_text,charsets[cur_charset]); |
||
487 | } |
||
488 | |||
489 | |||
490 | |||
491 | void SetMailBoxStatus(dword percent1, text1) |
||
492 | { |
||
493 | DrawProgressBar(3, Form.cheight -status_bar_h + 1, 220, 12, sc.work, 0xC3C3C3, 0x54B1D6, sc.work_text, percent1, text1); |
||
494 | cur_st_percent = percent1; |
||
495 | cur_st_text = text1; |
||
496 | } |
||
497 | |||
498 | |||
499 | void StopLoading() |
||
500 | { |
||
501 | aim = NULL; |
||
502 | mailbuffer = free(mailbuffer); |
||
503 | to = from = date = subj = cur_charset = NULL; |
||
504 | while (PollSocket(socket)) ReadSocket(socket); |
||
505 | } |
||
506 | |||
507 | int GetMailCount(){ |
||
508 | char tmpbuf4[512]; |
||
509 | strcpyb(#immbuffer, #tmpbuf4, "+OK ", " "); |
||
510 | return atoi(#tmpbuf4); |
||
511 | } |
||
512 | |||
513 | |||
514 | |||
515 | |||
516 | |||
517 | |||
518 | |||
519 | |||
520 | void listputc(char agot_char){ |
||
521 | *listpointer=agot_char; |
||
522 | listpointer++; |
||
523 | *listpointer='\0'; |
||
524 | } |
||
525 | |||
526 | int GetLetterSize_(int number){ |
||
527 | char serch_num[24]; |
||
528 | char letter_size1[24]; |
||
529 | |||
530 | strcpy(#serch_num, "\n"); |
||
531 | strcat(#serch_num, itoa(number)); |
||
532 | strcat(#serch_num, " "); |
||
533 | strcpyb(listbuffer, #letter_size1, #serch_num, "\n"); |
||
534 | return atoi(#letter_size1); |
||
535 | } |
||
536 | |||
537 | |||
538 | |||
3412 | leency | 539 | |
540 | void letter_attr::CreateMailsArray() |
||
3368 | leency | 541 | { |
542 | mails_db = free(mails_db); |
||
3412 | leency | 543 | mails_db = malloc( mail_list.count * sizeof(atr) ); |
3368 | leency | 544 | } |
545 | |||
3412 | leency | 546 | void letter_attr::SetMailsSizes() |
3368 | leency | 547 | { |
3412 | leency | 548 | int i, off; |
3368 | leency | 549 | for (i=0; i < mail_list.count; i++) |
550 | { |
||
3412 | leency | 551 | ESDWORD[sizeof(atr)*i+#mails_db+#atr.size-#atr] = GetLetterSize_(i); |
3368 | leency | 552 | } |
553 | } |
||
554 | |||
3412 | leency | 555 | int letter_attr::GetLetterSize(int N) |
3368 | leency | 556 | { |
3412 | leency | 557 | return ESDWORD[sizeof(atr)*N+#mails_db+#atr.size-#atr]; |
3368 | leency | 558 | }>>>150;>>>>=0)>5;>>> |