/* Banner Server - DMS - feb 98 - by Sylvain HUET */ defcom Cbanner=banner S;; defcom Cedit=edit;; typeof clis=[CLIENT r1];; typeof edit=[CLIENT r1];; typeof texts=S;; var save=0;; typeof dmifile=S;; fun sendbanner(c,s)= if s==nil then nil else let strlen s -> sz in (let 0->i in while i[a n] in if strcmp hd a "banner" then a::chgbanner n else ("banner"::texts::nil)::chgbanner n;; fun broad(x,s)=_DMSsend this x s;; fun __banner(s0)= if !findList edit DMSsender then nil else let munzip s0 -> s in (set texts=s; if save then _storepack strbuild chgbanner strextr _getpack _checkpack dmifile dmifile else nil; apply_on_list clis @sendbanner s; _DMSevent this nil "log" strcatn "banner_changed_by "::(_DMSgetLogin DMSsender)::nil nil);; fun logout(cli)= set clis=remove_from_list clis cli; set edit=remove_from_list edit cli; _DMSevent this cli "destroyed" nil nil; 0;; fun activate(from,cli,action,param,rep)= if !strcmp action "start" then if _DMScreateClientDMI this cli nil then (set clis=cli::clis; sendbanner cli texts; _DMSevent this cli "entering" nil nil) else nil else if !strcmp action "destroy" then if _DMSdelClientDMI this cli then logout cli else nil else if !strcmp action "edit" then (_DMSsend this cli Cedit[]; if findList edit cli then nil else if !_DMSclientAlive cli then nil else (set edit=cli::edit;0)) else nil;; fun IniDMI(file)= set dmifile=file; let strextr _getpack _checkpack file ->l in (set texts=getInfo l "banner"; set save=atoi getInfo l "save"); _DMSregisterDMI this @activate nil @logout nil;;