diff options
author | David Athay <ko2fan@gmail.com> | 2009-04-23 17:31:14 +0100 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2009-04-23 17:31:14 +0100 |
commit | 0d439c39e99dbf1120dce784459176f744f70728 (patch) | |
tree | ef9dd8ccd23e3ec3f35ad08b1bbe40ac633cd5ab /src/net/tmwserv/chathandler.cpp | |
parent | 0b1079c93c9ec61a0e0c00f8c942e5ef84052c05 (diff) | |
download | mana-0d439c39e99dbf1120dce784459176f744f70728.tar.gz mana-0d439c39e99dbf1120dce784459176f744f70728.tar.bz2 mana-0d439c39e99dbf1120dce784459176f744f70728.tar.xz mana-0d439c39e99dbf1120dce784459176f744f70728.zip |
Added listing all online users
Diffstat (limited to 'src/net/tmwserv/chathandler.cpp')
-rw-r--r-- | src/net/tmwserv/chathandler.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/net/tmwserv/chathandler.cpp b/src/net/tmwserv/chathandler.cpp index e3421e93..41dc7bee 100644 --- a/src/net/tmwserv/chathandler.cpp +++ b/src/net/tmwserv/chathandler.cpp @@ -66,6 +66,7 @@ ChatHandler::ChatHandler() CPMSG_QUIT_CHANNEL_RESPONSE, CPMSG_LIST_CHANNELUSERS_RESPONSE, CPMSG_CHANNEL_EVENT, + CPMSG_WHO_RESPONSE, 0 }; handledMessages = _messages; @@ -110,6 +111,11 @@ void ChatHandler::handleMessage(MessageIn &msg) case CPMSG_CHANNEL_EVENT: handleChannelEvent(msg); + break; + + case CPMSG_WHO_RESPONSE: + handleWhoResponse(msg); + break; } } @@ -296,6 +302,21 @@ void ChatHandler::handleChannelEvent(MessageIn &msg) } } +void ChatHandler::handleWhoResponse(MessageIn &msg) +{ + std::string userNick; + + while(msg.getUnreadLength()) + { + userNick = msg.readString(); + if (userNick == "") + { + break; + } + localChatTab->chatLog(userNick, BY_SERVER); + } +} + void ChatHandler::talk(const std::string &text) { MessageOut msg(PGMSG_SAY); @@ -379,4 +400,10 @@ void ChatHandler::kickUser(int channelId, const std::string &name) Net::ChatServer::connection->send(msg); } +void ChatHandler::who() +{ + MessageOut msg(PCMSG_WHO); + Net::ChatServer::connection->send(msg); +} + } // namespace TmwServ |