X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=netconn.c;h=65b64830067da60339105a1a36e91d4cacd5cd98;hb=cf74e01c006d2937bf1e3a522efc7b2dd0f40ba2;hp=3253b7989109115f0a162c91f9d6f6a8a140d984;hpb=4cea57335d11201c0c7eedc1dd15bdd56538b99f;p=xonotic%2Fdarkplaces.git diff --git a/netconn.c b/netconn.c index 3253b798..65b64830 100755 --- a/netconn.c +++ b/netconn.c @@ -35,6 +35,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. cvar_t sv_public = {0, "sv_public", "0", "1: advertises this server on the master server (so that players can find it in the server browser); 0: allow direct queries only; -1: do not respond to direct queries; -2: do not allow anyone to connect; -3: already block at getchallenge level"}; cvar_t sv_public_rejectreason = {0, "sv_public_rejectreason", "The server is closing.", "Rejection reason for connects when sv_public is -2"}; static cvar_t sv_heartbeatperiod = {CVAR_SAVE, "sv_heartbeatperiod", "120", "how often to send heartbeat in seconds (only used if sv_public is 1)"}; +extern cvar_t sv_status_privacy; static cvar_t sv_masters [] = { @@ -2286,6 +2287,7 @@ static qboolean NetConn_BuildStatusResponse(const char* challenge, char* out_msg int length; char teambuf[3]; const char *crypto_idstring; + const char *str; SV_VM_Begin(); @@ -2301,19 +2303,16 @@ static qboolean NetConn_BuildStatusResponse(const char* challenge, char* out_msg } *qcstatus = 0; - if(prog->globaloffsets.worldstatus >= 0) + str = PRVM_GetString(PRVM_serverglobalstring(worldstatus)); + if(str && *str) { - const char *str = PRVM_G_STRING(prog->globaloffsets.worldstatus); - if(str && *str) - { - char *p; - const char *q; - p = qcstatus; - for(q = str; *q && p - qcstatus < (ptrdiff_t)(sizeof(qcstatus)) - 1; ++q) - if(*q != '\\' && *q != '\n') - *p++ = *q; - *p = 0; - } + char *p; + const char *q; + p = qcstatus; + for(q = str; *q && p - qcstatus < (ptrdiff_t)(sizeof(qcstatus)) - 1; ++q) + if(*q != '\\' && *q != '\n') + *p++ = *q; + *p = 0; } /// \TODO: we should add more information for the full status string @@ -2357,6 +2356,8 @@ static qboolean NetConn_BuildStatusResponse(const char* challenge, char* out_msg int nameind, cleanind, pingvalue; char curchar; char cleanname [sizeof(cl->name)]; + const char *str; + prvm_edict_t *ed; // Remove all characters '"' and '\' in the player name nameind = 0; @@ -2380,19 +2381,17 @@ static qboolean NetConn_BuildStatusResponse(const char* challenge, char* out_msg pingvalue = 0; *qcstatus = 0; - if(prog->fieldoffsets.clientstatus >= 0) + ed = PRVM_EDICT_NUM(i + 1); + str = PRVM_GetString(PRVM_serveredictstring(ed, clientstatus)); + if(str && *str) { - const char *str = PRVM_E_STRING(PRVM_EDICT_NUM(i + 1), prog->fieldoffsets.clientstatus); - if(str && *str) - { - char *p; - const char *q; - p = qcstatus; - for(q = str; *q && p != qcstatus + sizeof(qcstatus) - 1; ++q) - if(*q != '\\' && *q != '"' && !ISWHITESPACE(*q)) - *p++ = *q; - *p = 0; - } + char *p; + const char *q; + p = qcstatus; + for(q = str; *q && p != qcstatus + sizeof(qcstatus) - 1; ++q) + if(*q != '\\' && *q != '"' && !ISWHITESPACE(*q)) + *p++ = *q; + *p = 0; } if ((gamemode == GAME_NEXUIZ || gamemode == GAME_XONOTIC) && (teamplay.integer > 0)) @@ -3248,7 +3247,10 @@ static int NetConn_ServerParsePacket(lhnetsocket_t *mysocket, unsigned char *dat MSG_WriteLong(&net_message, client->colors); MSG_WriteLong(&net_message, client->frags); MSG_WriteLong(&net_message, (int)(realtime - client->connecttime)); - MSG_WriteString(&net_message, client->netconnection ? client->netconnection->address : "botclient"); + if(sv_status_privacy.integer) + MSG_WriteString(&net_message, client->netconnection ? "hidden" : "botclient"); + else + MSG_WriteString(&net_message, client->netconnection ? client->netconnection->address : "botclient"); StoreBigLong(net_message.data, NETFLAG_CTL | (net_message.cursize & NETFLAG_LENGTH_MASK)); NetConn_Write(mysocket, net_message.data, net_message.cursize, peeraddress); SZ_Clear(&net_message);