(svn r23255) [1.1] -Backport from trunk:

- Fix: When any keys on the on-screen keyboard were pressed the text cursor disappeared (r23132)
- Fix: [NoAI] AIOrder::IsCurrentOrderPartOfOrderList return false for valid vehicles and crashed for invalid ones (r23131)
- Fix: [NoAI] calling require() to include a file gave you 100.000 opcodes for free (r23117)
- Fix: Allow accessing the server's client info as well in the admin network [FS#4813] (r23115)
This commit is contained in:
rubidium
2011-11-18 21:04:08 +00:00
parent 5d9975cad1
commit a04aad0df3
6 changed files with 33 additions and 20 deletions
+16 -7
View File
@@ -199,16 +199,20 @@ NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientJoin(ClientID clien
return NETWORK_RECV_STATUS_OKAY;
}
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientInfo(const NetworkClientSocket *cs)
/**
* Send an initial set of data from some client's information.
* @param cs The socket of the client.
* @param ci The information about the client.
*/
NetworkRecvStatus ServerNetworkAdminSocketHandler::SendClientInfo(const NetworkClientSocket *cs, const NetworkClientInfo *ci)
{
/* Only send data when we're a proper client, not just someone trying to query the server. */
const NetworkClientInfo *ci = cs->GetInfo();
if (ci == NULL) return NETWORK_RECV_STATUS_OKAY;
Packet *p = new Packet(ADMIN_PACKET_SERVER_CLIENT_INFO);
p->Send_uint32(ci->client_id);
p->Send_string(const_cast<NetworkAddress &>(cs->client_address).GetHostname());
p->Send_string(cs == NULL ? "" : const_cast<NetworkAddress &>(cs->client_address).GetHostname());
p->Send_string(ci->client_name);
p->Send_uint8 (ci->client_lang);
p->Send_uint32(ci->join_date);
@@ -571,12 +575,17 @@ DEF_ADMIN_RECEIVE_COMMAND(Server, ADMIN_PACKET_ADMIN_POLL)
/* The admin is requesting client info. */
const NetworkClientSocket *cs;
if (d1 == UINT32_MAX) {
this->SendClientInfo(NULL, NetworkClientInfo::GetByClientID(CLIENT_ID_SERVER));
FOR_ALL_CLIENT_SOCKETS(cs) {
this->SendClientInfo(cs);
this->SendClientInfo(cs, cs->GetInfo());
}
} else {
cs = NetworkClientSocket::GetByClientID((ClientID)d1);
if (cs != NULL) this->SendClientInfo(cs);
if (d1 == CLIENT_ID_SERVER) {
this->SendClientInfo(NULL, NetworkClientInfo::GetByClientID(CLIENT_ID_SERVER));
} else {
cs = NetworkClientSocket::GetByClientID((ClientID)d1);
if (cs != NULL) this->SendClientInfo(cs, cs->GetInfo());
}
}
break;
@@ -658,7 +667,7 @@ void NetworkAdminClientInfo(const NetworkClientSocket *cs, bool new_client)
ServerNetworkAdminSocketHandler *as;
FOR_ALL_ACTIVE_ADMIN_SOCKETS(as) {
if (as->update_frequency[ADMIN_UPDATE_CLIENT_INFO] & ADMIN_FREQUENCY_AUTOMATIC) {
as->SendClientInfo(cs);
as->SendClientInfo(cs, cs->GetInfo());
if (new_client) {
as->SendClientJoin(cs->client_id);
}