Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 4185 → Rev 4186

/programs/cmm/liza/liza.c
45,9 → 45,9
#define WIN_H 440
#define WIN_MIN_W 500
#define WIN_MIN_H 380
#define LOGIN_HEADER "Login - Email client Liza 0.9.2"
#define OPTIONS_HEADER "Options - Email client Liza 0.9.2"
#define MAILBOX_HEADER "Mail Box - Email client Liza 0.9.2"
#define LOGIN_HEADER "Login - Email client Liza 0.9.3"
#define OPTIONS_HEADER "Options - Email client Liza 0.9.3"
#define MAILBOX_HEADER "Mail Box - Email client Liza 0.9.3"
#define BUFFERSIZE 512
proc_info Form;
system_colors sc;
/programs/cmm/liza/mail_box.c
1,4 → 1,5
//Leency & SoUrcerer, LGPL
//Hidnplayer
 
#define LIST_INFO_H 59
int status_bar_h = 15;
33,7 → 34,7
if (aim) switch(aim)
{
case SEND_NSTAT:
SetLoginStatus("Counting mail, awaiting answer...");
SetMailBoxStatus(NULL, "Counting mail, awaiting answer...");
request_len = GetRequest("STAT", NULL);
Send(socketnum, #request, request_len, 0);
if (EAX == 0xffffffff) { debug("Error sending STAT. Retry..."w); break;}
81,7 → 82,7
if (strncmp(listpointer-5,"\n.\n",5)==0) // note that c-- assembles "\n.\n" to 0x0d, 0x0a, 0x2e, 0x0d, 0x0a
{
aim = SEND_RETR;
debug("Got mail list");
debug("goto SEND_RETR");
DrawMailBox();
*listpointer='\0';
94,7 → 95,6
from = to = date = subj = cur_charset = NULL;
letter_view.ClearList();
DrawMailBox();
debug("Send RETR, awaiting answer...");
request_len = GetRequest("RETR", itoa(mail_list.current+1));
if (Send(socketnum, #request, request_len, 0) == 0xffffffff)
{
103,7 → 103,8
}
mailsize = atr.GetSize(mail_list.current+1) + 1024;
free(mailstart);
if (!mailstart = malloc(mailsize))
mailstart = malloc(mailsize);
if (!mailstart)
{
debug("alloc error!");
aim=NULL;
111,15 → 112,13
}
mailend = mailstart;
aim = GET_ANSWER_RETR;
debug("goto GET_ANSWER_RETR");
break;
case GET_ANSWER_RETR:
ticks = Receive(socketnum, mailend, mailsize + mailstart - mailend, MSG_DONTWAIT);
if (ticks == 0xffffffff) break;
mailend = mailend + ticks;
 
if (!aim) break;
 
mailend += ticks;
if (mailsize + mailstart - mailend - 2 < 0)
{
debug("Resizing buffer");
127,7 → 126,6
mailstart = realloc(mailstart, mailsize);
if (!mailstart) { StopConnect("Realloc error!"); break;}
}
 
if (mailsize>9000)
{
load_persent = mailend - mailstart * 100 ;
143,7 → 141,7
{
int key, id;
mouse m;
int panels_drag = 0;
int panels_drag=0, clicked_list=0;
dword line_col, text_col;
 
mail_list.h = Form.cheight/4;
198,8 → 196,14
{
if (letter_view.MouseScroll(m.vert)) DrawLetter();
}
//if (!m.lkm) && (menu.ProcessMouse(mm.x, mm.y)) &&
//if (!m.lkm) && if (menu.ProcessMouse(mm.x, mm.y)) DrawMenuList();
if (m.lkm) && (mail_list.MouseOver(m.x, m.y)) && (!clicked_list) clicked_list=1;
if (!m.lkm) && (clicked_list) if (mail_list.ProcessMouse(m.x, m.y))
{
clicked_list = 0;
if (aim) break;
DrawMailList();
aim = SEND_RETR;
}
 
break;
case evButton:
241,14 → 245,6
}
if (id==CLOSE_CHANGE_CHARSET) goto _MB_DRAW;
 
if (id>=30)
{
if (aim) break;
mail_list.current = mail_list.first + id - 30;
DrawMailList();
aim = SEND_RETR;
}
 
break;
case evKey:
key = GetKey();
321,7 → 317,6
PutPaletteImage(sizeof(letter_icons)/3*direction + #letter_icons, 18,12, on_x+18,
mail_list.line_h-12/2+ on_y, 8, #letter_icons_pal);
WriteText(on_x + 42, on_y+5, 0x80, 0, atr.GetSubject(i+mail_list.first+1));
DefineButton(0, on_y, mail_list.w-1, mail_list.line_h, 30+i+BT_HIDE+BT_NOFRAME);
DrawBar(0, on_y + mail_list.line_h-1, mail_list.w, 1, 0xCCCccc);
WriteText(10, on_y+5, 0x80, 0, itoa(i+mail_list.first+1));
WriteText(mail_list.w - 40, on_y+5, 0x80, 0, ConvertMemSize(atr.GetSize(i+mail_list.first+1)));
347,8 → 342,8
WriteText (45, lt_y+20, 0x80, sc.work_text, #to);
WriteTextB(10, lt_y+32, 0x80, sc.work_text, "Date:");
WriteText (45, lt_y+32, 0x80, sc.work_text, #date);
WriteTextB(10, lt_y+44, 0x80, sc.work_text, "Subject:");
WriteText (66, lt_y+44, 0x80, sc.work_text, #subj);
WriteTextB(10, lt_y+44, 0x80, sc.work_text, "Subj:");
WriteText (45, lt_y+44, 0x80, sc.work_text, #subj);
}
 
void DrawLetter()
364,7 → 359,7
{
for ( ; i < letter_view.first; i++) cur_line = GetNextLine(cur_line);
 
for (i=0; i < letter_view.h / letter_view.line_h; i++)
for (i=0; i < letter_view.visible; i++)
{
next_line = GetNextLine(cur_line);
line_text = CopyBetweenOffsets(cur_line, next_line);
/programs/cmm/liza/parselist.c
5,9 → 5,10
dword line_off, new_buf;
char tline[256];
 
if ( mailend-mailstart > 9) if (strncmp(mailend-5,"\n.\n",5)==0) // note that c-- assembles "\n.\n" to 0x0d, 0x0a, 0x2e, 0x0d, 0x0a
if ( mailend-mailstart > 9) && (strncmp(mailend-5,"\n.\n",5)==0) // note that c-- assembles "\n.\n" to 0x0d, 0x0a, 0x2e, 0x0d, 0x0a
{
mailend -= 5;
DSBYTE[mailend] = '\0';
if (strstr(mailstart, "+OK")!=mailstart)
{
aim = GET_ANSWER_RETR;
16,13 → 17,13
return;
}
aim=NULL;
DSBYTE[mailend] = '\0';
mailsize = mailend - mailstart;
 
debug("Getting QP");
if (strstri(mailstart, "quoted-printable")!=0)
{
new_buf = malloc(mailend-mailstart);
qp_decode stdcall (mailstart, new_buf, mailend-mailstart);
new_buf = malloc(mailsize);
qp_decode stdcall (mailstart, new_buf, mailsize);
if (EAX==-1) debug("Too small buffer to convert QUOTED-PRINTABLE");
else
{
32,12 → 33,16
mailend = mailsize + mailstart;
}
}
debug("GetHeaders: From, To, Date, Subject");
GetHeader(#from, "\nFrom:");
GetHeader(#to, "\nTo:");
GetHeader(#date, "\nDate:");
GetHeader(#subj, "\nSubject:");
mdata = strstr(mailstart, "\n\r") + 3; // 0x0d 0x0a, 0x0a
debug("Get mdata");
mdata = strstr(mailstart, "\x0a\x0d") + 3; // 0x0d 0x0a, 0x0a
debug("ConvertToDOS");
ConvertToDOS(mdata, mailstart);
debug("FromHTMLtoTXT");
FromHTMLtoTXT();
letter_view.first = letter_view.count = 0;
47,6 → 52,7
line_off = GetNextLine(line_off);
letter_view.count++;
}
debug("SetAtrFromCurr");
atr.SetAtrFromCurr(mail_list.current+1);
DrawMailBox();
}
83,7 → 89,7
dword cur_chr, txt_buf_srt, txt_buf_end, is_tag=0;
int i;
if (strstri(mdata, "<html>")==0) && (strstri(mailstart, "text/html")==0) {debug("no html tags found"); return;}
debug ("converting: html -> txt");
debug ("Mail got <html> code");
cur_chr = mdata;
txt_buf_srt = malloc(mailend - mailstart);
txt_buf_end = txt_buf_srt;
137,13 → 143,20
return line;
}
 
 
void GetHeader(dword workstr, searchstr)
{
char tmpbuf[512];
dword Qoff;
int q_start, b_start;
 
strcpyb(mailstart, workstr, searchstr, "\n");
if (strstri(workstr, "?Q?"))
debug(searchstr);
debug(workstr);
if (strlen(workstr)<8) return;
q_start = strstri(workstr, "?Q?");
b_start = strstri(workstr, "?B?");
if (q_start)
{
qp_decode stdcall (workstr, #tmpbuf, strlen(workstr));
ConvertToDOS(#tmpbuf, workstr);
151,9 → 164,11
Qoff = strstri(workstr, "?Q?");
strcpy(workstr, Qoff);
}
if (strstr(workstr, "?B?"))
 
//any text that goes after "?=" deletes now
if (b_start)
{
base64_decode stdcall (strstri(workstr, "?B?"), #tmpbuf, strlen(workstr));
base64_decode stdcall (b_start, #tmpbuf, strlen(b_start)-5);
ConvertToDOS(#tmpbuf, workstr);
strcpy(workstr, #tmpbuf);
}