/******************************************************************************* Module SoundAlert Server part Version: 3.1 Authors: Marc BARILLEY & Sebastien DENEUX Last update: 21/05/2001 Sound Module *******************************************************************************/ /******************************************************************************* *******************************************************************************/ defcom Calert=alert S;; typeof alert = [[S S] r1];; /* file alias */ typeof ll = [CLIENT r1];; fun alertByAlias (x, al)= let x -> [_ alias] in !strcmp alias al ;; fun broad (a, c)= _DMSsend this a c ;; /*fun rflMulti (multi, x, mode)= if mode == MEDIA_MODE_STOP then _DSmulti multi else nil ;;*/ fun fireAlrt (file)= apply_on_list ll @broad Calert [file] /*let _CRmulti _channel DMSwin 0 0 0 0 _checkpack file nil -> multi in if multi==nil then nil else ( _SETmultiReflexMode multi @rflMulti 0; _PLAYmulti multi; apply_on_list ll @broad Calert [file]; ); 0*/ ;; fun unregister (cli)= if is_in_list ll cli then ( set ll=remove_from_list ll cli; _DMSevent this cli "destroyed" nil nil ) else nil ;; fun getAlrt(l)= if l==nil then nil else let l->[q n] in if !strcmp hd q "alert" then let hd tl q -> name in ( _RSregister this name 1 name; [name hd tl tl q]::getAlrt n ) else getAlrt n ;; fun activate (from, cli, action, param, rep)= if !strcmp action "start" then if (!_DMSclientAlive cli)|| is_in_list ll cli then nil else ( _DMScreateClientDMI this cli nil; set ll=cli::ll; _DMSevent this cli "entering" nil nil ) else if !strcmp action "destroy" then if !is_in_list ll cli then nil else ( _DMSdelClientDMI this cli; set ll=remove_from_list ll cli; _DMSevent this cli "destroyed" nil nil ) else ( let search_in_list alert @alertByAlias action -> [file alias] in if file==nil then nil else ( fireAlrt file; _DMSevent this cli alias nil nil ) ) ;; fun IniDMI(param)= _DMSregisterDMI this @activate nil @unregister nil; let strextr _getpack _checkpack param ->l in set alert=getAlrt l ;;