コード例 #1
0
ファイル: dialogs.cpp プロジェクト: MrtsComputers/miranda-ng
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; 
}
コード例 #2
0
ファイル: dbfilter.cpp プロジェクト: truefriend-cz/miranda-ng
// if it's a protocol going offline, attempt to send terminate session to all contacts of that protocol
// (this would be hooked as the ME_CLIST_STATUSMODECHANGE handler except that event is sent *after* the proto goes offline)
int StatusModeChange(WPARAM wParam, LPARAM lParam)
{
	int status = (int)wParam;
	if (status != ID_STATUS_OFFLINE)
		return 0;

	const char *proto = (char *)lParam;

	lib_cs_lock();

	ConnContext *context = otr_user_state->context_root;
	while (context) {
		if (context->msgstate == OTRL_MSGSTATE_ENCRYPTED && (proto == 0 || mir_strcmp(proto, context->protocol) == 0)) {
			MCONTACT hContact = (UINT_PTR)context->app_data;

			if (hContact) {
				otrl_message_disconnect(otr_user_state, &ops, (void*)hContact, context->accountname, context->protocol, context->username, OTRL_INSTAG_BEST);
				SetEncryptionStatus(hContact, TRUST_NOT_PRIVATE);
			}

		}
		context = context->next;
	}

	return 0;
}
コード例 #3
0
ファイル: utils.cpp プロジェクト: 0xmono/miranda-ng
void VerifyFingerprintMessage(ConnContext *context, bool verify) {
	TCHAR msg[1024];
	mir_sntprintf(msg, 1024, (verify)?TranslateT(LANG_FINGERPRINT_VERIFIED):TranslateT(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT((MCONTACT)context->app_data));
	msg[1023] = '\0';
	ShowMessage((MCONTACT)context->app_data, msg);
	SetEncryptionStatus((MCONTACT)context->app_data, otr_context_get_trust(context));
}
コード例 #4
0
ファイル: utils.cpp プロジェクト: tweimer/miranda-ng
void VerifyFingerprintMessage(ConnContext *context, bool verify) {
	MCONTACT hContact = (UINT_PTR)context->app_data;

	wchar_t msg[1024];
	mir_snwprintf(msg, (verify) ? TranslateW(LANG_FINGERPRINT_VERIFIED) : TranslateW(LANG_FINGERPRINT_NOT_VERIFIED), contact_get_nameT(hContact));
	ShowMessage(hContact, msg);
	SetEncryptionStatus(hContact, otr_context_get_trust(context));
}
コード例 #5
0
ファイル: dbfilter.cpp プロジェクト: truefriend-cz/miranda-ng
int WindowEvent(WPARAM wParam, LPARAM lParam)
{
	MessageWindowEventData *mwd = (MessageWindowEventData *)lParam;
	if (mwd->uType == MSG_WINDOW_EVT_CLOSE && options.end_window_close) {
		FinishSession(mwd->hContact);
		return 0;
	}

	if (mwd->uType != MSG_WINDOW_EVT_OPEN)
		return 0;

	MCONTACT hContact = mwd->hContact, hTemp;
	if ((hTemp = db_mc_getMostOnline(hContact)) != 0)
		hContact = hTemp;

	if (!Proto_IsProtoOnContact(hContact, MODULENAME))
		return 0;

	lib_cs_lock();
	ConnContext *context = otrl_context_find_miranda(otr_user_state, hContact);
	SetEncryptionStatus(hContact, otr_context_get_trust(context));
	return 0;
}