forked from pantyusha/nesca
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vercheckerthread.cpp
39 lines (35 loc) · 1.14 KB
/
vercheckerthread.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "vercheckerthread.h"
#include "externData.h"
#include "mainResources.h"
#include "Connector.h"
#include "Utils.h"
void _checkVer()
{
while(true) {
const char request[64] = {"http://nesca.d3w.org/version"};
std::string buffer;
std::vector<std::string> headerVector{ "X-Nescav3: True" };
Connector con;
con.nConnect(request, 80, &buffer, NULL, &headerVector);
char *ptr1 = NULL;
if(buffer.size() > 0)
{
if(Utils::ustrstr(buffer, std::string("\r\n\r\n")) != -1)
{
ptr1 = strstr((char*)buffer.c_str(), "\r\n\r\n");
if(strcmp(gVER, ptr1 + 4) != 0)
{
stt->doEmitionFoundData("<br><font color=\"Pink\">======Update required======<br>Latest version: " + QString(ptr1 + 4) +
"<br>Your version: " + QString(gVER) + "<br>=========================</font>");
stt->doEmitionShowRedVersion();
};
};
};
vct->sleep(600000); //10 min
};
//vct->terminate();
}
void VerCheckerThread::run()
{
_checkVer();
}