/* Photo Server - DMS - mar 00 - by Sylvain HUET */ struct Pho=[workPho:S,signPho:S,transPho:S]mkPho;; fun logout(ui)= _RSunregister this itoa UgetId UgetUser ui; 0;; fun cbTrans(ui,cli,act,param,p) = /*sd*/ if cli!=UtoC UgetUser ui then nil else set p.transPho=param; 0 ;; fun cbAddbmp(ui,cli,act,s,p)= if cli!=UtoC UgetUser ui then nil else if s==nil then set p.workPho="" else if strlen s then ( set p.workPho= let strcat p.workPho s -> ns in if (strlen ns)<16384 then ns else "" ) else let itoa UgetId UgetUser ui -> name in let _getlongname p.workPho "face" "#" -> sign in ( _storepack p.workPho strcat "tmp/photo/srv" sign; _RSunregister this name; _RSregister this name 0 p.workPho; set p.workPho=nil; set p.signPho=strcat "tmp/photo/" sign; _DMSeventTag this UgetUser ui "changed" nil nil nil; nil ); 0;; fun cbGetsign(ui,cli,act,param,p) = UsendMessage ui cli "set" strbuild ("sign"::p.signPho::nil)::("trans"::p.transPho::nil)::nil /*sd*/ ;; fun reguser(u)= let UcreateUI this u nil nil treeNew nil nil -> ui in let mkPho [nil nil nil] -> p in (UcbDelete ui @logout; UcbMessage ui ["trans" mkfun5 @cbTrans p]::["add" mkfun5 @cbAddbmp p]::["get" mkfun5 @cbGetsign p]::nil);; /*sd*/ /* client part has been started */ fun __register()= reguser CtoU DMSsender ;; fun start(u, param)= _DMScreateClientDMI this UtoC u param ;; fun Astart (from, u, action, param, ulist, tag) = start u nil;; fun start2(cli,action)=start CtoU cli nil;; fun IniDMI(param)= _DMSdefineActions this ["start" @Astart]::nil; _DMShookInactiveClientActions this ["getPhoto" @start2]::["show" @start2]::nil ;;