forked from KolibriOS/kolibrios
Liza 0.9a: bugfixes & cleanup.
git-svn-id: svn://kolibrios.org@4141 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
68817c31bc
commit
bd6b9902ad
@ -45,9 +45,9 @@ enum {
|
|||||||
#define WIN_H 440
|
#define WIN_H 440
|
||||||
#define WIN_MIN_W 500
|
#define WIN_MIN_W 500
|
||||||
#define WIN_MIN_H 380
|
#define WIN_MIN_H 380
|
||||||
#define LOGIN_HEADER "Login - Email client Liza 0.9"
|
#define LOGIN_HEADER "Login - Email client Liza 0.9a"
|
||||||
#define OPTIONS_HEADER "Options - Email client Liza 0.9"
|
#define OPTIONS_HEADER "Options - Email client Liza 0.9a"
|
||||||
#define MAILBOX_HEADER "Mail Box - Email client Liza 0.9"
|
#define MAILBOX_HEADER "Mail Box - Email client Liza 0.9a"
|
||||||
#define BUFFERSIZE 512
|
#define BUFFERSIZE 512
|
||||||
proc_info Form;
|
proc_info Form;
|
||||||
system_colors sc;
|
system_colors sc;
|
||||||
|
@ -227,7 +227,7 @@ void MailBoxLoop()
|
|||||||
mail_list.count = GetMailCount();
|
mail_list.count = GetMailCount();
|
||||||
debug("Letters:");
|
debug("Letters:");
|
||||||
debug(itoa(mail_list.count));
|
debug(itoa(mail_list.count));
|
||||||
listbuffer = free(listbuffer);
|
free(listbuffer);
|
||||||
listbuffer = mem_Alloc(30*mail_list.count); //24* original
|
listbuffer = mem_Alloc(30*mail_list.count); //24* original
|
||||||
listpointer = listbuffer;
|
listpointer = listbuffer;
|
||||||
aim = SEND_NLIST;
|
aim = SEND_NLIST;
|
||||||
@ -252,21 +252,21 @@ void MailBoxLoop()
|
|||||||
|
|
||||||
if (aim == GET_ANSWER_NLIST)
|
if (aim == GET_ANSWER_NLIST)
|
||||||
{
|
{
|
||||||
ticks = Receive(socketnum, #immbuffer, BUFFERSIZE, 0);
|
ticks = Receive(socketnum, listpointer, listbuffer + 30*mail_list.count - listpointer, MSG_DONTWAIT);
|
||||||
if ((ticks == 0xffffffff) || (ticks < 3)) break;
|
if (ticks == 0xffffffff) break;
|
||||||
|
listpointer = listpointer + ticks;
|
||||||
//for (;ticks>0;ticks--)
|
|
||||||
//{
|
if (listpointer - listbuffer < 5) break;
|
||||||
if (immbuffer[ticks-3]=='.') //this way of checking end of message IS BAD
|
if (strncmp(listpointer-5,"\n.\n",5)==0) // note that c-- assembles "\n.\n" to 0x0d, 0x0a, 0x2e, 0x0d, 0x0a
|
||||||
{
|
{
|
||||||
aim = SEND_RETR;
|
aim = SEND_RETR;
|
||||||
debug("Got mail list");
|
debug("Got mail list");
|
||||||
DrawMailBox();
|
DrawMailBox();
|
||||||
|
|
||||||
atr.CreateArray();
|
*listpointer='\0';
|
||||||
atr.SetSizes();
|
atr.CreateArray();
|
||||||
}
|
atr.SetSizes();
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aim == SEND_RETR)
|
if (aim == SEND_RETR)
|
||||||
@ -279,7 +279,7 @@ void MailBoxLoop()
|
|||||||
Send(socketnum, #request, request_len, 0);
|
Send(socketnum, #request, request_len, 0);
|
||||||
if (EAX == 0xffffffff) { notify("Error while trying to get letter from server"); aim=NULL; break;}
|
if (EAX == 0xffffffff) { notify("Error while trying to get letter from server"); aim=NULL; break;}
|
||||||
|
|
||||||
mailbuffer = free(mailbuffer);
|
free(mailbuffer);
|
||||||
letter_size = atr.GetSize(mail_list.current+1) + 1024;
|
letter_size = atr.GetSize(mail_list.current+1) + 1024;
|
||||||
mailbuffer = malloc(letter_size);
|
mailbuffer = malloc(letter_size);
|
||||||
if (!mailbuffer) {debug("alloc error!"); aim=NULL; break;}
|
if (!mailbuffer) {debug("alloc error!"); aim=NULL; break;}
|
||||||
@ -290,8 +290,7 @@ void MailBoxLoop()
|
|||||||
if (aim == GET_ANSWER_RETR)
|
if (aim == GET_ANSWER_RETR)
|
||||||
{
|
{
|
||||||
ticks = Receive(socketnum, mailpointer, letter_size + mailbuffer - mailpointer , MSG_DONTWAIT);
|
ticks = Receive(socketnum, mailpointer, letter_size + mailbuffer - mailpointer , MSG_DONTWAIT);
|
||||||
if (ticks == 0xffffffff) break;
|
if (ticks == 0xffffffff) break;
|
||||||
if (ticks == 0) break;
|
|
||||||
//debugi(EAX);
|
//debugi(EAX);
|
||||||
|
|
||||||
mailpointer = mailpointer + ticks;
|
mailpointer = mailpointer + ticks;
|
||||||
@ -497,40 +496,27 @@ int GetMailCount(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void listputc(char agot_char){
|
|
||||||
*listpointer=agot_char;
|
|
||||||
listpointer++;
|
|
||||||
*listpointer='\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
int GetLetterSize_(int number){
|
int GetLetterSize_(int number){
|
||||||
char serch_num[24];
|
char search_num[24];
|
||||||
char letter_size1[24];
|
char letter_size1[24];
|
||||||
strcpy(#serch_num, "\n");
|
strcpy(#search_num, "\n"); // 0x0d, 0x0a
|
||||||
strcat(#serch_num, itoa(number));
|
strcat(#search_num, itoa(number));
|
||||||
strcat(#serch_num, " ");
|
strcat(#search_num, " ");
|
||||||
strcpyb(listbuffer, #letter_size1, #serch_num, "\n");
|
strcpyb(listbuffer, #letter_size1, #search_num, "\x0d");
|
||||||
return atoi(#letter_size1);
|
return atoi(#letter_size1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void letter_attr::CreateArray()
|
void letter_attr::CreateArray()
|
||||||
{
|
{
|
||||||
mails_db = free(mails_db);
|
free(mails_db);
|
||||||
mails_db = malloc( mail_list.count * sizeof(atr) );
|
mails_db = malloc( mail_list.count * sizeof(atr) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void letter_attr::SetSizes()
|
void letter_attr::SetSizes()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0; i < mail_list.count; i++)
|
for (i=1; i < mail_list.count; i++)
|
||||||
{
|
{
|
||||||
ESDWORD[sizeof(atr)*i+#mails_db+#atr.size-#atr] = GetLetterSize_(i);
|
ESDWORD[sizeof(atr)*i+#mails_db+#atr.size-#atr] = GetLetterSize_(i);
|
||||||
ESDWORD[sizeof(atr)*i+#mails_db+#atr.subject-#atr] = ' ';
|
ESDWORD[sizeof(atr)*i+#mails_db+#atr.subject-#atr] = ' ';
|
||||||
|
@ -9,7 +9,6 @@ void ParseMail()
|
|||||||
{
|
{
|
||||||
debug("End of mail detected");
|
debug("End of mail detected");
|
||||||
mailpointer = mailpointer - 5;
|
mailpointer = mailpointer - 5;
|
||||||
*mailpointer='\0';
|
|
||||||
|
|
||||||
if (strstr(mailbuffer, "+OK")!=mailbuffer)
|
if (strstr(mailbuffer, "+OK")!=mailbuffer)
|
||||||
{
|
{
|
||||||
@ -19,7 +18,7 @@ void ParseMail()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
aim=NULL;
|
aim=NULL;
|
||||||
DSBYTE[mailpointer+1] = '\0';
|
DSBYTE[mailpointer] = '\0';
|
||||||
debug("Real letter size:");
|
debug("Real letter size:");
|
||||||
debugi(mailpointer - mailbuffer);
|
debugi(mailpointer - mailbuffer);
|
||||||
|
|
||||||
@ -31,7 +30,7 @@ void ParseMail()
|
|||||||
if (EAX==-1) debug("Too small buffer to convert QUOTED-PRINTABLE");
|
if (EAX==-1) debug("Too small buffer to convert QUOTED-PRINTABLE");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mailbuffer = free(mailbuffer);
|
free(mailbuffer);
|
||||||
mailbuffer = new_buf;
|
mailbuffer = new_buf;
|
||||||
mailpointer = strlen(mailbuffer) + mailbuffer;
|
mailpointer = strlen(mailbuffer) + mailbuffer;
|
||||||
}
|
}
|
||||||
@ -41,7 +40,7 @@ void ParseMail()
|
|||||||
GetHeader(#to, "\nTo:");
|
GetHeader(#to, "\nTo:");
|
||||||
GetHeader(#date, "\nDate:");
|
GetHeader(#date, "\nDate:");
|
||||||
GetHeader(#subj, "\nSubject:");
|
GetHeader(#subj, "\nSubject:");
|
||||||
mdata = strstr(mailbuffer, "\n\r") + 3;
|
mdata = strstr(mailbuffer, "\n") + 3;
|
||||||
debug ("converting to dos");
|
debug ("converting to dos");
|
||||||
ConvertToDOS(mdata, mailbuffer);
|
ConvertToDOS(mdata, mailbuffer);
|
||||||
FromHTMLtoTXT();
|
FromHTMLtoTXT();
|
||||||
|
Loading…
Reference in New Issue
Block a user