/* TermColor - DMS - Aug 99 - by Sebastien DENEUX*/ /* add choice textColorEditLine - by iri - june 2003 - colorTerm 2.2 */ /* add choice otherColorText - by iri - september 2003 - colorTerm 2.3 */ /* add button "away" - by arkeon - october 2003 - colorTerm 2.3 */ defcom Chear=hear S;; defcom ChearInfoMsg=hearInfoMsg S;; /*info color msg*/ defcom CgetFocus=getFocus;; defcom CchangeClientInfos=changeClientInfos S S I S I;; /*send client informations (login, newLogin, textColor, font, changeFlag)*/ defcom CLogout=logout S;;/*advise all clients that a client has logged out*/ typeof clis=[[CLIENT DMI S S I] r1];; /*[CLIENT DMI REPLY LANGUAGE COLOR]*/ typeof backColor=S;; typeof loginNameColor=S;; typeof ActionsMsgColor=S;; typeof System1MsgTextColor=S;; typeof System2MsgTextColor=S;; typeof usersMsgColors=S;; typeof defOtherUser1MsgTextColor=S;; typeof defOtherUser2MsgTextColor=S;; typeof defaultMacrosFile=S;;/*default SCS site macros file*/ /* begin iri */ typeof textColorEditLine=S;; typeof otherColorText=S;; /* end iri */ typeof awayCheck=S;; /* Arkeon */ /*-------------*/ fun bycli(x,c)=let x->[a _ _ _ _] in a==c;; /*-------------*/ fun broad(x,s)=let x->[a _ _ _ _] in _DMSsend this a s;; /*-------------*/ fun logout(cli)= let search_in_list clis @bycli cli -> c in if c==nil then nil else ( set clis=remove_from_list clis c; apply_on_list clis @broad CLogout [_DMSgetLogin cli];/*advise all clients that a client has logged out (used for msg colors)*/ _DMSevent this cli "destroyed" nil nil ) ;; /*-------------*/ /*advise all clients that a client msg color has changed*/ /*keep in a list the changes (will be sent when a new user logs in*/ fun __changeColor(co)= let search_in_list clis @bycli DMSsender -> e in mutate e <- [_ _ _ _ co]; apply_on_list clis @broad CchangeClientInfos [_DMSgetLogin DMSsender nil co nil 1] ;; /*-------------*/ fun activate(from,cli,action,param,rep)= if !strcmp action "start" then ( /* begin iri + arkeon */ _DMScreateClientDMI this cli linebuild (awayCheck)::(defaultMacrosFile)::(defOtherUser1MsgTextColor)::(defOtherUser2MsgTextColor)::(ActionsMsgColor)::(backColor)::(loginNameColor)::(System1MsgTextColor)::(System2MsgTextColor)::(textColorEditLine)::(otherColorText)::(usersMsgColors)::nil; /* end iri + arkeon */ _DMSevent this cli "entering" nil nil ) else if !strcmp action "destroy" then (_DMSdelClientDMI this cli; logout cli) else if !strcmp action "!ChgLogin" then (apply_on_list clis @broad CchangeClientInfos [param _DMSgetLogin cli nil nil 2];0) /*advise all clients that a login has changed*/ else if !strcmp action "broadMsg" then (apply_on_list clis @broad Chear [param]; 0) else if !strcmp action "privateMsg" then _DMSsend this cli Chear [param] else if !strcmp action "broadInfo" then (apply_on_list clis @broad ChearInfoMsg [param]; 0) else if !strcmp action "privateInfo" then _DMSsend this cli ChearInfoMsg [param] else if !strcmp action "getDialogS" then let search_in_list clis @bycli cli -> c in if c==nil then nil else (mutate c <-[_ from rep _ _]; _DMSsend this cli CgetFocus []) else nil;; /*-------------*/ fun IniDMI(param)= let strextr _getpack _checkpack param -> l in ( set backColor = getInfo l "backColor"; set System1MsgTextColor = getInfo l "System1MsgTextColor"; set System2MsgTextColor = getInfo l "System2MsgTextColor"; set loginNameColor = getInfo l "loginNameColor"; set ActionsMsgColor = getInfo l "ActionsMsgColor"; set usersMsgColors = getInfo l "usersMsgColors"; set defOtherUser1MsgTextColor = getInfo l "defOtherUser1MsgTextColor"; set defOtherUser2MsgTextColor = getInfo l "defOtherUser2MsgTextColor"; /* begin iri */ set textColorEditLine = getInfo l "textColorEditLine"; set otherColorText = getInfo l "otherColorText"; /* end iri */ set awayCheck = if !strcmpi getInfo l "awayCheck" "on" then "1" else "0"; /* Arkeon */ set defaultMacrosFile = getInfo l "defaultMacrosFile" ); _DMSregisterDMI this @activate nil @logout nil ;; /*-------------*/ /*send the new client msg changed colors, cli font of other clients*/ fun sendCurrentClisInfos(l,cli)= if l==nil then 0 else let l -> [[ccli _ _ cfont ccolor] q] in ( _DMSsend this cli CchangeClientInfos [_DMSgetLogin ccli nil ccolor cfont 0]; sendCurrentClisInfos q cli ) ;; /*-------------*/ fun __register(col)= let search_in_list clis @bycli DMSsender -> e in if e!=nil then nil else let _locCli this DMSsender "TEXT_FONT" nil -> font in ( sendCurrentClisInfos clis DMSsender; /*send the new client msg changed colors, font of other clients*/ apply_on_list clis @broad CchangeClientInfos [_DMSgetLogin DMSsender nil col font 0]; /*send to all users new user infos*/ set clis=[DMSsender nil nil font col]::clis; _DMSevent this DMSsender "in" nil nil ) ;; /*-------------*/ fun __speak(s)= let search_in_list clis @bycli DMSsender -> c in if c==nil then nil else let c->[_ d r _ _] in _DMSreply this DMSsender d r s nil;;