summaryrefslogtreecommitdiff
path: root/src/connectionhandler.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <bertram@cegetel.net>2006-01-20 23:17:19 +0000
committerYohann Ferreira <bertram@cegetel.net>2006-01-20 23:17:19 +0000
commitd318b2428878bd0e35b189b3e6d3bffd825da25c (patch)
treedc61bd08aec87a5293e1ca072079652ad6047423 /src/connectionhandler.cpp
parent7960ff184f15a3b6029fef8e5100d24a6c556afe (diff)
downloadmanaserv-d318b2428878bd0e35b189b3e6d3bffd825da25c.tar.gz
manaserv-d318b2428878bd0e35b189b3e6d3bffd825da25c.tar.bz2
manaserv-d318b2428878bd0e35b189b3e6d3bffd825da25c.tar.xz
manaserv-d318b2428878bd0e35b189b3e6d3bffd825da25c.zip
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.
Diffstat (limited to 'src/connectionhandler.cpp')
-rw-r--r--src/connectionhandler.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/connectionhandler.cpp b/src/connectionhandler.cpp
index 9ce663df..38233a6a 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<tmwserv::BeingPtr> beingList =
+ chatChannelManager->getUserListInChannel(channelId);
+ // If the being is in the channel, send it
+ for (std::vector<tmwserv::BeingPtr>::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();