Subversion Repositories Kolibri OS

Rev

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