Пример #1
0
INT_PTR CALLBACK DlgProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch ( msg ) {
	case WM_INITDIALOG: 
		{
			if (!lParam) {
				EndDialog(hwndDlg, IDCANCEL);
				return FALSE;
			}
			SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)_T(LANG_OTR_FPVERIFY_TITLE));
			SetDlgItemText(hwndDlg, IDC_STC_SMP_HEAD, _T(LANG_OTR_FPVERIFY_TITLE));
			TranslateDialogDefault( hwndDlg );
			SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);

			// Move window to screen center
			// Get the owner window and dialog box rectangles. 
			HWND hwndOwner; RECT rcOwner, rcDlg, rc;
			if ((hwndOwner = GetParent(hwndDlg)) == NULL) 
			{
				hwndOwner = GetDesktopWindow(); 
			}

			GetWindowRect(hwndOwner, &rcOwner); 
			GetWindowRect(hwndDlg, &rcDlg); 
			CopyRect(&rc, &rcOwner); 

			// Offset the owner and dialog box rectangles so that right and bottom 
			// values represent the width and height, and then offset the owner again 
			// to discard space taken up by the dialog box. 

			OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top); 
			OffsetRect(&rc, -rc.left, -rc.top); 
			OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom); 

			// The new position is the sum of half the remaining space and the owner's 
			// original position. 

			SetWindowPos(hwndDlg, 
				HWND_TOP, 
				rcOwner.left + (rc.right / 2), 
				rcOwner.top + (rc.bottom / 2), 
				0, 0,          // Ignores size arguments. 
				SWP_NOSIZE); 

			// end center dialog

			ConnContext *context = (ConnContext*)lParam;
			Fingerprint *fp = context->active_fingerprint;
			if (!fp) {
				EndDialog(hwndDlg, IDCANCEL);
				return FALSE;
			}
			TCHAR buff[512];
			if (!fp->trust || fp->trust[0] == '\0')
				mir_sntprintf(buff, 512, TranslateT(LANG_OTR_FPVERIFY_DESC), contact_get_nameT((HANDLE)context->app_data));
			else
				mir_sntprintf(buff, 512, TranslateT(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT((HANDLE)context->app_data));

			SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff);

			unsigned char hash[20];
			lib_cs_lock();
			if (!otrl_privkey_fingerprint_raw(otr_user_state, hash, context->accountname, context->protocol)) {
				lib_cs_unlock();
				EndDialog(hwndDlg, IDCANCEL);
				return FALSE;
			}
			otrl_privkey_hash_to_humanT(buff, hash);
			lib_cs_unlock();
			SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, buff);
			SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, TRUE, 0);
			SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateT(LANG_YOUR_PRIVKEY));
			
			otrl_privkey_hash_to_humanT(buff, fp->fingerprint);
			SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, buff);
			SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, TRUE, 0);
			SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_CONTACT_FINGERPRINT));

			EnableWindow(GetDlgItem(hwndDlg, IDC_CBO_SMP_CHOOSE), FALSE);

			ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_HIDE);
			ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_SHOWNA);
			ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_SHOWNA);
			SetFocus(GetDlgItem(hwndDlg, IDCANCEL));
			
			return FALSE;
		}

	case WM_COMMAND: 
		switch ( HIWORD( wParam )) {
			case BN_CLICKED: 
				switch ( LOWORD( wParam )) {	
					case IDYES:
					case IDNO:
					case IDCANCEL:
					case IDOK:
						EndDialog(hwndDlg, LOWORD( wParam ));
						break;
				}
		}
		break;

	}

	return FALSE;
}
Пример #2
0
static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	HWND lv = GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST);

	switch (msg) {
	case WM_INITDIALOG:
		TranslateDialogDefault(hwndDlg);
		SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) new FPModifyMap());

		SendDlgItemMessage(hwndDlg, IDC_LV_FINGER_LIST, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT);// | LVS_EX_CHECKBOXES);
		{
			// add list columns
			LVCOLUMN lvc;
			// Initialize the LVCOLUMN structure.
			// The mask specifies that the format, width, text, and
			// subitem members of the structure are valid.
			lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM;
			lvc.fmt = LVCFMT_LEFT;

			lvc.iSubItem = 0;
			lvc.pszText = TranslateT(LANG_CONTACT);
			lvc.cx = 100;     // width of column in pixels
			ListView_InsertColumn(lv, 0, &lvc);

			lvc.iSubItem = 1;
			lvc.pszText = TranslateT(LANG_PROTO);
			lvc.cx = 90;     // width of column in pixels
			ListView_InsertColumn(lv, 1, &lvc);

			lvc.iSubItem = 2;
			lvc.pszText = TranslateT(LANG_ACTIVE);
			lvc.cx = 50;     // width of column in pixels
			ListView_InsertColumn(lv, 2, &lvc);

			lvc.iSubItem = 3;
			lvc.pszText = TranslateT(LANG_VERIFIED);
			lvc.cx = 50;     // width of column in pixels
			ListView_InsertColumn(lv, 3, &lvc);

			lvc.iSubItem = 4;
			lvc.pszText = TranslateT(LANG_FINGERPRINT);
			lvc.cx = 300;     // width of column in pixels
			ListView_InsertColumn(lv, 4, &lvc);
		}
		SendMessage(hwndDlg, WMU_REFRESHLIST, 0, 0);
		return TRUE;

	case WMU_REFRESHLIST:
		// enumerate contacts, fill in list
		ListView_DeleteAllItems(lv);
		{
			LVITEM lvI = { 0 };

			// Some code to create the list-view control.
			// Initialize LVITEM members that are common to all
			// items.
			lvI.mask = LVIF_TEXT | LVIF_PARAM;// | LVIF_NORECOMPUTE;// | LVIF_IMAGE;

			TCHAR *user, hash[45] = { 0 };
			for (ConnContext *context = otr_user_state->context_root; context; context = context->next) {
				if (context->app_data) {
					user = (TCHAR*)contact_get_nameT((UINT_PTR)context->app_data);
					if (user) {
						PROTOACCOUNT *pa = Proto_GetAccount(context->protocol);

						for (Fingerprint *fp = context->fingerprint_root.next; fp; fp = fp->next) {
							otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
							lvI.iSubItem = 0;
							lvI.lParam = (LPARAM)fp;
							lvI.pszText = user;
							int d = ListView_InsertItem(lv, &lvI);

							ListView_SetItemText(lv, d, 1, pa->tszAccountName);
							ListView_SetItemText(lv, d, 2, (context->active_fingerprint == fp) ? TranslateT(LANG_YES) : TranslateT(LANG_NO));
							ListView_SetItemText(lv, d, 3, (fp->trust && fp->trust[0] != '\0') ? TranslateT(LANG_YES) : TranslateT(LANG_NO));
							ListView_SetItemText(lv, d, 4, hash);
						}
					}
				}
			}
		}
		return TRUE;

	case WM_COMMAND:
		switch (HIWORD(wParam)) {
		int sel;
		case BN_CLICKED:
			switch (LOWORD(wParam)) {
			case IDC_BTN_FINGER_DONTTRUST:
				sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST));
				if (sel != -1) {
					LVITEM lvi = { 0 };
					lvi.mask = LVIF_PARAM;
					lvi.iItem = sel;
					ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), &lvi);
					Fingerprint *fp = (Fingerprint*)lvi.lParam;
					FPModifyMap* fpm = (FPModifyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
					(*fpm)[fp] = FPM_NOTRUST;
					ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), sel, 3, TranslateT(LANG_NO));
					SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
				}
				break;
			case IDC_BTN_FINGER_TRUST:
				sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST));
				if (sel != -1) {
					LVITEM lvi = { 0 };
					lvi.mask = LVIF_PARAM;
					lvi.iItem = sel;
					ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), &lvi);
					Fingerprint *fp = (Fingerprint*)lvi.lParam;
					FPModifyMap* fpm = (FPModifyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
					(*fpm)[fp] = FPM_VERIFY;
					ListView_SetItemText(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), sel, 3, TranslateT(LANG_YES));
					SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
				}
				break;
			
			case IDC_BTN_FINGER_FORGET:
				sel = ListView_GetSelectionMark(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST));
				if (sel != -1) {
					LVITEM lvi = { 0 };
					lvi.mask = LVIF_PARAM;
					lvi.iItem = sel;
					ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), &lvi);
					Fingerprint *fp = (Fingerprint*)lvi.lParam;
					if (fp->context->active_fingerprint == fp) {
						MCONTACT hContact = (UINT_PTR)fp->context->app_data;
						TCHAR buff[1024], hash[45];
						otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
						PROTOACCOUNT *pa = Proto_GetAccount(GetContactProto(hContact));
						mir_sntprintf(buff, TranslateT(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT(hContact), pa->tszAccountName);
						ShowError(buff);
					}
					else {
						FPModifyMap* fpm = (FPModifyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
						(*fpm)[fp] = FPM_DELETE;
						ListView_DeleteItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), sel);
						SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
					}
				}
				break;
			}
		}
		break;

	case WM_NOTIFY:
		if (((LPNMHDR)lParam)->code == (UINT)PSN_APPLY) {
			// handle apply
			FPModifyMap *fpm = (FPModifyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
			// Iterate over the map and print out all key/value pairs.
			// Using a const_iterator since we are not going to change the values.
			for (FPModifyMap::const_iterator it = fpm->begin(); it != fpm->end(); ++it) {
				if (!it->first) continue;
				switch (it->second) {
				case FPM_DELETE:
					if (it->first->context->active_fingerprint == it->first) {
						MCONTACT hContact = (UINT_PTR)it->first->context->app_data;
						TCHAR buff[1024], hash[45];
						otrl_privkey_hash_to_humanT(hash, it->first->fingerprint);
						PROTOACCOUNT *pa = Proto_GetAccount(GetContactProto(hContact));
						mir_sntprintf(buff, TranslateT(LANG_FINGERPRINT_NOT_DELETED), hash, contact_get_nameT(hContact), pa->tszAccountName);
						ShowError(buff);
					}
					else otrl_context_forget_fingerprint(it->first, 1);
					break;

				case FPM_VERIFY:
					otrl_context_set_trust(it->first, "verified");
					if (it->first == it->first->context->active_fingerprint)
						VerifyFingerprint(it->first->context, true);
					break;

				case FPM_NOTRUST:
					otrl_context_set_trust(it->first, NULL);
					if (it->first == it->first->context->active_fingerprint)
						VerifyFingerprint(it->first->context, false);
					break;
				}
			}

			if (!fpm->empty())
				otr_gui_write_fingerprints(0);
			fpm->clear();
			SendMessage(hwndDlg, WMU_REFRESHLIST, 0, 0);
			return TRUE;
		}
		break;

	case WM_DESTROY:
		FPModifyMap *fpm = (FPModifyMap*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
		fpm->clear();
		delete fpm;
		break;
	}

	return FALSE;
}
Пример #3
0
INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
	switch ( msg ) {
	case WM_INITDIALOG: 
		{
			if (!lParam) {
				EndDialog(hwndDlg, IDCANCEL);
				return FALSE;
			}
			TranslateDialogDefault( hwndDlg );

			ConnContext *context = (ConnContext*)lParam;
			if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) {
				EndDialog(hwndDlg, IDCANCEL);
				return FALSE;
			}

			TCHAR title[512], *proto = mir_a2t(contact_get_proto((HANDLE)context->app_data));
			mir_sntprintf(title, 512, TranslateT(LANG_SMP_VERIFY_TITLE), contact_get_nameT((HANDLE)context->app_data), proto);
			mir_free(proto);
			SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)title);
			SetDlgItemText(hwndDlg, IDC_STC_SMP_HEAD, title);
			SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);

			// Move window to screen center
			// Get the owner window and dialog box rectangles. 
			HWND hwndOwner; RECT rcOwner, rcDlg, rc;
			if ((hwndOwner = GetParent(hwndDlg)) == NULL) 
			{
				hwndOwner = GetDesktopWindow(); 
			}

			GetWindowRect(hwndOwner, &rcOwner); 
			GetWindowRect(hwndDlg, &rcDlg); 
			CopyRect(&rc, &rcOwner); 

			// Offset the owner and dialog box rectangles so that right and bottom 
			// values represent the width and height, and then offset the owner again 
			// to discard space taken up by the dialog box. 

			OffsetRect(&rcDlg, -rcDlg.left, -rcDlg.top); 
			OffsetRect(&rc, -rc.left, -rc.top); 
			OffsetRect(&rc, -rcDlg.right, -rcDlg.bottom); 

			// The new position is the sum of half the remaining space and the owner's 
			// original position. 

			SetWindowPos(hwndDlg, 
				HWND_TOP, 
				rcOwner.left + (rc.right / 2), 
				rcOwner.top + (rc.bottom / 2), 
				0, 0,          // Ignores size arguments. 
				SWP_NOSIZE); 

			// end center dialog


			HWND cmb = GetDlgItem(hwndDlg, IDC_CBO_SMP_CHOOSE);
			SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_SMPTYPE_QUESTION));
			SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_SMPTYPE_PASSWORD));
			SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_SMPTYPE_FINGERPRINT));
			SendMessage(cmb, CB_SELECTSTRING, -1, (WPARAM)TranslateT(LANG_SMPTYPE_QUESTION));
			EnableWindow(GetDlgItem(hwndDlg, IDC_CBO_SMP_CHOOSE), TRUE);

			
			Fingerprint *fp = context->active_fingerprint;
			if (!fp) {
				EndDialog(hwndDlg, IDCANCEL);
				return FALSE;
			}
			TCHAR buff[1024];
			if (!fp->trust || fp->trust[0] == '\0')
				mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT((HANDLE)context->app_data));
			else
				mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT((HANDLE)context->app_data));

			SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff);

			SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, _T(""));
			SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, FALSE, 0);
			SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateT(LANG_SMP_QUESTION));
			
			SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, _T(""));
			SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, FALSE, 0);
			SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_SMP_ANSWER));

			
			ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_SHOWNA);
			ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_HIDE);
			ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_HIDE);
			SetFocus(GetDlgItem(hwndDlg, IDC_CBO_SMP_CHOOSE));
			
			return FALSE;
		}

	case WM_COMMAND: 
		switch ( HIWORD( wParam )) {
			case BN_CLICKED: 
						{
							ConnContext* context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
							TCHAR msg[1024];
						switch ( LOWORD( wParam )) {
							case IDCANCEL:
								EndDialog(hwndDlg, LOWORD( wParam ));
								break;
							case IDOK:
								GetDlgItemText(hwndDlg, IDC_CBO_SMP_CHOOSE, msg, 255);
								if (_tcsncmp(msg, TranslateT(LANG_SMPTYPE_QUESTION), 255)==0) {
									if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) {
										TCHAR msg[512];
										mir_sntprintf(msg, 512, TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT((HANDLE)context->app_data));
										ShowError(msg);
									}else {
									int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, WM_GETTEXTLENGTH, 0, 0);
									TCHAR *question = new TCHAR[len+1];
									GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, question, len+1);
									char *quest = mir_utf8encodeT(question);
									delete question;

									len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0);
									TCHAR *answer = new TCHAR[len+1];
									GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, answer, len+1);
									char *ans = mir_utf8encodeT(answer);
									delete answer;

									SMPInitUpdateDialog(context, false);
									otr_start_smp(context, quest, (const unsigned char*)ans, strlen(ans));
									mir_free(quest);
									mir_free(ans);
									}

								}else if (_tcsncmp(msg, TranslateT(LANG_SMPTYPE_PASSWORD), 255)==0) {
									if (smp_for_contact.find(context->app_data) != smp_for_contact.end()) {
										TCHAR msg[512];
										mir_sntprintf(msg, 512, TranslateT(LANG_SMP_IN_PROGRESS), contact_get_nameT((HANDLE)context->app_data));
										ShowError(msg);
									}else {
									int len = SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, WM_GETTEXTLENGTH, 0, 0);
									TCHAR *answer = new TCHAR[len+1];
									GetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, answer, len+1);
									char *ans = mir_utf8encodeT(answer);
									delete answer;

									SMPInitUpdateDialog(context, false);
									otr_start_smp(context, NULL, (const unsigned char*)ans, strlen(ans));
									mir_free(ans);
									}

								}else break;
								EndDialog(hwndDlg, LOWORD( wParam ));
								break;
							case IDYES:
								VerifyFingerprint(context, true);
								EndDialog(hwndDlg, LOWORD( wParam ));
								break;
							case IDNO:
								VerifyFingerprint(context, false);
								EndDialog(hwndDlg, LOWORD( wParam ));
								break;
						}
						}
						break;
			case CBN_SELCHANGE:
				switch ( LOWORD( wParam )) {	
					case IDC_CBO_SMP_CHOOSE:
						{ 
							ConnContext* context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
							Fingerprint *fp = context->active_fingerprint;
							if (!fp) {
								EndDialog(hwndDlg, IDCANCEL);
								return TRUE;
							}
							BOOL trusted = false;
							if (fp->trust && fp->trust[0] != '\0') trusted = true;

							TCHAR buff[512];
							GetDlgItemText(hwndDlg, IDC_CBO_SMP_CHOOSE, buff, 255);
							if (_tcsncmp(buff, TranslateT(LANG_SMPTYPE_QUESTION), 255)==0) {
								if (trusted)
									mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPQUESTION_VERIFIED_DESC), contact_get_nameT((HANDLE)context->app_data));
								else
									mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPQUESTION_VERIFY_DESC), contact_get_nameT((HANDLE)context->app_data));

								SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff);

								SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, _T(""));
								SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, FALSE, 0);
								SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateT(LANG_SMP_QUESTION));

								SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, _T(""));
								SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, FALSE, 0);
								SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_SMP_ANSWER));


								ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_SHOWNA);
								ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_HIDE);
								ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_HIDE);
							} else if (_tcsncmp(buff, TranslateT(LANG_SMPTYPE_PASSWORD), 255)==0) {
								if (trusted)
									mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPPASSWORD_VERIFIED_DESC), contact_get_nameT((HANDLE)context->app_data));
								else
									mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPPASSWORD_VERIFY_DESC), contact_get_nameT((HANDLE)context->app_data));

								SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff);

								SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, _T(""));
								SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, TRUE, 0);
								SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, _T(""));

								SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, _T(""));
								SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, FALSE, 0);
								SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_SMP_PASSWORD));


								ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_SHOWNA);
								ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_HIDE);
								ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_HIDE);
							} else if (_tcsncmp(buff, TranslateT(LANG_SMPTYPE_FINGERPRINT), 255)==0) {
								if (trusted)
									mir_sntprintf(buff, 512, TranslateT(LANG_OTR_FPVERIFIED_DESC), contact_get_nameT((HANDLE)context->app_data));
								else
									mir_sntprintf(buff, 512, TranslateT(LANG_OTR_FPVERIFY_DESC), contact_get_nameT((HANDLE)context->app_data));

								SetDlgItemText(hwndDlg, IDC_STC_SMP_INFO, buff);

								unsigned char hash[20];
								lib_cs_lock();
								if (!otrl_privkey_fingerprint_raw(otr_user_state, hash, context->accountname, context->protocol)) {
									lib_cs_unlock();
									EndDialog(hwndDlg, IDCANCEL);
									return FALSE;
								}
								otrl_privkey_hash_to_humanT(buff, hash);
								lib_cs_unlock();
								SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD1, buff);
								SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD1, EM_SETREADONLY, TRUE, 0);
								SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD1, TranslateT(LANG_YOUR_PRIVKEY));

								otrl_privkey_hash_to_humanT(buff, fp->fingerprint);
								SetDlgItemText(hwndDlg, IDC_EDT_SMP_FIELD2, buff);
								SendDlgItemMessage(hwndDlg, IDC_EDT_SMP_FIELD2, EM_SETREADONLY, TRUE, 0);
								SetDlgItemText(hwndDlg, IDC_STC_SMP_FIELD2, TranslateT(LANG_CONTACT_FINGERPRINT));

								ShowWindow(GetDlgItem(hwndDlg, IDOK), SW_HIDE);
								ShowWindow(GetDlgItem(hwndDlg, IDYES), SW_SHOWNA);
								ShowWindow(GetDlgItem(hwndDlg, IDNO), SW_SHOWNA);

							}
						}break;
				}
		}
		break;

	}

	return FALSE;
}