/* Photo3 Server - DMS - march 99 - by Sylvain HUET */ /* modified 20th Apr by Christophe LOREK */ defcom CgetPlugin=getPlugin I S;; defcom CsetSign=setSign I S I;; defcom Cex=ex;; var type="Photo3";; struct Pho=[cliPho:CLIENT,idPho:I,workPho:S,signPho:S,transPho:I]mkPho;; typeof clis=[Pho r1];; fun cliByCli(x,c)=x.cliPho==c;; fun cliById(x,id)=x.idPho==id;; fun logout(cli)= _RSunregister this itoa _DMSgetId cli; set clis=remove_from_list clis search_in_list clis @cliByCli cli; 0;; fun activate(from,cli,action,param,rep)= if !strcmp action "start" then _DMScreateClientDMI this cli nil else if !strcmp action "start_show" then _DMScreateClientDMI this cli "" else if !strcmp action "ex" then (_DMSsend this cli Cex []; logout cli) else if !strcmp action "getPlugin" then (_DMScreateClientDMI this cli nil; _DMSsend this cli CgetPlugin [_DMSgetHandle from rep]) else nil;; fun IniDMI(param)= _DMSregisterDMI this @activate @logout nil nil;; fun __getSign(id)= let search_in_list clis @cliById id -> q in _DMSsend this DMSsender CsetSign [id q.signPho q.transPho];; fun __trans(f)= let search_in_list clis @cliByCli DMSsender -> q in let if q!=nil then q else let mkPho[DMSsender DMSsender.idCLI "" nil nil] -> r in (set clis=r::clis;r) -> p in set p.transPho=f;; fun __addbitmap(s)= let search_in_list clis @cliByCli DMSsender -> q in let if q!=nil then q else let mkPho[DMSsender DMSsender.idCLI "" nil nil] -> r in (set clis=r::clis;r) -> p in 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 _DMSgetId DMSsender -> 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; _DMSsetress DMSsender "Avatar" type; _DMSevent this DMSsender "changed" nil nil; nil) ;;