/* Ignore Server - DMS - Apr 99 - by Christophe LOREK */ /* rev Apr 00 - by Sebastien DENEUX */ typeof clis = [CLIENT r1];; typeof ignoreBroadClis=[CLIENT r1];; defcom Cregister = register I S S;; defcom CsendClis = sendClis S;; defcom CdelCli = delCli I S;; defcom CtestMsg = testMsg S S;; defcom CupdateIgnList = updateIgnList S S;; defcom Cchglogin = chglogin S S;; defcom CignoreBroad = ignoreBroad I I S;; /* create a list of name and Id of the clients */ fun ClientNameList(CliList)= if CliList == nil then nil else let CliList -> [currentcli NCliList] in ((itoa _DMSgetId currentcli)::(_DMSgetLogin currentcli)::nil)::(ClientNameList NCliList);; fun broad(cli,comm)= _DMSsend this cli comm;; fun logout(cli)= set ignoreBroadClis = remove_from_list ignoreBroadClis cli; set clis = remove_from_list clis cli; apply_on_list clis @broad CdelCli [(_DMSgetId cli) (_DMSgetLogin cli)]; _DMSevent this cli "destroyed" nil nil;; fun activate(from,cli,action,param,rep)= if !strcmp action "Start" then ( _DMScreateClientDMI this cli param; _DMSsend this cli CsendClis [strbuild ClientNameList clis]; apply_on_list clis @broad Cregister [(_DMSgetId cli) (_DMSgetLogin cli) linebuild "0"::"0"::"0"::"0"::"0"::"0"::"0"::nil ]; set clis = cli::(remove_from_list clis cli); 0 ) else if !strcmp action "!changeLogin" then ( apply_on_list clis @broad Cchglogin [param (_DMSgetLogin cli)]; 0 ) else if !strcmp action "hear" then ( apply_on_list clis @broad CtestMsg [(_DMSgetLogin cli) param ]; 0 ) else if !strcmp action "Show" then 0 else if !strcmp action "Hide" then 0 else if !strcmp action "ignoreBroad" then ( apply_on_list clis @broad CignoreBroad [1 _DMSgetId cli _DMSgetLogin cli]; set ignoreBroadClis=cli::(remove_from_list ignoreBroadClis cli); 0 ) else if !strcmp action "unIgnoreBroad" then ( apply_on_list clis @broad CignoreBroad [0 _DMSgetId cli _DMSgetLogin cli]; set ignoreBroadClis=remove_from_list ignoreBroadClis cli; 0 ) else nil;; /*----------------*/ fun broad2(e,cli)=_DMSsend this cli CignoreBroad [1 _DMSgetId e _DMSgetLogin e];; /*----------------*/ fun __registered()= apply_on_list ignoreBroadClis @broad2 DMSsender; /*send new client current ignored users*/ 0;; fun IniDMI(file)= _DMSregisterDMI this @activate nil @logout nil;;