void XonoticToSDialog_loadXonoticToS(entity me)
{
- string ToSText = "";
+ /*string ToSText = "";
int fh = fopen("tos.txt", FILE_READ);
if (fh >= 0)
{
fclose(fh);
}
LOG_INFO("Test: ", _Nex_ExtResponseSystem_TOS, ": ", ftos(XonoticToSDialog_shouldShow()));
- me.textBox.setText(me.textBox, ToSText);
+ me.textBox.setText(me.textBox, ToSText);*/
+ string downloadurl = "http://maria.omaera.org/tos.txt";
+ url_single_fopen(downloadurl, FILE_READ, XonoticToS_OnGet, me);
+}
+
+void XonoticToS_OnGet(entity fh, entity me, int status)
+{
+ switch (status) {
+ case URL_READY_CLOSED:
+ {
+ break;
+ }
+ case URL_READY_ERROR:
+ {
+ me.text = strzone("Error reading ToS");
+ me.textBox.setText(me.textBox, me.text);
+ break;
+ }
+ case URL_READY_CANREAD:
+ {
+ strfree(me.text);
+ string temp = "";
+ for (string s; (s = url_fgets(fh)); )
+ {
+ if (temp != "")
+ {
+ temp = strcat(temp, "\n", s);
+ }
+ else
+ {
+ temp = s;
+ }
+ }
+ url_fclose(fh);
+ me.text = strzone(temp);
+ me.textBox.setText(me.textBox, me.text);
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
}
bool XonoticToSDialog_shouldShow()
{
- return (_Nex_ExtResponseSystem_TOS && !autocvar__termsofservice_accepted);
+ //return (_Nex_ExtResponseSystem_TOS && !autocvar__termsofservice_accepted);
+ LOG_INFO("newtos value: ", _Nex_ExtResponseSystem_NewToS);
+ return (_Nex_ExtResponseSystem_NewToS != "");
}
void XonoticToSDialog_fill(entity me)
#pragma once
-bool autocvar__termsofservice_accepted = false;
-
#include "rootdialog.qh"
CLASS(XonoticToSDialog, XonoticRootDialog)
METHOD(XonoticToSDialog, shouldShow, bool());
ATTRIB(XonoticToSDialog, rows, float, 16);
ATTRIB(XonoticToSDialog, columns, float, 6.2);
ATTRIB(XonoticToSDialog, name, string, "TermsOfService");
+
+ ATTRIB(XonoticToSDialog, text, string);
ATTRIB(XonoticToSDialog, textBox, entity);
ATTRIB(XonoticToSDialog, closable, float, 0);
ENDCLASS(XonoticToSDialog)
+
+void XonoticToS_OnGet(entity fh, entity me, int status);
} else if(!me.disconnectDialogVisibility && (gamestatus & (GAME_ISSERVER | GAME_CONNECTED))) {
// If gamestate is "ingame" (and dialog is not visible),
- // make disconnect button visible
+ // make disconnect button visiblefosdialog
entity n, i;
n = me.mainNexposee;
i = me.disconnectDialog;
string s;
string un_version = "";
+ string un_tosversion = "";
string un_download = "";
string un_url = "";
string un_bannedservers = "";
un_version = s;
break;
}
+ case "T":
+ {
+ un_tosversion = s;
+ break;
+ }
case "C":
{
un_compatexpire = s;
}
}
}
+
+ if(un_tosversion != "")
+ {
+ if(autocvar__termsofservice_accepted != un_tosversion) {
+ _Nex_ExtResponseSystem_NewToS = strzone(un_tosversion);
+ LOG_INFO("Setting netwos value to ", un_tosversion);
+ }
+ }
if(un_bannedservers != "")
{
_Nex_ExtResponseSystem_TOS = strzone(data);
LOG_INFO("Data: ", _Nex_ExtResponseSystem_TOS);
+ LOG_INFO("New TOS version: ", _Nex_ExtResponseSystem_NewToS);
}
// END OF URI SYSTEM ////////////////////////////////////////////////////////
// for privacy, munge the start count a little
startcnt = floor((floor(startcnt / 10) + random()) * 10);
- uri = sprintf("http://update.xonotic.org/checkupdate.txt?version=%s&cnt=%d", uri_escape(cvar_string("g_xonoticversion")), startcnt);
+ //uri = sprintf("http://update.xonotic.org/checkupdate.txt?version=%s&cnt=%d", uri_escape(cvar_string("g_xonoticversion")), startcnt);
+ uri = "http://maria.omaera.org/checkupdate.txt";
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;
draw_CenterText(mid - 1 * line, l1, fs, '1 0 0', 1, 0);
draw_CenterText(mid - 0 * line, l2, fs, '0 0 1', 1, 0);
}
+
if (!campaign_name_previous)
campaign_name_previous = strzone(strcat(campaign_name, "x")); // force unequal
if(campaign_name == campaign_name_previous)
string _Nex_ExtResponseSystem_RecommendedServers;
float _Nex_ExtResponseSystem_RecommendedServersNeedsRefresh;
string _Nex_ExtResponseSystem_TOS;
+string _Nex_ExtResponseSystem_NewToS;
void CheckSendCvars(entity me, string cvarnamestring);
+
+string autocvar__termsofservice_accepted = "0";