const int URI_GET_CURL = 17;
const int URI_GET_CURL_END = 32;
const int URI_GET_UPDATENOTIFICATION = 33;
+const int URI_GET_TOS = 34;
const int URI_GET_URLLIB = 128;
const int URI_GET_URLLIB_END = 191;
#include "textbox.qh"
#include "textlabel.qh"
#include "button.qh"
+#include "util.qh"
void Close_Clicked(entity btn, entity me)
{
}
fclose(fh);
}
+ LOG_INFO("Test: ", _Nex_ExtResponseSystem_TOS, ": ", ftos(XonoticToSDialog_shouldShow()));
me.textBox.setText(me.textBox, ToSText);
}
bool XonoticToSDialog_shouldShow()
{
- return (fexists("tos.txt") && !autocvar__termsofservice_accepted);
+ return (_Nex_ExtResponseSystem_TOS && !autocvar__termsofservice_accepted);
}
void XonoticToSDialog_fill(entity me)
{
UpdateNotification_URI_Get_Callback(id, status, data);
}
+ else if (id == URI_GET_TOS)
+ {
+ TOS_URI_Get_Callback(id, status, data);
+ }
else
{
LOG_INFOF("Received HTTP request data for an invalid id %d.", id);
}
}
+void TOS_URI_Get_Callback(float id, float status, string data)
+{
+ if(_Nex_ExtResponseSystem_TOS)
+ {
+ LOG_TRACE("error: TOS_URI_Get_Callback has been called before");
+ return;
+ }
+ if(status != 0)
+ {
+ LOG_TRACEF("error receiving tos: status is %d", status);
+ return;
+ }
+
+ _Nex_ExtResponseSystem_TOS = strzone(data);
+ LOG_INFO("Data: ", _Nex_ExtResponseSystem_TOS);
+}
+
// END OF URI SYSTEM ////////////////////////////////////////////////////////
void updateCheck()
uri_get(uri, URI_GET_UPDATENOTIFICATION);
}
+ // Terms of Service updater, re-using the existing external response system!
+ if(_Nex_ExtResponseSystem_Queried == 1)
+ {
+ _Nex_ExtResponseSystem_Queried = 2;
+
+ string tosurl = "http://update.xonotic.org/tos.txt";
+ uri_get(tosurl, URI_GET_TOS);
+ }
+
if(_Nex_ExtResponseSystem_PacksStep > 0)
{
float n, i;
void UpdateNotification_URI_Get_Callback(float id, float status, string data);
+void TOS_URI_Get_Callback(float id, float status, string data);
+
// game type list box stuff (does not NEED to contain all game types, other
// types stay available via console)
entity GameType_GetID(int cnt);
float _Nex_ExtResponseSystem_PromotedServersNeedsRefresh;
string _Nex_ExtResponseSystem_RecommendedServers;
float _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh;
+string _Nex_ExtResponseSystem_TOS;
void CheckSendCvars(entity me, string cvarnamestring);