mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-12-28 05:11:34 +00:00
HTTP update alert
This commit is contained in:
parent
48b2112af7
commit
032adadd86
2 changed files with 40 additions and 1 deletions
|
@ -455,3 +455,39 @@ HMS_fetch_servers (msg_server_t *list, int room_number)
|
|||
|
||||
HMS_end(hms);
|
||||
}
|
||||
|
||||
const char *
|
||||
HMS_compare_mod_version (void)
|
||||
{
|
||||
static char buffer[16];
|
||||
|
||||
struct HMS_buffer *hms;
|
||||
|
||||
char *version;
|
||||
char *version_name;
|
||||
|
||||
hms = HMS_connect("versions/%d", MODID);
|
||||
|
||||
if (HMS_do(hms))
|
||||
{
|
||||
version = strtok(hms->buffer, " ");
|
||||
version_name = strtok(0, "\n");
|
||||
|
||||
if (version && version_name)
|
||||
{
|
||||
if (atoi(version) != MODVERSION)
|
||||
{
|
||||
strlcpy(buffer, version_name, sizeof buffer);
|
||||
version_name = buffer;
|
||||
}
|
||||
else
|
||||
version_name = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
version_name = NULL;
|
||||
|
||||
HMS_end(hms);
|
||||
|
||||
return version_name;
|
||||
}
|
||||
|
|
|
@ -105,6 +105,7 @@ void HMS_unlist (void);
|
|||
void HMS_update (void);
|
||||
void HMS_list_servers (void);
|
||||
void HMS_fetch_servers (msg_server_t *list, int room);
|
||||
const char * HMS_compare_mod_version (void);
|
||||
|
||||
// ================================ DEFINITIONS ===============================
|
||||
|
||||
|
@ -568,7 +569,9 @@ const char *GetMODVersion(void)
|
|||
static msg_t msg;
|
||||
|
||||
if (HMS_in_use())
|
||||
return NULL;
|
||||
{
|
||||
return HMS_compare_mod_version();
|
||||
}
|
||||
|
||||
// we must be connected to the master server before writing to it
|
||||
if (MS_Connect(GetMasterServerIP(), GetMasterServerPort(), 0))
|
||||
|
|
Loading…
Reference in a new issue