summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradmin@progandy.co.cc <admin@progandy.co.cc@eced67a3-f377-a0ae-92ae-d6de1850b05a>2010-09-11 19:31:30 +0000
committeradmin@progandy.co.cc <admin@progandy.co.cc@eced67a3-f377-a0ae-92ae-d6de1850b05a>2010-09-11 19:31:30 +0000
commit2ef110b55c664e80dddca099f1376c874f28fbc9 (patch)
tree6461b55a4498049f9d1b5c476a7218f6d4e6464f
parent1f8a1134a166fb9de9e31745a1fa21cb15662bb4 (diff)
- [ issue 3 ] fixed automatic key generation on connection
git-svn-id: http://mirotr.googlecode.com/svn/trunk@7 eced67a3-f377-a0ae-92ae-d6de1850b05a
-rw-r--r--MirOTR/otr.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/MirOTR/otr.cpp b/MirOTR/otr.cpp
index 9779800..f409e03 100644
--- a/MirOTR/otr.cpp
+++ b/MirOTR/otr.cpp
@@ -28,16 +28,17 @@ OtrlMessageAppOps ops = {
struct GenKeyData{
HWND dialog;
- char *proto;
+ const char *proto;
};
static unsigned int CALLBACK generate_key_thread(void* param) {
CallService(MS_SYSTEM_THREAD_PUSH, 0, 0);
GenKeyData *data = (GenKeyData *)param;
- lib_cs_lock();
+ //lib_cs_lock();
otrl_privkey_generate(otr_user_state, g_private_key_filename, data->proto, data->proto);
- lib_cs_unlock();
+ //lib_cs_unlock();
PostMessage(data->dialog, WMU_ENDDIALOG, 0, 0);
+ mir_free(data);
CallService(MS_SYSTEM_THREAD_POP, 0, 0);
return 0;
}
@@ -57,7 +58,7 @@ INT_PTR CALLBACK GenKeyDlgFunc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lPa
mir_sntprintf(buff, 256, TranslateT(LANG_GENERATE_KEY), proto);
mir_free(proto);
SetDlgItemText(hWndDlg, IDC_GENERATE, buff);
- GenKeyData *data = new GenKeyData();
+ GenKeyData *data = (GenKeyData *)mir_calloc(sizeof(GenKeyData));
data->dialog = hWndDlg;
data->proto = (char*)lParam;
CloseHandle((HANDLE)_beginthreadex(0, 0, generate_key_thread, (void*)data, 0, 0));
@@ -105,7 +106,9 @@ extern "C" {
//DWORD tid;
//CloseHandle(CreateThread(0, 0, newKeyThread, (VOID *)nkd, 0, &tid));
//QueueUserAPC(newKeyAPC, Global::mainThread, (DWORD)nkd);
- DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_GENKEYNOTIFY), GetDesktopWindow(), GenKeyDlgFunc, (LPARAM)protocol );
+ if (opdata) protocol = contact_get_proto((HANDLE)opdata);
+ if (!protocol) return;
+ DialogBoxParamW(hInst, MAKEINTRESOURCE(IDD_GENKEYNOTIFY), 0, GenKeyDlgFunc, (LPARAM)protocol );
}