/* TermColor Client - DMS - Aug 99 - by Sebastien DENEUX*/ /*last update : 20/01/2000*/ /* res à faire : - affichage des macros externes voir la flag visible/invisible ou autre... */ /* 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 Cspeak=speak S;; defcom Cregister=register I;; /*color*/ defcom CChangeColor=changeColor I;;/*when user change his own color*/ var ownMacrosFile="locked/conf/termColor/termColorMacros.txt";; /*user macros*/ var max_macro_length=100;;/*max length for a macro*/ var MacroBmpFile = "dms/interf/colorterm/macrobut.png";; /* image pour le bouton des macros */ var ColorBmpFile = "dms/interf/colorterm/colorbut.png";; /* image pour le bouton de la palette */ var ParamBmpFile = "dms/interf/colorterm/parambut.png";; /* image pour le bouton des paramètres du chat */ var AwayBmpFile = "dms/interf/colorterm/awaybut.png";; /* image pour le bouton away */ /* Arkeon */ var allBitmap = 0;; typeof defaultMacrosFile=S;;/*SCS site default macros*/ typeof configFile=S;;/*config file to save color*/ /*colors defined in the editor*/ typeof backColor=I;; /* couleur de fond */ typeof loginNameColor=I;; /* couleur du pseudo */ typeof System1MsgTextColor=I;; /* couleur des messages avec >> */ typeof System2MsgTextColor=I;; typeof ActionsMsgColor=I;; /* Couleur des messages macros */ typeof myMsgTextColor=I;; typeof usersMsgColors=[S r1];; typeof defOtherUser1MsgTextColor=I;; typeof defOtherUser2MsgTextColor=I;; /* begin iri */ typeof textColorEditLine=I;; /* couleur de la police du champ de saisie */ typeof otherColorText=I;; /* couleur des msgs provenant d'autres modules et de l'action privateInfo */ /* end iri */ typeof awayCheck=I;; /* Arkeon */ typeof lastUserName=S;; /*name of the last user that has spoken*/ var userColorState=1;; /*used to change the text color at each time a message is received (and when the user has changed)*/ var allUsersMsgTextIsBlack=0;;/*indicates that all users msg text is black*/ var noSystemMessages=0;;/*indicates that system messages will not be displayed on the client*/ var autoScrollIsOff=0;;/*indicates that the text scrolls automatically*/ typeof allMessages=[[S S I I I] r1];;/*contains all messages information (texte,police,size,color,flag)*/ var max_save_msg=150;;/*max size : used for allMessages structure and text, text2 max lines*/ var nbMsg=0;;/*nb msg written*/ typeof ignoreListIn=[S r1];; /*names of the clients to ignore for input*/ typeof clis=[[S I S] r1];;/*[login color font]*/ typeof win = ObjWin;; typeof PanelContainer = ObjContainer;; typeof text=ObjRichText;; typeof cmd=CompText;; var focussrv=0;; typeof focus=DMI;; typeof reply=S;; typeof win2=ObjWin;; typeof text2=ObjRichText;; typeof cmd2=ObjText;; typeof file=W;; typeof savitem=ObjMenuItem;; var saving=0;; /*macros*/ var macrosListPosCourante = -1;; /*current position in the list*/ typeof mesMacros = [[S S] r1];; typeof defaultMacros = [[S S] r1];; typeof macroEdit1 = ObjText;; typeof macroEdit2 = ObjText;; var userMacrosFile="locked/conf/ColorTermOwnMacros.txt";; /*own macros file*/ typeof externalMacros=[[S S S I] r1];; /*macros added with addMacro action [originCat shortCut info flag]*/ var colorMapOpened=0;; /*1 if colormap is opened*/ /*-------------*/ /*change the login name in ignore list*/ fun ChangeNameIgnList (oldname, newname, IgnList)= if IgnList == nil then 0 else let IgnList -> [currentname NIgnList] in if !strcmp oldname currentname then (mutate IgnList <- [newname _];1) else ChangeNameIgnList oldname newname NIgnList;; /*-------------*/ /*return the client msg color and font if changed*/ /*else return -1*/ fun getCliInfosFromCliList(l,userLogin)= if l==nil then nil else let l -> [[login color font] q] in if !strcmp login userLogin then [color font] else getCliInfosFromCliList q userLogin ;; /*-------------*/ fun cliByLogin(cli,userLogin)= let cli -> [currentLogin _ _] in !strcmp currentLogin userLogin;; /*-------------*/ fun cliByLogin2(currentLogin,userLogin)=!strcmp currentLogin userLogin;; /*-------------*/ /*a client has changed his msg color or login*/ fun __changeClientInfos(userLogin,newUserLogin,color,font,flag)= let search_in_list clis @cliByLogin userLogin -> e in if flag==0 then /*new user*/ ( set clis=[userLogin color font]::(remove_from_list clis e); 0 ) else if flag==1 then /*color*/ ( mutate e <- [_ color _]; 0 ) else if flag==2 then /*login*/ ( mutate e <- [newUserLogin _ _]; 0 ) else nil ;; /*-------------*/ /*a client has logged out*/ fun __logout(userLogin)= set clis = remove_from_list clis (search_in_list clis @cliByLogin userLogin) ;; /*-------------*/ /*add msg to text2*/ fun _message2(mess,msgPolice,msgSize,msgColor,msgFlag)= _ADDtextRichText text2 mess msgPolice msgSize msgColor msgFlag; let _GETlineCountRichText text2->s in while s>max_save_msg do (_DELlineRichText text2 0;set s=s-1); if autoScrollIsOff then nil else let _GETlineCountRichText text2->s in _SCROLLrichText text2 0 s-1; mess;; /*-------------*/ fun _destroyevent2(a,b)= _DStext cmd2; _DSrichText text2; set win2=nil;; /*-------------*/ fun _paint2(a,b)= _PAINTrichText text2;; /*-------------*/ fun _resize2(a,b,w,h)= if h<40 || w<40 then nil else ( _SIZEtext cmd2 w 20 0 h-20; /*before rich text */ _SIZErichText text2 w h-20 0 0; if autoScrollIsOff then nil else let _GETlineCountRichText text2->s in _SCROLLrichText text2 0 s-1 );; /*-------------*/ fun _Save (d,f,s)= if s==nil then nil else (set file=s; if saving then nil else set saving=(_CHKmenu savitem 1; 1));; /*-------------*/ fun _saveas(x,f)= _DLGrflsave (_DLGSaveFile _channel win2 nil nil strcat (_loc this "RECORDING_FILE" nil) " (*.txt)\0*.txt\0\0") @_Save 0; 0;; /*-------------*/ fun _chksav(a,b)= if saving==0 && file==nil then _saveas nil nil else (set saving=if saving then (_CHKmenu savitem 0; 0) else (_CHKmenu savitem 1; 1));; /**************************************************************************** * Cette fonction dessine un rectangle de la couleur sélectionnée sur le * bouton de sélection de couleur. ****************************************************************************/ fun DrawSelectedColor (colorBmp, color) = let _GETalphaBitmaps colorBmp -> [bitmap _] in ( _DRAWrectangle bitmap 2/*posx*/ 2/*posy*/ 16 16 DRAW_INVISIBLE 0 0 DRAW_SOLID color; _DRAWrectangle bitmap 2/*posx*/ 22/*posy*/ 16 16 DRAW_INVISIBLE 0 0 DRAW_SOLID color; _DRAWrectangle bitmap 2/*posx*/ 42/*posy*/ 16 16 DRAW_INVISIBLE 0 0 DRAW_SOLID color; _PAINTcontainer PanelContainer ); 0 ;; /*end color map window*/ fun _endColor(a, colorBmp)= set colorMapOpened=0; if a!=nil then ( set myMsgTextColor=a; /*update choose color button on interface*/ DrawSelectedColor colorBmp a; _DMSsend this CChangeColor [a]; _storepack strbuild ("myMsgTextColor"::(itoa a)::nil)::nil configFile;/*save color in config file*/ ) else nil;; /*-------------*/ fun _textIsBlack(a,b)= set allUsersMsgTextIsBlack= allUsersMsgTextIsBlack^1; _CHKmenu b allUsersMsgTextIsBlack;; /*-------------*/ fun _autoScrollIsOff(a,b)= set autoScrollIsOff= autoScrollIsOff^1; _CHKmenu b autoScrollIsOff;; /*-------------*/ fun _noSystemMessages(a,b)= set noSystemMessages= noSystemMessages^1; _CHKmenu b noSystemMessages;; /*-------------*/ /*add add all messages in text2*/ fun addAllMessages(allMsg)= if allMsg==nil then 0 else let allMsg -> [[currentMsg currentPolice currentSize currentColor currentFlag] queue] in ( _message2 currentMsg currentPolice currentSize currentColor currentFlag; addAllMessages queue );; /*-------------*/ /*add element at the end of the list*/ /*only max_save_msg elements are saved*/ fun ajouterFinListe(l,new)= if nbMsg>=max_save_msg then tl (listcat l new::nil) else listcat l new::nil;; /*-------------*/ /*write a message in the richtext*/ fun _message(mess)= let nth_char mess 0 -> c in let nth_char mess 1 -> c2 in let (_loc this "TEXT_FONT" nil) -> font in let atoi (_loc this "TEXT_SIZE" nil) -> size in if c=='> && noSystemMessages then nil else /*no system messages*/ if c=='> then if c2=='> then ( _ADDtextRichText text mess font size System1MsgTextColor 4; /*system1 msg*/ set allMessages = ajouterFinListe allMessages [mess font size System1MsgTextColor 4]; set nbMsg=nbMsg+1; if win2==nil then nil else _message2 mess font size System1MsgTextColor 4 ) else ( _ADDtextRichText text mess font size System2MsgTextColor 4; /*system2 msg*/ set allMessages = ajouterFinListe allMessages [mess font size System2MsgTextColor 4]; set nbMsg=nbMsg+1; if win2==nil then nil else _message2 mess font size System2MsgTextColor 4) else if c=='< then let strfind ">" mess 0 -> pos1 in let substr mess 1 (pos1-1) -> userLogin in ( if (strcmp lastUserName userLogin) && (pos1!=nil) then ( set userColorState = userColorState ^ 1; set lastUserName=userLogin ) else nil; if (search_in_list ignoreListIn @cliByLogin2 userLogin)!=nil then nil /*if in ignore list*/ else let substr mess (pos1+1) ((strlen mess)-pos1) -> messCorps in /*message without login name*/ ( if (nth_char messCorps 1) == '/ then /*ACTION MESSAGE*/ let substr messCorps 2 ((strlen messCorps)-1) -> mess in (_ADDtextRichText text mess font size ActionsMsgColor 0; set allMessages = ajouterFinListe allMessages [mess font size ActionsMsgColor 0]; set nbMsg=nbMsg+1; if win2==nil then nil else _message2 mess font size ActionsMsgColor 0) else /*users messages*/ let if !strcmp userLogin DMSlogin then [myMsgTextColor font] else getCliInfosFromCliList clis userLogin -> [colorFromList fontFromList] in /*own msg*/ let if allUsersMsgTextIsBlack || colorFromList==nil then if userColorState then defOtherUser1MsgTextColor else defOtherUser2MsgTextColor else colorFromList -> userMsgColor in ( _ADDtextRichText text strcatn "<"::userLogin::">"::nil fontFromList size loginNameColor 0; /*user msg*/ _ADDtextRichText text messCorps fontFromList size userMsgColor 0; /*user msg*/ set allMessages = ajouterFinListe allMessages [(strcatn "<"::userLogin::">"::nil) fontFromList size loginNameColor 0]; set allMessages = ajouterFinListe allMessages [messCorps fontFromList size userMsgColor 0]; set nbMsg=nbMsg+1; if win2==nil then nil else ( _message2 strcatn "<"::userLogin::">"::nil fontFromList size loginNameColor 0; _message2 messCorps fontFromList size userMsgColor 0 ) ) ) ) else ( /* begin iri */ let strcat mess "\n" -> mess2 in ( _ADDtextRichText text mess2 font size otherColorText 0; if win2==nil then nil else _message2 mess2 font size otherColorText 0; ) ); /* end iri */ if autoScrollIsOff then nil else (let _GETlineCountRichText text->s in while s>max_save_msg do (_DELlineRichText text 0;set s=s-1); let _GETlineCountRichText text->s in _SCROLLrichText text 0 s-1 ); if saving then _appendpack mess file else nil; mess;; /*-------------*/ fun __hear(s)=_message s;; /*-------------*/ /*receive an info msg*/ fun __hearInfoMsg(s)= let strextr s -> [[texte[police[size[color[flag _]]]]]_] in if (nth_char texte 0) =='> && noSystemMessages then nil else /*no system messages*/ let strcat texte "\n" -> mess in ( /* begin iri */ _ADDtextRichText text mess police atoi size otherColorText atoi flag; /*system1 msg*/ set allMessages = ajouterFinListe allMessages [mess police atoi size otherColorText atoi flag]; set nbMsg=nbMsg+1; /* end iri */ if autoScrollIsOff then nil else ( let _GETlineCountRichText text->s in while s>max_save_msg do (_DELlineRichText text 0;set s=s-1); let _GETlineCountRichText text->s in _SCROLLrichText text 0 s-1 ); if saving then _appendpack mess file else nil; if win2==nil then nil else _message2 mess police atoi size otherColorText atoi flag; /* otherColorText; avant : atoi color */ );; /*-------------*/ /*send the message*/ fun sendMessage(s)= _DMSevent this "command" s nil; if focussrv then _DMSsend this Cspeak [s] else _DMSreply this focus reply s nil; 0;; /*-------------*/ fun macroByName(elt,macroName)= let elt -> [currentName _] in !strcmpi currentName macroName;; /*-------------*/ fun macroByName2(elt,macroName)= let elt -> [_ currentName _ _] in !strcmpi currentName macroName;; /*-------------*/ /*send a macros*/ fun _sendMacro(a,b)= if (!strcmp (substr b 0 3) "%me") && ((nth_char b 3) == 32) then /*message contains %me followed by a space*/ let search_in_list externalMacros @macroByName2 "/me" -> elt in if elt!=nil then _DMSevent this "extMacroCommand" (strcat "/me " substr b 4 strlen b) nil else sendMessage strcatn "/"::"["::DMSlogin::(substr b 3 ((strlen b) -3))::"]"::nil else sendMessage b;; /*-------------*/ /*action message (messages that begins by /)*/ fun actionMsg(ligne)= let strextr ligne -> [[param0[param1 _]] _] in let substr ligne (strfind " " ligne 1) (strlen ligne) -> suite in /*string after action (param0)*/ if (nth_char param0 0) != '/ then nil else /*action begins by slash*/ let substr param0 1 ((strlen param0)-1) -> action in ( let search_in_list externalMacros @macroByName2 param0 -> elt in if elt!=nil then _DMSevent this "extMacroCommand" ligne nil else if !strcmp action "me" then if suite==nil then (_message strcatn "> invalid parameters\n"::nil;0) else let strcatn "/"::"["::DMSlogin::suite::"]"::nil -> newLigne in sendMessage newLigne /*if a macros is defined both in defaultMacros and in ownMacros, the one defined in own macros is used*/ else let search_in_list mesMacros @macroByName param0 -> elt in /*search for own macro action*/ if elt!=nil then let elt -> [_ contents] in _sendMacro nil contents else let search_in_list defaultMacros @macroByName param0 -> elt in /*search for default macro action*/ if elt!=nil then let elt -> [_ contents] in _sendMacro nil contents else (_message strcatn "> ["::(param0)::"] is not a valid action\n"::nil;0) );; /*-------------*/ fun _textE (cText, param, type, text) = let _GETcompText cText -> ligne in let nth_char ligne 0 -> c in if c=='/ then /*action message, we do not display it and send it to server*/ actionMsg ligne else sendMessage ligne; _SETcompText cText "" nil nil CT_BEGIN; 0 ;; /*-------------*/ fun _textE2(x,y)= if (_GETlineCount cmd2) >= 2 then let _GETline cmd2 0 -> ligne in let nth_char ligne 0 -> c in ( if c=='/ then /*action message, we do not display it and send it to server*/ actionMsg ligne else sendMessage ligne; _DELline cmd2 0; 0 ) else nil;; /*-------------*/ /*returns a string from the mesMacros*/ fun _getMacrosS(l,res)= if l==nil then res else let l -> [[macro contents] queue] in let strcatn macro::" "::contents::"\n"::nil -> currentLigne in _getMacrosS queue (strcat currentLigne res);; /*-------------*/ /*save macros to file*/ fun _saveMacros()= _storepack (_getMacrosS mesMacros "") ownMacrosFile;; /*-------------*/ /*returns the list l in a string format with spaces*/ fun _getContents(l,res)= if l==nil then res else let l -> [mot suite] in _getContents suite (strcatn res::" "::mot::nil);; /*-------------*/ /*load macros from macro file in mesMacros*/ fun _loadMacros(l,res)= if l==nil then res else let l -> [tete queue] in let tete -> [macro suite] in let _getContents suite nil -> s in let substr s 1 ((strlen s)-1) -> contents in if ((nth_char contents 0)=='/) || ((!strcmp (substr contents 0 3) "%me") && ((nth_char contents 3)!=32)) then /*invalid format macro*/ _loadMacros queue res else (set contents = substr contents 0 max_macro_length; /*limit the macro length*/ _loadMacros queue (listcat res [macro contents]::nil));; /*-------------*/ /*add a new macro*/ fun _ajouterMacro(a,listeTab)= let _GETtext macroEdit1 -> Sedit1 in let _GETtext macroEdit2 -> Sedit2 in if (strlen Sedit1)!=0 && (strlen Sedit2)!=0 && (nth_char Sedit1 0)=='/ && (nth_char Sedit2 0)!='/ && (search_in_list mesMacros @macroByName Sedit1)==nil then ( set Sedit2 = substr Sedit2 0 max_macro_length; /*limit the macro length*/ set mesMacros = listcat mesMacros [Sedit1 Sedit2]::nil; _ADDlistTabItem listeTab 0 0 Sedit1; _SETlistTabItem listeTab 0 1 Sedit2; _saveMacros;/*save in file*/ 0 ) else nil;; /*-------------*/ /*delete a macro*/ fun _supprimerMacro(a,listeTab)= if macrosListPosCourante!=-1 then ( set mesMacros = remove_nth_from_list mesMacros ((sizelist mesMacros) - macrosListPosCourante -1); _DELlistTabItem listeTab macrosListPosCourante; /*delete currentmacro in the list*/ _saveMacros; /*save in file*/ set macrosListPosCourante=-1 /*no more selection*/ ) else nil;; /*-------------*/ /*update a macro*/ fun _majMacro(a,listeTab)= let _GETtext macroEdit1 -> Sedit1 in let _GETtext macroEdit2 -> Sedit2 in if (strlen Sedit1)!=0 && (strlen Sedit2)!=0 && (nth_char Sedit1 0)=='/ && (nth_char Sedit2 0)!='/ then ( let search_in_list mesMacros @macroByName Sedit1 -> elt in if elt==nil then nil else (set Sedit2 = substr Sedit2 0 max_macro_length; /*limit the macro length*/ mutate elt <- [Sedit1 Sedit2]); _SETlistTabItem listeTab macrosListPosCourante 1 Sedit2; _saveMacros; /*save in file*/ 0 ) else nil;; /*-----------*/ /*update the 3 edition zones when CB on list*/ fun _majEdit(liste,b,pos)= let nth_list mesMacros ((sizelist mesMacros) - pos - 1) -> [element1 element2] in (set macrosListPosCourante = pos; _SETtext macroEdit1 element1; _SETtext macroEdit2 element2);; /*-------------*/ /*add macros in listeTab*/ fun _addMacrosInListe(l,listeTab)= if l==nil then nil else let l -> [[macro contents] queue] in (_ADDlistTabItem listeTab 0 0 macro; _SETlistTabItem listeTab 0 1 contents; _addMacrosInListe queue listeTab;0);; /*-------------*/ /*show the window interface to configure macros*/ fun _configureMacros(a,b)= let 400 -> w in let 200 -> h in let _CRwindow _channel win nil nil w h+105 WN_MENU (_loc this "CONFIG_TITLE" nil) -> winConfigureMacros in ( _CRtext _channel winConfigureMacros 0 h+30 w 75 ET_BORDER _loc this "HELP_MACRO_TXT" nil; set macroEdit1 = _CReditText _channel winConfigureMacros 0 h+5 w*1/3 25 ET_BORDER ""; set macroEdit2 = _CReditText _channel winConfigureMacros w*1/3 h+5 w*2/3 25 ET_BORDER+ET_AHSCROLL ""; let _CRlistTab _channel winConfigureMacros 0 30 w h-25 LV_BORDER -> listeTab in ( _ADDlistTabColumn listeTab 0 w*1/3 ET_ALIGN_LEFT _loc this "MACRO_SHORTCUT" nil; _ADDlistTabColumn listeTab 1 w*2/3 ET_ALIGN_LEFT _loc this "MACROS_CONTENTS" nil; _addMacrosInListe mesMacros listeTab; _CBlistTabSelect listeTab @_majEdit nil; /*update zone edit*/ _CBbutton (_CRbutton _channel winConfigureMacros 0 0 133 30 PB_TABFOCUS (_loc this "ADD_MACRO_MENU" nil) ) @_ajouterMacro listeTab; _CBbutton (_CRbutton _channel winConfigureMacros 133 0 134 30 PB_TABFOCUS (_loc this "DELETE_MACRO_MENU" nil) ) @_supprimerMacro listeTab; _CBbutton (_CRbutton _channel winConfigureMacros 267 0 133 30 PB_TABFOCUS (_loc this "UPDATE_MACRO_MENU" nil) ) @_majMacro listeTab; 0 ); );; /*-------------*/ /*show large chat window*/ fun _enlargeChatWindow(a,b)= if win2!=nil then nil else let [400 400]->[w h] in ( set win2=_CRwindow _channel nil nil nil w h WN_MENU+WN_MINBOX+WN_SIZEBOX _DMSgetName this; _CBwinDestroy win2 @_destroyevent2 0; _CBwinSize win2 @_resize2 0; _CBwinPaint win2 @_paint2 0; set cmd2=_CReditText _channel win2 0 h-20 w 20 ET_AHSCROLL|ET_AVSCROLL|ET_DOWN ""; _CBtext cmd2 @_textE2 0; set text2=_CRrichText _channel win2 0 0 w h-20 ET_VSCROLL|ET_AVSCROLL|ET_DOWN|ET_NOEDIT ""; _SETbkgColorRichText text2 backColor; addAllMessages allMessages /*add all Messages in text2*/ ) ;; /*-------------*/ /*add the macros from list l as items of menu*/ fun _addMacrosMenuItem(menu,l)= if l==nil then nil else let l -> [[macro contents] queue] in /*replace %me by login*/ let if (!strcmp (substr contents 0 3) "%me") && ((nth_char contents 3) == 32) then /*message contains %me followed by a space*/ strcat DMSlogin (substr contents 3 ((strlen contents) -3)) else contents -> contents2 in ( _CBmenu _APPitem _channel menu ME_ENABLED strcatn contents2::" ("::macro::")"::nil @_sendMacro contents; _addMacrosMenuItem menu queue; 0 );; /*-------------*/ /*update Ignore Flag*/ fun updateIgnoreFlag(type,name,state)= if !strcmp type "ChatIn" then if atoi state then set ignoreListIn=name::(removef_from_list ignoreListIn @cliByLogin2 name) else set ignoreListIn=removef_from_list ignoreListIn @cliByLogin2 name else nil; 0;; /*-------------*/ /*update the name of the login when change*/ /* in ignore lists and global clis list*/ fun updateLogin(oldname,newname)= ChangeNameIgnList oldname newname ignoreListIn; 0;; /*-------------*/ fun macroByName3(elt,b)= let b -> [cat name] in let elt -> [currentCat currentName _ _] in (!strcmpi currentName name) && (!strcmpi currentCat cat);; /*-------------*/ fun addExtMacros(l)= if l==nil then nil else let l -> [tete queue] in let tete -> [a[b[c[d _]]]] in ( let search_in_list externalMacros @macroByName3 [a b] -> elt in if elt==nil then set externalMacros = [a b c atoi d]::externalMacros else nil; addExtMacros queue; 0 );; /*-------------*/ fun delExtMacros(l)= if l==nil then nil else let l -> [tete queue] in let tete -> [a[b _]] in ( set externalMacros = removef_from_list externalMacros @macroByName3 [a b]; delExtMacros queue; 0 );; /*-------------*/ fun activate(from,action,param,rep)= /* if !strcmp action "!addCommand" then if (nth_char param 0)==13 then (_ADDtext cmd "\n";_textE nil nil;0) else (_ADDtext cmd param;0) else*/ if !strcmp action "privateMsg" then (_message param;0) else if !strcmp action "privateInfo" then (__hearInfoMsg param;0) else if !strcmp action "getDialog" then (set focussrv=0; set focus=from; set reply=rep;0) else if !strcmp action "IgnoreFlag" then let lineextr param -> [type[id[name[state _]]]] in updateIgnoreFlag type name state else if !strcmp action "IgnChgLogin" then let lineextr param -> [oldName[newName _]] in updateLogin oldName newName else if !strcmp action "IgnLogout" then let lineextr param -> [id[name _]] in (set ignoreListIn=removef_from_list ignoreListIn @cliByLogin2 name;0) else if !strcmp action "registerExtMacro" then let strextr param -> l in (addExtMacros l;0) else if !strcmp action "unregisterExtMacro" then let strextr param -> l in (delExtMacros l;0) else nil;; /*-------------*/ /*CB win destroy*/ fun _destroyevent(a,b)= _DSrichText text; _DScompText cmd; _DScontainer PanelContainer; _DSwindow win2; _DMSdelete this;; /*-------------*/ fun _end(a)=_DMSdelete this;; /*-------------*/ fun _resize(x,s)= let x->[wn x y w h] in _SIZEwindow win w h x y; 0;; /*-------------*/ fun _resize3(a,b,w,h)= if h<40 || w<40 then nil else ( _SIZEcontainer PanelContainer 0 h-20 w 20; _SIZErichText text w h-20 0 0; if autoScrollIsOff then nil else let _GETlineCountRichText text->s in _SCROLLrichText text 0 s-1 );; /*-------------*/ fun _paint(a,b)= _PAINTrichText text; _PAINTcontainer PanelContainer ;; /*-------------*/ fun endDownDefaultMacroFile(doc)= let strextr _getpack _checkpack defaultMacrosFile -> l in /*load macros file in defaultMacros*/ set defaultMacros = _loadMacros l nil; 0;; /**************************************************************************** * Arkeon * Fonction réflexe du bouton Away * ****************************************************************************/ fun CBFawayBut (Check, cont, posx, posy, btn, mask) = if _GETcompCheckState Check then _DMSevent this "Away" nil nil else _DMSevent this "Back" nil nil ;; /**************************************************************************** * * Fonction réflexe du bouton de macros * ****************************************************************************/ fun CBFmacroBut (cRollOver, cont/*param*/,posx, posy, btn, mask) = let _GETcontainerExPositionSize cont -> [x y w h] in let _CRpopupMenu _channel -> contextMenu in ( /*_addMacrosMenuItem contextMenu externalMacros; _APPitem _channel contextMenu ME_SEPARATOR nil;*/ /*modif en cours*/ _addMacrosMenuItem contextMenu defaultMacros; if (mesMacros!=nil) && (defaultMacros!=nil) then (_APPitem _channel contextMenu ME_SEPARATOR nil; _addMacrosMenuItem contextMenu mesMacros) else _addMacrosMenuItem contextMenu mesMacros; _DRAWmenu win contextMenu x+w-40 y PM_RIGHT_ALIGN+PM_BOTTOM_ALIGN );; /**************************************************************************** * * Fonction réflexe du bouton de choix de la couleur du texte * ****************************************************************************/ fun CBFcolorBut (cRollOver, colorBmp,posx, posy, btn, mask) = if colorMapOpened then nil else ( set colorMapOpened = 1; _CRcolorMap _channel win2 100 100 (_loc this "CHOOSE_TEXT_COLOR" nil) mkfun2 @_endColor colorBmp (if myMsgTextColor==nil then 0 else myMsgTextColor) ) ;;/*for compatibility with previous version*/ /**************************************************************************** * * Fonction réflexe du bouton de menu contextuel * ****************************************************************************/ fun CBFparamBut (cRollOver, cont/*param*/,posx, posy, btn, mask) = let _GETcontainerExPositionSize cont -> [x y w h] in let _CRpopupMenu _channel -> contextMenu in ( _CBmenu _APPitem _channel contextMenu ME_ENABLED (_loc this "ENLARGE_ITEM" nil) @_enlargeChatWindow nil; _APPitem _channel contextMenu ME_SEPARATOR nil; let _APPitem _channel contextMenu ME_ENABLED (_loc this "DEF_COLOR_ITEM" nil) -> itemChooseColor in ( _CBmenu itemChooseColor @_textIsBlack itemChooseColor; _CHKmenu itemChooseColor allUsersMsgTextIsBlack ); let _APPitem _channel contextMenu ME_ENABLED (_loc this "DISABLE_SYSTEM_ITEM" nil) -> itemNoSystemMessages in ( _CBmenu itemNoSystemMessages @_noSystemMessages itemNoSystemMessages; _CHKmenu itemNoSystemMessages noSystemMessages ); /*PROVISOIRE*/ let _APPitem _channel contextMenu ME_ENABLED _loc this "AUTO_SCROLL_OFF" nil -> itemautoScroll in ( _CBmenu itemautoScroll @_autoScrollIsOff itemautoScroll; _CHKmenu itemautoScroll autoScrollIsOff; ); _APPitem _channel contextMenu ME_SEPARATOR nil; _CBmenu _APPitem _channel contextMenu ME_ENABLED (_loc this "CONFIG_ITEM" nil) @_configureMacros nil; _APPitem _channel contextMenu ME_SEPARATOR nil; _CBmenu _APPitem _channel contextMenu ME_ENABLED (_loc this "RECORD_ITEM" nil) @_saveas 0; _APPitem _channel contextMenu ME_SEPARATOR ""; set savitem=_APPitem _channel contextMenu ME_ENABLED+if !saving then 0 else ME_CHECKED (_loc this "RECORDING_ITEM" nil); _CBmenu savitem @_chksav 0; _DRAWmenu win contextMenu x+w y PM_RIGHT_ALIGN+PM_BOTTOM_ALIGN ) ;; /*************************************************************************** * * Panneau de commande (nouvelle lib2D pour la compatibilité MAC) * Ce panneau contient les trois boutons à droite de la ligne de Chat * ***************************************************************************/ fun CreatePanel (win,x,y) = let _GETwindowPositionSize win -> [_ _ w h] in let _CRcontainerFromObjWin _channel win 0 h-20 w 20 CO_CHILDINSIDE backColor nil -> cont in let _LDalphaBitmap _channel _checkpack MacroBmpFile -> macroBmp in let _LDalphaBitmap _channel _checkpack ColorBmpFile -> colorBmp in let _LDalphaBitmap _channel _checkpack ParamBmpFile -> paramBmp in let _LDalphaBitmap _channel _checkpack AwayBmpFile -> awayBmp in /* Arkeon */ let _CRcompRollOver _channel cont nil [w-60 0] OBJ_ENABLE|OBJ_VISIBLE|ROL_CLICK|OBJ_LW_FLEX 0 macroBmp -> macroBut in let _CRcompRollOver _channel cont nil [w-40 0] OBJ_ENABLE|OBJ_VISIBLE|ROL_CLICK|OBJ_LW_FLEX 0 colorBmp -> colorBut in let _CRcompRollOver _channel cont nil [w-20 0] OBJ_ENABLE|OBJ_VISIBLE|ROL_CLICK|OBJ_LW_FLEX 0 paramBmp -> paramBut in let if awayCheck==1 then _CRcompCheck _channel cont nil [w-80 0] OBJ_ENABLE|OBJ_VISIBLE|ROL_CLICK|OBJ_LW_FLEX 0 awayBmp else nil -> awayBut in /* Arkeon */ let _CRfont _channel (atoi (_loc this "TEXT_SIZE2" nil)) 0 0 (_loc this "TEXT_FONT" nil) -> font in ( let if awayCheck==1 then w-80 else w-60 -> wc in /* Arkeon */ /* begin iri */ set cmd = _CRcompText _channel cont nil [0 0] OBJ_ENABLE|OBJ_VISIBLE|OBJ_MW_FLEX|CT_EDITLINE 0 wc 20 nil font [textColorEditLine 0 0 0] nil nil nil; /* Arkeon */ /* end iri */ _CBcompTextValidation cmd @_textE nil CT_VALIDENTER; set PanelContainer = cont; DrawSelectedColor colorBmp myMsgTextColor; _CBcompRollOverClick macroBut @CBFmacroBut cont; _CBcompRollOverClick colorBut @CBFcolorBut colorBmp; _CBcompRollOverClick paramBut @CBFparamBut cont; _CBcompCheckClick awayBut @CBFawayBut cont; /* Arkeon */ _PAINTcontainer cont ); 0 ;; /*-------------*/ fun IniDMI(param)= srand _tickcount;/*initialize random*/ /* modif iri + arkeon param */ let lineextr param-> [PawayCheck[PdefaultMacrosFile[PdefOtherUser1MsgTextColor[PdefOtherUser2MsgTextColor[PActionMsgColor[PbackColor[PloginNameColor [PSystem1MsgTextColor[PSystem2MsgTextColor[PtextColorEditLine[PotherColorText[PusersMsgColors _]]]]]]]]]]]] in ( set defaultMacrosFile=PdefaultMacrosFile; set configFile=strcatn "locked/conf/termColor/"::(substr _getlongname DMSname "" "#" 1 16)::".conf"::nil; /*set the config file name (name of the site in locked/conf/termColor)*/ set usersMsgColors=hd strextr PusersMsgColors; set defOtherUser1MsgTextColor=atoi PdefOtherUser1MsgTextColor; set defOtherUser2MsgTextColor=atoi PdefOtherUser2MsgTextColor; set ActionsMsgColor=atoi PActionMsgColor; set backColor=atoi PbackColor; set loginNameColor=atoi PloginNameColor; set System1MsgTextColor=atoi PSystem1MsgTextColor; set System2MsgTextColor=atoi PSystem2MsgTextColor; /* begin iri */ set textColorEditLine = atoi PtextColorEditLine; set otherColorText = atoi PotherColorText; /* end iri */ set awayCheck = atoi PawayCheck /* Arkeon */ ); let strextr _getpack _checkpack ownMacrosFile -> l in /*load own macros file in mesMacros*/ set mesMacros = _loadMacros l nil; let hd switchstr strextr _getpack _checkpack configFile "myMsgTextColor" -> col in if col!=nil then ( set myMsgTextColor= atoi col; 0 ) else ( set myMsgTextColor= atoi (nth_list usersMsgColors (mod rand 7)); /*no color in config file, set a random color from usersMsgColors list*/ _storepack strbuild ("myMsgTextColor"::(itoa myMsgTextColor)::nil)::nil configFile;/*save color in config file*/ 0 ); let _DMSgetZone this "Term" @_end @_resize @_end ->[wn x y w h] in (set win=if wn==nil then _CRwindow _channel DMSwin nil nil 280 240 WN_MENU+WN_MINBOX+WN_SIZEBOX _DMSgetName this else _CRwindow _channel wn x y w h WN_CHILDINSIDE|WN_NOCAPTION|WN_NOBORDER _DMSgetName this; _CBwinDestroy win @_destroyevent 0; set text=_CRrichText _channel win 0 0 w h-20 ET_VSCROLL|ET_AVSCROLL|ET_DOWN|ET_NOEDIT ""; _SETbkgColorRichText text backColor; _CBwinSize win @_resize3 0; _CBwinPaint win @_paint 0; _SIZErichText text w h-20 0 0; /*evite un pb de refresh la première fois que l'on affiche le term*/ CreatePanel win w-60 h-20; _DMSregisterDMI this @activate nil; _DMSsend this Cregister [myMsgTextColor]; _RSCdownload this defaultMacrosFile defaultMacrosFile @endDownDefaultMacroFile 3; 0 );; /*-------------*/ fun __getFocus()=set focussrv=1;;