HTTP update alert
This commit is contained in:
1 parent
48b2112af7
commit
032adadd86
2 files changed
+40
-1
No files matched your search
@@ -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;
|
||||
}
|
||||
+4
-1
@@ -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))
|
||||
|
||||
Reference in new issue
Block a user