/* Scol Engine 5 - 2008/04/22 - B.Bourineau */ fun cbSendStat(curlobj, p, data, code)= let p -> [str url] in if (code == -1) then ( mutate p <- [(strcat str data) _]; 0; ) // download finished else if (code == 0) then ( _fooS strcatn ">>>>>>>>> Send stats response : "::url::": "::str::nil; 0; ) else ( _fooS strcatn ">>>>>>>>> Send stats error : "::url::" with code : "::(itoa code)::nil; 0; ); 0;; fun sendStats(id)= let (strextr _getpack _checkpack sVersionFile) -> lver in let btime htoi (getInfo lver "version") -> vd in let (getInfo lver "name") -> vn in let strcatn "id="::id::"&ver="::(strcatn vn::" - "::vd::nil)::nil -> params in let _CRcurlRequest _channel sStatsUrl -> objcurl in ( _SETcurlOption objcurl CURLOPT_HEADER 0; _SETcurlOption objcurl CURLOPT_FOLLOWLOCATION 1; _SETcurlOption objcurl CURLOPT_SSL_VERIFYPEER 0; _SETcurlOption objcurl CURLOPT_CONNECTTIMEOUT 5; if ((params == nil) || (!strcmp (strtrim params) "")) then nil else ( _SETcurlOption objcurl CURLOPT_POST 1; _SETcurlOptionS objcurl CURLOPT_POSTFIELDS params; ); _CALLcurlRequest objcurl @cbSendStat ["" sStatsUrl]; ); 0;; fun pubbyname(a,s)= let a->[x _ _] in !strcmp webtostr x webtostr s;; fun nameofpub(a)= let a->[x _ _] in x;; fun ipofpub(a)= let a->[_ port1 port2] in if port1==nil then if port2==nil then nil else strcatn "scol://applet:http://"::_hostIP::":"::(itoa port2)::"/"::(itoh4 port2)::"?X"::nil else strcatn "scol://"::_hostIP::":"::(itoa port1)::nil;; fun ipofpub2(a)= let a->[_ port1 port2] in if port1==nil && port2==nil then nil else strcatn "scol://"::_hostIP::":"::(nameofpub a)::nil;; fun searchpub(l,n)= if l==nil then nil else let l->[r nxt] in let search_in_list r.pubRun @pubbyname n -> x in ( if x==nil then searchpub nxt n else x );; fun searchpub2(l,n)= if l==nil then nil else let l->[r nxt] in let search_in_list r.pubRun @pubbyname n -> x in ( if x==nil then searchpub2 nxt n else r );; fun _resizeT(a,t,x,y)= _SIZEtext t x-2 y-2 1 1;; fun chgusm2(l,a,b,s,k)= if l==nil then if k then s::nil else nil else let l->[ll n] in let hd strextr ll -> [h [hh _]] in if (!strcmp h a)&&((b==nil)||(!strcmpi b substr hh 0 strlen b)) then s::chgusm2 n a b s 0 else ll::chgusm2 n a b s k;; fun chgusm(a,b,line)= _saveusmini linebuild chgusm2 (lineextr _loadusmini nil) a b line 1;; fun _showsetupwin(a,b)= showSetup 0; 0;; /*task menu right click*/ fun callmenu(a,b,c)= if c != 1 then nil else ( createmenus; _SETfocus nil; let _GETscreenPos->[x y] in _DRAWmenu nil contmenu x y PM_SCREEN|PM_RIGHT_ALIGN|PM_BOTTOM_ALIGN; ); 0;; /*task menu dbl click*/ fun dclicktask(a,b,c)= showAddressBar hd back; 0;; fun buildl(l)= if l==nil then nil else let l->[a n] in let buildl n -> res in if (!strcmp substr a 0 19 "locked/lang/master.")&&(!strcmp substr a (strlen a)-5 5 ".lang") then let hd getInfos strextr _getpack _checkpack a "LANGUAGE" -> s in if s==nil then res else [substr a 19 (strlen a)-24 s]::res else res;; fun insertstring(s,l,f)= if l==nil then s::nil else let exec f with [s hd l] -> res in if res==0 then insertstring s tl l f else if res<0 then s::l else (hd l)::insertstring s tl l f;; fun sort(l,f)= if l==nil then nil else insertstring hd l sort tl l f f;; fun cmpbyclear(x,y)= let x->[_ a] in let y->[_ b] in strcmp a b;; fun buildlanguages()= set languages = sort buildl _listoffiles "locked/lang" @cmpbyclear;; fun reinitloc()= buildlanguages; startloc "locked/lang/master"; _SETdefaultFont set font = _CRfont chn0 atoi loc "FONTSZ" 0 0 loc "FONT"; _SETtaskIconText icon strcat strcat loc "SE" " - " _versionname; 0;; fun launchmachine(n,r)= _newmachine n _getpack _checkpack n r 0; 0;; fun launchscript(n)= launchmachine n.nameScript n.rightsScript;; fun _launch(t,n)= launchscript n;; fun search_in_script(l,f,i)= if l==nil then nil else let l->[a n] in if exec f with [a i] then a else let search_in_script a.sonsScript f i -> b in if b!=nil then b else search_in_script n f i;; fun srvbyname(r,s)= if !strcmp r.nameScript s then 1 else 0;; fun srvbyclear(r,s)= if !strcmp r.clearScript s then 1 else 0;; fun runbychan(r,c)= if r.canalRun==c then 1 else 0;; fun runbyname(r,n)= if !strcmp r.nameRun n then 1 else if !strcmp r.nameRun strcat n " *" then 1 else 0;; fun rebuild2(l)= if l==nil then nil else let l->[a b] in if b==nil then a::nil else a::" "::rebuild2 b;; fun rebuild(l)= if l==nil then nil else let l->[a nxt] in if (nth_char hd a 0)=='> then let rebuild nxt -> [nxt2 q] in let mkScript[nil strcatn rebuild2 a nil nil q]-> s in let rebuild nxt2->[nxt3 qq] in [nxt3 s::qq] else if !strcmp hd a "<" then [nxt nil] else let rebuild nxt->[n q] in [n (mkScript[hd tl a hd a nil nil nil])::q];; fun servics()= let search_in_list customs @srvbyclear loc "STARTUP"->s in s.sonsScript;; fun launch(t,l)= if l==nil then _deltimer t else let l->[x n] in ( launch nil x.sonsScript; if x.nameScript!=nil then launchscript x else nil; if t==nil then set t=_starttimer _channel AutoStartDelay else nil; _rfltimer t @launch n; nil );; fun newstart(l,olds)= if l==nil then 0 else let l->[x n] in ( newstart x.sonsScript olds; let search_in_script olds @srvbyname x.nameScript -> s in if s==nil then launchscript x else nil; newstart n olds );; fun initcustserv()= let rebuild strextr _getpack _checkpack "locked/etc/custom.txt" ->[_ c] in set customs=c; set back=lineextr _getpack _checkpack "locked/etc/history.txt" ;; fun _select(t,r)= set current=r; _scriptc r.canalRun "_load \"locked/master2.pkg\"\niniwindow"; 0;; /*public*/ fun createpublic2(r,mpublic)= let ipofpub r -> url in _CBmenu (_APPitem chn0 mpublic ME_ENABLED strcat strcat nameofpub r " : " url) @_contact ipofpub r;; fun createpublic(r,mpublic)= apply_on_list r.pubRun @createpublic2 mpublic;; fun refreshpublic(m)= apply_on_list running @createpublic m;; /*custom*/ fun _destroycust(s)= if s==nil then 0 else let servics -> olds in ( _storepack s "locked/etc/custom.txt"; initcustserv; newstart servics olds; 0; );; fun _editcust(a,b)= inibook chn0 nil 300 300 loc "ESM" loc "ESM" @_destroycust _getpack _checkpack "locked/etc/custom.txt" 1 nil; 0;; fun createcustom(l,menu)= if l==nil then 0 else let l->[s nxt] in if s.nameScript==nil then let _APPpopup chn0 menu substr s.clearScript 1 1000 -> z in ( createcustom s.sonsScript z; createcustom nxt menu ) else let _APPitem chn0 menu ME_ENABLED s.clearScript -> z in ( _CBmenu z @_launch s; createcustom nxt menu; );; fun refreshcustom(m)= _CBmenu (_APPitem chn0 m ME_ENABLED loc "ESM") @_editcust ""; _APPitem chn0 m ME_SEPARATOR ""; createcustom customs m;; /*active*/ fun createactive(r,mactive)= if r.scriptRun==nil then let search_in_script servics @srvbyname r.nameRun -> s in if s==nil then nil else ( set r.scriptRun=s; set r.nameRun=strcat r.nameRun " *"; ) else if (search_in_script servics @srvbyname r.scriptRun.nameScript) != nil then nil else ( set r.scriptRun=nil; set r.nameRun=substr r.nameRun 0 (strlen r.nameRun)-2; ); if r.canalRun==nil then nil else let _APPitem chn0 mactive ME_ENABLED r.nameRun -> z in _CBmenu z @_select r;; fun refreshactive(m)= apply_on_list running @createactive m;; /*back*/ fun saveBack()= _storepack linebuild back "locked/etc/history.txt"; 0;; fun createback(name,mhistory)= let _APPitem chn0 mhistory ME_ENABLED name -> z in _CBmenu z @_contact name;; fun refreshback(m)= apply_on_list back @createback m;; /*about*/ fun labout(l)= if l==nil then nil else let l->[a b] in a::if b==nil then nil else ", "::labout b;; fun _about(a,b)= let (strextr _getpack _checkpack sVersionFile) -> lver in let (getInfo lver "name") -> vn in let btime htoi (getInfo lver "version") -> vd in _DLGMessageBox chn0 nil (loc "AB") strloc loc "AB2" vn::vd::_versionname::(btime _versiondate)::_hostIP::nil 0;; /*----------*/ // update interface url bar fun _settextsite(n)= 0;; fun contact(s,env)= if (!strcmp substr s 0 8 "https://")||(!strcmp substr s 0 7 "http://")||(!strcmp substr s 0 7 "file://")||(!strcmp substr s 0 6 "ftp://")||(!strcmp substr s 0 6 "rtsp://")||(!strcmp substr s 0 7 "mailto:") then ( _openbrowserhttp s; set numb=numb+1; 0; ) else ( _newmachine strcat "browser" itoa numb (strcat "_load \"locked/stduser.pkg\"\n" mkscript maincom [s rights env]) nil 0; set numb=numb+1; 0; ); if s!=nil && strcmp s "" then ( set back=[s cutlist back 10 s]; saveBack; ) else nil;; /*ressources*/ fun _destroyress(s)= if s==nil then nil else _saveressini s; 0;; fun _editress(a,b)= iniText chn0 nil 300 300 loc "RSE" loc "RSE" @_destroyress _loadressini; 0;; /*expert mode*/ fun _destroypart(s)= if s==nil then nil else _saveusmini s; 0;; fun _editpart(a,b)= iniText chn0 nil 300 300 loc "CFE" loc "CFE" @_destroypart _loadusmini nil; 0;; /*contact*/ fun _contact(t,n)= _settextsite n; contact n nil;; fun _gotosite(a,b)= _contact nil b; 0;; fun _startscript(x,s)= launchmachine s nil;; // voyager close fun _quit(a,b)= _DStaskIcon icon; _closemachine; 0;; fun addlinkmenu(a,z)= let z->[chn root] in match a with ( urlLink [n r] ->_CBmenu _APPitem chn root ME_ENABLED n @_gotosite r ) | ( scriptLink [n r] ->_CBmenu _APPitem chn root ME_ENABLED n @_startscript r );; fun _showurlwin(a, b)= showAddressBar hd back; 0;; fun _mnupdate(mnu, mode)= _checkUpdate mode; 0;; /*----------*/ /*menu taskIcon*/ fun createmenus()= let _CRpopupMenu chn0 -> root in ( // show url window _CBmenu _APPitem chn0 root ME_ENABLED loc "ADDRESSBAR" @_showurlwin 0; // open setup window _CBmenu _APPitem chn0 root ME_ENABLED loc "CONF" @_showsetupwin 0; refreshcustom _APPpopup chn0 root loc "ST"; /*start application*/ let _APPpopup chn0 root loc "ADV" -> adv in /*advanced*/ ( refreshpublic _APPpopup chn0 adv loc "SRV"; _APPitem chn0 adv ME_SEPARATOR ""; refreshactive _APPpopup chn0 adv loc "CONS"; _APPitem chn0 adv ME_SEPARATOR ""; _CBmenu (_APPitem chn0 adv ME_ENABLED loc "RSE") @_editress 0; _CBmenu (_APPitem chn0 adv ME_ENABLED loc "EXPERT") @_editpart 0; // TODO develloper mode check ); _APPitem chn0 root ME_SEPARATOR ""; // history refreshback _APPpopup chn0 root loc "HIS"; _APPitem chn0 root ME_SEPARATOR ""; // update _CBmenu (_APPitem chn0 root ME_ENABLED loc "CHKUPDATE") @_mnupdate 1; // about _CBmenu (_APPitem chn0 root ME_ENABLED loc "AB") @_about 0; _APPitem chn0 root ME_SEPARATOR ""; // close _CBmenu (_APPitem chn0 root ME_ENABLED loc "QUIT") @_quit 0; _DSmenu contmenu; set contmenu=root; _SETtaskIconMenu icon contmenu; 0; );; fun processpile(flags,l)= if l==nil then 0 else let l->[[com [arg1 [arg2 _]]] n] in ( if !strcmp com "goto" then ( contact arg1 nil; processpile flags n; ) else if !strcmp com "loadupdpkg" then ( _storepack arg2 arg1; processpile flags n; ) else if !strcmp com "startupd" then ( _openchannel nil strcatn (substr arg1 0 (strlen arg1)-1)::"\ "::(itoa flags)::"\n"::nil _envchannel _channel; processpile flags n; ) else processpile flags n; );; fun fullurl(srv,cport,req,first)= strcatn "http://"::srv::":"::(itoa if first then cport else portdef)::"/"::(itoh4 cport)::"?"::req::nil;; fun cbmain(inet,z,s,reason)= let z->[flags srv cport req napps first current] in if reason==0 then ( mutate z<-[_ _ _ _ _ _ strcat current s]; 0 ) else let strextr current -> l in if !strcmp hd hd l "ok" then ( /* if napps==nil then set firstping=1 else nil; */ processpile flags tl l; set pendingreq=0; ) else if first then ( _fooS "try again via std port"; startreq flags srv cport req napps 0; ) else ( _fooS "cannot reach server"; set pendingreq=0; if napps==nil then nil else set nbapps=nbapps+napps; );; fun cbStartReq (url, param, res) = _fooS "cbStartReq"; _fooS strcat "valeur de url :" url; _fooS strcat "valeur de res :" itoa res; let param -> [flags srv cport req napps first] in if !res then ( _fooS "cannot open url (connection error)"; set pendingreq = 0; if napps == nil then nil else set nbapps = nbapps + napps ) else let INETGetURL chn0 _fooS fullurl srv cport req first 0 @cbmain [flags srv cport req napps first nil] -> url in if url == nil then ( _fooS "cannot open url (inet error)"; set pendingreq = 0; if napps == nil then nil else set nbapps = nbapps + napps ) else nil;; /* flags=masque de 1 pour se reconnecter sur le dernier site après un update 2 pour afficher un message si aucune màj disponible */ fun startreq (flags, srv, cport, req, napps, first) = _fooS "startreq1"; set pendingreq = 1; _rflINETisConnected _fooS strcat "http://" srv @cbStartReq [flags srv cport req napps first]; // envoie la requete que si l'on est connecté au net (évite d'afficher la popup d'IE) 0;; fun requestn(n)= strcat "USE" strbuild ("tr"::(_getress "License")::nil):: ("n"::(itoa n)::nil):: nil;; fun htmlbin3(l,res)= if l==nil then res else let l->[x n] in htmlbin3 n ((nameofpub x)::(ipofpub2 x)::nil)::res;; fun htmlbin2(l,res)= if l==nil then res else let l->[a n] in htmlbin3 a.pubRun htmlbin2 n res;; fun htmlbin()= strcat http_headerb strbuild ("name"::(_getress "DefaultName")::nil)::htmlbin2 running nil;; fun htmldir3(l,res)= if l==nil then res else let l->[x n] in htmldir3 n ""::(nameofpub x)::"
"::res;; fun htmldir2(l,res)= if l==nil then res else let l->[a n] in htmldir3 a.pubRun htmldir2 n res;; fun htmldir()= strcatn http_header::"

"::(_getress "DefaultName")::" 's Scol Services


\n"::htmldir2 running nil;; fun htmlreq(con,name)= let searchpub running name -> x in strcat http_header if x==nil then if getservhttp==nil then "OFF" else exec getservhttp with [con name] else ipofpub x;; fun htmlreqbin(name)= let searchpub running name -> x in strcat http_headerb if x==nil then "OFF" else ipofpub x;; fun cbprox(inet,z,s,reason)= let z->[con url flag] in ( /*_fooS strcatn ">>>get "::(itoa strlen s)::" bytes from "::url::"("::(itoa reason)::")"::nil;*/ if reason==0 then ( HTTPsend con s; 0; ) else ( closeHTTPcon con; 0; ) );; fun cbclose_http(con,reqhttp)= INETStopURL reqhttp;; fun htmlproxy(com,url,con,req)= if (nth_char url 6)=='C then _logfile "proxy"::(getHTTPclientIP con)::nil else nil; if !strcmpi com "GET" then let INETGetURL chn0 strcatn "http://"::_hostIP::":"::(itoa htoi substr url 1 4)::url::nil 1 @cbprox [con url 0] -> httpreq in if httpreq==nil then "" else ( rflHTTPclose con @cbclose_http httpreq; nil; ) else let INETGetURLex chn0 com strcatn "http://"::_hostIP::":"::(itoa htoi substr url 1 4)::url::nil (substr req (4+strfind "\13\10\13\10" req 0) strlen req) 1 @cbprox [con url 0] -> httpreq in if httpreq==nil then "" else ( rflHTTPclose con @cbclose_http httpreq; nil; );; fun http_onrequest(con,x,req)= let hd strextr req -> l in let l->[com [url _]] in if ((nth_char url 0)=='/)&&((nth_char url 5)=='?) then htmlproxy com url con req else let webtostr substr url 0 8 -> url2 in if ((nth_char url2 0)=='/)&&((nth_char url2 5)=='?) then htmlproxy com strcat url2 substr url 8 strlen url con req else if (!strcmpi com "GET") then if !strcmp url "/" then htmldir else if !strcmp url "/?" then htmlbin else if !strcmp substr url 0 2 "/?" then htmlreqbin substr url 2 strlen url else htmlreq con substr url 1 strlen url else "";; /* lancement des serveurs HTTP */ fun launchHTTP(listport)= if listport==nil then 0 else let listport -> [p n] in ( startHTTPserver chn0 atoi p @http_onrequest nil; launchHTTP n; );; fun main(p)= // load the usmress.ini multiress strextr _loadressini; srand time; // load logmaster server _load "locked/stdsrvlog.pkg"; // set the voyager channel set chn0 = _channel; // get the ip index _setLocalIPnumber atoi _getress "localIPindex"; // start the localisation system reinitloc; /* _isFirstScol 2 si lancé en autostart, scol.exe /autostart 1 si c'est le premier usmwin, 0 sinon. */ // si le voyager n'est pas déja dans la liste des processus alors on tente d'ouvrir un port à partir du dernier port connu dans le usmuser.ini if (_getScolProcesses > 1) && ((!_isStartMode) || (_isFirstScol)) then ( _DStaskIcon icon; _closemachine; ) else ( // if the default 1200 port is already used we try to find an unused port if (_setserver _envchannel chn0 p "_load \"locked/stdsrvlog2.pkg\"")!=nil then nil else ( //$BB if two voyager are started immediatly (multi ax for example) the first test fail if (_isStartMode) then ( _DStaskIcon icon; _closemachine; ) else ( // known free ports set p = 49152; while (_setserver _envchannel chn0 p "_load \"locked/stdsrvlog2.pkg\"")==nil do ( set p = p + 4; ); 0; ); ); // default standar port (1200) set port = p; let strbuild ("port"::(itoa port)::nil)::nil -> lastport in chgusm "port" nil substr lastport 0 (strlen lastport)-1; // get the voyager debug mode set voyagerDebugMode = let _getress "voyagerDebugMode" -> n in if n==nil then 0 else atoi n; // get the voyager debug mode set iDevMode = let _getress "voyagerDevMode" -> n in if n==nil then 0 else atoi n; set bmpVoyagerIcon = _LDbitmap chn0 _checkpack if _platform==1 then sVoyagerIconPath else sVoyagerUnixIconPath; let (strextr _getpack _checkpack sVersionFile) -> lver in let (getInfo lver "name") -> vn in set icon = _CRtaskIcon2 chn0 bmpVoyagerIcon strcat strcat loc "SE" " - " vn; // init custom,history initcustserv; /* 2 si lancé en autostart, 1 si c'est le premier usmwin, 0 sinon. Dans le 2nd cas, le iniVoyager sera fait à la fin du splash, ainsi que la def de CB sur la taskIcon */ /* if _isFirstScol==2 then ( 0; ) else nil; */ _CBtaskIconClick icon @callmenu 0; _CBtaskIconDClick icon @dclicktask 0; // launch the autostart services app launch nil servics; // set the voyager ID and cache directory if (_getress "License") != nil then nil else chgress "License" strcat _getress "Origin" BigToAsc BigRand; // set the cache directory to the licence name _movecache _getress "License"; if (_getress "DefaultName") != nil then nil else chgress "DefaultName" strcat "Guest_" (itoa (mod rand 1000)); // init Local http server default port - 1 startHTTPserver chn0 p-1 @http_onrequest nil; launchHTTP getInfos (strextr _loadusmini nil) "porthttp"; set _masterchannel = chn0; if (_getress "voyagerStatistics") != nil then nil else chgress "voyagerStatistics" "1"; if (atoi (_getress "voyagerStatistics")) != 1 then nil else sendStats _getress "License"; if (_getress "voyagerUpdate") != nil then nil else chgress "voyagerUpdate" "1"; if (atoi (_getress "voyagerUpdate")) != 1 then nil else _checkUpdate 0; _logfile "******************** start ********************"::nil; 0; ); 0;; proto cbRetryClose = fun [Timer u0] I;; fun cbRetryClose(trm, p)= _deltimer trm; if ((sizelist running) > 0) || (iDevMode == 1) || (voyagerDebugMode == 1) || (wUpdateWindow != nil) then nil else ( if !iSetup then ( _DStaskIcon icon; _closemachine; ) else ( _rfltimer _starttimer _masterchannel 1000 @cbRetryClose nil; 0; ); ); 0;; fun _killedrun(r,x)= /* x!=1 si destruction forcee */ set running=remove_from_list running r; if cbkilled==nil then nil else exec cbkilled with [r x]; if x && r.scriptRun != nil && (_channeltime _channel)>20 then launchscript r.scriptRun else nil; if ((sizelist running) > 0) || (iDevMode == 1) || (voyagerDebugMode == 1) then nil else ( _rfltimer _starttimer _masterchannel 5000 @cbRetryClose nil; ); 0;; fun _killed(x)= let search_in_list running @runbychan _channel -> r in if r==nil then nil else _killedrun r x;; fun _closed()= _killed 1;; fun __norestart(x)= let search_in_list running @runbychan _channel -> r in ( set r.scriptRun=nil; set r.nameRun="norestart"; );; fun filter()= let _channelIP _channel -> ip in if (strcmp ip "127.0.0.1") && (strcmp ip _hostIP) && (strcmp ip "unplugged") then 1 else 0;; // correct url spaces fun correctUrl(s)= if ((strfindi "https://" s 0) != nil)||((strfindi "http://" s 0) != nil)||((strfindi "file://" s 0) != nil)||((strfind "ftp://" s 0) != nil) then ( let 0 -> pos in let " " -> from in let "%20" -> to in let strlen from -> fsize in let strlen to -> tsize in if ((fsize <= 0) || (tsize <= 0)) then s else while ((set pos = strfind from s pos) != nil) do set s = strcatn (substr s 0 pos)::to::(substr s (pos + fsize) ((strlen s) - pos))::nil; ) else nil; s;; fun __register(s)= if filter then nil else ( if !strcmp s "vgh" then nil else set nbapps=nbapps+1; if (!strcmp substr s 0 2 "__") && (nil!=search_in_list running @runbyname s) then _killchannel _channel else ( let search_in_script servics @srvbyname s -> p in set running=(mkRun[strcat s (if p==nil then "" else " *") _channel p nil nil currunnum])::running; set currunnum=currunnum+1; ); );; fun __setsite(s)= if filter then nil else _settextsite s;; fun __goto(s)= if filter then nil else ( _settextsite s; _closechannel; contact (correctUrl s) nil; _closed );; fun __gotoA(s)= if filter then nil else ( _closechannel; launchmachine (correctUrl s) nil; _closed );; fun __open(s)= if filter then nil else ( _settextsite s; contact (correctUrl s) nil );; fun __gotoR(s,r)= if filter then nil else ( _settextsite s; _closechannel; contact (correctUrl s) r; _closed );; fun _openR(s,r)= if filter then nil else ( _settextsite s; contact (correctUrl s) r );; fun __public(s,p)= if filter then nil else let search_in_list running @runbychan _channel -> r in ( if (sizelist r.pubRun)>9 then nil else set r.pubRun=[s p nil]::r.pubRun; if cbpublic==nil then nil else exec cbpublic with [s p]; );; fun __publicHTTP(s,p)= if filter then nil else let search_in_list running @runbychan _channel -> r in ( if (sizelist r.pubRun)>9 then nil else set r.pubRun=[strcat s "-via_http" nil p]::r.pubRun; if cbpublichttp==nil then nil else exec cbpublichttp with [s p]; );; /* fun localinfos2(x,a)= let x->[name _ http] in _on _channel Cservice [name ipofpub2 x];; */ fun localinfos2(x, param)= // iri let param -> [r ip] in let x -> [name porttcp porthttp] in let if (porttcp == nil) && (porthttp == nil) then nil else if porttcp == nil then itoa porthttp else itoa porttcp -> p in let strcatn "scol://" :: ip :: ":" :: p :: nil -> adr in _on _channel Cservice [name adr];; fun localinfos(r,ip)= apply_on_list r.pubRun @localinfos2 [r ip];; fun __infos(ip)= apply_on_list running @localinfos ip;; fun __getserv(s)= let searchpub running s -> x in if x==nil && getservdirect!=nil then exec getservdirect with [s] else ( _on _channel Cservis [s ipofpub x]; if getservis!=nil then exec getservis with [s] else nil; );; fun _addc(x,s,r)= if r then ( _storepack strcat s _getpack _checkpack "locked/etc/custom.txt" "locked/etc/custom.txt"; initcustserv; 0; ) else nil;; fun __addcustom(s)= if filter || (search_in_script customs @srvbyname s)!=nil then nil else _DLGrflmessage _DLGMessageBox chn0 nil loc "ADSRV" strloc loc "ADSM" s::nil 2 @_addc s;; fun _addres(x,s,r)= if r then let s->[a b] in chgress a b else nil;; fun __address(a,b)= if filter then nil else _DLGrflmessage _DLGMessageBox chn0 nil loc "ADRS" strloc loc "ADRS?" a::b::nil 2 @_addres [a b];; fun __restartUpd(adr)= if filter then nil else ( /* fermeture du client */ _closechannel; // Bastien rappel la fonction d'update simple _checkUpdate 1; );; fun __addHistory(s)= _settextsite s; if s!=nil && strcmp s "" then ( set back=[s cutlist back 10 s]; saveBack; ) else nil; 0;;