/******************************************************************************* Plugin Link Server part Version: 1.0 Author: Sebastien DENEUX Last update: 27/07/2001 *******************************************************************************/ /******************************************************************************* *******************************************************************************/ typeof class = S;; /* Plugin class name*/ /******************************************************************************* password answer *******************************************************************************/ fun cbAnswer(answ,ulist,z)= let z->[cli ui link linkParam] in if !strcmp answ "yes" then ( _DMSevent this cli strcatn class::".link."::link::nil linkParam nil; UsendMessage ui cli "resClick" "1" ) else if !strcmp answ "cancel" then nil else UsendMessage ui cli "resClick" "0" ;; /******************************************************************************* user has clicked on a link, ask for a password if needed, then run the event *******************************************************************************/ fun cbClick (ui, cli, action, param, z)= let CtoU cli -> user in let z -> [o password link linkParam] in if password!=nil then _DMSeventTag this user strcat class ".askPassword" password nil [mkfun3 @cbAnswer [cli ui link linkParam] 3600 0] else ( _DMSevent this cli strcatn class::".link."::link::nil linkParam nil; UsendMessage ui cli "resClick" "1" ) ;; /******************************************************************************* New object creation o -> Ob : object <- I : not used *******************************************************************************/ fun newOb (o) = /* instance params */ let hd UgetParam ObUi o "*password" -> password in let hd UgetParam ObUi o "link" -> link in let hd UgetParam ObUi o "param" -> linkParam in /* class params */ let switchstr PLUGparams thisplug link -> pluginParams in let atoi hd pluginParams -> needParam in let [o password link (if needParam then linkParam else nil)] -> z in UcbMessage ObUi o ["click" mkfun5 @cbClick z]::nil; 0 ;; /******************************************************************************* Function called when plugin is initialised file -> S : '*.plug' file name <- I : not used *******************************************************************************/ fun IniPlug (file) = set class=getInfo strextr _getpack _checkpack file "name"; PlugRegister class @newOb nil; 0 ;;