summaryrefslogtreecommitdiff
path: root/src/net/eathena
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-04 15:45:30 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-04 15:45:30 +0300
commit6f06cd42b8e56aaae2be853a31d73d0115a39c2a (patch)
tree589d5d51b66018b6063bf954f90b96a3244b2e3d /src/net/eathena
parent13b4a16c46983b786d31f6cf67632a3bd4e14b8f (diff)
downloadmanaplus-6f06cd42b8e56aaae2be853a31d73d0115a39c2a.tar.gz
manaplus-6f06cd42b8e56aaae2be853a31d73d0115a39c2a.tar.bz2
manaplus-6f06cd42b8e56aaae2be853a31d73d0115a39c2a.tar.xz
manaplus-6f06cd42b8e56aaae2be853a31d73d0115a39c2a.zip
Add chat command for create chat room (incomplete).
New chat command: /chatroom NAME
Diffstat (limited to 'src/net/eathena')
-rw-r--r--src/net/eathena/chathandler.cpp23
-rw-r--r--src/net/eathena/chathandler.h3
2 files changed, 23 insertions, 3 deletions
diff --git a/src/net/eathena/chathandler.cpp b/src/net/eathena/chathandler.cpp
index 57d57ca6c..de66468e2 100644
--- a/src/net/eathena/chathandler.cpp
+++ b/src/net/eathena/chathandler.cpp
@@ -55,6 +55,8 @@ extern Net::ChatHandler *chatHandler;
namespace EAthena
{
+std::string ChatHandler::mChatRoom;
+
ChatHandler::ChatHandler() :
MessageHandler(),
Ea::ChatHandler()
@@ -393,11 +395,12 @@ void ChatHandler::createChatRoom(const std::string &title,
{
createOutPacket(CMSG_CREAYE_CHAT_ROOM);
outMsg.writeInt16(static_cast<int16_t>(
- password.size() + title.size() + 5), "len");
+ 7 + 8 + 36), "len");
outMsg.writeInt16(static_cast<int16_t>(limit), "limit");
outMsg.writeInt8(static_cast<int8_t>(isPublic ? 1 : 0), "public");
outMsg.writeString(password, 8, "password");
outMsg.writeString(title, 36, "title");
+ mChatRoom = title;
}
void ChatHandler::battleTalk(const std::string &text) const
@@ -845,8 +848,22 @@ void ChatHandler::talkPet(const std::string &restrict text,
void ChatHandler::processChatRoomCreateAck(Net::MessageIn &msg)
{
- UNIMPLIMENTEDPACKET;
- msg.readUInt8("flag");
+ const int result = msg.readUInt8("flag");
+ switch(result)
+ {
+ case 0:
+ chatWindow->addChatRoomTab(mChatRoom, true);
+ break;
+ case 1:
+ NotifyManager::notify(NotifyTypes::ROOM_LIMIT_EXCEEDED);
+ break;
+ case 2:
+ NotifyManager::notify(NotifyTypes::ROOM_ALREADY_EXISTS);
+ break;
+ default:
+ UNIMPLIMENTEDPACKET;
+ break;
+ }
}
void ChatHandler::processChatRoomDestroy(Net::MessageIn &msg)
diff --git a/src/net/eathena/chathandler.h b/src/net/eathena/chathandler.h
index 879217b41..c0807c37a 100644
--- a/src/net/eathena/chathandler.h
+++ b/src/net/eathena/chathandler.h
@@ -166,6 +166,9 @@ class ChatHandler final : public MessageHandler, public Ea::ChatHandler
static void processBattleChatMessage(Net::MessageIn &msg);
static void processScriptMessage(Net::MessageIn &msg);
+
+ private:
+ static std::string mChatRoom;
};
} // namespace EAthena