From d318b2428878bd0e35b189b3e6d3bffd825da25c Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Fri, 20 Jan 2006 23:17:19 +0000 Subject: Chat channeling commit part 3. Is now linked with the connection handler to chat in a specific channel. Also made some fixes on the chat channeling. --- src/connectionhandler.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/connectionhandler.cpp') diff --git a/src/connectionhandler.cpp b/src/connectionhandler.cpp index 9ce663d..38233a6 100644 --- a/src/connectionhandler.cpp +++ b/src/connectionhandler.cpp @@ -27,6 +27,7 @@ #include "connectionhandler.h" #include "netsession.h" +#include "chatchannelmanager.h" #include "utils/logger.h" #ifdef SCRIPT_SUPPORT @@ -294,6 +295,24 @@ void ConnectionHandler::sendAround(tmwserv::BeingPtr beingPtr, MessageOut &msg) } } +void ConnectionHandler::sendInChannel(short channelId, MessageOut &msg) +{ + for (NetComputers::iterator i = clients.begin(); i != clients.end();i++) + { + const std::vector beingList = + chatChannelManager->getUserListInChannel(channelId); + // If the being is in the channel, send it + for (std::vector::const_iterator j = beingList.begin(); + j != beingList.end(); j++) + { + if ((*i)->getCharacter().get() == (*j).get() ) + { + (*i)->send(msg.getPacket()); + } + } + } +} + unsigned int ConnectionHandler::getClientNumber() { return clients.size(); -- cgit