]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/network/clientpackethandler.cpp
[CSM] Add method that display chat to client-sided lua. (#5089) (#5091)
[dragonfireclient.git] / src / network / clientpackethandler.cpp
index b11f73e869d452677dec5607a8a383874394542a..d0642c86aa8fa94c863eb9b5dd7e0020355b77df 100644 (file)
@@ -30,6 +30,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "server.h"
 #include "util/strfnd.h"
 #include "network/clientopcodes.h"
+#include "script/clientscripting.h"
 #include "util/serialize.h"
 #include "util/srp.h"
 #include "tileanimation.h"
@@ -141,7 +142,7 @@ void Client::handleCommand_AcceptSudoMode(NetworkPacket* pkt)
 }
 void Client::handleCommand_DenySudoMode(NetworkPacket* pkt)
 {
-       m_chat_queue.push(L"Password change denied. Password NOT changed.");
+       pushToChatQueue(L"Password change denied. Password NOT changed.");
        // reset everything and be sad
        deleteAuthData();
 }
@@ -411,7 +412,10 @@ void Client::handleCommand_ChatMessage(NetworkPacket* pkt)
                message += (wchar_t)read_wchar;
        }
 
-       m_chat_queue.push(message);
+       // If chat message not consummed by client lua API
+       if (!m_script->on_receiving_message(wide_to_utf8(message))) {
+               pushToChatQueue(message);
+       }
 }
 
 void Client::handleCommand_ActiveObjectRemoveAdd(NetworkPacket* pkt)