summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/chat-server/chathandler.cpp21
-rw-r--r--src/chat-server/chathandler.hpp5
-rw-r--r--src/defines.h3
3 files changed, 29 insertions, 0 deletions
diff --git a/src/chat-server/chathandler.cpp b/src/chat-server/chathandler.cpp
index 515d56b..c1387ce 100644
--- a/src/chat-server/chathandler.cpp
+++ b/src/chat-server/chathandler.cpp
@@ -164,6 +164,10 @@ void ChatHandler::processMessage(NetComputer *comp, MessageIn &message)
handlePrivMsgMessage(computer, message);
break;
+ case PCMSG_WHO:
+ handleWhoMessage(computer);
+ break;
+
case PCMSG_ENTER_CHANNEL:
handleEnterChannelMessage(computer, message);
break;
@@ -370,6 +374,23 @@ ChatHandler::handlePrivMsgMessage(ChatClient &client, MessageIn &msg)
storage->addTransaction(trans);
}
+void ChatHandler::handleWhoMessage(ChatClient &client)
+{
+ MessageOut reply(CPMSG_WHO_RESPONSE);
+
+ std::map<std::string, ChatClient*>::iterator itr, itr_end;
+ itr = mPlayerMap.begin();
+ itr_end = mPlayerMap.end();
+
+ while (itr != itr_end)
+ {
+ reply.writeString(itr->first);
+ ++itr;
+ }
+
+ client.send(reply);
+}
+
void ChatHandler::handleEnterChannelMessage(ChatClient &client, MessageIn &msg)
{
MessageOut reply(CPMSG_ENTER_CHANNEL_RESPONSE);
diff --git a/src/chat-server/chathandler.hpp b/src/chat-server/chathandler.hpp
index c58206d..1de44fc 100644
--- a/src/chat-server/chathandler.hpp
+++ b/src/chat-server/chathandler.hpp
@@ -164,6 +164,11 @@ class ChatHandler : public ConnectionHandler
handlePrivMsgMessage(ChatClient &client, MessageIn &msg);
/**
+ * Deal with Who messages.
+ */
+ void handleWhoMessage(ChatClient &client);
+
+ /**
* Deal with player entering channel.
*/
void
diff --git a/src/defines.h b/src/defines.h
index c657e6b..7ffb242 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -227,6 +227,9 @@ enum {
PCMSG_CHAT = 0x0410, // S text, W channel
PCMSG_ANNOUNCE = 0x0411, // S text
PCMSG_PRIVMSG = 0x0412, // S user, S text
+ PCMSG_WHO = 0x0415, // -
+ CPMSG_WHO_RESPONSE = 0x0416, // { S user }
+
// -- Channeling
CPMSG_CHANNEL_EVENT = 0x0430, // W channel, B event, S info
PCMSG_ENTER_CHANNEL = 0x0440, // S channel, S password