A solution to the problem of when to set the extended info keys. This allows

for nice large amounts of client info to be sent to a QuakeForge server.

sv_main.c:
	Append " QF" to the challenge reply. This DOES NOT break older clients
	because atoi stops parsing at the first non-number character but
	returns the value of what it successfully parsed. If a client does
	choke on this, its libc is broken and not to spec.

cl_main.c:
	Check for "QF" in the challenge string and if it's there, set the
	QF extended info keys before connecting. Also, make sure the extended
	info keys are NOT set prior to starting the connect process. This is
	done is the CL_Disconnect function.
This commit is contained in:
Bill Currie 2000-10-04 16:22:51 +00:00
parent 065abe9464
commit fc6ff9374d
2 changed files with 38 additions and 14 deletions

View file

@ -82,6 +82,7 @@
#include <strings.h>
#endif
void CL_RemoveQFInfoKeys ();
// we need to declare some mouse variables here, because the menu system
// references them even when on a unix system.
@ -489,8 +490,7 @@ void CL_Disconnect (void)
cls.demoplayback = cls.demorecording = cls.timedemo = false;
Info_RemoveKey (cls.userinfo, "*cap");
Info_RemoveKey (cls.userinfo, "*qsg_version");
CL_RemoveQFInfoKeys ();
}
Cam_Reset();
@ -658,19 +658,41 @@ void CL_FullServerinfo_f (void)
} else {
allowskybox = false;
}
if ((p = Info_ValueForKey (cl.serverinfo, "*qsg_version")) && *p) {
char cap[100] = ""; // max of 98 or so flags
// set the capabilities info. single char flags (possibly with
// modifiefs)
// defined capabilities:
}
/*
CL_AddQFInfoKeys
*/
void
CL_AddQFInfoKeys ()
{
char cap[100] = ""; // max of 98 or so flags
// set the capabilities info. single char flags (possibly with
// modifiefs)
// defined capabilities:
// z client can accept gzipped files.
#ifdef HAVE_ZLIB
// z client can accept gzipped files.
strcat (cap, "z");
strcat (cap, "z");
#endif
Info_SetValueForStarKey (cls.userinfo, "*cap", cap, MAX_INFO_STRING);
Info_SetValueForStarKey (cls.userinfo, "*qsg_version", QSG_VERSION,
MAX_SERVERINFO_STRING);
}
Info_SetValueForStarKey (cls.userinfo, "*cap", cap, MAX_INFO_STRING);
Info_SetValueForStarKey (cls.userinfo, "*qsg_version", QSG_VERSION,
MAX_SERVERINFO_STRING);
Con_Printf ("QuakeForge server detected\n");
}
/*
CL_RemoveQFInfoKeys
*/
void
CL_RemoveQFInfoKeys ()
{
Info_RemoveKey (cls.userinfo, "*cap");
Info_RemoveKey (cls.userinfo, "*qsg_version");
}
/*
@ -1004,6 +1026,8 @@ void CL_ConnectionlessPacket (void)
s = MSG_ReadString ();
cls.challenge = atoi(s);
if (strstr (s, "QF"))
CL_AddQFInfoKeys ();
CL_SendConnectPacket ();
return;
}

View file

@ -626,7 +626,7 @@ void SVC_GetChallenge (void)
}
// send it back
Netchan_OutOfBandPrint (net_from, "%c%i", S2C_CHALLENGE,
Netchan_OutOfBandPrint (net_from, "%c%i QF", S2C_CHALLENGE,
svs.challenges[i].challenge);
}