summaryrefslogtreecommitdiff
path: root/src/connectionhandler.cpp
diff options
context:
space:
mode:
authorYohann Ferreira <bertram@cegetel.net>2006-03-05 01:14:15 +0000
committerYohann Ferreira <bertram@cegetel.net>2006-03-05 01:14:15 +0000
commitee55fb86718729e1ce445b9f674bf8287981cbaf (patch)
tree3053a880f816f176d316e21f61924a219eb545b4 /src/connectionhandler.cpp
parentdca3ef9431e83d60ed305c8a301081d2d004f849 (diff)
downloadmanaserv-ee55fb86718729e1ce445b9f674bf8287981cbaf.tar.gz
manaserv-ee55fb86718729e1ce445b9f674bf8287981cbaf.tar.bz2
manaserv-ee55fb86718729e1ce445b9f674bf8287981cbaf.tar.xz
manaserv-ee55fb86718729e1ce445b9f674bf8287981cbaf.zip
Added the server code to enter and leave a channel. Some minor fix to the state code, and completed the TODO a little for later coding.
Diffstat (limited to 'src/connectionhandler.cpp')
-rw-r--r--src/connectionhandler.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/src/connectionhandler.cpp b/src/connectionhandler.cpp
index c7a3d49b..a336a842 100644
--- a/src/connectionhandler.cpp
+++ b/src/connectionhandler.cpp
@@ -323,10 +323,11 @@ void ConnectionHandler::makeUsersLeaveChannel(const short channelId)
MessageOut result;
result.writeShort(SMSG_QUIT_CHANNEL_RESPONSE);
result.writeByte(CHATCNL_OUT_OK);
+
+ const std::vector<tmwserv::BeingPtr> beingList =
+ chatChannelManager->getUserListInChannel(channelId);
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 the 'leave now' packet
for (std::vector<tmwserv::BeingPtr>::const_iterator j = beingList.begin();
j != beingList.end(); j++)
@@ -338,3 +339,28 @@ void ConnectionHandler::makeUsersLeaveChannel(const short channelId)
}
}
}
+
+void ConnectionHandler::warnUsersAboutPlayerEventInChat(const short channelId,
+ const std::string& userName,
+ const char eventId)
+{
+ MessageOut result;
+ result.writeShort(SMSG_UPDATE_CHANNEL_RESPONSE);
+ result.writeByte(eventId);
+ result.writeString(userName);
+
+ const std::vector<tmwserv::BeingPtr> beingList =
+ chatChannelManager->getUserListInChannel(channelId);
+ for (NetComputers::iterator i = clients.begin(); i != clients.end();i++)
+ {
+ // If the being is in the channel, send it the 'eventId' packet
+ for (std::vector<tmwserv::BeingPtr>::const_iterator j = beingList.begin();
+ j != beingList.end(); j++)
+ {
+ if ((*i)->getCharacter().get() == (*j).get() )
+ {
+ (*i)->send(result.getPacket());
+ }
+ }
+ }
+}