summaryrefslogtreecommitdiff
path: root/src/net/tmwserv/chathandler.cpp
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2009-04-23 17:31:14 +0100
committerDavid Athay <ko2fan@gmail.com>2009-04-23 17:31:14 +0100
commit0d439c39e99dbf1120dce784459176f744f70728 (patch)
treeef9dd8ccd23e3ec3f35ad08b1bbe40ac633cd5ab /src/net/tmwserv/chathandler.cpp
parent0b1079c93c9ec61a0e0c00f8c942e5ef84052c05 (diff)
downloadmana-client-0d439c39e99dbf1120dce784459176f744f70728.tar.gz
mana-client-0d439c39e99dbf1120dce784459176f744f70728.tar.bz2
mana-client-0d439c39e99dbf1120dce784459176f744f70728.tar.xz
mana-client-0d439c39e99dbf1120dce784459176f744f70728.zip
Added listing all online users
Diffstat (limited to 'src/net/tmwserv/chathandler.cpp')
-rw-r--r--src/net/tmwserv/chathandler.cpp27
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