File IvoRSS.hws changed (mode: 100755) (index 17efb1b..cccab73) |
21 |
21 |
;@INCLUDE "feeds.hws" |
;@INCLUDE "feeds.hws" |
22 |
22 |
|
|
23 |
23 |
@INCLUDE "feedtree.hws" |
@INCLUDE "feedtree.hws" |
|
24 |
|
@INCLUDE "lurk.hws" |
24 |
25 |
@INCLUDE "IvoR.hws" |
@INCLUDE "IvoR.hws" |
25 |
26 |
|
|
26 |
27 |
@BRUSH 1, "128px-Feed-icon.png", {LoadAlpha=True, ScaleHeight=32, ScaleWidth=32} |
@BRUSH 1, "128px-Feed-icon.png", {LoadAlpha=True, ScaleHeight=32, ScaleWidth=32} |
|
... |
... |
Function p_MUIEvent(msg) |
187 |
188 |
Case "stopbtn": |
Case "stopbtn": |
188 |
189 |
p_Unlock() |
p_Unlock() |
189 |
190 |
|
|
|
191 |
|
Case "herewegobtn": |
|
192 |
|
p_StartLurk() |
|
193 |
|
Case "stoplurkbtn": |
|
194 |
|
lurk.PleaseStop = True |
|
195 |
|
|
|
196 |
|
|
|
197 |
|
|
190 |
198 |
EndSwitch |
EndSwitch |
191 |
199 |
EndSwitch |
EndSwitch |
192 |
200 |
EndFunction |
EndFunction |
|
... |
... |
Function p_Unlock() |
323 |
331 |
EndFunction |
EndFunction |
324 |
332 |
|
|
325 |
333 |
|
|
|
334 |
|
Function p_StartLurk() |
|
335 |
|
mui.Set("herewegobtn", "Disabled", True) |
|
336 |
|
mui.Set("stoplurkbtn", "Disabled", False) |
|
337 |
|
lurk.PleaseStop = False |
|
338 |
|
|
|
339 |
|
lurk:Explore(mui.Get("websource", "Contents")) |
|
340 |
|
|
|
341 |
|
mui.Set("stoplurkbtn", "Disabled", True) |
|
342 |
|
mui.Set("herewegobtn", "Disabled", False) |
|
343 |
|
EndFunction |
|
344 |
|
|
|
345 |
|
|
|
346 |
|
|
326 |
347 |
|
|
327 |
348 |
|
|
328 |
349 |
mui.CreateGUI(ReadString(1)) |
mui.CreateGUI(ReadString(1)) |
|
... |
... |
InstallEventHandler({MUIRoyale = p_MUIEvent}) |
331 |
352 |
p_StartUpLoading() |
p_StartUpLoading() |
332 |
353 |
|
|
333 |
354 |
|
|
334 |
|
|
|
335 |
355 |
Repeat |
Repeat |
336 |
356 |
WaitEvent |
WaitEvent |
337 |
357 |
Forever |
Forever |
File lurk.hws added (mode: 100755) (index 0000000..f1ecf17) |
|
1 |
|
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
lurk = {PleaseStop=True} |
|
5 |
|
;č jako v celé té appce i zde se pevně zavážeme |
|
6 |
|
;č na struktury grafického rozhraní a jejich metody, |
|
7 |
|
;č na MUI Royale. |
|
8 |
|
;č předělávání nás tedy bude bolet... |
|
9 |
|
|
|
10 |
|
|
|
11 |
|
Function lurk:set_status(s$) |
|
12 |
|
mui.Set("lurkstatus", "Contents", s$) |
|
13 |
|
EndFunction |
|
14 |
|
|
|
15 |
|
Function lurk:Replay(err_code, msg$) |
|
16 |
|
self:set_status( |
|
17 |
|
IIf(err_code = #ERR_NONE, msg$, "\27b" .. GetErrorName(err_code))) |
|
18 |
|
EndFunction |
|
19 |
|
|
|
20 |
|
;č tohle nejde udělat jako method - |
|
21 |
|
;č volající kód by asi musel ho i správně volat |
|
22 |
|
Function lurk_callback(t) |
|
23 |
|
If t.Action = #DOWNLOADFILE_STATUS |
|
24 |
|
lurk:set_status(t.Count .. "/" .. t.Total .. " read from " .. t.UserData) |
|
25 |
|
CheckEvents() ; keep MUI responsive |
|
26 |
|
Return(lurk.PleaseStop) |
|
27 |
|
EndIf |
|
28 |
|
EndFunction |
|
29 |
|
|
|
30 |
|
|
|
31 |
|
;č stáhnout soubor |
|
32 |
|
Function lurk:Explore(url$) |
|
33 |
|
self.PleaseStop = False |
|
34 |
|
;č zjednodušená kontrola, pokud řetězec obsahuje procenta, |
|
35 |
|
;č považujeme ho za "eskejpnutý". |
|
36 |
|
;č Na případ, kdy uživatel strčí do URLu osamělý znak procenta vysereme |
|
37 |
|
;FindStr(s$, "%") <> -1 |
|
38 |
|
Local err_code, html$, count = ?DownloadFile(url$, |
|
39 |
|
{Adapter="hurl", Fail404=True, Encoded=FindStr(url$, "%") <> -1}, |
|
40 |
|
lurk_callback, url$) |
|
41 |
|
If self.PleaseStop |
|
42 |
|
self:set_status("interrupted") |
|
43 |
|
Return() |
|
44 |
|
EndIf |
|
45 |
|
If err_code = #ERR_NONE |
|
46 |
|
self:set_status(count .. "bytes from " .. url$ .. " transmitted") |
|
47 |
|
|
|
48 |
|
Else |
|
49 |
|
self:set_status("\27b" .. GetErrorName(err_code)) |
|
50 |
|
EndIf |
|
51 |
|
EndFunction |