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/netcomputer.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/netcomputer.cpp') diff --git a/src/netcomputer.cpp b/src/netcomputer.cpp index 40685b51..777610b4 100644 --- a/src/netcomputer.cpp +++ b/src/netcomputer.cpp @@ -22,15 +22,14 @@ */ #include "netcomputer.h" +#include "chatchannelmanager.h" #include "state.h" -#include -#include NetComputer::NetComputer(ConnectionHandler *handler, TCPsocket sock): handler(handler), socket(sock), - accountPtr(NULL), - characterPtr(NULL) + mAccountPtr(NULL), + mCharacterPtr(NULL) { } @@ -52,32 +51,33 @@ void NetComputer::send(const Packet *p) void NetComputer::setAccount(tmwserv::AccountPtr acc) { - accountPtr = acc; + mAccountPtr = acc; } void NetComputer::setCharacter(tmwserv::BeingPtr ch) { tmwserv::State &state = tmwserv::State::instance(); - if (characterPtr.get() != NULL) + if (mCharacterPtr.get() != NULL) { // Remove being from the world. - state.removeBeing(characterPtr); + unsetCharacter(); } - characterPtr = ch; - state.addBeing(characterPtr, characterPtr->getMapId()); + mCharacterPtr = ch; + state.addBeing(mCharacterPtr, mCharacterPtr->getMapId()); } void NetComputer::unsetAccount() { unsetCharacter(); - accountPtr = tmwserv::AccountPtr(NULL); + mAccountPtr = tmwserv::AccountPtr(NULL); } void NetComputer::unsetCharacter() { // remove being from world tmwserv::State &state = tmwserv::State::instance(); - state.removeBeing(characterPtr); - characterPtr = tmwserv::BeingPtr(NULL); + state.removeBeing(mCharacterPtr); + chatChannelManager->removeUserFromEveryChannels(mCharacterPtr); + mCharacterPtr = tmwserv::BeingPtr(NULL); } -- cgit v1.2.3-70-g09d2