2013-03-12 17:19:10 +01:00
|
|
|
//Leency & SoUrcerer, LGPL
|
2013-11-06 19:50:58 +01:00
|
|
|
//Hidnplayer
|
2013-03-12 17:19:10 +01:00
|
|
|
|
|
|
|
#define LIST_INFO_H 59
|
|
|
|
int status_bar_h = 15;
|
|
|
|
|
|
|
|
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};
|
|
|
|
|
|
|
|
char *listbuffer;
|
|
|
|
char *listpointer;
|
|
|
|
|
2013-11-05 00:27:39 +01:00
|
|
|
char *mailstart;
|
|
|
|
char *mailend;
|
|
|
|
int mailsize;
|
2013-03-12 17:19:10 +01:00
|
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
GET_MAIL = 20,
|
|
|
|
SEND_MAIL,
|
|
|
|
DELETE_LETTER,
|
|
|
|
SAVE_LETTER,
|
|
|
|
STOP_LOADING,
|
|
|
|
EXIT_MAIL,
|
|
|
|
CHANGE_CHARSET,
|
|
|
|
CLOSE_CHANGE_CHARSET
|
|
|
|
};
|
|
|
|
|
2014-01-22 01:28:22 +01:00
|
|
|
void MailBoxNetworkProcess() {
|
2013-11-05 20:38:16 +01:00
|
|
|
int load_persent;
|
|
|
|
if (aim) switch(aim)
|
|
|
|
{
|
|
|
|
case SEND_NSTAT:
|
2013-11-06 19:50:58 +01:00
|
|
|
SetMailBoxStatus(NULL, "Counting mail, awaiting answer...");
|
2013-11-05 20:38:16 +01:00
|
|
|
request_len = GetRequest("STAT", NULL);
|
|
|
|
Send(socketnum, #request, request_len, 0);
|
2014-03-14 20:06:48 +01:00
|
|
|
if (EAX == 0xffffffff) { debugln("Error sending STAT. Retry..."w); break;}
|
2013-11-05 20:38:16 +01:00
|
|
|
aim = GET_ANSWER_NSTAT;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GET_ANSWER_NSTAT:
|
|
|
|
ticks = Receive(socketnum, #immbuffer, BUFFERSIZE, 0);
|
|
|
|
if ((ticks == 0xffffff) || (ticks < 2)) break;
|
|
|
|
|
|
|
|
if (immbuffer[ticks-2]=='\n')
|
|
|
|
{
|
2014-03-14 20:06:48 +01:00
|
|
|
debugln(#immbuffer);
|
2013-11-05 20:38:16 +01:00
|
|
|
if (strstr(#immbuffer,"+OK"))
|
|
|
|
{
|
|
|
|
strcpyb(#immbuffer, #param, "+OK ", " ");
|
|
|
|
mail_list.count = atoi(#param);
|
|
|
|
free(listbuffer);
|
|
|
|
listbuffer = mem_Alloc(30*mail_list.count); //24* original
|
|
|
|
listpointer = listbuffer;
|
|
|
|
aim = SEND_NLIST;
|
2014-03-14 20:06:48 +01:00
|
|
|
debugln("Receiving mail list...");
|
2013-11-05 20:38:16 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
StopConnect("Sorry, can't recieve your mail");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SEND_NLIST:
|
2015-08-04 16:36:07 +02:00
|
|
|
WriteText(5, Form.cheight-11, 0x80, system.color.work_text, "Send LIST, awaiting answer...");
|
2013-11-05 20:38:16 +01:00
|
|
|
request_len = GetRequest("LIST", NULL);
|
|
|
|
Send(socketnum, #request, request_len, 0);
|
2014-03-14 20:06:48 +01:00
|
|
|
if (EAX == 0xffffffff) {debugln("Error while sending LIST. Retry..."); break;}
|
2013-11-05 20:38:16 +01:00
|
|
|
else aim = GET_ANSWER_NLIST;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GET_ANSWER_NLIST:
|
|
|
|
ticks = Receive(socketnum, listpointer, listbuffer + 30*mail_list.count - listpointer, MSG_DONTWAIT);
|
|
|
|
if (ticks == 0xffffffff) break;
|
|
|
|
listpointer = listpointer + ticks;
|
|
|
|
|
|
|
|
if (listpointer - listbuffer < 5) break;
|
|
|
|
if (strncmp(listpointer-5,"\n.\n",5)==0) // note that c-- assembles "\n.\n" to 0x0d, 0x0a, 0x2e, 0x0d, 0x0a
|
|
|
|
{
|
|
|
|
aim = SEND_RETR;
|
2014-03-14 20:06:48 +01:00
|
|
|
debugln("goto SEND_RETR");
|
2013-11-05 20:38:16 +01:00
|
|
|
DrawMailBox();
|
|
|
|
|
|
|
|
*listpointer='\0';
|
|
|
|
atr.CreateArray();
|
|
|
|
atr.SetSizes();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case SEND_RETR:
|
|
|
|
from = to = date = subj = cur_charset = NULL;
|
2014-01-22 01:28:22 +01:00
|
|
|
WB1.list.ClearList();
|
2013-11-05 20:38:16 +01:00
|
|
|
DrawMailBox();
|
2015-09-09 16:24:42 +02:00
|
|
|
request_len = GetRequest("RETR", itoa(mail_list.cur_y+1));
|
2013-11-05 20:38:16 +01:00
|
|
|
if (Send(socketnum, #request, request_len, 0) == 0xffffffff)
|
|
|
|
{
|
|
|
|
StopConnect("Error while trying to get letter from server");
|
|
|
|
break;
|
|
|
|
}
|
2015-09-09 16:24:42 +02:00
|
|
|
mailsize = atr.GetSize(mail_list.cur_y+1) + 1024;
|
2013-11-05 20:38:16 +01:00
|
|
|
free(mailstart);
|
2013-11-06 19:50:58 +01:00
|
|
|
mailstart = malloc(mailsize);
|
2014-04-22 00:30:28 +02:00
|
|
|
mailend = mailstart;
|
2013-11-06 19:50:58 +01:00
|
|
|
if (!mailstart)
|
2013-11-05 20:38:16 +01:00
|
|
|
{
|
2014-03-14 20:06:48 +01:00
|
|
|
debugln("alloc error!");
|
2013-11-05 20:38:16 +01:00
|
|
|
aim=NULL;
|
|
|
|
break;
|
|
|
|
}
|
2020-03-22 20:50:16 +01:00
|
|
|
debugval("mailsize", mailsize);
|
2013-11-05 20:38:16 +01:00
|
|
|
aim = GET_ANSWER_RETR;
|
2014-03-14 20:06:48 +01:00
|
|
|
debugln("goto GET_ANSWER_RETR");
|
2013-11-06 19:50:58 +01:00
|
|
|
break;
|
2013-11-05 20:38:16 +01:00
|
|
|
|
|
|
|
case GET_ANSWER_RETR:
|
2020-03-22 20:50:16 +01:00
|
|
|
debugval("mailsize", mailsize);
|
|
|
|
debugval("mailstart", mailstart);
|
|
|
|
debugval("mailend", mailend);
|
2013-11-05 20:38:16 +01:00
|
|
|
ticks = Receive(socketnum, mailend, mailsize + mailstart - mailend, MSG_DONTWAIT);
|
|
|
|
if (ticks == 0xffffffff) break;
|
2014-04-22 00:30:28 +02:00
|
|
|
mailend = mailend + ticks;
|
2013-11-05 20:38:16 +01:00
|
|
|
if (mailsize + mailstart - mailend - 2 < 0)
|
|
|
|
{
|
2014-03-14 20:06:48 +01:00
|
|
|
debugln("Resizing buffer");
|
2013-11-05 20:38:16 +01:00
|
|
|
mailsize += 4096;
|
|
|
|
mailstart = realloc(mailstart, mailsize);
|
|
|
|
if (!mailstart) { StopConnect("Realloc error!"); break;}
|
|
|
|
}
|
2014-04-22 00:30:28 +02:00
|
|
|
/*
|
2013-11-05 21:31:48 +01:00
|
|
|
if (mailsize>9000)
|
2013-11-05 20:38:16 +01:00
|
|
|
{
|
|
|
|
load_persent = mailend - mailstart * 100 ;
|
|
|
|
load_persent /= mailsize - 1024;
|
|
|
|
if (load_persent != cur_st_percent) SetMailBoxStatus( load_persent , NULL);
|
|
|
|
}
|
2014-04-22 00:30:28 +02:00
|
|
|
*/
|
|
|
|
//ParseMail();
|
2013-11-05 20:38:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-12 17:19:10 +01:00
|
|
|
|
2014-01-22 01:28:22 +01:00
|
|
|
void MailBoxLoop() {
|
2015-08-11 13:29:31 +02:00
|
|
|
int id;
|
2013-11-06 19:50:58 +01:00
|
|
|
int panels_drag=0, clicked_list=0;
|
2013-03-12 17:19:10 +01:00
|
|
|
dword line_col, text_col;
|
|
|
|
|
|
|
|
mail_list.h = Form.cheight/4;
|
|
|
|
mail_list.ClearList();
|
2015-08-29 22:14:17 +02:00
|
|
|
WB1.list.no_selection = true;
|
2013-03-12 17:19:10 +01:00
|
|
|
SetMailBoxStatus( NULL , NULL);
|
|
|
|
cur_charset = 0;
|
2013-11-05 00:27:39 +01:00
|
|
|
aim = SEND_NSTAT;
|
2013-03-12 17:19:10 +01:00
|
|
|
|
|
|
|
goto _MB_DRAW;
|
|
|
|
|
|
|
|
loop()
|
|
|
|
{
|
|
|
|
WaitEventTimeout(2);
|
|
|
|
switch(EAX & 0xFF)
|
|
|
|
{
|
|
|
|
case evMouse:
|
2015-08-02 00:08:58 +02:00
|
|
|
mouse.get();
|
2013-03-12 17:19:10 +01:00
|
|
|
|
2015-08-02 00:08:58 +02:00
|
|
|
if (!mouse.lkm) panels_drag=0;
|
|
|
|
if (mouse.lkm) && (mouse.y>mail_list.y+mail_list.h-1) && (mouse.y<mail_list.y+mail_list.h+6)
|
2014-01-22 01:28:22 +01:00
|
|
|
&& (!scroll1.delta2) && (!scroll_wv.delta2) panels_drag = 1;
|
2013-03-12 17:19:10 +01:00
|
|
|
if (panels_drag)
|
|
|
|
{
|
2015-08-10 14:06:47 +02:00
|
|
|
if (mouse.y<mail_list.y+60) || (mouse.y>Form.cheight-60-status_bar_h-LIST_INFO_H) break;
|
2015-08-02 00:08:58 +02:00
|
|
|
mail_list.h = mouse.y - mail_list.y-2;
|
2013-03-12 17:19:10 +01:00
|
|
|
DrawMailBox();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2016-12-13 23:10:32 +01:00
|
|
|
PageLinks.HoverAndProceed(mouse.x, mouse.y);
|
2014-01-22 01:28:22 +01:00
|
|
|
|
2013-03-12 17:19:10 +01:00
|
|
|
if (!mail_list.count) break;
|
2014-01-22 01:28:22 +01:00
|
|
|
if (!panels_drag) { scrollbar_v_mouse (#scroll1); scrollbar_v_mouse (#scroll_wv); }
|
2013-03-12 17:19:10 +01:00
|
|
|
|
|
|
|
if (mail_list.first <> scroll1.position)
|
|
|
|
{
|
|
|
|
mail_list.first = scroll1.position;
|
|
|
|
DrawMailList();
|
|
|
|
break;
|
|
|
|
};
|
2014-01-22 01:28:22 +01:00
|
|
|
if (WB1.list.first <> scroll_wv.position)
|
2013-03-12 17:19:10 +01:00
|
|
|
{
|
2014-01-22 01:28:22 +01:00
|
|
|
WB1.list.first = scroll_wv.position;
|
2013-03-12 17:19:10 +01:00
|
|
|
DrawLetter();
|
|
|
|
break;
|
|
|
|
};
|
|
|
|
|
2015-08-02 00:08:58 +02:00
|
|
|
if (mail_list.y+mail_list.h + 10 > mouse.y)
|
2013-03-12 17:19:10 +01:00
|
|
|
{
|
2015-08-02 00:08:58 +02:00
|
|
|
if (mail_list.MouseScroll(mouse.vert)) DrawMailList();
|
2013-03-12 17:19:10 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-08-02 00:08:58 +02:00
|
|
|
if (WB1.list.MouseScroll(mouse.vert)) DrawLetter();
|
2013-03-12 17:19:10 +01:00
|
|
|
}
|
2015-08-02 00:08:58 +02:00
|
|
|
if (mouse.lkm) && (mail_list.MouseOver(mouse.x, mouse.y)) && (!clicked_list) clicked_list=1;
|
|
|
|
if (!mouse.lkm) && (clicked_list) if (mail_list.ProcessMouse(mouse.x, mouse.y))
|
2013-11-06 19:50:58 +01:00
|
|
|
{
|
|
|
|
clicked_list = 0;
|
|
|
|
if (aim) break;
|
|
|
|
DrawMailList();
|
|
|
|
aim = SEND_RETR;
|
|
|
|
}
|
2013-03-12 17:19:10 +01:00
|
|
|
|
|
|
|
break;
|
|
|
|
case evButton:
|
|
|
|
id = GetButtonID();
|
|
|
|
if (id==1) SaveAndExit();
|
|
|
|
if (id==GET_MAIL) aim = SEND_NSTAT;
|
|
|
|
if (id==SAVE_LETTER)
|
|
|
|
{
|
2013-11-05 00:27:39 +01:00
|
|
|
if (!mailstart) break;
|
2018-04-16 00:44:36 +02:00
|
|
|
CreateFile(strlen(mailstart), mailstart, "mail.txt");
|
2013-03-12 17:19:10 +01:00
|
|
|
pause(10);
|
2019-03-18 23:31:13 +01:00
|
|
|
RunProgram("/sys/tinypad", "mail.txt");
|
2013-03-12 17:19:10 +01:00
|
|
|
}
|
|
|
|
if (id==STOP_LOADING)
|
|
|
|
{
|
|
|
|
StopLoading();
|
|
|
|
DrawStatusBar();
|
|
|
|
DrawMailList();
|
|
|
|
}
|
|
|
|
if (id==EXIT_MAIL)
|
|
|
|
{
|
|
|
|
StopLoading();
|
2013-10-31 19:40:41 +01:00
|
|
|
Close(socketnum);
|
2013-03-12 17:19:10 +01:00
|
|
|
LoginBoxLoop();
|
|
|
|
}
|
|
|
|
if (id==CHANGE_CHARSET)
|
|
|
|
{
|
|
|
|
DefineButton(0,0,Form.cwidth,Form.cheight, CLOSE_CHANGE_CHARSET+BT_HIDE+BT_NOFRAME);
|
2015-08-04 16:36:07 +02:00
|
|
|
DrawRectangle(Form.cwidth-100, Form.cheight-status_bar_h- 70, 70, 82, system.color.work_graph);
|
|
|
|
DrawRectangle3D(Form.cwidth-99, Form.cheight-status_bar_h- 69, 68, 80, 0xFFFfff, system.color.work);
|
2013-03-12 17:19:10 +01:00
|
|
|
for (id=0; id<5; id++)
|
|
|
|
{
|
2015-08-04 16:36:07 +02:00
|
|
|
if (cur_charset==id+1) { line_col=system.color.work_button; text_col=system.color.work_button_text; }
|
|
|
|
else { line_col=system.color.work; text_col=system.color.work_text; }
|
2013-03-12 17:19:10 +01:00
|
|
|
DrawBar(Form.cwidth-98, id*16+Form.cheight-status_bar_h- 68, 67, 16, line_col);
|
|
|
|
DrawCaptButton(Form.cwidth-100, id*16+Form.cheight-status_bar_h- 68, 70,16, 10+id+BT_HIDE,
|
|
|
|
0, text_col, charsets[id+1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (id==CLOSE_CHANGE_CHARSET) goto _MB_DRAW;
|
|
|
|
|
|
|
|
break;
|
|
|
|
case evKey:
|
2015-08-11 13:29:31 +02:00
|
|
|
GetKeys();
|
2013-03-12 17:19:10 +01:00
|
|
|
|
2015-08-11 13:29:31 +02:00
|
|
|
if (!aim) && (mail_list.ProcessKey(key_scancode))
|
2013-11-03 12:21:09 +01:00
|
|
|
{
|
2013-03-12 17:19:10 +01:00
|
|
|
DrawMailList();
|
|
|
|
aim = SEND_RETR;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
case evReDraw: _MB_DRAW:
|
|
|
|
if !(DefineWindow(MAILBOX_HEADER)) break;
|
2014-01-22 01:28:22 +01:00
|
|
|
scroll1.bckg_col = scroll_wv.bckg_col = 0xBBBbbb;
|
2015-08-04 16:36:07 +02:00
|
|
|
scroll1.frnt_col = scroll_wv.frnt_col = system.color.work;
|
|
|
|
scroll1.line_col = scroll_wv.line_col = system.color.work_graph;
|
2013-03-12 17:19:10 +01:00
|
|
|
DrawToolbar();
|
|
|
|
DrawMailBox();
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
2013-11-05 20:38:16 +01:00
|
|
|
MailBoxNetworkProcess();
|
2013-03-12 17:19:10 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DrawMailBox()
|
|
|
|
{
|
|
|
|
DrawMailList();
|
|
|
|
DrawLetterInfo();
|
2014-01-22 01:28:22 +01:00
|
|
|
InitTWB();
|
2013-03-12 17:19:10 +01:00
|
|
|
DrawLetter();
|
|
|
|
DrawStatusBar();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-22 01:28:22 +01:00
|
|
|
void DrawToolbar() {
|
2013-03-12 17:19:10 +01:00
|
|
|
#define BUT_Y 7
|
|
|
|
#define BUT_H 22
|
|
|
|
#define BUT_W 74
|
|
|
|
int toolbar_w = BUT_Y + BUT_H + BUT_Y + 3;
|
2015-08-10 14:06:47 +02:00
|
|
|
mail_list.SetSizes(0, toolbar_w, Form.cwidth - scroll1.size_x - 1, mail_list.h, 18);
|
2013-03-12 17:19:10 +01:00
|
|
|
|
2015-08-04 16:36:07 +02:00
|
|
|
DrawBar(0,0, Form.cwidth,toolbar_w-3, system.color.work);
|
|
|
|
DrawCaptButton(10 , BUT_Y, BUT_W, BUT_H, GET_MAIL, system.color.work_button, system.color.work_button_text,"Get mail");
|
|
|
|
DrawCaptButton(BUT_W+ 20, BUT_Y, BUT_W+10, BUT_H, SAVE_LETTER, system.color.work_button, system.color.work_button_text,"Save letter");
|
|
|
|
DrawCaptButton(Form.cwidth-BUT_W - 10, BUT_Y, BUT_W, BUT_H, EXIT_MAIL, system.color.work_button, system.color.work_button_text,"< Exit");
|
2013-03-12 17:19:10 +01:00
|
|
|
|
2015-08-04 16:36:07 +02:00
|
|
|
DrawBar(0, mail_list.y-3, mail_list.w,1, system.color.work_graph);
|
2013-03-12 17:19:10 +01:00
|
|
|
DrawBar(0, mail_list.y-2, mail_list.w,1, 0xdfdfdf);
|
|
|
|
DrawBar(0, mail_list.y-1, mail_list.w,1, 0xf0f0f0);
|
|
|
|
}
|
|
|
|
|
2014-01-22 01:28:22 +01:00
|
|
|
void DrawMailList() {
|
2013-03-26 01:45:57 +01:00
|
|
|
int i, on_y, on_x, direction;
|
2013-11-03 12:21:09 +01:00
|
|
|
dword sel_col;
|
2015-09-09 16:24:42 +02:00
|
|
|
mail_list.visible = mail_list.h / mail_list.item_h;
|
2013-03-12 17:19:10 +01:00
|
|
|
|
|
|
|
for (i=30; i<150; i++) DeleteButton(i);
|
|
|
|
for (i=0; (i<mail_list.visible) && (i+mail_list.first<mail_list.count); i++)
|
|
|
|
{
|
2015-09-09 16:24:42 +02:00
|
|
|
on_y = i*mail_list.item_h + mail_list.y;
|
|
|
|
if (mail_list.cur_y==mail_list.first+i) sel_col=0xEEEeee; else sel_col=0xFFFfff;
|
|
|
|
DrawBar(0, on_y, mail_list.w, mail_list.item_h-1, sel_col);
|
2013-03-26 01:45:57 +01:00
|
|
|
direction = atr.GetDirection(i+mail_list.first+1);
|
|
|
|
on_x = strlen(itoa(i+mail_list.first+1))*6;
|
2013-11-03 12:21:09 +01:00
|
|
|
letter_icons_pal[0]=sel_col;
|
|
|
|
PutPaletteImage(sizeof(letter_icons)/3*direction + #letter_icons, 18,12, on_x+18,
|
2015-09-09 16:24:42 +02:00
|
|
|
mail_list.item_h-12/2+ on_y, 8, #letter_icons_pal);
|
2013-03-26 01:45:57 +01:00
|
|
|
WriteText(on_x + 42, on_y+5, 0x80, 0, atr.GetSubject(i+mail_list.first+1));
|
2015-09-09 16:24:42 +02:00
|
|
|
DrawBar(0, on_y + mail_list.item_h-1, mail_list.w, 1, 0xCCCccc);
|
2013-03-12 17:19:10 +01:00
|
|
|
WriteText(10, on_y+5, 0x80, 0, itoa(i+mail_list.first+1));
|
2014-04-22 00:30:28 +02:00
|
|
|
WriteText(mail_list.w - 40, on_y+5, 0x80, 0, ConvertSize(atr.GetSize(i+mail_list.first+1)));
|
2013-03-12 17:19:10 +01:00
|
|
|
}
|
2015-09-09 16:24:42 +02:00
|
|
|
DrawBar(0, i*mail_list.item_h + mail_list.y, mail_list.w, -i*mail_list.item_h+mail_list.h, 0xFFFfff);
|
2013-03-12 17:19:10 +01:00
|
|
|
DrawScroller1();
|
|
|
|
}
|
|
|
|
|
2014-01-22 01:28:22 +01:00
|
|
|
void DrawLetterInfo() {
|
2013-03-12 17:19:10 +01:00
|
|
|
int lt_y = mail_list.y+mail_list.h;
|
2015-08-04 16:36:07 +02:00
|
|
|
DrawBar(0, lt_y, mail_list.w, 1, system.color.work_graph);
|
2013-03-12 17:19:10 +01:00
|
|
|
DrawBar(0, lt_y+1, Form.cwidth, 1, LBUMP);
|
2015-08-04 16:36:07 +02:00
|
|
|
DrawBar(0, lt_y+2, Form.cwidth, LIST_INFO_H-4, system.color.work);
|
2013-03-12 17:19:10 +01:00
|
|
|
WriteText(mail_list.w-30/2, lt_y, 0x80, 0x888888, "= = =");
|
|
|
|
WriteText(mail_list.w-30/2, lt_y+1, 0x80, 0xEeeeee, "= = =");
|
2015-08-04 16:36:07 +02:00
|
|
|
DrawBar(0, lt_y+LIST_INFO_H-2, Form.cwidth, 1, system.color.work_graph); //bottom
|
2014-04-22 00:30:28 +02:00
|
|
|
DrawBar(0, lt_y+LIST_INFO_H-1, Form.cwidth, 1, 0xdfdfdf);
|
|
|
|
DrawBar(0, lt_y+LIST_INFO_H , Form.cwidth, 1, 0xf0f0f0);
|
2015-08-04 16:36:07 +02:00
|
|
|
WriteTextB(10, lt_y+8 , 0x80, system.color.work_text, "From:");
|
|
|
|
WriteText (45, lt_y+8 , 0x80, system.color.work_text, #from);
|
|
|
|
WriteTextB(10, lt_y+20, 0x80, system.color.work_text, "To:");
|
|
|
|
WriteText (45, lt_y+20, 0x80, system.color.work_text, #to);
|
|
|
|
WriteTextB(10, lt_y+32, 0x80, system.color.work_text, "Date:");
|
|
|
|
WriteText (45, lt_y+32, 0x80, system.color.work_text, #date);
|
|
|
|
WriteTextB(10, lt_y+44, 0x80, system.color.work_text, "Subj:");
|
|
|
|
WriteText (45, lt_y+44, 0x80, system.color.work_text, #subj);
|
2013-03-12 17:19:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-22 01:28:22 +01:00
|
|
|
void InitTWB() {
|
|
|
|
WB1.list.SetSizes(0, mail_list.y+mail_list.h+LIST_INFO_H+1, Form.cwidth - scroll_wv.size_x - 1,
|
2015-08-10 14:06:47 +02:00
|
|
|
Form.cheight - mail_list.y - mail_list.h - LIST_INFO_H - 1 - status_bar_h, 12);
|
2014-01-22 01:28:22 +01:00
|
|
|
WB1.list.column_max = WB1.list.w - 30 / 6;
|
2015-09-09 16:24:42 +02:00
|
|
|
WB1.list.visible = WB1.list.h / WB1.list.item_h;
|
2014-04-22 00:30:28 +02:00
|
|
|
WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h);
|
2014-01-22 01:28:22 +01:00
|
|
|
|
|
|
|
strcpy(#header, #version);
|
|
|
|
WB1.list.first = WB1.list.count = 0;
|
|
|
|
}
|
2013-03-12 17:19:10 +01:00
|
|
|
|
2020-03-25 01:23:58 +01:00
|
|
|
|
2014-01-22 01:28:22 +01:00
|
|
|
void DrawLetter() {
|
2014-01-27 21:16:33 +01:00
|
|
|
bufsize = strlen(mdata);
|
2020-03-25 01:23:58 +01:00
|
|
|
bufpointer = mdata;
|
2020-03-27 11:38:54 +01:00
|
|
|
if (bufsize) && (bufpointer) {
|
|
|
|
WB1.ParseHtml();
|
|
|
|
WB1.DrawPage();
|
|
|
|
}
|
2014-04-22 00:30:28 +02:00
|
|
|
DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, 0xFFFfff);
|
2013-03-12 17:19:10 +01:00
|
|
|
}
|
|
|
|
|
2014-01-22 01:28:22 +01:00
|
|
|
void DrawScroller1() {
|
2013-03-12 17:19:10 +01:00
|
|
|
scroll1.max_area = mail_list.count;
|
|
|
|
scroll1.cur_area = mail_list.visible;
|
|
|
|
scroll1.position = mail_list.first;
|
|
|
|
scroll1.all_redraw=1;
|
|
|
|
scroll1.start_x = mail_list.x + mail_list.w;
|
|
|
|
scroll1.start_y = mail_list.y - 3;
|
|
|
|
scroll1.size_y = mail_list.h + 4;
|
|
|
|
scrollbar_v_draw(#scroll1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-22 01:28:22 +01:00
|
|
|
void DrawStatusBar() {
|
2013-03-12 17:19:10 +01:00
|
|
|
int st_y = Form.cheight -status_bar_h;
|
2015-08-04 16:36:07 +02:00
|
|
|
DrawBar(0, st_y, Form.cwidth, status_bar_h, system.color.work);
|
2013-03-12 17:19:10 +01:00
|
|
|
if (aim) {
|
|
|
|
SetMailBoxStatus(cur_st_percent, cur_st_text);
|
2015-08-04 16:36:07 +02:00
|
|
|
DrawCaptButton(240, st_y+1, 36, status_bar_h-3, STOP_LOADING, system.color.work_button, system.color.work_button_text,"Stop");
|
2013-03-12 17:19:10 +01:00
|
|
|
}
|
2015-08-04 16:36:07 +02:00
|
|
|
DrawCaptButton(Form.cwidth - 100, st_y+1, 70, status_bar_h-2, CHANGE_CHARSET+BT_HIDE, system.color.work, system.color.work_text,charsets[cur_charset]);
|
2013-03-12 17:19:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-01-22 01:28:22 +01:00
|
|
|
void SetMailBoxStatus(dword percent1, text1) {
|
2015-08-04 16:36:07 +02:00
|
|
|
DrawProgressBar(3, Form.cheight -status_bar_h + 1, 220, 12, system.color.work, 0xC3C3C3, 0x54B1D6, system.color.work_text, percent1);
|
|
|
|
WriteText(3, Form.cheight -status_bar_h + 1, 0x80, system.color.work_text, text1);
|
2013-11-05 20:38:16 +01:00
|
|
|
cur_st_percent = percent1;
|
2013-03-12 17:19:10 +01:00
|
|
|
cur_st_text = text1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-01-22 01:28:22 +01:00
|
|
|
void StopLoading() {
|
2013-03-12 17:19:10 +01:00
|
|
|
aim = NULL;
|
2013-11-05 00:27:39 +01:00
|
|
|
mailstart = free(mailstart);
|
2013-03-12 17:19:10 +01:00
|
|
|
to = from = date = subj = cur_charset = NULL;
|
|
|
|
}
|
|
|
|
|
2014-01-22 01:28:22 +01:00
|
|
|
int GetLetterSize_(int number) {
|
2013-11-05 00:27:39 +01:00
|
|
|
char search_num[24];
|
|
|
|
char mailsize1[24];
|
2013-11-05 23:20:44 +01:00
|
|
|
strcpy(#search_num, "\x0a"); // 0x0d, 0x0a
|
2013-11-05 00:27:39 +01:00
|
|
|
itoa_(#search_num+1, number);
|
|
|
|
chrcat(#search_num, ' ');
|
|
|
|
strcpyb(listbuffer, #mailsize1, #search_num, "\x0d");
|
|
|
|
return atoi(#mailsize1);
|
2013-03-12 17:19:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-03-21 15:33:54 +01:00
|
|
|
void EventClickLink() {
|
2015-08-27 01:55:33 +02:00
|
|
|
RunProgram("/sys/network/WebView", PageLinks.GetURL(PageLinks.active));
|
|
|
|
}
|