diff --git a/programs/cmm/TWB/TWB.c b/programs/cmm/TWB/TWB.c
index 051124af4b..71b3e14d7f 100644
--- a/programs/cmm/TWB/TWB.c
+++ b/programs/cmm/TWB/TWB.c
@@ -1,8 +1,8 @@
#include "..\TWB\links.h"
-dword buf;
-dword filesize;
+dword bufpointer;
+dword bufsize;
#define URL param
@@ -10,12 +10,10 @@ scroll_bar scroll_wv = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555
char header[2048];
-int downloader_id;
-
char download_path[]="/rd/1/.download";
struct TWebBrowser {
- llist list; //need #include "..\lib\list_box.h"
+ llist list;
DrawBufer DrawBuf;
void GetNewUrl();
void ReadHtml();
@@ -151,20 +149,20 @@ void TWebBrowser::ReadHtml(byte encoding)
else
file_size stdcall (#URL);
- filesize = EBX;
- if (!filesize) return;
+ bufsize = EBX;
+ if (!bufsize) return;
- mem_Free(buf);
- buf = mem_Alloc(filesize);
+ mem_Free(bufpointer);
+ bufpointer = mem_Alloc(bufsize);
if (!strncmp(#URL,"http:",5))
- ReadFile(0, filesize, buf, #download_path);
+ ReadFile(0, bufsize, bufpointer, #download_path);
else
- ReadFile(0, filesize, buf, #URL);
+ ReadFile(0, bufsize, bufpointer, #URL);
cur_encoding = encoding;
- if (encoding==_WIN) wintodos(buf);
- if (encoding==_UTF) utf8rutodos(buf);
- if (encoding==_KOI) koitodos(buf);
+ if (encoding==_WIN) wintodos(bufpointer);
+ if (encoding==_UTF) utf8rutodos(bufpointer);
+ if (encoding==_KOI) koitodos(bufpointer);
}
@@ -197,7 +195,7 @@ void TWebBrowser::ParseHTML(dword bufpos){
if (!strcmp(#URL + strlen(#URL) - 4, ".mht")) ignor_text = 1;
}
- for ( ; bufstart+filesize > bufpos; bufpos++;)
+ for ( ; bufstart+bufsize > bufpos; bufpos++;)
{
bukva = ESBYTE[bufpos];
if (ignor_text) && (bukva!='<') continue;
@@ -255,7 +253,7 @@ void TWebBrowser::ParseHTML(dword bufpos){
do
{
bufpos++;
- if (bufstart + filesize <= bufpos) break 2;
+ if (bufstart + bufsize <= bufpos) break 2;
}
while (ESBYTE[bufpos] <>'-');
@@ -263,7 +261,7 @@ void TWebBrowser::ParseHTML(dword bufpos){
if (ESBYTE[bufpos] <>'-') goto HH_;
}
}
- while (ESBYTE[bufpos] !='>') && (bufpos < bufstart + filesize) //получаем тег и его параметры
+ while (ESBYTE[bufpos] !='>') && (bufpos < bufstart + bufsize) //получаем тег и его параметры
{
bukva = ESBYTE[bufpos];
if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' ';
diff --git a/programs/cmm/TWB/img_cache.h b/programs/cmm/TWB/img_cache.h
index 99ecd5d6a3..8eb3622c3b 100644
--- a/programs/cmm/TWB/img_cache.h
+++ b/programs/cmm/TWB/img_cache.h
@@ -43,9 +43,8 @@ void ImageCache::Images(int left1, top1, width1)
do{
if (!strcmp(#parametr,"src=")) //надо объединить с GetNewUrl()
{
- if (downloader_id) strcpy(#img_path, #history_list[history_current-1].Item);
- else strcpy(#img_path, BrowserHistory.CurrentUrl()); //достаём адрес текущей страницы
-
+ //if (downloader_id) strcpy(#img_path, #history_list[history_current-1].Item); else
+ strcpy(#img_path, BrowserHistory.CurrentUrl());
if (strcmpn(#img_path, "http:", 5)!=0) || (strcmpn(#options, "http:", 5)!=0)
{
//get path: absolute or relative
diff --git a/programs/cmm/browser/HTMLv.c b/programs/cmm/browser/HTMLv.c
index 37fd27384f..6516e90bc1 100644
--- a/programs/cmm/browser/HTMLv.c
+++ b/programs/cmm/browser/HTMLv.c
@@ -58,6 +58,8 @@ int action_buf;
dword http_transfer = 0;
dword http_buffer;
+int downloader_id;
+
#include "..\TWB\TWB.c"
#include "menu_rmb.h"
@@ -80,6 +82,7 @@ void main()
if (load_dll2(boxlib, #box_lib_init,0)!=0) {notify("System Error: library doesn't exists /rd/1/lib/box_lib.obj"); ExitProcess();}
if (load_dll2(libio, #libio_init,1)!=0) notify("Error: library doesn't exists - libio");
if (load_dll2(libimg, #libimg_init,1)!=0) notify("Error: library doesn't exists - libimg");
+ if (load_dll2(libHTTP, #http_lib_init,1)!=0) notify("Error: library doesn't exists - http");
if (!URL) strcpy(#URL, "/sys/index.htm");
Form.width=WIN_W;
@@ -101,7 +104,7 @@ void main()
m.get();
PageLinks.Hover(m.x, m.y, link_color_inactive, link_color_active, bg_color);
- if (m.y>WB1.list.y) && (m.y
WB1.list.y) && (m.yWB1.list.count) WB1.list.first=WB1.list.count-WB1.list.visible;
- if (btn<>WB1.list.first) WB1.ParseHTML(buf);
+ if (btn<>WB1.list.first) WB1.ParseHTML(bufpointer);
}
break;
@@ -167,28 +170,29 @@ void main()
if (action_buf) { Scan(action_buf); action_buf=0;}
Draw_Window();
break;
+
case evNetwork:
return;
- //open page
- http_get stdcall (#URL, 0);
+ http_get stdcall (#search_path, 0);
http_transfer = EAX;
- IF (http_transfer<0) notify("Error from HTTP lib");
- //
- if (http_transfer != 0) {
+ IF (http_transfer < 0) notify("Error from HTTP lib");
+
+ if (http_transfer > 0) {
http_process stdcall (http_transfer);
$push EAX
ESI = http_transfer;
- if (!ESI.http_msg.content_received) break;
- buf = ESI.http_msg.content_ptr;
- debug(buf);
- filesize = ESI.http_msg.content_received;
- debugi(filesize);
- WB1.ParseHTML(buf);
+ bufpointer = ESI.http_msg.content_ptr;
+ debug(bufpointer);
+ //bufsize = ESI.http_msg.content_received;
+ bufsize = strlen(bufpointer)-2;
+ debugi(bufsize);
+ WB1.ParseHTML(bufpointer);
$pop EAX
if (EAX == 0) {
http_free stdcall (http_transfer);
http_transfer=0;
}
+ pause(10);
}
default:
if (downloader_id<>0)
@@ -256,28 +260,28 @@ void Scan(int id)
{
case 011: //Ctrk+K
WB1.ReadHtml(_KOI);
- WB1.ParseHTML(buf);
+ WB1.ParseHTML(bufpointer);
return;
case 021: //Ctrl+U
WB1.ReadHtml(_UTF);
- WB1.ParseHTML(buf);
+ WB1.ParseHTML(bufpointer);
return;
case 004: //Ctrl+D
WB1.ReadHtml(_DOS);
- WB1.ParseHTML(buf);
+ WB1.ParseHTML(bufpointer);
return;
case 005: //Win encoding
WB1.ReadHtml(_WIN);
- WB1.ParseHTML(buf);
+ WB1.ParseHTML(bufpointer);
return;
case 009: //free img cache
ImgCache.Free();
notify(IMAGES_CACHE_CLEARED);
- WB1.ParseHTML(buf);
+ WB1.ParseHTML(bufpointer);
return;
case BACK:
@@ -293,7 +297,7 @@ void Scan(int id)
else RunProgram("/rd/1/tinypad", #download_path);
return;
case 054: //F5
- IF(address_box.flags & 0b10) WB1.ParseHTML(buf);
+ IF(address_box.flags & 0b10) WB1.ParseHTML(bufpointer);
return;
case REFRESH:
@@ -334,7 +338,7 @@ void Scan(int id)
IF(WB1.list.first == WB1.list.count - WB1.list.visible) return;
WB1.list.first += WB1.list.visible + 2;
IF(WB1.list.visible + WB1.list.first > WB1.list.count) WB1.list.first = WB1.list.count - WB1.list.visible;
- WB1.ParseHTML(buf);
+ WB1.ParseHTML(bufpointer);
return;
case 184: //PgUp
@@ -342,30 +346,30 @@ void Scan(int id)
IF(WB1.list.first == 0) return;
WB1.list.first -= WB1.list.visible - 2;
IF(WB1.list.first < 0) WB1.list.first = 0;
- WB1.ParseHTML(buf);
+ WB1.ParseHTML(bufpointer);
return;
case 178:
case BTN_UP: //мотаем вверх
if (WB1.list.first <= 0) return;
WB1.list.first--;
- WB1.ParseHTML(buf);
+ WB1.ParseHTML(bufpointer);
return;
case 177:
case BTN_DOWN: //мотаем вниз
if (WB1.list.visible + WB1.list.first >= WB1.list.count) return;
WB1.list.first++;
- WB1.ParseHTML(buf);
+ WB1.ParseHTML(bufpointer);
return;
case 180: //home
- if (WB1.list.KeyHome()) WB1.ParseHTML(buf);
+ if (WB1.list.KeyHome()) WB1.ParseHTML(bufpointer);
return;
case 181: //end
if (WB1.list.count < WB1.list.visible) return;
- if (WB1.list.KeyEnd()) WB1.ParseHTML(buf);
+ if (WB1.list.KeyEnd()) WB1.ParseHTML(bufpointer);
return;
}
}
@@ -456,31 +460,31 @@ void ShowPage()
address_box.offset=0;
edit_box_draw stdcall(#address_box);
- if (!filesize)
+ if (!bufsize)
{
PageLinks.Clear();
if (GetProcessSlot(downloader_id)<>0)
{
- filesize = sizeof(loading);
+ bufsize = sizeof(loading);
WB1.ParseHTML(#loading);
}
else
{
if (strncmp(#URL,"http:",5)==0)
{
- filesize = sizeof(page_not_found_no_internet);
+ bufsize = sizeof(page_not_found_no_internet);
WB1.ParseHTML(#page_not_found_no_internet);
}
else
{
- filesize = sizeof(page_not_found);
+ bufsize = sizeof(page_not_found);
WB1.ParseHTML(#page_not_found);
}
}
//return;
}
else
- WB1.ParseHTML(buf);
+ WB1.ParseHTML(bufpointer);
if (!header) strcpy(#header, #version);
if (!strcmp(#version, #header)) DrawTitle(#header);
diff --git a/programs/cmm/liza/mail_box.c b/programs/cmm/liza/mail_box.c
index 191ef8d52b..aef6079ec2 100644
--- a/programs/cmm/liza/mail_box.c
+++ b/programs/cmm/liza/mail_box.c
@@ -355,8 +355,9 @@ void InitTWB() {
}
void DrawLetter() {
- filesize = strlen(mdata);
- if (filesize) WB1.ParseHTML(mdata);
+ pre_text = 2;
+ bufsize = strlen(mdata);
+ if (bufsize) WB1.ParseHTML(mdata);
}