Subversion Repositories Kolibri OS

Rev

Rev 6058 | Rev 6366 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. //HTML Viewer in C--
  2. //Copyright 2007-2013 by Veliant & Leency
  3. //Asper, lev, Lrz, Barsuk, Nable...
  4. //home icon - rachel fu, GPL licence
  5.  
  6. #ifndef AUTOBUILD
  7.         #include "lang.h--"
  8. #endif
  9.  
  10. //libraries
  11. #define MEMSIZE 1060000
  12. #include "..\lib\gui.h"
  13. #include "..\lib\draw_buf.h"
  14. #include "..\lib\list_box.h"
  15. #include "..\lib\cursor.h"
  16. #include "..\lib\collection.h"
  17. #include "..\lib\font.h"
  18. #include "..\lib\menu.h"
  19.  
  20. //*.obj libraries
  21. #include "..\lib\obj\box_lib.h"
  22. #include "..\lib\obj\libio_lib.h"
  23. #include "..\lib\obj\libimg_lib.h"
  24. #include "..\lib\obj\http.h"
  25. #include "..\lib\obj\iconv.h"
  26. //useful patterns
  27. #include "..\lib\patterns\libimg_load_skin.h"
  28. #include "..\lib\patterns\history.h"
  29. #include "..\lib\patterns\http_downloader.h"
  30.  
  31. char homepage[] = FROM "html\\homepage.htm";
  32.  
  33. #ifdef LANG_RUS
  34. char version[]=" ’¥ªáâ®¢ë© ¡à ã§¥à 1.48";
  35. ?define IMAGES_CACHE_CLEARED "Šíè ª à⨭®ª ®ç¨é¥­"
  36. ?define T_LAST_SLIDE "â® ¯®á«¥¤­¨© á« ©¤"
  37. char loading[] = "‡ £à㧪  áâà ­¨æë...<br>";
  38. char page_not_found[] = FROM "html\page_not_found_ru.htm";
  39. char accept_language[]= "Accept-Language: ru\n";
  40. char rmb_menu[] =
  41. "®á¬®âà¥âì ¨á室­¨ª
  42. ¥¤ ªâ¨à®¢ âì ¨á室­¨ª
  43. ˆáâ®à¨ï
  44. Žç¨áâ¨âì ªíè ª à⨭®ª
  45. Œ¥­¥¤¦¥à § £à㧮ª";
  46. #else
  47. char version[]=" Text-based Browser 1.48";
  48. ?define IMAGES_CACHE_CLEARED "Images cache cleared"
  49. ?define T_LAST_SLIDE "This slide is the last"
  50. char loading[] = "Loading...<br>";
  51. char page_not_found[] = FROM "html\page_not_found_en.htm";
  52. char accept_language[]= "Accept-Language: en\n";
  53. char rmb_menu[] =
  54. "View source
  55. Edit source
  56. History
  57. Free image cache
  58. Download Manager";
  59. #endif
  60.  
  61. #define URL_SERVICE_HISTORY "WebView://history"
  62. #define URL_SERVICE_HOME "WebView://home"
  63. #define URL_SERVICE_SOURCE "WebView://source:"
  64.  
  65. proc_info Form;
  66.  
  67. //char search_path[]="http://nigma.ru/index.php?s=";
  68. int redirected = 0;
  69.  
  70. char stak[4096];
  71.  
  72. int action_buf;
  73.  
  74. dword http_transfer = 0;
  75. dword http_buffer;
  76.  
  77. dword TOOLBAR_H = 33;
  78. dword STATUSBAR_H = 15;
  79. dword col_bg;
  80. dword panel_color;
  81. dword border_color;
  82.  
  83. progress_bar wv_progress_bar;
  84. byte souce_mode = false;
  85.  
  86. enum {
  87.         BACK_BUTTON=1000,
  88.         FORWARD_BUTTON,
  89.         REFRESH_BUTTON,
  90.         GOTOURL_BUTTON,
  91.         SANDWICH_BUTTON
  92. };
  93.  
  94. enum {
  95.         VIEW_SOURCE=1100,
  96.         EDIT_SOURCE,
  97.         VIEW_HISTORY,
  98.         FREE_IMG_CACHE,
  99.         DOWNLOAD_MANAGER
  100. };
  101.  
  102. #include "..\TWB\TWB.c"
  103. #include "history.h"
  104. #include "show_src.h"
  105. #include "download_manager.h"
  106.  
  107. char editURL[sizeof(URL)];
  108. int     mouse_twb;
  109. edit_box address_box = {250,56,34,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(URL),#editURL,#mouse_twb,2,19,19};
  110.  
  111.  
  112. void main()
  113. {
  114.         dword btn;
  115.         int half_scroll_size;
  116.         int scroll_used=0, show_menu;
  117.         CursorPointer.Load(#CursorFile);
  118.         load_dll(boxlib, #box_lib_init,0);
  119.         load_dll(libio, #libio_init,1);
  120.         load_dll(libimg, #libimg_init,1);
  121.         load_dll(libHTTP, #http_lib_init,1);
  122.         load_dll(iconv_lib, #iconv_open,0);
  123.         Libimg_LoadImage(#skin, abspath("wv_skin.png"));
  124.         SetSkinColors();
  125.         CreateDir("/tmp0/1/downloads");
  126.         if (param) strcpy(#URL, #param); else strcpy(#URL, URL_SERVICE_HOME);
  127.         WB1.DrawBuf.zoom = 1;
  128.         WB1.list.SetFont(8, 14, 10011000b);
  129.         WB1.list.no_selection = true;
  130.         label.init(DEFAULT_FONT);
  131.         SetEventMask(0xa7);
  132.         BEGIN_LOOP_APPLICATION:
  133.                 WaitEventTimeout(2);
  134.                 switch(EAX & 0xFF)
  135.                 {
  136.                         CASE evMouse:
  137.                                 if (!CheckActiveProcess(Form.ID)) break;
  138.                                 edit_box_mouse stdcall (#address_box);
  139.                                 mouse.get();
  140.                                 if (WB1.list.MouseOver(mouse.x, mouse.y))
  141.                                 {
  142.                                         PageLinks.Hover(mouse.x, WB1.list.first*WB1.list.item_h + mouse.y, link_color_inactive, link_color_active, bg_color);
  143.                                         if (bufsize) && (mouse.pkm) && (mouse.up) {
  144.                                                 menu.show(Form.left+mouse.x-6,Form.top+mouse.y+skin_height+3, 180, #rmb_menu, VIEW_SOURCE);
  145.                                                 break;
  146.                                         }
  147.                                         if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
  148.                                 }
  149.                                 scrollbar_v_mouse (#scroll_wv);
  150.                                 if (WB1.list.first != scroll_wv.position)
  151.                                 {
  152.                                         WB1.list.first = scroll_wv.position;
  153.                                         WB1.DrawPage();
  154.                                         break;
  155.                                 }
  156.                                 break;
  157.  
  158.                         case evButton:
  159.                                 btn=GetButtonID();
  160.                                 if (btn==1)     ExitProcess();
  161.                                 Scan(btn);
  162.                                 break;
  163.  
  164.                         case evKey:
  165.                                 GetKeys();
  166.                                 if (address_box.flags & 0b10)  
  167.                                 {
  168.                                         if (key_ascii == ASCII_KEY_ENTER) Scan(key_scancode); else
  169.                                         if (key_ascii != 0x0d) && (key_ascii != 183) && (key_ascii != 184) {EAX = key_ascii << 8; edit_box_key stdcall(#address_box);}
  170.                                 }
  171.                                 else
  172.                                 {
  173.                                         Scan(key_scancode);
  174.                                 }
  175.                                 break;
  176.  
  177.                         case evReDraw:
  178.                                 if (menu.list.cur_y) {
  179.                                         Scan(menu.list.cur_y);
  180.                                         menu.list.cur_y = 0;
  181.                                 }
  182.                                 DefineAndDrawWindow(GetScreenWidth()-800/2,GetScreenHeight()-600/2,800,600,0x73,col_bg,0,0);
  183.                                 GetProcessInfo(#Form, SelfInfo);
  184.                                 if (Form.status_window>2) { DrawTitle(#header); break; }
  185.                                 if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; }
  186.                                 if (Form.width<280) { MoveSize(OLD,OLD,280,OLD); break; }
  187.                                 Draw_Window();
  188.                                 break;
  189.                                
  190.                         case evNetwork:
  191.                                 if (http_transfer > 0) {
  192.                                         http_receive stdcall (http_transfer);
  193.                                         $push EAX
  194.                                         ESI = http_transfer;
  195.                                         wv_progress_bar.max = ESI.http_msg.content_length;
  196.                                         if (wv_progress_bar.value != ESI.http_msg.content_received)
  197.                                         {
  198.                                                 wv_progress_bar.value = ESI.http_msg.content_received; 
  199.                                                 DrawProgress();
  200.                                         }
  201.                                         $pop EAX
  202.                                         if (EAX == 0) {
  203.                                                 ESI = http_transfer;
  204.                                                 // Handle redirects
  205.                                                 if (ESI.http_msg.status >= 300) && (ESI.http_msg.status < 400)
  206.                                                 {
  207.                                                         redirected++;
  208.                                                         if (redirected<=5)
  209.                                                         {
  210.                                                                 http_find_header_field stdcall (http_transfer, "location\0");
  211.                                                                 if (EAX!=0) {
  212.                                                                         ESI = EAX;
  213.                                                                         EDI = #URL;
  214.                                                                         do {
  215.                                                                                 $lodsb;
  216.                                                                                 $stosb;
  217.                                                                         } while (AL != 0) && (AL != 13) && (AL != 10));
  218.                                                                         DSBYTE[EDI-1]='\0';
  219.                                                                 }
  220.                                                         }
  221.                                                         else
  222.                                                         {
  223.                                                                 notify("Too many redirects");
  224.                                                                 StopLoading();
  225.                                                                 break;
  226.                                                         }
  227.                                                 }
  228.                                                 else
  229.                                                 {
  230.                                                         redirected = 0;
  231.                                                 }
  232.                                                 // Loading the page is complete, free resources
  233.                                                 if (redirected>0)
  234.                                                 {
  235.                                                         http_free stdcall (http_transfer);
  236.                                                         http_transfer=0;
  237.                                                         GetAbsoluteURL(#URL);
  238.                                                         history.back();
  239.                                                         strcpy(#editURL, #URL);
  240.                                                         DrawEditBoxWebView();
  241.                                                         OpenPage();
  242.                                                 }
  243.                                                 else
  244.                                                 {
  245.                                                         history.add(#URL);
  246.                                                         ESI = http_transfer;
  247.                                                         bufpointer = ESI.http_msg.content_ptr;
  248.                                                         bufsize = ESI.http_msg.content_received;
  249.                                                         http_free stdcall (http_transfer);
  250.                                                         http_transfer=0;
  251.                                                         SetPageDefaults();
  252.                                                         ShowPage();
  253.                                                 }
  254.                                         }
  255.                                 }
  256.                 }
  257.         goto BEGIN_LOOP_APPLICATION;
  258. }
  259.  
  260. void SetElementSizes()
  261. {
  262.         address_box.top = TOOLBAR_H/2-7;
  263.         address_box.width = Form.cwidth - address_box.left - 25 - 22;
  264.         WB1.list.SetSizes(0, TOOLBAR_H, Form.width - 10 - scroll_wv.size_x / WB1.DrawBuf.zoom,
  265.                 Form.cheight - TOOLBAR_H - STATUSBAR_H, WB1.list.font_h + WB1.DrawBuf.zoom + WB1.DrawBuf.zoom * WB1.DrawBuf.zoom);
  266.         WB1.list.wheel_size = 7;
  267.         WB1.list.column_max = WB1.list.w - scroll_wv.size_x / WB1.list.font_w;
  268.         WB1.list.visible = WB1.list.h - 5 / WB1.list.item_h;
  269.         if (WB1.list.w!=WB1.DrawBuf.bufw) {
  270.                 WB1.DrawBuf.Init(WB1.list.x, WB1.list.y, WB1.list.w, WB1.list.h * 30);
  271.                 Scan(REFRESH_BUTTON);
  272.         }
  273. }
  274.  
  275.  
  276.  
  277. void Draw_Window()
  278. {
  279.         int list__w, list__h;
  280.         DrawBar(0,0, Form.cwidth,TOOLBAR_H-2, panel_color);
  281.         DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, 0xD7D0D3);
  282.         DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, border_color);
  283.         SetElementSizes();
  284.         DrawRectangle(address_box.left-3, address_box.top-3, address_box.width+5, 20,border_color);
  285.         DefineButton(address_box.left-50, address_box.top-2, 23, skin.h-2, BACK_BUTTON+BT_HIDE, 0);
  286.         DefineButton(address_box.left-26, address_box.top-2, 23, skin.h-2, FORWARD_BUTTON+BT_HIDE, 0);
  287.         img_draw stdcall(skin.image, address_box.left-51, address_box.top-3, 48, skin.h, 3, 0);
  288.         DefineButton(address_box.left+address_box.width+1, address_box.top-3, 16, skin.h-1, REFRESH_BUTTON+BT_HIDE+BT_NOFRAME, 0);
  289.         DefineButton(Form.cwidth-24, address_box.top-3, 19, skin.h-1, SANDWICH_BUTTON+BT_HIDE, 0);
  290.         img_draw stdcall(skin.image, Form.cwidth-22, address_box.top-3, 16, skin.h, 85, 0);
  291.         DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,STATUSBAR_H, col_bg);
  292.         DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, border_color);
  293.         if (!header) OpenPage(); else { WB1.DrawPage(); DrawEditBoxWebView(); }
  294.         DrawRectangle(scroll_wv.start_x, scroll_wv.start_y, scroll_wv.size_x, scroll_wv.size_y-1, scroll_wv.bckg_col);
  295.         DrawProgress();
  296.  
  297.         /*
  298.         list__w = 200;
  299.         list__h = 200;
  300.         label.raw_size = 0;
  301.         label.write_buf(10,10, list__w, list__h, 0xFFFFFF, 0, 11, "Hello World!");
  302.         label.write_buf(10,23, list__w, list__h, 0xFFFFFF, 0xFF00FF, 12, "How are you?");
  303.         label.write_buf(11,40, list__w, list__h, 0xFFFFFF, 0x2E74BB, 15, "Fine");
  304.         label.apply_smooth();
  305.         label.show_buf(0,0);
  306.         */
  307. }
  308.  
  309.  
  310. void Scan(dword id__)
  311. {
  312.         action_buf=0;
  313.         if (WB1.list.ProcessKey(id__)) WB1.DrawPage();
  314.         else switch (id__)
  315.         {
  316.                 case SCAN_CODE_BS:
  317.                 case BACK_BUTTON:
  318.                         if (history.back()) {
  319.                                 strcpy(#URL, history.current());
  320.                                 OpenPage();
  321.                         }
  322.                         return;
  323.                 case FORWARD_BUTTON:
  324.                         if (history.forward()) {
  325.                                 strcpy(#URL, history.current());
  326.                                 OpenPage();
  327.                         }
  328.                         return;
  329.                 case GOTOURL_BUTTON:
  330.                 case SCAN_CODE_ENTER:
  331.                         if (!strncmp(#editURL,"http:",5)) || (editURL[0]=='/') || (!strncmp(#editURL,"WebView:",9))
  332.                         {
  333.                                 strcpy(#URL, #editURL);
  334.                         }
  335.                         else
  336.                         {
  337.                                 strlcpy(#URL,"http://",7);
  338.                                 strcat(#URL, #editURL);
  339.                         }
  340.                         OpenPage();
  341.                         return;
  342.                 case 063: //F5
  343.                         IF(address_box.flags & 0b10) return;
  344.                 case REFRESH_BUTTON:
  345.                         if (http_transfer > 0)
  346.                         {
  347.                                 StopLoading();
  348.                                 Draw_Window();
  349.                         }
  350.                         else OpenPage();
  351.                         return;
  352.                 case SANDWICH_BUTTON:
  353.                         mouse.y = TOOLBAR_H-6;
  354.                         mouse.x = Form.cwidth - 167;
  355.                         menu.show(Form.left+mouse.x-6,Form.top+mouse.y+skin_height+3, 180, #rmb_menu, VIEW_SOURCE);
  356.                         return;
  357.                 case VIEW_SOURCE:
  358.                         WB1.list.first = 0;
  359.                         ShowSource();
  360.                         WB1.LoadInternalPage(bufpointer, bufsize);
  361.                         break;
  362.                 case EDIT_SOURCE:
  363.                         if (!strncmp(#URL,"http:",5))
  364.                         {
  365.                                 WriteFile(bufsize, bufpointer, "/tmp0/1/WebView_tmp.htm");
  366.                                 if (!EAX) RunProgram("/rd/1/tinypad", "/tmp0/1/WebView_tmp.htm");
  367.                         }
  368.                         else RunProgram("/rd/1/tinypad", #URL);
  369.                         return;
  370.                 case FREE_IMG_CACHE:
  371.                         ImgCache.Free();
  372.                         notify(IMAGES_CACHE_CLEARED);
  373.                         WB1.DrawPage();
  374.                         return;
  375.                 case VIEW_HISTORY:
  376.                         strcpy(#URL, URL_SERVICE_HISTORY);
  377.                         OpenPage();
  378.                         return;
  379.                 case DOWNLOAD_MANAGER:
  380.                         if (!downloader_opened) {
  381.                                 downloader_edit = NULL;
  382.                                 CreateThread(#Downloader,#downloader_stak+4092);
  383.                         }
  384.                         return;
  385.         }
  386. }
  387.  
  388.  
  389. void StopLoading()
  390. {
  391.         if (http_transfer)
  392.         {
  393.                 EAX = http_transfer;
  394.                 EAX = EAX.http_msg.content_ptr;         // get pointer to data
  395.                 $push   EAX                                                     // save it on the stack
  396.                 http_free stdcall (http_transfer);      // abort connection
  397.                 $pop    EAX                                                    
  398.                 free(EAX);                                              // free data
  399.                 http_transfer=0;
  400.                 bufsize = 0;
  401.                 bufpointer = free(bufpointer);
  402.         }
  403.         wv_progress_bar.value = 0;
  404.         img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 52, 0);
  405. }
  406.  
  407. void SetPageDefaults()
  408. {
  409.         strcpy(#header, #version);
  410.         WB1.list.count = WB1.list.first = 0;
  411.         stroka = 0;
  412.         cur_encoding = CH_NULL;
  413.         if (o_bufpointer) o_bufpointer = free(o_bufpointer);
  414.         anchor_line_num=WB1.list.first;
  415.         anchor[0]='|';
  416. }
  417.  
  418. void OpenPage()
  419. {
  420.         StopLoading();
  421.         souce_mode = false;
  422.         strcpy(#editURL, #URL);
  423.         history.add(#URL);
  424.         if (!strncmp(#URL,"WebView:",8))
  425.         {
  426.                 SetPageDefaults();
  427.                 if (!strcmp(#URL, URL_SERVICE_HOME)) WB1.LoadInternalPage(#homepage, sizeof(homepage));
  428.                 else if (!strcmp(#URL, URL_SERVICE_HISTORY)) ShowHistory();
  429.                 DrawEditBoxWebView();
  430.                 return;
  431.         }
  432.         if (!strncmp(#URL,"http:",5))
  433.         {
  434.                 img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, 131, 0);
  435.                 http_get stdcall (#URL, 0, 0, #accept_language);
  436.                 http_transfer = EAX;
  437.                 if (!http_transfer)
  438.                 {
  439.                         StopLoading();
  440.                         bufsize = 0;
  441.                         bufpointer = free(bufpointer);
  442.                         ShowPage();
  443.                         return;
  444.                 }
  445.         }
  446.         else
  447.         {
  448.                 file_size stdcall (#URL);
  449.                 bufsize = EBX;
  450.                 if (bufsize)
  451.                 {
  452.                         free(bufpointer);
  453.                         bufpointer = malloc(bufsize);
  454.                         SetPageDefaults();
  455.                         ReadFile(0, bufsize, bufpointer, #URL);
  456.                 }
  457.                 ShowPage();
  458.         }
  459. }
  460.  
  461. DrawEditBoxWebView()
  462. {
  463.         DrawWideRectangle(address_box.left-2, address_box.top-2, address_box.width+3, 19, 2, address_box.color);
  464.         address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#editURL);
  465.         address_box.offset = 0;
  466.         edit_box_draw stdcall(#address_box);
  467.         if (http_transfer > 0) EAX = 131; else EAX = 52;
  468.         img_draw stdcall(skin.image, address_box.left+address_box.width+1, address_box.top-3, 17, skin.h, EAX, 0);
  469. }
  470.  
  471.  
  472. void ShowPage()
  473. {
  474.         DrawEditBoxWebView();
  475.         if (!bufsize)
  476.         {
  477.                 if (http_transfer) WB1.LoadInternalPage(#loading, sizeof(loading));
  478.                 else WB1.LoadInternalPage(#page_not_found, sizeof(page_not_found));
  479.         }
  480.         else
  481.         {
  482.                 WB1.Prepare();
  483.         }
  484.         //if (!header) strcpy(#header, #version);
  485.         if (!strcmp(#version, #header)) DrawTitle(#header);
  486. }
  487.  
  488. byte UrlExtIs(dword ext)
  489. {
  490.         if (!strcmpi(#URL + strlen(#URL) - strlen(ext), ext)) return true;
  491.         return false;
  492. }
  493.  
  494. int SetSkinColors()
  495. {
  496.         dword image_data;
  497.         image_data = DSDWORD[skin.image+24];
  498.         col_bg = DSDWORD[image_data];
  499.         panel_color  = DSDWORD[skin.w*4*4 + image_data];
  500.         border_color = DSDWORD[skin.w*4*7 + image_data];
  501.         wv_progress_bar.progress_color = DSDWORD[skin.w*4*10 + image_data];
  502.         $and col_bg, 0x00ffffff
  503.         $and panel_color, 0x00ffffff
  504.         $and border_color, 0x00ffffff
  505.         $and wv_progress_bar.progress_color, 0x00ffffff
  506. }
  507.  
  508. void DrawProgress()
  509. {
  510.         unsigned long btn;
  511.         if (http_transfer == 0) return;
  512.         if (wv_progress_bar.max) btn = address_box.width*wv_progress_bar.value/wv_progress_bar.max; else btn = 30;
  513.         DrawBar(address_box.left-2, address_box.top+15, btn, 2, wv_progress_bar.progress_color);
  514. }
  515.  
  516. void ClickLink()
  517. {
  518.         if (http_transfer > 0)
  519.         {
  520.                 StopLoading();
  521.                 history.back();
  522.         }
  523.  
  524.         strcpy(#URL, PageLinks.GetURL(PageLinks.active));      
  525.         //#1
  526.         if (URL[0] == '#')
  527.         {
  528.                 strcpy(#anchor, #URL+strrchr(#URL, '#'));              
  529.                 strcpy(#URL, history.current());
  530.                 WB1.list.first=WB1.list.count-WB1.list.visible;
  531.                 ShowPage();
  532.                 return;
  533.         }
  534.         //liner.ru#1
  535.         if (strrchr(#URL, '#')!=-1)
  536.         {
  537.                 strcpy(#anchor, #URL+strrchr(#URL, '#'));
  538.                 URL[strrchr(#URL, '#')-1] = 0x00;
  539.         }
  540.        
  541.         GetAbsoluteURL(#URL);
  542.        
  543.         if (UrlExtIs(".png")==1) || (UrlExtIs(".gif")==1) || (UrlExtIs(".jpg")==1) || (UrlExtIs(".zip")==1) || (UrlExtIs(".kex")==1)
  544.         || (UrlExtIs(".7z")==1) || (UrlExtIs("netcfg")==1)
  545.         {
  546.                 //notify(#URL);
  547.                 if (!strncmp(#URL,"http://", 7))
  548.                 {
  549.                         strcpy(#downloader_edit, #URL);
  550.                         CreateThread(#Downloader,#downloader_stak+4092);
  551.                 }
  552.                 else RunProgram("@open", #URL);
  553.                 strcpy(#editURL, history.current());
  554.                 strcpy(#URL, history.current());
  555.                 return;
  556.         }
  557.         if (!strncmp(#URL,"mailto:", 7))
  558.         {
  559.                 notify(#URL);
  560.                 strcpy(#editURL, history.current());
  561.                 strcpy(#URL, history.current());
  562.                 return;
  563.         }
  564.         OpenPage();
  565.         return;
  566. }
  567.  
  568.  
  569. char downloader_stak[4096];
  570. stop: