/******************************************************************************* Plugin Image Server part Version: 1.0 Authors: Laurent Plumat, Jeremy GIAIME Last update: 27/06/2001 Image Plugin *******************************************************************************/ struct Tdata = [ reload : Timer, /*time before relaoding */ imageName : S /* picture name*/ ]mkData;; typeof class = S;; /* Plugin class name (here is template) */ /******************************************************************************** function wich find what to do *********************************************************************************/ fun Analyse (type ,o ,z) = if !strcmpi type "url" then UsendMessage ObUi o nil "UrlReady" z.imageName else if !strcmpi type "file" then let _getpack _checkpack z.imageName -> string in ( _RSunregister this z.imageName; _RSregister this z.imageName RScontrol string; UsendMessage ObUi o nil "BitmapReady" z.imageName; ) else nil; 0 ;; /*********************************************************************************** callback to call Analyse with the good parameter t -> timer param -> parameter ************************************************************************************/ fun cbAnalyse (t, param)= let param -> [type o z] in Analyse type o z ;; /*********************************************************************************** fonction to refresh the picture o -> l -> [S I Tdata] ************************************************************************************/ fun refresh (o,l) = let l -> [type rate z] in if (rate) < 2000 then nil else if z.reload == nil then set z.reload = _rfltimer _starttimer _channel rate @cbAnalyse [type o z] else nil; 0 ;; /******************************************************************************* Callback o -> objAnchor : anchor from -> cli -> CLIENT :client action -> S : action param -> S : picture on a content type reply -> z -> *******************************************************************************/ fun cbshowImage(o, from, cli, action, param, reply, z)= let strextr param -> l in let getInfo l "type" -> type in let getInfo l "rate" -> rate in ( set z.imageName = getInfo l "value"; if z.reload == nil then nil else ( _deltimer z.reload; set z.reload = nil ); Analyse type o z; if rate == nil then nil else refresh o [type atoi rate z]; 0 ) ;; /******************************************************************************* New object creation o -> Ob : object <- I : not used *******************************************************************************/ fun newOb(o)= let hd UgetParam ObUi o "type" -> type in let hd UgetParam ObUi o "value" -> value in if !strcmp type "file" then let _getpack _checkpack value -> string in ( _RSunregister this value; _RSregister this value RScontrol string ) else nil; let mkData [nil nil] -> z in ObRegisterAction o (strcatn (ObName o)::".showImageALL"::nil) mkfun7 @cbshowImage z; 0 ;; /******************************************************************************* Plugin initialisation, the PlugRegister function has to be called at the end file -> S : '*.plug' file name <- I : not used *******************************************************************************/ fun IniPlug(file)= set class=getInfo strextr _getpack _checkpack file "name"; PlugRegister class @newOb nil; 0 ;;