summaryrefslogtreecommitdiff
path: root/src/gui/chat.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2005-09-17 13:51:37 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2005-09-17 13:51:37 +0000
commite846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c (patch)
tree8feb8b51d731057412a59aeddbbe83b75b09912a /src/gui/chat.cpp
parent3bfcee0d9c033a46fe1b13795d89909c8fb6a239 (diff)
downloadMana-e846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c.tar.gz
Mana-e846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c.tar.bz2
Mana-e846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c.tar.xz
Mana-e846d4502b59a1a3b8d658a37ae5b5ce4aa1c00c.zip
Completed transition to use MessageOut.
Diffstat (limited to 'src/gui/chat.cpp')
-rw-r--r--src/gui/chat.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index e6dabaaa..3ef6703c 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -31,8 +31,11 @@
#include "scrollarea.h"
#include "../playerinfo.h"
+#include "../log.h"
+#include "../net/messageout.h"
#include "../net/network.h"
+#include "../net/protocol.h"
ChatWindow::ChatWindow(const std::string &logfile):
Window("")
@@ -194,7 +197,7 @@ bool ChatWindow::isFocused()
char *ChatWindow::chat_send(std::string nick, std::string msg)
{
- short packid = 0x008c;
+ short packetId = CMSG_CHAT_MESSAGE;
// prepare command
if (msg.substr(0, 1) == "/") {
@@ -211,17 +214,16 @@ char *ChatWindow::chat_send(std::string nick, std::string msg)
nick += " : ";
nick += msg;
msg = nick;
- packid = 0x008c;
+ //packetId = 0x008c;
}
- msg += "\0";
-
// send processed message
- writeWord(0, packid);
- writeWord(2, (unsigned short)(msg.length() + 4));
- memcpy(writePointer(4), msg.c_str(), msg.length());
- writeSet((int)msg.length()+4);
- nick = msg = "";
+ MessageOut outMsg;
+ outMsg.writeShort(packetId);
+ outMsg.writeShort(msg.length() + 4);
+ outMsg.writeString(msg, msg.length());
+ writeSet(msg.length() + 4);
+
return "";
}