diff options
author | Stijn Buys <ingar@osirion.org> | 2008-11-08 16:51:28 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-11-08 16:51:28 +0000 |
commit | 6cd1a38f1d3a0a45846d63a75475400372af1277 (patch) | |
tree | 35bc79e34fe727fc387103a183f80b203c6dfa12 /src/core/netserver.cc | |
parent | 731dfb8f3ca9c34e4160021cb221c3056c00dbf9 (diff) |
moved message functions into Player class
Diffstat (limited to 'src/core/netserver.cc')
-rw-r--r-- | src/core/netserver.cc | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/src/core/netserver.cc b/src/core/netserver.cc index c6214c9..3f0d2e8 100644 --- a/src/core/netserver.cc +++ b/src/core/netserver.cc @@ -282,7 +282,7 @@ void NetServer::client_initialize(NetClient *client) { // send welcome message std::string welcome("^B"); welcome.append(Cvar::sv_name->str()); - send_message(client, "info", welcome); + client->player()->send(welcome); client->transmit(fd()); // send zones @@ -406,25 +406,6 @@ void NetServer::frame(unsigned long timestamp) * zone <id> <zone create/update data> */ -// broadcast a "msg <channel>" message to all clients -void NetServer::broadcast_message(const char *channel, std::string const & message, Player *ignore_player) -{ - if (!channel) - return; - - std::string msg("msg "); - msg.append(channel); - msg += ' '; - msg.append(message); - msg += '\n'; - - for (Clients::iterator it = clients.begin(); it != clients.end(); it++) { - if (((*it)->player() && (*it)->player() != ignore_player) && ((*it)->state() == NetClient::Connected)) { - (*it)->send_raw(msg); - } - } -} - // send a "msg <channel>" message to one client void NetServer::send_message(NetClient *client, const char *channel, std::string const & message) { @@ -625,7 +606,7 @@ void NetServer::parse_incoming_message(NetClient *client, const std::string & me core::CommandBuffer::exec(); while(console()->rconbuf().size()) { - server()->send(client->player(), (*console()->rconbuf().begin())); + send_message(client, "rcon", (*console()->rconbuf().begin())); core::console()->rconbuf().pop_front(); } @@ -633,7 +614,7 @@ void NetServer::parse_incoming_message(NetClient *client, const std::string & me console()->set_rcon(false); } else { - server()->send(client->player(), "rcon access denied"); + send_message(client, "info", "rcon access denied"); con_print << "^B" << client->player()->name() << "^W rcon access denied" << std::endl; } } |