/* Snapshot Plugin - DMS - September 99 - by Sylvain HUET */ /* rev. April 00 - by Sébastien DENEUX */ typeof class=S;; fun sendPhoto(a,b)= let b-> [ui sign] in UsendCli this a ui "PhotoChg" sign;; fun addbitmap(ui,z,s)= let z->[o cur sign file reg] in if s!=nil then (mutate z<-[_ if cur!=nil && (strlen cur)>40000 then cur else strcat cur s _ _ _]; 0) else let munzip cur -> fs in let _getlongname fs "face" "#" -> sign in ( _RSunregister this file; _RSregister this file RScontrol fs; mutate z<-[_ nil sign _ _]; if !strcmpi hd UgetParam ObUi o "registeredClientsOnly" "yes" then /*send only to the clients that have registered*/ apply_on_list reg @sendPhoto [ui sign] else UsendCli this nil ObUi o "PhotoChg" sign; /*send to all clients*/ nil);; fun cbcomm(ui,cli,action,param,z)= let z->[o _ sign file _] in if !strcmp action "addPhoto" then addbitmap ui z param else if !strcmp action "Name?" then UsendCli this cli ui "setName" file else if !strcmp action "Photo?" then UsendCli this cli ui "PhotoChg" sign else nil;; fun cbdel(ui,file)= _RSunregister this file; 0;; fun reset(o,from,cli,action,param,reply,z)= mutate z <- [o nil nil _ _]; 0;; fun register(o,from,cli,action,param,reply,z)= let z -> [_ _ _ _ reg] in mutate z <- [_ _ _ _ cli::(remove_from_list reg cli)]; UsendCli this cli ObUi o "registered" nil; 0;; fun unregister(o,from,cli,action,param,reply,z)= let z -> [_ _ _ _ reg] in mutate z <- [_ _ _ _ (remove_from_list reg cli)]; 0;; fun cbdelcli(ui,cli,z)= let z -> [_ _ _ _ reg] in mutate z <- [_ _ _ _ (remove_from_list reg cli)]; 0;; fun newOb(o)= let strcat "tmp/snap/" substr _getlongname strcat (substr this.fileDMI 0 (strfind "." this.fileDMI 1)) (ObName o) "" "#" 1 8 -> s in let [o nil nil s nil] -> z in ( if !strcmpi hd UgetParam ObUi o "registeredClientsOnly" "yes" then (ObRegisterAction o strcat ObName o ".register" mkfun7 @register z; ObRegisterAction o strcat ObName o ".unregister" mkfun7 @unregister z) else (ObRegisterAction o strcat ObName o ".register" nil; /*necessary for the moment*/ ObRegisterAction o strcat ObName o ".unregister" nil); ObRegisterAction o strcat ObName o ".reset" mkfun7 @reset z; UcbComm this ObUi o mkfun5 @cbcomm z; UcbDel this ObUi o mkfun2 @cbdel s; UcbDelCli this ObUi o mkfun3 @cbdelcli z; 0 );; fun IniPlug(file)= set class=getInfo strextr _getpack _checkpack file "name"; PlugRegister class @newOb nil; 0;;