Ticket #3171: t3171_clear_muc_messages_v1.patch
File t3171_clear_muc_messages_v1.patch, 5.9 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/gui/lobby/lobby.js
153 153 * 154 154 * @return Array containing the player, presence, nickname, and rating listings. 155 155 */ 156 156 function updatePlayerList() 157 157 { 158 159 Engine.ClearMucMessages(); 158 160 var playersBox = Engine.GetGUIObjectByName("playersBox"); 159 161 var playerList = []; 160 162 var presenceList = []; 161 163 var nickList = []; 162 164 var ratingList = []; -
source/lobby/IXmppClient.h
52 52 virtual void GUIGetGameList(ScriptInterface& scriptInterface, JS::MutableHandleValue ret) = 0; 53 53 virtual void GUIGetBoardList(ScriptInterface& scriptInterface, JS::MutableHandleValue ret) = 0; 54 54 virtual void GUIGetProfile(ScriptInterface& scriptInterface, JS::MutableHandleValue ret) = 0; 55 55 56 56 virtual void GuiPollMessage(ScriptInterface& scriptInterface, JS::MutableHandleValue ret) = 0; 57 virtual void ClearMucMessages() = 0; 57 58 virtual void SendMUCMessage(const std::string& message) = 0; 58 59 }; 59 60 60 61 extern IXmppClient *g_XmppClient; 61 62 extern bool g_rankedGame; -
source/lobby/XmppClient.cpp
620 620 621 621 m_GuiMessageQueue.pop_front(); 622 622 } 623 623 624 624 /** 625 * Clear the GUI message queue. 626 */ 627 void XmppClient::ClearMucMessages() 628 { 629 // TODO: use mutex lock here? 630 bool clean; 631 do 632 { 633 clean = true; 634 for (std::deque<GUIMessage>::iterator it = m_GuiMessageQueue.begin(); it!=m_GuiMessageQueue.end(); ++it) 635 { 636 GUIMessage message = *it; 637 if (message.type == L"muc") 638 { 639 debug_printf("Deleting muc message \n"); 640 m_GuiMessageQueue.erase(it); 641 clean = false; 642 break; 643 } 644 } 645 } while (!clean); 646 } 647 648 /** 625 649 * Send a standard MUC textual message. 626 650 */ 627 651 void XmppClient::SendMUCMessage(const std::string& message) 628 652 { 629 653 m_mucRoom->send(message); -
source/lobby/XmppClient.h
132 132 std::wstring from; 133 133 std::wstring message; 134 134 std::string datetime; 135 135 }; 136 136 void GuiPollMessage(ScriptInterface& scriptInterface, JS::MutableHandleValue ret); 137 void ClearMucMessages(); 137 138 void SendMUCMessage(const std::string& message); 138 139 protected: 139 140 void PushGuiMessage(XmppClient::GUIMessage message); 140 141 void CreateSimpleMessage(const std::string& type, const std::string& text, const std::string& level = "standard", const std::string& data = ""); 141 142 -
source/lobby/scripting/JSInterface_Lobby.cpp
49 49 scriptInterface.RegisterFunction<JS::Value, &JSI_Lobby::GetPlayerList>("GetPlayerList"); 50 50 scriptInterface.RegisterFunction<JS::Value, &JSI_Lobby::GetGameList>("GetGameList"); 51 51 scriptInterface.RegisterFunction<JS::Value, &JSI_Lobby::GetBoardList>("GetBoardList"); 52 52 scriptInterface.RegisterFunction<JS::Value, &JSI_Lobby::GetProfile>("GetProfile"); 53 53 scriptInterface.RegisterFunction<JS::Value, &JSI_Lobby::LobbyGuiPollMessage>("LobbyGuiPollMessage"); 54 scriptInterface.RegisterFunction<void, &JSI_Lobby::ClearMucMessages>("ClearMucMessages"); 54 55 scriptInterface.RegisterFunction<void, std::wstring, &JSI_Lobby::LobbySendMessage>("LobbySendMessage"); 55 56 scriptInterface.RegisterFunction<void, std::wstring, &JSI_Lobby::LobbySetPlayerPresence>("LobbySetPlayerPresence"); 56 57 scriptInterface.RegisterFunction<void, std::wstring, &JSI_Lobby::LobbySetNick>("LobbySetNick"); 57 58 scriptInterface.RegisterFunction<std::wstring, &JSI_Lobby::LobbyGetNick>("LobbyGetNick"); 58 59 scriptInterface.RegisterFunction<void, std::wstring, std::wstring, &JSI_Lobby::LobbyKick>("LobbyKick"); … … 243 244 g_XmppClient->GuiPollMessage(*(pCxPrivate->pScriptInterface), &poll); 244 245 245 246 return poll; 246 247 } 247 248 249 void JSI_Lobby::ClearMucMessages(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)) 250 { 251 if (g_XmppClient) 252 g_XmppClient->ClearMucMessages(); 253 } 254 248 255 void JSI_Lobby::LobbySendMessage(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), std::wstring message) 249 256 { 250 257 if (!g_XmppClient) 251 258 return; 252 259 -
source/lobby/scripting/JSInterface_Lobby.h
47 47 JS::Value GetPlayerList(ScriptInterface::CxPrivate* pCxPrivate); 48 48 JS::Value GetGameList(ScriptInterface::CxPrivate* pCxPrivate); 49 49 JS::Value GetBoardList(ScriptInterface::CxPrivate* pCxPrivate); 50 50 JS::Value GetProfile(ScriptInterface::CxPrivate* pCxPrivate); 51 51 JS::Value LobbyGuiPollMessage(ScriptInterface::CxPrivate* pCxPrivate); 52 void ClearMucMessages(ScriptInterface::CxPrivate* pCxPrivate); 52 53 void LobbySendMessage(ScriptInterface::CxPrivate* pCxPrivate, std::wstring message); 53 54 void LobbySetPlayerPresence(ScriptInterface::CxPrivate* pCxPrivate, std::wstring presence); 54 55 void LobbySetNick(ScriptInterface::CxPrivate* pCxPrivate, std::wstring nick); 55 56 std::wstring LobbyGetNick(ScriptInterface::CxPrivate* pCxPrivate); 56 57 void LobbyKick(ScriptInterface::CxPrivate* pCxPrivate, std::wstring nick, std::wstring reason);