Exemplo n.º 1
0
void MirandaUtils::userActionThread(void* threadArg)
{
	Thread_Push(0);
	ActionThreadArgStruct* actionThreadArgPtr = (ActionThreadArgStruct*)threadArg;

	if (actionThreadArgPtr->mirfoxDataPtr == NULL){
		MFLogger::getInstance()->log(L"MirandaUtils::userActionThread: ERROR mirfoxDataPtr == NULL");
		return;
	}

	if (actionThreadArgPtr->mirfoxDataPtr->Plugin_Terminated){
		MFLogger::getInstance()->log(L"MirandaUtils::userActionThread: Plugin_Terminated return");
		return;
	}

	actionThreadArgPtr->mirfoxDataPtr->workerThreadsCount++;

	if (actionThreadArgPtr->menuItemType == 'C'){
		actionThreadArgPtr->instancePtr->sendMessageToContact(actionThreadArgPtr);
	} else if (actionThreadArgPtr->menuItemType == 'A'){
		actionThreadArgPtr->instancePtr->setStatusOnAccount(actionThreadArgPtr);
		delete actionThreadArgPtr->accountSzModuleName;
	} else {
		MFLogger::getInstance()->log(TEXT("MirandaUtils::userActionThread: ERROR: unknown actionThreadArgPtr->menuItemType"));
	}

	delete actionThreadArgPtr->userActionSelection;
	actionThreadArgPtr->mirfoxDataPtr->workerThreadsCount--;
	delete threadArg;

	Thread_Pop();
	return;

}
Exemplo n.º 2
0
unsigned int CALLBACK verify_context_thread(void *param)
{
	Thread_Push( 0 );

	if (param) {
		ConnContext *context = (ConnContext *)param;
		TCHAR msg[1024];
		switch ( DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SMP_INPUT), 0, DlgProcVerifyContext, (LPARAM)param) ) {
			case IDOK:
			case IDYES:
				lib_cs_lock();
				otrl_context_set_trust(context->active_fingerprint, "verified");
				otrl_privkey_write_fingerprints(otr_user_state, g_fingerprint_store_filename);
				lib_cs_unlock();
				mir_sntprintf(msg, 1024, TranslateT(LANG_FINGERPRINT_VERIFIED), contact_get_nameT((HANDLE)context->app_data));
				msg[1023] = '\0';
				ShowMessage((HANDLE)context->app_data, msg);
				SetEncryptionStatus(context->app_data, otr_context_get_trust(context));
				break;
			case IDNO:
				lib_cs_lock();
				otrl_context_set_trust(context->active_fingerprint, NULL);
				otrl_privkey_write_fingerprints(otr_user_state, g_fingerprint_store_filename);
				lib_cs_unlock();
				mir_sntprintf(msg, 1024, TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT((HANDLE)context->app_data));
				msg[1023] = '\0';
				ShowMessage((HANDLE)context->app_data, msg);
				SetEncryptionStatus(context->app_data, otr_context_get_trust(context));
				break;
		}
	}

	Thread_Pop();
	return 0; 
}
Exemplo n.º 3
0
DWORD WINAPI forkthread_r(void *arg)
{
	FORK_ARG *fa = (FORK_ARG*)arg;
	pThreadFunc callercode = fa->threadcode;
	void *cookie = fa->arg;
	Thread_Push((HINSTANCE)callercode);
	SetEvent(fa->hEvent);

	callercode(cookie);

	HANDLE hThread = GetCurrentThread();
	SetThreadPriority(hThread, THREAD_PRIORITY_TIME_CRITICAL);
	Thread_Pop();
	CloseHandle(hThread);
	return 0;
}
Exemplo n.º 4
0
static unsigned int CALLBACK regen_key_thread(void* param)
{
	Thread_Push(0);
	PROTOREGENKEYOPTIONS *opts = (PROTOREGENKEYOPTIONS *)param;
	TCHAR buff[512];

	mir_sntprintf(buff, TranslateT(LANG_OTR_ASK_NEWKEY), opts->proto);
	EnableWindow(opts->refresh, FALSE);
	if (IDYES == MessageBox(opts->refresh, buff, TranslateT(LANG_OTR_INFO), MB_ICONQUESTION|MB_YESNO)) {
		char* proto = mir_t2a(opts->proto);
		otr_gui_create_privkey(0, proto, proto);
		SendMessage(opts->refresh, WMU_REFRESHPROTOLIST, 0, 0);
	}
	EnableWindow(opts->refresh, TRUE);
	delete opts;
	Thread_Pop();
	return 0;
}
Exemplo n.º 5
0
DWORD WINAPI forkthreadex_r(void * arg)
{
	struct FORK_ARG *fa = (struct FORK_ARG *)arg;
	pThreadFuncEx threadcode = fa->threadcodeex;
	pThreadFuncOwner threadcodeex = (pThreadFuncOwner)fa->threadcodeex;
	void *cookie = fa->arg;
	void *owner = fa->owner;
	unsigned long rc = 0;

	Thread_Push((HINSTANCE)threadcode, fa->owner);
	SetEvent(fa->hEvent);
	if (owner)
		rc = threadcodeex(owner, cookie);
	else
		rc = threadcode(cookie);

	SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
	Thread_Pop();
	return rc;
}