Exemplo n.º 1
0
void Updater::CheckUpdate(bool isBetaChannelEnabled)
{
    if (m_netwManager==NULL)
        m_netwManager = new QNetworkAccessManager(this);

//    QSettings cfg(TSHelpers::GetFullConfigPath(), QSettings::IniFormat);
//    m_isBetaChannel = cfg.value("beta",false).toBool();
    m_isBetaChannel = isBetaChannelEnabled;
    if (m_isBetaChannel)
        CheckUpdate(BETA_CHECK);

    CheckUpdate(STABLE);
}
Exemplo n.º 2
0
/*********************************************************************************
 * Networkthread for background network initialize and update check with idle prio
 *********************************************************************************/
static void * networkinitcallback(void *arg)
{
	while (1)
	{
		if (!checkincomming && networkHalt)
			LWP_SuspendThread(networkthread);

		Initialize_Network();

		if (networkinitialized == true && updatechecked == false)
		{

			if (CheckUpdate() > 0) updateavailable = true;

			//suspend thread
			updatechecked = true;
			networkHalt = true;
		}

		if (checkincomming) NetworkWait();

		usleep(100000);
	}
	return NULL;
}
Exemplo n.º 3
0
int NeedUpdate()
{
	ERROR_OUTPUT(__func__);

		if (!FileExists(UPDATEXML))
		{
			ERROR_OUTPUT("UPDATE_XML");
			return UPDATE_XML;
		}
		else
		{
			if (!CheckInstall())
			{
				ERROR_OUTPUT("UPDATE_FILES");
				return UPDATE_FILES;
			}
			
			if (FileExists(UPDATEFILE) && CheckUpdate(UPDATEFILE))
			{
				ERROR_OUTPUT("UPDATE_MCF");
				return UPDATE_MCF;
			}
		}

	return UPDATE_NONE;
}
Exemplo n.º 4
0
void CHMMDemoView::OnMouseMove(UINT nFlags, CPoint point)
{
    CView::OnMouseMove(nFlags, point);
    if( nFlags & MK_LBUTTON )
    {
        (CPoint&)m_tmp_sel.right = point;
        CheckUpdate();
    }
}
Exemplo n.º 5
0
INT KJxUpdaterDlg::_ShowWebThreadFunc()
{
	// TODO: Add your control notification handler code here
	m_CtrlCheckUpdate.EnableWindow(false);
	CheckUpdate();
	m_CtrlCheckUpdate.EnableWindow(true);

	return true;
}
Exemplo n.º 6
0
LRESULT KJxUpdaterDlg::OnStartUpMsg(WPARAM wParam, LPARAM lParam)
{
	// TODO: Add your control notification handler code here
	m_CtrlCheckUpdate.EnableWindow(false);
	CheckUpdate();
	m_CtrlCheckUpdate.EnableWindow(true);
	m_CtrlQuit.EnableWindow(true);

	return 0;
}
Exemplo n.º 7
0
AString ADVBConfig::GetConfigItem(const AString& name, const AString& defval) const
{
	AString res;

	CheckUpdate();

	if (config.Exists(name)) res = config.Get(name);
	else					 res = defval;

	//debug("Request for '%s' (def: '%s'): '%s'\n", name.str(), defval.str(), res.str());

	return res;
}
Exemplo n.º 8
0
// 检查更新
void CAboutPage::OnStnClickedStatic1()
{
	switch (CheckUpdate())
	{
	case UPDATE_NO_UPDATE:
		AfxMessageBox(_T("已经是最新版本"));
		break;
	case UPDATE_FAILED_TO_GET_INFO:
		if (AfxMessageBox(_T("获取文件信息失败,手动更新?"), MB_ICONQUESTION | MB_YESNO) == IDYES)
			ManuallyUpdate();
		break;
	}
}
Exemplo n.º 9
0
void CHMMDemoView::SetSelection( RECT* sel )
{
    if( sel )
    {
        m_tmp_sel = NormalizeRect( *sel );
    }
    else
    {
        CImage& img = Camera().GetFrame();
        m_tmp_sel = CRect( 0, 0, img.Width(), img.Height() );
    }
    CheckUpdate();
}
Exemplo n.º 10
0
AString ADVBConfig::GetConfigItem(const AString& name) const
{
	const AString *def = NULL;
	AString res;

	CheckUpdate();

	if (config.Exists(name)) res = config.Get(name);
	else if ((def = (const AString *)defaults.Read(name)) != NULL) res = *def;

	//debug("Request for '%s' (def: '%s'): '%s'\n", name.str(), def ? def->str() : "<notset>", res.str());

	return res;
}
Exemplo n.º 11
0
int Chat_Load()
{
	CheckUpdate();

	CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Message Sessions")_T("/")LPGENT("Group chats"), FONTMODE_ALTER };
	mir_getCI(&data);
	saveCI = *pci;
	pci->OnCreateModule = OnCreateModule;
	pci->OnNewUser = OnNewUser;

	pci->OnSetStatus = OnSetStatus;
	pci->OnSetTopic = OnSetTopic;

	pci->OnAddLog = OnAddLog;

	pci->OnCreateSession = OnCreateSession;
	pci->OnRemoveSession = OnRemoveSession;
	pci->OnRenameSession = OnRenameSession;
	pci->OnReplaceSession = OnReplaceSession;
	pci->OnDblClickSession = OnDblClickSession;

	pci->OnEventBroadcast = OnEventBroadcast;
	pci->OnSetStatusBar = OnSetStatusBar;
	pci->OnChangeNick = OnChangeNick;
	pci->ShowRoom = ShowRoom;
	pci->OnLoadSettings = OnLoadSettings;

	// this operation is unsafe, that's why we restore the old pci state on exit
	pci->DoSoundsFlashPopupTrayStuff = DoSoundsFlashPopupTrayStuff;
	pci->IsHighlighted = IsHighlighted;
	pci->LogToFile = LogToFile;
	pci->DoPopup = DoPopup;
	pci->ShowPopup = ShowPopup;
	pci->Log_CreateRtfHeader = Log_CreateRtfHeader;
	pci->UM_CompareItem = UM_CompareItem;
	pci->ReloadSettings();

	g_hMenu = LoadMenu(g_hInst, MAKEINTRESOURCE(IDR_MENU));

	g_Settings.Highlight = new CMUCHighlight();
	return 0;
}
Exemplo n.º 12
0
int NeedUpdateNonGpl()
{
	std::wstring path = UTIL::OS::getAppDataPath(UPDATEFILE_W);

	if (!FileExists(UPDATEXML_W))
	{
		return UPDATE_XML;
	}
	else
	{
		if (FileExists(path.c_str()) && CheckUpdate(path.c_str()))
			return UPDATE_MCF;

		if (!CheckInstall())
			return UPDATE_FILES;
	}

	if (CheckCert())
		return UPDATE_CERT;

	return UPDATE_NONE;
}
Exemplo n.º 13
0
// 自动更新线程
UINT AFX_CDECL AutoUpdateThread(LPVOID _dlg)
{
	CTiebaManagerDlg* dlg = (CTiebaManagerDlg*)_dlg;
	CoInitializeEx(NULL, COINIT_MULTITHREADED);
	CheckUpdateResult res = CheckUpdate();
	CoUninitialize();
	switch (res)
	{
	case UPDATE_FAILED_TO_GET_FILE_ID:
		dlg->m_stateStatic.SetWindowText(_T("检查更新失败:获取文件ID失败,在设置里手动检查更新"));
		break;
	case UPDATE_FAILED_TO_GET_LINK:
		if (AfxMessageBox(_T("获取下载地址失败,手动更新?"), MB_ICONQUESTION | MB_YESNO) == IDYES)
			ShellExecute(NULL, _T("open"), UPDATE_FULL_URL, NULL, NULL, SW_NORMAL);
	case UPDATE_NO_UPDATE:
	case UPDATE_HAS_UPDATE:
		dlg->m_stateStatic.SetWindowText(_T("待机中"));
		break;
	}

	return 0;
}
Exemplo n.º 14
0
bool CSecurityCache::GetEigenvalue(unsigned char *data,DWORD& length)
{
    // 获得所有的数据
    int effectnum;
    CheckUpdate(effectnum);//得到有效数据个数
    if(false == m_isChange)
        return true;

    if(effectnum <= 0)
    {
        data = NULL;
        length = 0;
        return true;
    }

    length = effectnum * SECURE_SIZE;
    unsigned char* pBuffer = new unsigned char[length];

    if(pBuffer == NULL)
        return false;

    unsigned char* cur = pBuffer;
    for(int i = 0; i < SECURE_BUCKET_SIZE; i++)
    {
        for(list<SecCachStruct*>::iterator ite = m_secuBucket[i].begin(); ite != m_secuBucket[i].end(); ite ++)
        {
            if(((*ite)->tag == 1) || (*ite)->tag == 3 || (*ite)->tag == 4)//有效数据
            {
                memcpy(cur,(void*)(*ite)->chkdata,SECURE_SIZE);
                cur += SECURE_SIZE;
            }
        }
    }

    data = pBuffer;
    return true;
}
Exemplo n.º 15
0
int NeedUpdateNonGpl()
{
	UpdateLogHandle ulh;

	std::wstring path = UTIL::OS::getAppDataPath(UPDATEFILE_W);

	if (!FileExists(UPDATEXML_W))
	{
		Log("NeedUpdate: Missing Xml");
		return UPDATE_XML;
	}
	else
	{
		if (FileExists(path.c_str()) && CheckUpdate(path.c_str()))
		{
			Log("NeedUpdate: Missing Mcf");
			return UPDATE_MCF;
		}

		if (!CheckInstall())
		{
			Log("NeedUpdate: Bad Files");
			return UPDATE_FILES;
		}
	}

#ifdef WITH_CODESIGN
	if (CheckCert())
	{
		Log("NeedUpdate: Bad Cert");
		return UPDATE_CERT;
	}
#endif

	return UPDATE_NONE;
}
Exemplo n.º 16
0
int main(int argc, char **argv) {
	char text[256];
	int i;

	#ifdef _WIN32
		HMODULE hLib;
		WSADATA wsadata;
		WSAStartup(0x0202, &wsadata);

		InitUptimePerfCounter();

		hLib = LoadLibrary("advapi32.dll");
		if (hLib)
			lpfnRtlGenRandom = (_RtlGenRandom)GetProcAddress(hLib, "SystemFunction036");

		#ifdef _DEBUG
			_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF |
				_CRTDBG_CHECK_ALWAYS_DF |  _CRTDBG_CHECK_CRT_DF | _CRTDBG_ALLOC_MEM_DF);
		#endif
	#endif

	GetOS(text);
	printf("\n -- Phyros " BOT_VER " -- %s --\n\n", text);

	loadedtime = getuptime();

	#ifndef _WIN32
		SetPipeSignalHandler();
	
		if (getuid() == 0) {
			printf("WARNING: should not be running as root!\n");
			setuid(GetUidFromUsername("nobody"));
		} //////should set the group id instead so files can be modified at runtime
	#endif

	botpluser = malloc(sizeof(LUSER));
	botpluser->access = 103;
	strcpy(botpluser->username, "the bot");

	maintid = get_self_tid();
	
	#ifndef _DEBUG
		SetSegvSignalHandler();
	#endif

	tagbans[WCP_BACK]  = RadixInit();
	tagbans[WCP_FRONT] = RadixInit();
	tagbans[WCP_BOTH]  = RadixInit();
	phrases	 = RadixInit();
	cdkeys   = VectorInit(8);
	//banqueue = malloc(BANQUEUE_INITIALSIZE * sizeof(char *));
	//bqsize   = BANQUEUE_INITIALSIZE;

	SetDefaultConfig();

	LoadConfig();
	LoadUsers();
	LoadCDKeys();
	GetRealms();
	BlacklistLoad();
	LoadPhrases();
	CmdTreeInit();
	LoadAccessModifications();

	ParseCmdLine(argc, argv);

	for (i = 0; i != 3; i++) {
		if (!hashes[i][0]) {
			gstate |= GFS_USEBNLS;
			printf("WARNING: path for binary \'%s\' not set, falling back to BNLS checkrevision\n",
				hash_filenames[i]);
			break;
		}
	}

	if (gstate & GFS_CHECKUPDATES) {
		printf(" - checking %s%s for updates...\n", updatesite, updateverfile);
		printf("%s\n", updateresult[CheckUpdate(updatesite, updateverfile)]);
	}

	CreateAsyncTimer();
	ptimertid = _CreateThread(PeriodicTimerWaitProc, NULL);
	AddPeriodicTimer(TIMER_NULLPKT, 10, NullPacketTimerProc);
	
	setjmp(jmpenv);


	////////////////////////////////////////////TEST BATTERY//////////////////////////////////////
	/*ChatHandleChannel("Clan Blah", 0, 0);
	//ChatHandleJoin("loladfg", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); 
	ChatHandleJoin("loladf1aaaaaaaaaa", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); 
	ChatHandleJoin("loladf2bbbbbfffe", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); 
	ChatHandleJoin("loladf3", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); 
	ChatHandleJoin("loladf4", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); 
	ChatHandleJoin("loladf5", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); 
	ChatHandleJoin("loladf6", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); 
	ChatHandleJoin("loladf7", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); 
	ChatHandleJoin("loladf8", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); 
	ChatHandleJoin("loladf9", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); 
	ChatHandleJoin("loladfa", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); 
	ChatHandleJoin("loladfb", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); 
	ChatHandleJoin("loladfc", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); 
	ChatHandleJoin("loladfd", 0, 43, "PXES 0 0 0 0 0 PXES", 0, 0); */

	/*printf("%x\n", FindTextInWildcards(tagbans, "asdfgdfg"));
	printf("%x\n", FindTextInWildcards(tagbans, "as[tg]gdfg"));
	printf("%x\n", FindTextInWildcards(tagbans, "asdfgdfg[tg]"));
	printf("%x\n", FindTextInWildcards(tagbans, "asdfgdfg"));
	printf("%x\n", FindPhraseban(phrases, "raiasdfdasdfzomgzasdfasdfasdfasdf"));
	printf("%x\n", FindPhraseban(phrases, "raiasdfgdfgbloop"));
	printf("%x\n", FindPhraseban(phrases, "bloo asfukdfgdfg zomg"));*/
	/////////////////////////////////////////////////////////////////////////////////////////////

	while (1) {
		fgets(text, sizeof(text), stdin);
		text[strlen(text) - 1] = 0;
		if (*(int16_t *)text == '//')
			CheckCommand(NULL, text, 0, 0);
		else
			QueueAdd(text, curbotinc());
	}
	return 0;
}
Exemplo n.º 17
0
/*!
 * \brief Config::onNetwManagerFinished Qt slot to retrieve the content
 * \param reply a QNetworkReply containing the update data to parse
 */
void Updater::onNetwManagerFinished(QNetworkReply *reply)
{
    if (!m_URLs.remove(reply->url()))
        return;

    bool isReplyStable = reply->url().toString().contains("addons.teamspeak.com");
    if (reply->error() != QNetworkReply::NoError)
    {
        TSLogging::Log(reply->errorString(),LogLevel_WARNING);
    }
    else
    {
        QByteArray arr = reply->readAll();

        QVariant possibleRedirectUrl = reply->attribute(QNetworkRequest::RedirectionTargetAttribute);

        /* We'll deduct if the redirection is valid in the redirectUrl function */
        _urlRedirectedTo = this->redirectUrl(possibleRedirectUrl.toUrl(), _urlRedirectedTo);

        if(!_urlRedirectedTo.isEmpty()) /* If the URL is not empty, we're being redirected. */
        {
            TSLogging::Log(QString("%1: Update check forwarding to %2").arg(this->objectName()).arg(_urlRedirectedTo.toString()),LogLevel_INFO);
            CheckUpdate(_urlRedirectedTo);
            return;
        }

        int start = arr.indexOf((isReplyStable)?QString(ts3plugin_name()).append("_"):"Version",0);
        if (start == -1)
        {
            TSLogging::Log((this->objectName() + ": Did not find Version."),LogLevel_WARNING);
            return;
        }

        QString endStr = (isReplyStable)?".ts3_plugin":"Platforms";
        int end = arr.indexOf(endStr,start);
        if (end == -1)
        {
            TSLogging::Log((this->objectName() + ": Did not find %1.").arg(endStr),LogLevel_WARNING);
            return;
        }

        QString parse(arr.mid(start,end-start));
        QRegExp rx;
        if (isReplyStable)
            rx.setPattern("\\d+(?:\\_\\d+)+");
        else
            rx.setPattern("\\d+(?:\\.\\d+)+");

        int pos = rx.indexIn(parse);
        if (pos > -1)
            parse = rx.cap(0);

        if (isReplyStable)
        {
            parse.replace("_",".");
            m_VersionStable = parse;
        }
        else
            m_VersionBeta = parse;
    }

    reply->deleteLater();
    _urlRedirectedTo.clear();
    if (m_URLs.isEmpty())
    {
        m_netwManager->deleteLater();
        m_netwManager=NULL;
        CheckTriggerUpdateDialog();
    }
}
Exemplo n.º 18
0
UINT CTrafficMonitorApp::CheckUpdateThreadFunc(LPVOID lpParam)
{
	CCommon::SetThreadLanguage(theApp.m_general_data.language);		//设置线程语言
	CheckUpdate(false);		//检查更新
	return 0;
}
Exemplo n.º 19
0
bool CSecurityCache::IsChanged()
{
    int effectnum;
    CheckUpdate(effectnum);//得到有效数据个数
    return m_isChange;
}
Exemplo n.º 20
0
//更新到安全缓存文件中
bool CSecurityCache::Flush()
{
    int effectnum;
    CheckUpdate(effectnum);//得到有效数据个数
    if(false == m_isChange)
        return true;

    WCHAR expName[MAX_PATH] = {0};
    ExpandEnvironmentStringsW(m_cathfile.c_str(), expName, MAX_PATH);
    HANDLE hFile;


    if(effectnum <= 0)
    {
        hFile = CreateFileW(expName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
        if(hFile != INVALID_HANDLE_VALUE)
        {
            CloseHandle(hFile);
        }
        return true;
    }

    SecCachStruct tp;
    DWORD len = effectnum*(sizeof(tp.filename)+SECURE_SIZE + sizeof(short int));
    unsigned char* pBuffer = new unsigned char[len];

    if(pBuffer == NULL)
        return false;

    unsigned char* cur = pBuffer;
    for(int i = 0; i < SECURE_BUCKET_SIZE; i++)
    {
        for(list<SecCachStruct*>::iterator ite = m_secuBucket[i].begin(); ite != m_secuBucket[i].end(); ite ++)
        {
            if(((*ite)->tag == 1) || (*ite)->tag == 3 || (*ite)->tag == 4)//有效数据
            {
                memcpy(cur,(void*)(*ite)->filename,sizeof((*ite)->filename));
                cur += sizeof((*ite)->filename);
                memcpy(cur,(void*)(*ite)->chkdata,SECURE_SIZE);
                cur += SECURE_SIZE;
                memcpy(cur,(void*)&((*ite)->tag),sizeof(short int));
                cur += sizeof(short int);
            }
        }
    }

    int packlen = len + 128;
    unsigned char* pPackBuf = new unsigned char[packlen];

    if(pPackBuf == NULL)
    {
        delete[] pBuffer;
        return false;
    }

    int ret = CachePack(pBuffer,len,pPackBuf);

    delete[] pBuffer;//先清缓存

    if(ret < 0)
    {
        delete[] pPackBuf;
        return false;
    }


    hFile = CreateFileW(expName, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);

    if(hFile == INVALID_HANDLE_VALUE)
    {
        ::MessageBoxW(NULL, L"打开安全缓存失败",L"安全缓存",MB_OK | MB_SETFOREGROUND);
        delete[] pPackBuf;
        return false;
    }

    DWORD dwLength;
    if(!WriteFile(hFile,pPackBuf,ret,&dwLength,NULL))
    {
        ::MessageBoxW(NULL, L"写安全缓存失败",L"安全缓存",MB_OK | MB_SETFOREGROUND);
        CloseHandle(hFile);
        delete[] pPackBuf;
        return false;
    }
    CloseHandle(hFile);
    delete[] pPackBuf;
    return true;
}
Exemplo n.º 21
0
void CHMMDemoView::OnLButtonDown(UINT nFlags, CPoint point)
{
    CView::OnLButtonDown(nFlags, point);
    /*(CPoint&)m_sel = */(CPoint&)m_tmp_sel.left = (CPoint&)m_tmp_sel.right = point;
    CheckUpdate();
}
Exemplo n.º 22
0
void CHMMDemoView::OnLButtonUp(UINT nFlags, CPoint point)
{
    CView::OnLButtonUp(nFlags, point);
    (CPoint&)m_tmp_sel.right = point;
    CheckUpdate();
}