/* module showIp - part server */ /* by iri : info@irizone.net - version 1.0 - 01/2004 */ /* by iri : info@irizone.net - version 2.0 - 02/2004 */ /* version 1.0 : IP, version 2.0 : IP + "Autokill" */ typeof adrIP = ObjText;; typeof tempsSaisie = ObjText;; typeof tempsCombo = ObjBox;; typeof shutCheck = ObjCheck;; typeof tempsAffich = ObjRichText;; typeof winchild = ObjWin;; typeof sd = I;; typeof total = I;; typeof bmpAide = ObjBitmap;; typeof bmpOk = ObjBitmap;; fun aide(a, b)= let _CRwindow _channel winchild nil nil 200 100 WN_DOWN|WN_MENU "HELP !" -> winAide in _SETtext _CRtext _channel winAide 0 0 200 100 ET_AVSCROLL|ET_VSCROLL "" (_loc this "HELP" nil);; fun defcombo()= _ADDcombo tempsCombo 2 "mn"; _ADDcombo tempsCombo 3 "h"; _SSELcombo tempsCombo "h";; fun end(s)=_closemachine;; fun _resizeI(x,s)= let x->[win x y w h] in _SIZEtext adrIP w h x y; 0;; fun broadMsg(s)= _DMSeventTag this nil "msg" s nil nil;; fun stopSrv()= _DMSeventTag this nil "shutdown" nil nil nil;; fun vert()= make_rgb 0 255 0;; fun rouge()= make_rgb 255 0 0;; fun msg(color, s)= _SETbkgColorRichText tempsAffich color; _SETtextRichText tempsAffich s "Arial" 7 0 3;; fun whatmsg(mn, h)= strcatn (_loc this "MSG" nil)::" ["::(itoa h)::"h "::(itoa mn)::"mn]"::nil;; fun _temps(t, u)= _SETtext adrIP strcat "IP : " _hostIP; if total != nil then ( set total = total - 1; msg vert strcatn "Reste "::(itoa total)::" minutes"::nil; if total == 2 && sd then let localtime time -> [_ mn h _ _ _ _ _] in broadMsg whatmsg mn h else if total == 0 then if sd then stopSrv else nil else if total < 0 then ( msg rouge strcatn "Depuis "::(itoa total)::" minutes"::nil; 0 ) else 0; ) else 0;; fun calcTps(t, ref)= if !strcmp ref "h" then set total = t*60 else if !strcmp ref "mn" then set total = t else set total = nil; msg vert strcatn "Reste "::(itoa total)::" minutes"::nil; 0;; fun cbOK(button, p)= msg vert "Illimité"; let atoi _GETtext tempsSaisie -> temps in let _GETcombo tempsCombo -> [i ref] in let _GETcheck shutCheck -> sdown in ( if temps == 0 then set total = nil else calcTps temps ref; set sd = sdown ); 0;; fun cbShow()= let _DMSgetZone this "ip" nil @_resizeI @end ->[win x y w h] in if win==nil then ( set winchild = _CRwindow _channel DMSwin nil nil 130 50 WN_DOWN|WN_MENU "adresse IP"; set adrIP = _CRtext _channel winchild 0 0 130 23 ET_DOWN|ET_ALIGN_LEFT strcat "IP : " _hostIP; set tempsSaisie = _CReditText _channel winchild 0 25 95 23 ET_DOWN|ET_ALIGN_LEFT|ET_DOWN "0"; set tempsCombo = _CRcombo _channel winchild 100 50 25 50 CB_NOEDIT|CB_DOWN "h"; defcombo; _CRtext _channel winchild 0 75 100 23 ET_ALIGN_LEFT "Shutdown auto ? :"; set shutCheck = _CRcheck _channel winchild 105 75 15 15 CH_DOWN ""; _CBbutton _CRbuttonBitmap _channel winchild bmpOk 0 100 110 23 0 @cbOK 0; _CBbutton _CRbuttonBitmap _channel winchild bmpAide 110 100 20 20 0 @aide 0; set tempsAffich = _CRrichText _channel winchild 0 125 130 25 ET_ALIGN_LEFT|ET_DOWN "Illimité"; ) else ( set winchild = win; set adrIP = _CRtext _channel win x y w (h/5) ET_DOWN|ET_ALIGN_LEFT strcat "IP : " _hostIP; set tempsSaisie = _CReditText _channel win x y+h/5 w/2 h/5 ET_DOWN|ET_ALIGN_LEFT|ET_DOWN "0"; set tempsCombo = _CRcombo _channel win x+w/2 y+h/5 w/2 70 CB_NOEDIT|CB_DOWN "h"; defcombo; _CRtext _channel win x y+(2*h/5) w-30 h/5 ET_ALIGN_LEFT "Shutdown auto ? :"; set shutCheck = _CRcheck _channel win x+w-25 y+(2*h/5) 15 15 CH_DOWN ""; _CBbutton _CRbuttonBitmap _channel win bmpOk x y+(3*h/5) w-20 h/5 0 @cbOK 0; _CBbutton _CRbuttonBitmap _channel win bmpAide x+w-20 y+(3*h/5) 20 h/5 0 @aide 0; set tempsAffich = _CRrichText _channel win x y+(4*h/5) w h/5 ET_ALIGN_LEFT|ET_DOWN "Illimité" ); _rfltimer _starttimer _channel 60000 @_temps 0; 0;; fun close()= _closemachine; 0;; fun IniDMI(param)= let _DMSgetDef this "dmi" -> defBMP in (set bmpAide = _LDjpeg _channel _checkpack getInfo defBMP "bmpAide"; set bmpOk = _LDjpeg _channel _checkpack getInfo defBMP "bmpOk"); cbShow; _DMSregisterDMI this nil nil nil @close;;