Ticket #4069: 4069_chat_history_v1.3.patch
File 4069_chat_history_v1.3.patch, 13.1 KB (added by , 8 years ago) |
---|
-
binaries/data/config/default.cfg
350 350 zoom.in = 5 351 351 zoom.out = 4 352 352 353 [chat] 354 timestamp = false ; Show time chat message was posted 355 353 356 [lobby] 354 chattimestamp = false ; Show time chat message was posted355 357 history = 0 ; Number of past messages to display on join 356 358 room = "arena21" ; Default MUC room to join 357 359 server = "lobby.wildfiregames.com" ; Address of lobby server -
binaries/data/mods/public/gui/lobby/lobby.js
11 11 /** 12 12 * Whether or not to display timestamps in the chat window. 13 13 */ 14 const g_ShowTimestamp = Engine.ConfigDB_GetValue("user", " lobby.chattimestamp") == "true";14 const g_ShowTimestamp = Engine.ConfigDB_GetValue("user", "chat.timestamp") == "true"; 15 15 16 16 /** 17 17 * Mute clients who exceed the rate of 1 message per second for this time -
binaries/data/mods/public/gui/options/options.json
90 90 "label": "Batch Training Size", 91 91 "tooltip": "Number of units trained per batch", 92 92 "parameters": { "config": "gui.session.batchtrainingsize", "min": 1, "max": 20 } 93 }, 94 { 95 "type": "boolean", 96 "label": "Chat Timestamp", 97 "tooltip": "Show time that messages are posted in the chat", 98 "parameters": { "config": "chat.timestamp" } 93 99 } 94 100 ], 95 101 "graphicsSetting": … … 245 251 "label": "Chat Backlog", 246 252 "tooltip": "Number of backlogged messages to load when joining the lobby", 247 253 "parameters": { "config": "lobby.history", "min": "0" } 248 },249 {250 "type": "boolean",251 "label": "Chat Timestamp",252 "tooltip": "Show time that messages are posted in the lobby chat",253 "parameters": { "config": "lobby.chattimestamp" }254 254 } 255 255 ] 256 256 } -
binaries/data/mods/public/gui/session/chat_window.xml
1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 3 <object name="chatDialogPanel" size="50%- 180 50%-66 50%+180 50%+54" type="image" hidden="true" sprite="genericPanel">3 <object name="chatDialogPanel" size="50%-210 50%-410 50%+210 50%+60" type="image" hidden="true" sprite="genericPanel"> 4 4 5 <!-- Message addressee --> 6 <object size="16 14 50 38" type="text" style="chatPanel"> 7 <translatableAttribute id="caption" context="chat input">To:</translatableAttribute> 8 </object> 9 <object size="75 12 100%-16 36" name="chatAddressee" type="dropdown" style="ModernDropDown" tooltip_style="sessionToolTipBold"> 10 <translatableAttribute id="tooltip" context="chat input">Select chatmessage addressee</translatableAttribute> 11 </object> 5 <object type="image" name="chatHistoryPage" size="0 0 100% 350" hidden="false"> 6 <!-- Chat History Filter --> 7 <object size="16 12 60 32" name="chatHistoryFilterLabel" type="text" style="chatPanel"> 8 <translatableAttribute id="caption" context="chat input">Filter:</translatableAttribute> 9 </object> 10 <object size="75 10 100%-16 34" name="chatHistoryFilter" type="dropdown" style="ModernDropDown" tooltip_style="sessionToolTipBold"> 11 <translatableAttribute id="tooltip" context="chat input">Filter the chat history.</translatableAttribute> 12 <action on="SelectionChange">updateChatHistory();</action> 13 </object> 12 14 13 <!-- Message text --> 14 <object size="16 46 50 70" type="text" style="chatPanel"> 15 <translatableAttribute id="caption" context="chat input">Text:</translatableAttribute> 15 <object name="chatHistory" type="text" size="10 46 100%-10 100%" sprite="ModernDarkBoxGold" style="chatHistory"/> 16 16 </object> 17 <object name="chatInput" size="75 44 100%-16 68" type="input" style="ModernInput" max_length="80">18 <translatableAttribute id="tooltip" context="chat input">Type the message to send.</translatableAttribute>19 <action on="Press">submitChatInput();</action>20 <action on="Tab">21 let playernames = [];22 for (let player in g_PlayerAssignments)23 playernames.push(g_PlayerAssignments[player].name);24 autoCompleteNick(this, playernames);25 </action>26 </object>27 17 28 <!-- Cancel Button --> 29 <object size="16 100%-40 30%+16 100%-12" type="button" style="StoneButton"> 30 <translatableAttribute id="caption">Cancel</translatableAttribute> 31 <action on="Press">closeChat();</action> 32 </object> 18 <object name="chatPage" size="0 100%-120 100% 100%"> 19 <!-- Message addressee --> 20 <object size="16 100%-106 50 100%-82" type="text" style="chatPanel"> 21 <translatableAttribute id="caption" context="chat input">To:</translatableAttribute> 22 </object> 23 <object size="75 100%-108 100%-16 100%-84" name="chatAddressee" type="dropdown" style="ModernDropDown" tooltip_style="sessionToolTipBold"> 24 <translatableAttribute id="tooltip" context="chat input">Select chatmessage addressee.</translatableAttribute> 25 </object> 33 26 34 <!-- Send Button --> 35 <object size="60%+16 100%-40 100%-16 100%-12" type="button" style="StoneButton"> 36 <translatableAttribute id="caption">Send</translatableAttribute> 37 <action on="Press">submitChatInput();</action> 27 <!-- Message text --> 28 <object size="16 100%-74 50 100%-50" type="text" style="chatPanel"> 29 <translatableAttribute id="caption" context="chat input">Text:</translatableAttribute> 30 </object> 31 <object name="chatInput" size="75 100%-76 100%-16 100%-52" type="input" style="ModernInput" max_length="80"> 32 <translatableAttribute id="tooltip" context="chat input">Type the message to send.</translatableAttribute> 33 <action on="Press">submitChatInput();</action> 34 <action on="Tab"> 35 let playernames = []; 36 for (let player in g_PlayerAssignments) 37 playernames.push(g_PlayerAssignments[player].name); 38 autoCompleteNick(this, playernames); 39 </action> 40 </object> 41 42 <!-- Cancel Button --> 43 <object size="16 100%-40 30%+16 100%-12" type="button" style="StoneButton"> 44 <translatableAttribute id="caption">Cancel</translatableAttribute> 45 <action on="Press">closeChat();</action> 46 </object> 47 48 <!-- Extended Chat Checkbox --> 49 <object name="extendedChat" type="checkbox" checked="false" style="ModernTickBox" size="50%-50 100%-38 50%-24 100%-12"> 50 <action on="Press">resizeChatWindow();</action> 51 </object> 52 53 <!-- Extended Chat Label --> 54 <object type="text" size="50%-24 100%-38 50%+40 100%-12" text_align="left" textcolor="white"> 55 <translatableAttribute id="caption" context="chat">History</translatableAttribute> 56 </object> 57 58 <!-- Send Button --> 59 <object size="60%+16 100%-40 100%-16 100%-12" type="button" style="StoneButton"> 60 <translatableAttribute id="caption">Send</translatableAttribute> 61 <action on="Press">submitChatInput();</action> 62 </object> 38 63 </object> 39 40 64 </object> -
binaries/data/mods/public/gui/session/menu.js
217 217 let command = teamChat ? (g_IsObserver ? "/observers" : "/allies") : ""; 218 218 chatAddressee.selected = chatAddressee.list_data.indexOf(command); 219 219 220 Engine.GetGUIObjectByName("chatInput").focus();221 220 Engine.GetGUIObjectByName("chatDialogPanel").hidden = false; 221 222 resizeChatWindow(); 222 223 } 223 224 224 225 function closeChat() … … 228 229 Engine.GetGUIObjectByName("chatDialogPanel").hidden = true; 229 230 } 230 231 232 function resizeChatWindow() 233 { 234 let extended = Engine.GetGUIObjectByName("extendedChat").checked; 235 let chatDialogPanel = Engine.GetGUIObjectByName("chatDialogPanel"); 236 let chatHistoryPage = Engine.GetGUIObjectByName("chatHistoryPage"); 237 let chatPage = Engine.GetGUIObjectByName("chatPage"); 238 let panelSize = chatDialogPanel.size; 239 let topOffset = 60; 240 let height = -chatPage.size.top + (extended ? chatHistoryPage.size.bottom : 0); 241 panelSize.top = -height / 2 - topOffset; 242 panelSize.bottom = height / 2 - topOffset; 243 chatDialogPanel.size = panelSize; 244 245 if (extended) 246 { 247 /*let chatHistoryFilter = Engine.GetGUIObjectByName("chatHistoryFilter"); 248 chatHistoryFilter.hidden = g_IsObserver; 249 Engine.GetGUIObjectByName("chatHistoryFilterLabel").hidden = g_IsObserver; 250 let chatHistory = Engine.GetGUIObjectByName("chatHistory"); 251 let chatHistorySize = chatHistory.size; 252 chatHistorySize.top = g_IsObserver ? chatHistoryFilter.size.top : chatHistoryFilter.size.bottom + 12; 253 chatHistorySize.rtop = g_IsObserver ? chatHistoryFilter.size.rtop : chatHistoryFilter.size.rbottom; 254 chatHistory.size = chatHistorySize; 255 if (g_IsObserver) 256 chatHistoryFilter.selected = 0;*/ 257 updateChatHistory(); 258 } 259 chatHistoryPage.hidden = !extended; 260 Engine.GetGUIObjectByName("chatInput").focus(); 261 } 262 263 function initChatHistoryFilter() 264 { 265 let chatHistoryFilter = Engine.GetGUIObjectByName("chatHistoryFilter"); 266 let options = prepareForDropdown([ 267 { 268 "data": "all", 269 "text": translateWithContext("chat history filter", "All") 270 },{ 271 "data": "isChat", 272 "text": translateWithContext("chat history filter", "Chat") 273 },{ 274 "data": "isPlayersChat", 275 "text": translateWithContext("chat history filter", "Players chat") 276 },{ 277 "data": "isAllyChat", 278 "text": translateWithContext("chat history filter", "Ally chat") 279 } 280 ]); 281 chatHistoryFilter.list = options.text; 282 chatHistoryFilter.list_data = options.data; 283 chatHistoryFilter.selected = 0; 284 } 285 286 function updateChatHistory() 287 { 288 let chatHistoryFilter = Engine.GetGUIObjectByName("chatHistoryFilter"); 289 let selected = chatHistoryFilter.list_data[chatHistoryFilter.selected]; 290 Engine.GetGUIObjectByName("chatHistory").caption = g_ChatHistory.filter(msg => selected == "all" || msg[selected]).map( 291 msg => Engine.ConfigDB_GetValue("user", "chat.timestamp") == "true" ? 292 sprintf(translate("%(time)s %(message)s"), { 293 "time": msg.timePrefix, 294 "message": msg.txt 295 }) : 296 msg.txt).join("\n"); 297 } 298 231 299 function openDiplomacy() 232 300 { 233 301 closeOpenDialogs(); -
binaries/data/mods/public/gui/session/messages.js
15 15 const g_ChatLines = 20; 16 16 17 17 /** 18 * The strings to be displayed including sender and formating.18 * The currently displayed strings, limited by the given timeframe and limit above. 19 19 */ 20 20 var g_ChatMessages = []; 21 21 22 22 /** 23 * All unparsed chat messages received since connect, including timestamp. 24 */ 25 var g_ChatHistory = []; 26 27 /** 23 28 * Holds the timer-IDs used for hiding the chat after g_ChatTimeout seconds. 24 29 */ 25 30 var g_ChatTimers = []; … … 703 708 if (!formatted) 704 709 return; 705 710 711 // Remember the original text and some keys for filtering as it depends on g_PlayerAssignments 712 let time = new Date(Date.now()); 713 let senderID = msg.guid && g_PlayerAssignments[msg.guid] ? g_PlayerAssignments[msg.guid].player : 0; 714 g_ChatHistory.push({ 715 "txt": formatted, 716 "timePrefix": sprintf(translate("\\[%(time)s]"), { 717 "time": Engine.FormatMillisecondsIntoDateString(time.getTime(), translate("HH:mm")) 718 }), 719 "isChat": msg.type == "message", 720 "isPlayersChat": msg.type == "message" && senderID > 0 && !isPlayerObserver(senderID), 721 "isAllyChat": msg.type == "message" && g_Players[Engine.GetPlayerID()] && g_Players[Engine.GetPlayerID()].isAlly[senderID] 722 }); 723 if (!Engine.GetGUIObjectByName("chatDialogPanel").hidden) 724 updateChatHistory(); 725 706 726 g_ChatMessages.push(formatted); 707 727 g_ChatTimers.push(setTimeout(removeOldChatMessage, g_ChatTimeout * 1000)); 708 728 -
binaries/data/mods/public/gui/session/session.js
294 294 Engine.GetGUIObjectByName("menuExitButton").enabled = false; 295 295 296 296 initHotkeyTooltips(); 297 initChatHistoryFilter(); 297 298 298 299 if (hotloadData) 299 300 g_Selection.selected = hotloadData.selection; -
binaries/data/mods/public/gui/session/styles.xml
247 247 textcolor_selected="darkgray" 248 248 /> 249 249 250 <style name="chatHistory" 251 buffer_zone="5" 252 font="sans-13" 253 scrollbar="true" 254 scrollbar_style="ModernScrollBar" 255 scroll_bottom="true" 256 textcolor="white" 257 textcolor_selected="gold" 258 text_align="left" 259 text_valign="center" 260 /> 261 250 262 <style name="notificationPanel" 251 263 buffer_zone="5" 252 264 font="sans-bold-stroke-14"