summaryrefslogtreecommitdiff
path: root/MirOTR
diff options
context:
space:
mode:
authorNvinside <Nvinside@eced67a3-f377-a0ae-92ae-d6de1850b05a>2010-09-17 21:43:15 +0000
committerNvinside <Nvinside@eced67a3-f377-a0ae-92ae-d6de1850b05a>2010-09-17 21:43:15 +0000
commitc475377ad4dda8d4498fc7e418375f9041e04578 (patch)
tree8ecff8e987a478597c39973a571bd113331ce85d /MirOTR
parent2086396e736d0f41ab2654c8269db013af5284c6 (diff)
MirOTR 0.11.0.0:
Part 1 (i will some work add later!) * added german langpack.txt + x64 compatible (many thanks to thfabba) ! fixed some memory leaks git-svn-id: http://mirotr.googlecode.com/svn/trunk@22 eced67a3-f377-a0ae-92ae-d6de1850b05a
Diffstat (limited to 'MirOTR')
-rw-r--r--MirOTR/dbfilter.cpp6
-rw-r--r--MirOTR/dialogs.cpp36
-rw-r--r--MirOTR/mirotrmenu.cpp4
-rw-r--r--MirOTR/options.cpp58
-rw-r--r--MirOTR/options.h8
-rw-r--r--MirOTR/otr.cpp106
-rw-r--r--MirOTR/svcs_menu.cpp16
-rw-r--r--MirOTR/svcs_menu.h8
-rw-r--r--MirOTR/svcs_proto.cpp457
-rw-r--r--MirOTR/svcs_proto.h20
-rw-r--r--MirOTR/version.h14
11 files changed, 367 insertions, 366 deletions
diff --git a/MirOTR/dbfilter.cpp b/MirOTR/dbfilter.cpp
index 58e3b6d..677be9d 100644
--- a/MirOTR/dbfilter.cpp
+++ b/MirOTR/dbfilter.cpp
@@ -43,7 +43,7 @@ VOID CALLBACK DeleteTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTi
// add prefix to sent messages
-INT_PTR OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) {
+int OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) {
if(!options.prefix_messages || !lParam) return 0;
HANDLE hContact = (HANDLE)wParam;
DBEVENTINFO *dbei = (DBEVENTINFO *)lParam;
@@ -177,7 +177,7 @@ INT_PTR OnDatabaseEventPreAdd(WPARAM wParam, LPARAM lParam) {
return 1;
}
-INT_PTR OnDatabaseEventAdded(WPARAM wParam, LPARAM lParam) {
+int OnDatabaseEventAdded(WPARAM wParam, LPARAM lParam) {
if(!options.delete_history) return 0;
DBEVENTINFO info = {0};
@@ -267,7 +267,7 @@ int StatusModeChange(WPARAM wParam, LPARAM lParam) {
return 0;
}
-INT_PTR OnContactSettingChanged(WPARAM wParam, LPARAM lParam) {
+int OnContactSettingChanged(WPARAM wParam, LPARAM lParam) {
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
if (!lParam || strcmp(cws->szSetting, "Status") != 0) return 0;
HANDLE hContact = (HANDLE)wParam;
diff --git a/MirOTR/dialogs.cpp b/MirOTR/dialogs.cpp
index 50c25aa..4415aa0 100644
--- a/MirOTR/dialogs.cpp
+++ b/MirOTR/dialogs.cpp
@@ -44,7 +44,7 @@ INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
mir_sntprintf(title, 512, TranslateT(LANG_SMP_PROGRESS_DESC), name, proto);
mir_free(proto);
SetDlgItemText(hwndDlg, IDC_STC_SMP_HEADPRO, title);
- SetWindowLongPtr(hwndDlg, GWL_USERDATA, (LONG_PTR)context);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)context);
// Move window to screen center
// Get the owner window and dialog box rectangles.
@@ -89,7 +89,7 @@ INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
case WMU_REFRESHSMP:
{
- ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWL_USERDATA);
+ ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
SendDlgItemMessage(hwndDlg, IDC_PGB_SMP, PBM_SETPOS, wParam, 0);
switch (wParam) {
case 0:
@@ -103,15 +103,15 @@ INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
EnableWindow(GetDlgItem(hwndDlg, IDCANCEL), false);
EnableWindow(GetDlgItem(hwndDlg, IDOK), true);
smp_for_contact.erase(context->app_data);
- if (context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) {
- if (context->active_fingerprint->trust &&
- context->active_fingerprint->trust[0]) {
- SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_SUCCESS));
- } else {
- SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_SUCCESS_VERIFY));
- }
- } else {
- SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_FAILED));
+ if (context->smstate->sm_prog_state == OTRL_SMP_PROG_SUCCEEDED) {
+ if (context->active_fingerprint->trust &&
+ context->active_fingerprint->trust[0]) {
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_SUCCESS));
+ } else {
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_SUCCESS_VERIFY));
+ }
+ } else {
+ SetDlgItemText(hwndDlg, IDC_STC_SMP_PROGRESS, TranslateT(LANG_SMP_FAILED));
}
}
break;
@@ -124,7 +124,7 @@ INT_PTR CALLBACK DlgSMPUpdateProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
switch ( HIWORD( wParam )) {
case BN_CLICKED:
{
- ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWL_USERDATA);
+ ConnContext *context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch ( LOWORD( wParam )) {
case IDCANCEL:
otr_abort_smp(context);
@@ -177,7 +177,7 @@ INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
mir_free(proto);
SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)buff);
SetDlgItemText(hwndDlg, IDC_STC_SMP_HEAD, buff);
- SetWindowLongPtr(hwndDlg, GWL_USERDATA, (LONG_PTR)context);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)context);
if (data->question) {
mir_sntprintf(buff, 512, TranslateT(LANG_OTR_SMPQUESTION_RESPOND_DESC), contact_get_nameT(context->app_data));
@@ -259,7 +259,7 @@ INT_PTR CALLBACK DlgSMPResponseProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
switch ( HIWORD( wParam )) {
case BN_CLICKED:
{
- ConnContext *context = (ConnContext *)GetWindowLongPtr(hwndDlg, GWL_USERDATA);
+ ConnContext *context = (ConnContext *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch ( LOWORD( wParam )) {
case IDOK:
{
@@ -324,7 +324,7 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
mir_free(proto);
SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)title);
SetDlgItemText(hwndDlg, IDC_STC_SMP_HEAD, title);
- SetWindowLongPtr(hwndDlg, GWL_USERDATA, lParam);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
// Move window to screen center
// Get the owner window and dialog box rectangles.
@@ -401,7 +401,7 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
switch ( HIWORD( wParam )) {
case BN_CLICKED:
{
- ConnContext* context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWL_USERDATA);
+ ConnContext* context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
TCHAR msg[1024];
switch ( LOWORD( wParam )) {
case IDCANCEL:
@@ -468,7 +468,7 @@ INT_PTR CALLBACK DlgProcSMPInitProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
switch ( LOWORD( wParam )) {
case IDC_CBO_SMP_CHOOSE:
{
- ConnContext* context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWL_USERDATA);
+ ConnContext* context = (ConnContext*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
Fingerprint *fp = context->active_fingerprint;
if (!fp) {
EndDialog(hwndDlg, IDCANCEL);
@@ -624,7 +624,7 @@ INT_PTR CALLBACK DlgProcVerifyContext(HWND hwndDlg, UINT msg, WPARAM wParam, LPA
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, GWL_USERDATA, lParam);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
// Move window to screen center
// Get the owner window and dialog box rectangles.
diff --git a/MirOTR/mirotrmenu.cpp b/MirOTR/mirotrmenu.cpp
index 61425fc..0d2d5eb 100644
--- a/MirOTR/mirotrmenu.cpp
+++ b/MirOTR/mirotrmenu.cpp
@@ -172,7 +172,7 @@ LRESULT CALLBACK PopupMenuWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
if (CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam)) return TRUE;
break;
case WM_COMMAND:
- if (CallService(MO_PROCESSCOMMANDBYMENUIDENT, wParam, GetWindowLongPtr(hwnd, GWL_USERDATA))) return TRUE;
+ if (CallService(MO_PROCESSCOMMANDBYMENUIDENT, wParam, GetWindowLongPtr(hwnd, GWLP_USERDATA))) return TRUE;
break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
@@ -180,7 +180,7 @@ LRESULT CALLBACK PopupMenuWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM
void ShowOTRMenu(HANDLE hContact, POINT pt){
HMENU menu = (HMENU) CallService(MS_MIROTR_MENUBUILDMIROTR, (WPARAM)hContact, 0);
- SetWindowLongPtr(hDummyPaintWin, GWL_USERDATA, (LONG_PTR)hContact);
+ SetWindowLongPtr(hDummyPaintWin, GWLP_USERDATA, (LONG_PTR)hContact);
TrackPopupMenu(menu, 0, pt.x, pt.y, 0, hDummyPaintWin, 0);
DestroyMenu(menu);
}
diff --git a/MirOTR/options.cpp b/MirOTR/options.cpp
index 3ba46dc..1e71f29 100644
--- a/MirOTR/options.cpp
+++ b/MirOTR/options.cpp
@@ -109,7 +109,7 @@ void LoadOptions() {
LoadFilenames();
}
-extern "C" INT_PTR OpenOptions(WPARAM wParam, LPARAM lParam)
+extern "C" int OpenOptions(WPARAM wParam, LPARAM lParam)
{
OPTIONSDIALOGPAGE odp = { 0 };
@@ -525,7 +525,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
{
TranslateDialogDefault( hwndDlg );
- SetWindowLongPtr(hwndDlg, GWL_USERDATA, (ULONG_PTR) new ContactPolicyMap());
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (ULONG_PTR) new ContactPolicyMap());
HWND cmb = GetDlgItem(hwndDlg, IDC_CMB_CONT_POLICY);
SendMessage(cmb, CB_ADDSTRING, 0, (WPARAM)TranslateT(LANG_POLICY_DEFAULT));
@@ -637,7 +637,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
lvi.iItem = iUser;
lvi.iSubItem = 0;
ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_CONT_CONTACTS), &lvi);
- ContactPolicyMap* cpm = (ContactPolicyMap*) GetWindowLongPtr(hwndDlg, GWL_USERDATA);
+ ContactPolicyMap* cpm = (ContactPolicyMap*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
hContact = (HANDLE)lvi.lParam;
(*cpm)[hContact].policy = policy;
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
@@ -653,7 +653,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
if (code == (UINT) PSN_APPLY ) {
// handle apply
- ContactPolicyMap *cpm = (ContactPolicyMap*) GetWindowLongPtr(hwndDlg, GWL_USERDATA);
+ ContactPolicyMap *cpm = (ContactPolicyMap*) 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(ContactPolicyMap::const_iterator it = cpm->begin(); it != cpm->end(); ++it)
@@ -685,7 +685,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
SendDlgItemMessage(hwndDlg, IDC_LV_CONT_CONTACTS, LVM_GETITEM, 0, (LPARAM)&lvi);
HANDLE hContact = (HANDLE)lvi.lParam;
- ContactPolicyMap *cp = (ContactPolicyMap *)GetWindowLong(hwndDlg, GWL_USERDATA);
+ ContactPolicyMap *cp = (ContactPolicyMap *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
TCHAR buff[50];
ListView_GetItemText(((LPNMHDR)lParam)->hwndFrom, lvi.iItem, 3, buff, 50);
if (_tcsncmp(buff, TranslateT(LANG_YES), 50)==0){
@@ -704,7 +704,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsContacts(HWND hwndDlg, UINT msg, WPARAM
}
}break;
case WM_DESTROY:
- ContactPolicyMap *cpm = (ContactPolicyMap*) GetWindowLongPtr(hwndDlg, GWL_USERDATA);
+ ContactPolicyMap *cpm = (ContactPolicyMap*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
cpm->clear();
delete cpm;
break;
@@ -717,7 +717,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
switch ( msg ) {
case WM_INITDIALOG:
TranslateDialogDefault( hwndDlg );
- SetWindowLongPtr(hwndDlg, GWL_USERDATA, (ULONG_PTR) new FPModifyMap());
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (ULONG_PTR) new FPModifyMap());
SendDlgItemMessage(hwndDlg, IDC_LV_FINGER_LIST ,LVM_SETEXTENDEDLISTVIEWSTYLE, 0,LVS_EX_FULLROWSELECT);// | LVS_EX_CHECKBOXES);
@@ -771,29 +771,29 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
// 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;
- ConnContext * context = otr_user_state->context_root;
- TCHAR *proto, *user, hash[45] = {0};
- Fingerprint *fp;
- while (context) {
- if (context->app_data) {
- user = (TCHAR*)contact_get_nameT((HANDLE)context->app_data);
- if (user) {
- proto = mir_a2t(context->protocol);
- fp = context->fingerprint_root.next;
- while(fp) {
- otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
+ lvI.mask = LVIF_TEXT | LVIF_PARAM;// | LVIF_NORECOMPUTE;// | LVIF_IMAGE;
+ ConnContext * context = otr_user_state->context_root;
+ TCHAR *proto, *user, hash[45] = {0};
+ Fingerprint *fp;
+ while (context) {
+ if (context->app_data) {
+ user = (TCHAR*)contact_get_nameT((HANDLE)context->app_data);
+ if (user) {
+ proto = mir_a2t(context->protocol);
+ fp = context->fingerprint_root.next;
+ while(fp) {
+ otrl_privkey_hash_to_humanT(hash, fp->fingerprint);
if (hash) {
lvI.iSubItem = 0;
lvI.lParam = (LPARAM)fp;
lvI.pszText = user;
int d = ListView_InsertItem(lv, &lvI);
- ListView_SetItemText(lv,d, 1, proto);
- 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')? TranslateT(LANG_YES) : TranslateT(LANG_NO));
- ListView_SetItemText(lv,d, 4, hash );
- }
+ ListView_SetItemText(lv,d, 1, proto);
+ 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')? TranslateT(LANG_YES) : TranslateT(LANG_NO));
+ ListView_SetItemText(lv,d, 4, hash );
+ }
fp = fp->next;
}
mir_free(proto);
@@ -818,7 +818,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
Fingerprint *fp = NULL;
ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), &lvi);
fp = (Fingerprint*) lvi.lParam;
- FPModifyMap* fpm = (FPModifyMap*) GetWindowLongPtr(hwndDlg, GWL_USERDATA);
+ 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);
@@ -834,7 +834,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
Fingerprint *fp = NULL;
ListView_GetItem(GetDlgItem(hwndDlg, IDC_LV_FINGER_LIST), &lvi);
fp = (Fingerprint*) lvi.lParam;
- FPModifyMap* fpm = (FPModifyMap*) GetWindowLongPtr(hwndDlg, GWL_USERDATA);
+ 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);
@@ -856,7 +856,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
mir_sntprintf(buff, 1024, TranslateT(LANG_FINGERPRINT_STILL_IN_USE), hash, contact_get_nameT((HANDLE)fp->context->app_data));
ShowError(buff);
} else {
- FPModifyMap* fpm = (FPModifyMap*) GetWindowLongPtr(hwndDlg, GWL_USERDATA);
+ 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);
@@ -871,7 +871,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
if (((LPNMHDR)lParam)->code == (UINT) PSN_APPLY ) {
// handle apply
- FPModifyMap *fpm = (FPModifyMap*) GetWindowLongPtr(hwndDlg, GWL_USERDATA);
+ 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)
@@ -910,7 +910,7 @@ static INT_PTR CALLBACK DlgProcMirOTROptsFinger(HWND hwndDlg, UINT msg, WPARAM w
}
break;
case WM_DESTROY:
- FPModifyMap *fpm = (FPModifyMap*) GetWindowLongPtr(hwndDlg, GWL_USERDATA);
+ FPModifyMap *fpm = (FPModifyMap*) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
fpm->clear();
delete fpm;
break;
diff --git a/MirOTR/options.h b/MirOTR/options.h
index 0e915e7..ab81d3a 100644
--- a/MirOTR/options.h
+++ b/MirOTR/options.h
@@ -5,9 +5,9 @@
extern char* g_metaproto;
-#define PRIVATE_KEY_FILENAME "otr.private_key"
-#define FINGERPRINT_STORE_FILENAME "otr.fingerprints"
-
+#define PRIVATE_KEY_FILENAME "otr.private_key"
+#define FINGERPRINT_STORE_FILENAME "otr.fingerprints"
+
extern char g_fingerprint_store_filename[MAX_PATH];
extern char g_private_key_filename[MAX_PATH];
@@ -61,7 +61,7 @@ int OptInit(WPARAM wParam, LPARAM lParam);
void LoadOptions();
void SaveOptions();
-extern "C" INT_PTR OpenOptions(WPARAM wParam, LPARAM lParam);
+extern "C" int OpenOptions(WPARAM wParam, LPARAM lParam);
void InitOptions();
void DeinitOptions();
diff --git a/MirOTR/otr.cpp b/MirOTR/otr.cpp
index f8cc502..1d9e882 100644
--- a/MirOTR/otr.cpp
+++ b/MirOTR/otr.cpp
@@ -52,7 +52,7 @@ INT_PTR CALLBACK GenKeyDlgFunc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lPa
return 0;
}
TranslateDialogDefault(hWndDlg);
- SetClassLongPtr(hWndDlg, GCL_HICON, (LONG_PTR)LoadIcon(ICON_OTR,1) );
+ SetClassLongPtr(hWndDlg, GCLP_HICON, (LONG_PTR)LoadIcon(ICON_OTR,1) );
TCHAR buff[256];
TCHAR *proto = mir_a2t((char*)lParam);
mir_sntprintf(buff, 256, TranslateT(LANG_GENERATE_KEY), proto);
@@ -67,7 +67,7 @@ INT_PTR CALLBACK GenKeyDlgFunc(HWND hWndDlg, UINT msg, WPARAM wParam, LPARAM lPa
EndDialog(hWndDlg, 0);
return TRUE;
case WM_DESTROY:
- SetClassLongPtr(hWndDlg, GCL_HICON, 0);
+ SetClassLongPtr(hWndDlg, GCLP_HICON, 0);
ReleaseIcon(ICON_OTR,1);
}
return FALSE;
@@ -345,55 +345,55 @@ extern "C" {
// Forward decl
gcry_error_t otrl_privkey_write_FILEp(OtrlUserState us, FILE *privf);
-/* Generate a private DSA key for a given account, storing it into a
- * file on disk, and loading it into the given OtrlUserState. Overwrite any
- * previously generated keys for that account in that OtrlUserState. */
-gcry_error_t otrl_privkey_write(OtrlUserState us, const char *filename)
-{
- gcry_error_t err;
- FILE *privf;
-#ifndef WIN32
- mode_t oldmask;
-#endif
-
-#ifndef WIN32
- oldmask = umask(077);
-#endif
- privf = fopen(filename, "w+b");
- if (!privf) {
-#ifndef WIN32
- umask(oldmask);
-#endif
- err = gcry_error_from_errno(errno);
- return err;
- }
-
- err = otrl_privkey_write_FILEp(us, privf);
-
- fclose(privf);
-#ifndef WIN32
- umask(oldmask);
-#endif
- return err;
-}
-
-/* Just store the private keys of an OtrlUserState.
- * The FILE* must be open for reading and writing. */
-gcry_error_t otrl_privkey_write_FILEp(OtrlUserState us, FILE *privf)
-{
- OtrlPrivKey *p;
-
- if (!privf) return gcry_error(GPG_ERR_NO_ERROR);
-
-
-
- /* Output the other keys we know */
- fprintf(privf, "(privkeys\n");
- for (p=us->privkey_root; p; p=p->next) {
- otrl_account_write(privf, p->accountname, p->protocol, p->privkey);
- }
- if ( fprintf(privf, ")\n") < 0 )
- return gcry_error_from_errno(errno);
- return gcry_error(GPG_ERR_NO_ERROR);
-
+/* Generate a private DSA key for a given account, storing it into a
+* file on disk, and loading it into the given OtrlUserState. Overwrite any
+* previously generated keys for that account in that OtrlUserState. */
+ gcry_error_t otrl_privkey_write(OtrlUserState us, const char *filename)
+ {
+ gcry_error_t err;
+ FILE *privf;
+ #ifndef WIN32
+ mode_t oldmask;
+ #endif
+
+ #ifndef WIN32
+ oldmask = umask(077);
+ #endif
+ privf = fopen(filename, "w+b");
+ if (!privf) {
+ #ifndef WIN32
+ umask(oldmask);
+ #endif
+ err = gcry_error_from_errno(errno);
+ return err;
+ }
+
+ err = otrl_privkey_write_FILEp(us, privf);
+
+ fclose(privf);
+ #ifndef WIN32
+ umask(oldmask);
+ #endif
+ return err;
+ }
+
+/* Just store the private keys of an OtrlUserState.
+ * The FILE* must be open for reading and writing. */
+ gcry_error_t otrl_privkey_write_FILEp(OtrlUserState us, FILE *privf)
+ {
+ OtrlPrivKey *p;
+
+ if (!privf) return gcry_error(GPG_ERR_NO_ERROR);
+
+
+
+ /* Output the other keys we know */
+ fprintf(privf, "(privkeys\n");
+ for (p=us->privkey_root; p; p=p->next) {
+ otrl_account_write(privf, p->accountname, p->protocol, p->privkey);
+ }
+ if ( fprintf(privf, ")\n") < 0 )
+ return gcry_error_from_errno(errno);
+ return gcry_error(GPG_ERR_NO_ERROR);
+
} \ No newline at end of file
diff --git a/MirOTR/svcs_menu.cpp b/MirOTR/svcs_menu.cpp
index 6eaa3d6..f814774 100644
--- a/MirOTR/svcs_menu.cpp
+++ b/MirOTR/svcs_menu.cpp
@@ -12,7 +12,7 @@ int StartOTR(HANDLE hContact) {
if(!proto) return 1; // error
char *uname = contact_get_id(hContact);
if(!uname) return 1; // error
- WORD pol = DBGetContactSettingWord(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY);
+ DWORD pol = DBGetContactSettingDword(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY);
if(pol == CONTACT_DEFAULT_POLICY) pol = options.default_policy;
lib_cs_lock();
@@ -23,7 +23,7 @@ int StartOTR(HANDLE hContact) {
mir_free(uname);
return 0;
}
-int SVC_StartOTR(WPARAM wParam, LPARAM lParam) {
+INT_PTR SVC_StartOTR(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE)wParam, hSub;
if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) {
hContact = hSub;
@@ -45,7 +45,7 @@ int SVC_StartOTR(WPARAM wParam, LPARAM lParam) {
return 0;
}
-int SVC_RefreshOTR(WPARAM wParam, LPARAM lParam) {
+INT_PTR SVC_RefreshOTR(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE)wParam, hSub;
if(options.bHaveMetaContacts && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) {
hContact = hSub;
@@ -85,7 +85,7 @@ int otr_disconnect_contact(HANDLE hContact) {
return 0;
}
-int SVC_StopOTR(WPARAM wParam, LPARAM lParam) {
+INT_PTR SVC_StopOTR(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE)wParam;
// prevent this filter from acting on injeceted messages for metas, when they are passed though the subcontact's proto send chain
@@ -100,7 +100,7 @@ int SVC_StopOTR(WPARAM wParam, LPARAM lParam) {
return 0;
}
-int SVC_VerifyOTR(WPARAM wParam, LPARAM lParam) {
+INT_PTR SVC_VerifyOTR(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE)wParam;
ConnContext *context = otrl_context_find_miranda(otr_user_state, (HANDLE)wParam);
if (!context) return 1;
@@ -109,7 +109,7 @@ int SVC_VerifyOTR(WPARAM wParam, LPARAM lParam) {
return 0;
}
-int SVC_ToggleHTMLOTR(WPARAM wParam, LPARAM lParam) {
+INT_PTR SVC_ToggleHTMLOTR(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE)wParam;
if (db_byte_get(hContact, MODULENAME, "HTMLConv", 0))
db_byte_set(hContact, MODULENAME, "HTMLConv", 0);
@@ -159,7 +159,7 @@ int SVC_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) {
mi.flags = CMIM_FLAGS | CMIF_NOTOFFLINE | CMIF_TCHAR | CMIF_ICONFROMICOLIB;
const char *proto = contact_get_proto(hContact);
- WORD pol = CONTACT_DEFAULT_POLICY;
+ DWORD pol = CONTACT_DEFAULT_POLICY;
if(!proto || DBGetContactSettingByte(hContact, proto, "ChatRoom", 0) == 1) {
goto hide_all;
@@ -173,7 +173,7 @@ int SVC_PrebuildContactMenu(WPARAM wParam, LPARAM lParam) {
proto = contact_get_proto(hContact);
}
- pol = DBGetContactSettingWord(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY);
+ pol = DBGetContactSettingDword(hContact, MODULENAME, "Policy", CONTACT_DEFAULT_POLICY);
if(pol == CONTACT_DEFAULT_POLICY) pol = options.default_policy;
if(pol == OTRL_POLICY_NEVER || pol == OTRL_POLICY_ALWAYS) {
diff --git a/MirOTR/svcs_menu.h b/MirOTR/svcs_menu.h
index c6f3223..7dfc11a 100644
--- a/MirOTR/svcs_menu.h
+++ b/MirOTR/svcs_menu.h
@@ -1,8 +1,8 @@
#pragma once
-int SVC_StartOTR(WPARAM wParam, LPARAM lParam);
-int SVC_RefreshOTR(WPARAM wParam, LPARAM lParam);
-int SVC_StopOTR(WPARAM wParam, LPARAM lParam);
-int SVC_VerifyOTR(WPARAM wParam, LPARAM lParam);
+INT_PTR SVC_StartOTR(WPARAM wParam, LPARAM lParam);
+INT_PTR SVC_RefreshOTR(WPARAM wParam, LPARAM lParam);
+INT_PTR SVC_StopOTR(WPARAM wParam, LPARAM lParam);
+INT_PTR SVC_VerifyOTR(WPARAM wParam, LPARAM lParam);
int SVC_PrebuildContactMenu(WPARAM wParam, LPARAM lParam);
void InitMenu();
void DeinitMenu();
diff --git a/MirOTR/svcs_proto.cpp b/MirOTR/svcs_proto.cpp
index 3bcb056..d1991fb 100644
--- a/MirOTR/svcs_proto.cpp
+++ b/MirOTR/svcs_proto.cpp
@@ -4,7 +4,7 @@
#include "entities.h"
//TODO: Social-Millionaire-Dialoge
-int SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){
+INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){
if(!lParam) return 0;
CCSDATA *ccs = (CCSDATA *) lParam;
@@ -55,39 +55,39 @@ int SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){
}
}
- char *username = contact_get_id(ccs->hContact);
- err = otrl_message_sending(otr_user_state, &ops, (void*)ccs->hContact,
- proto, proto, username, oldmessage_utf, NULL, &newmessage,
- add_appdata, (void*)ccs->hContact);
- if (tmpencode!= NULL || !(ccs->wParam & PREF_UTF)) mir_free(oldmessage_utf);
- oldmessage_utf = NULL;
- mir_free(username);
-
- if (err && newmessage == NULL) {
- /* Be *sure* not to send out plaintext */
- ShowError(TranslateT(LANG_ENCRYPTION_ERROR));
- /* should not be needed
- char t[3] = {0, 0, 0};
+ char *username = contact_get_id(ccs->hContact);
+ err = otrl_message_sending(otr_user_state, &ops, (void*)ccs->hContact,
+ proto, proto, username, oldmessage_utf, NULL, &newmessage,
+ add_appdata, (void*)ccs->hContact);
+ if (tmpencode!= NULL || !(ccs->wParam & PREF_UTF)) mir_free(oldmessage_utf);
+ oldmessage_utf = NULL;
+ mir_free(username);
+
+ if (err && newmessage == NULL) {
+ /* Be *sure* not to send out plaintext */
+ ShowError(TranslateT(LANG_ENCRYPTION_ERROR));
+ /* should not be needed
+ char t[3] = {0, 0, 0};
if(ccs->wParam & PREF_UNICODE) { //TODO!! lstrlen(pre->szMessage)+1 ??
if (strlen(oldmessage)) memcpy(oldmessage, t,3 );
} else {
if (strlen(oldmessage)) memcpy(oldmessage, t, 1);
- }
- */
- return 1;
- } else if (newmessage) {
- /* Fragment the message if necessary, and send all but the last
- * fragment over the network. We will send the last segment later */
-
- // oldmessage_utf is not used anymore, so use it as buffer
- err = otrl_message_fragment_and_send(&ops, (void*)ccs->hContact, context,
- newmessage, OTRL_FRAGMENT_SEND_ALL_BUT_LAST, &oldmessage_utf);
- // newmessage is not needed anymore
- otrl_message_free(newmessage);
- // move the last fragment to newmessage, oldmessage_utf will be buffer later
- newmessage = oldmessage_utf;
-
- WPARAM oldflags = ccs->wParam;
+ }
+ */
+ return 1;
+ } else if (newmessage) {
+ /* Fragment the message if necessary, and send all but the last
+ * fragment over the network. We will send the last segment later */
+
+ // oldmessage_utf is not used anymore, so use it as buffer
+ err = otrl_message_fragment_and_send(&ops, (void*)ccs->hContact, context,
+ newmessage, OTRL_FRAGMENT_SEND_ALL_BUT_LAST, &oldmessage_utf);
+ // newmessage is not needed anymore
+ otrl_message_free(newmessage);
+ // move the last fragment to newmessage, oldmessage_utf will be buffer later
+ newmessage = oldmessage_utf;
+
+ WPARAM oldflags = ccs->wParam;
if(ccs->wParam & PREF_UTF) {
ccs->lParam = (LPARAM)newmessage;
} else if(ccs->wParam & PREF_UNICODE) {
@@ -100,21 +100,21 @@ int SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){
} else {
mir_utf8decode(newmessage, NULL);
ccs->lParam = (LPARAM)newmessage;
- }
- if (otr_context_get_trust(context) >= TRUST_UNVERIFIED) ccs->wParam;
- int ret = CallService(MS_PROTO_CHAINSEND, wParam, lParam);
+ }
+ if (otr_context_get_trust(context) >= TRUST_UNVERIFIED) ccs->wParam;
+ INT_PTR ret = CallService(MS_PROTO_CHAINSEND, wParam, lParam);
/*#ifdef _DEBUG
if(ccs->wParam & PREF_UNICODE)
MessageBox(0, (wchar_t *)ccs->lParam, _T("OTR - sending raw message"), MB_OK);
else
- MessageBoxA(0, (char *)ccs->lParam, ("OTR - sending raw message"), MB_OK);
-#endif*/
-
- // reset to original values
- ccs->lParam = (LPARAM)oldmessage;
- ccs->wParam = oldflags;
- otrl_message_free(newmessage);
+ MessageBoxA(0, (char *)ccs->lParam, ("OTR - sending raw message"), MB_OK);
+ #endif*/
+
+ // reset to original values
+ ccs->lParam = (LPARAM)oldmessage;
+ ccs->wParam = oldflags;
+ otrl_message_free(newmessage);
return ret;
}
@@ -122,7 +122,7 @@ int SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam){
return CallService(MS_PROTO_CHAINSEND, wParam, lParam);
}
-int SVC_OTRSendMessageW(WPARAM wParam, LPARAM lParam){
+INT_PTR SVC_OTRSendMessageW(WPARAM wParam, LPARAM lParam){
if(!lParam) return 0;
CCSDATA *ccs = (CCSDATA *) lParam;
@@ -137,7 +137,7 @@ int SVC_OTRSendMessageW(WPARAM wParam, LPARAM lParam){
#define MESSAGE_PREFIX_LEN 6
*/
-int SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){
+INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){
//PUShowMessage("OTR Recv Message", SM_NOTIFY);
CCSDATA *ccs = (CCSDATA *) lParam;
PROTORECVEVENT *pre = (PROTORECVEVENT *) ccs->lParam;
@@ -174,131 +174,132 @@ int SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){
if(!oldmessage_utf) return 1;
- char *newmessage = NULL;
- OtrlTLV *tlvs = NULL;
- OtrlTLV *tlv = NULL;
- BOOL ignore_msg;
- ConnContext *context;
- //NextExpectedSMP nextMsg;
-
- char *uname = contact_get_id(ccs->hContact);
- lib_cs_lock();
- ignore_msg = otrl_message_receiving(otr_user_state, &ops, (void*)ccs->hContact,
- proto, proto, uname, oldmessage_utf,
- &newmessage, &tlvs, add_appdata, (void*)ccs->hContact);
- lib_cs_unlock();
- mir_free(uname);
-
- if( !(pre->flags & PREF_UTF)) mir_free(oldmessage_utf);
- oldmessage_utf = NULL;
-
-
- tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
- if (tlv) {
+ char *newmessage = NULL;
+ OtrlTLV *tlvs = NULL;
+ OtrlTLV *tlv = NULL;
+ BOOL ignore_msg;
+ ConnContext *context;
+ //NextExpectedSMP nextMsg;
+
+ char *uname = contact_get_id(ccs->hContact);
+ lib_cs_lock();
+ ignore_msg = otrl_message_receiving(otr_user_state, &ops, (void*)ccs->hContact,
+ proto, proto, uname, oldmessage_utf,
+ &newmessage, &tlvs, add_appdata, (void*)ccs->hContact);
+ lib_cs_unlock();
+ mir_free(uname);
+
+ if( !(pre->flags & PREF_UTF)) mir_free(oldmessage_utf);
+ oldmessage_utf = NULL;
+
+
+ tlv = otrl_tlv_find(tlvs, OTRL_TLV_DISCONNECTED);
+ if (tlv) {
/* Notify the user that the other side disconnected. */
TCHAR buff[256];
mir_sntprintf(buff, 256, TranslateT(LANG_SESSION_TERMINATED_BY_OTR), contact_get_nameT(ccs->hContact));
//MessageBox(0, buff, Translate("OTR Information"), MB_OK);
ShowMessage((HANDLE)ccs->hContact, buff);
- //if(options.timeout_finished) ResetFinishedTimer();
- }
-
- lib_cs_lock();
- context = otrl_context_find_miranda(otr_user_state, ccs->hContact);
- lib_cs_unlock();
- /* Keep track of our current progress in the Socialist Millionaires'
- * Protocol. */
-
- /*
- if (context && ( (context->smstate->sm_prog_state == OTRL_SMP_PROG_CHEATED) ||
- otrl_tlv_find(tlvs, OTRL_TLV_SMP1Q) ||
- otrl_tlv_find(tlvs, OTRL_TLV_SMP1) ||
- otrl_tlv_find(tlvs, OTRL_TLV_SMP2) ||
- otrl_tlv_find(tlvs, OTRL_TLV_SMP3) ||
- otrl_tlv_find(tlvs, OTRL_TLV_SMP4) )
- )
- {
- otr_abort_smp(context); // we do not support it (yet), notify partner to shorten wait time
- }
- */
-
-
- if (context) {
- NextExpectedSMP nextMsg = context->smstate->nextExpected;
-
- if (context->smstate->sm_prog_state == OTRL_SMP_PROG_CHEATED) {
- otr_abort_smp(context);
- //otrg_dialog_update_smp(context, 0.0);
- SMPDialogUpdate(context, 0);
- context->smstate->nextExpected = OTRL_SMP_EXPECT1;
- context->smstate->sm_prog_state = OTRL_SMP_PROG_OK;
- } else {
-
- tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP1Q);
- if (tlv) {
- if (nextMsg != OTRL_SMP_EXPECT1)
- otr_abort_smp(context);
- else {
- char *question = (char *)tlv->data;
- char *eoq = (char*)memchr(question, '\0', tlv->len);
- if (eoq) {
- SMPDialogReply(context, question);
- }
- }
- }
- tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP1);
- if (tlv) {
- if (nextMsg != OTRL_SMP_EXPECT1)
- otr_abort_smp(context);
- else {
- SMPDialogReply(context, NULL);
- }
- }
- tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP2);
- if (tlv) {
- if (nextMsg != OTRL_SMP_EXPECT2)
- otr_abort_smp(context);
- else {
- context->smstate->nextExpected = OTRL_SMP_EXPECT4;
- SMPDialogUpdate(context, 60);
- }
- }
- tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP3);
- if (tlv) {
- if (nextMsg != OTRL_SMP_EXPECT3)
- otr_abort_smp(context);
- else {
- context->smstate->nextExpected = OTRL_SMP_EXPECT1;
- SMPDialogUpdate(context, 100);
- //otrg_dialog_update_smp(context, 1.0);
- }
- }
- tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP4);
- if (tlv) {
- if (nextMsg != OTRL_SMP_EXPECT4)
- otr_abort_smp(context);
- else {
- SMPDialogUpdate(context, 100);
- //otrg_dialog_update_smp(context, 1.0);
- context->smstate->nextExpected = OTRL_SMP_EXPECT1;
- }
- }
- tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP_ABORT);
- if (tlv) {
- SMPDialogUpdate(context, 0);
- context->smstate->nextExpected = OTRL_SMP_EXPECT1;
- }
- }
- }
- otrl_tlv_free(tlvs);
-
- /* If we're supposed to ignore this incoming message (because it's a
- * protocol message), set it to NULL, so that other plugins that
- * catch receiving-im-msg don't return 0, and cause it to be
- * displayed anyway. */
- if (ignore_msg) {
- /* should not be required ;)
+ //if(options.timeout_finished) ResetFinishedTimer();
+ }
+
+ lib_cs_lock();
+ context = otrl_context_find_miranda(otr_user_state, ccs->hContact);
+ lib_cs_unlock();
+ /* Keep track of our current progress in the Socialist Millionaires'
+ * Protocol. */
+
+ /*
+ if (context && ( (context->smstate->sm_prog_state == OTRL_SMP_PROG_CHEATED) ||
+ otrl_tlv_find(tlvs, OTRL_TLV_SMP1Q) ||
+ otrl_tlv_find(tlvs, OTRL_TLV_SMP1) ||
+ otrl_tlv_find(tlvs, OTRL_TLV_SMP2) ||
+ otrl_tlv_find(tlvs, OTRL_TLV_SMP3) ||
+ otrl_tlv_find(tlvs, OTRL_TLV_SMP4) )
+ )
+ {
+ otr_abort_smp(context); // we do not support it (yet), notify partner to shorten wait time
+ }
+ */
+
+
+ if (context) {
+ NextExpectedSMP nextMsg = context->smstate->nextExpected;
+
+ if (context->smstate->sm_prog_state == OTRL_SMP_PROG_CHEATED) {
+ otr_abort_smp(context);
+ //otrg_dialog_update_smp(context, 0.0);
+ SMPDialogUpdate(context, 0);
+ context->smstate->nextExpected = OTRL_SMP_EXPECT1;
+ context->smstate->sm_prog_state = OTRL_SMP_PROG_OK;
+ } else {
+
+ tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP1Q);
+ if (tlv) {
+ if (nextMsg != OTRL_SMP_EXPECT1)
+ otr_abort_smp(context);
+ else {
+ char *question = (char *)tlv->data;
+ char *eoq = (char*)memchr(question, '\0', tlv->len);
+ if (eoq) {
+ SMPDialogReply(context, question);
+ }
+ }
+ }
+ tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP1);
+ if (tlv) {
+ if (nextMsg != OTRL_SMP_EXPECT1)
+ otr_abort_smp(context);
+ else {
+ SMPDialogReply(context, NULL);
+ }
+ }
+ tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP2);
+ if (tlv) {
+ if (nextMsg != OTRL_SMP_EXPECT2)
+ otr_abort_smp(context);
+ else {
+ context->smstate->nextExpected = OTRL_SMP_EXPECT4;
+ SMPDialogUpdate(context, 60);
+ }
+ }
+ tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP3);
+ if (tlv) {
+ if (nextMsg != OTRL_SMP_EXPECT3)
+ otr_abort_smp(context);
+ else {
+ context->smstate->nextExpected = OTRL_SMP_EXPECT1;
+ SMPDialogUpdate(context, 100);
+ //otrg_dialog_update_smp(context, 1.0);
+ }
+ }
+ tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP4);
+ if (tlv) {
+ if (nextMsg != OTRL_SMP_EXPECT4)
+ otr_abort_smp(context);
+ else {
+ SMPDialogUpdate(context, 100);
+ //otrg_dialog_update_smp(context, 1.0);
+ context->smstate->nextExpected = OTRL_SMP_EXPECT1;
+ }
+ }
+ tlv = otrl_tlv_find(tlvs, OTRL_TLV_SMP_ABORT);
+ if (tlv) {
+ SMPDialogUpdate(context, 0);
+ context->smstate->nextExpected = OTRL_SMP_EXPECT1;
+ }
+ }
+ }
+ otrl_tlv_free(tlvs);
+
+ /* If we're supposed to ignore this incoming message (because it's a
+ * protocol message), set it to NULL, so that other plugins that
+ * catch receiving-im-msg don't return 0, and cause it to be
+ * displayed anyway. */
+ if (ignore_msg) {
+ /* should not be required ;)
+ char t[3] = {0, 0, 0};
char t[3] = {0, 0, 0};
if(pre->flags & PREF_UNICODE) { //TODO!! lstrlen(pre->szMessage)+1 ??
if (pre->szMessage && strlen(pre->szMessage)) memcpy(pre->szMessage, t,3 );
@@ -306,11 +307,11 @@ int SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){
if (pre->szMessage && strlen(pre->szMessage)) memcpy(pre->szMessage, t, 1);
}
*/
- if (newmessage) otrl_message_free(newmessage);
- return 1;
- } else if (newmessage) {
- //bool free=false;
- DWORD flags = pre->flags;
+ if (newmessage) otrl_message_free(newmessage);
+ return 1;
+ } else if (newmessage) {
+ //bool free=false;
+ DWORD flags = pre->flags;
/* if(pre->flags & PREF_UTF) {
oldmessage_utf = newmessage;
} else if(pre->flags & PREF_UNICODE) { //TODO!! lstrlen(pre->szMessage)+1 ??
@@ -321,72 +322,72 @@ int SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam){
oldmessage_utf = newmessage;
} */
- //pre->szMessage = oldmessage_utf;
- pre->flags &= ~PREF_UNICODE;
- pre->flags |= PREF_UTF; // just use UTF, so we do not have to recode the message
-
- bool is_miralloc = false;
- if (context) {
- TrustLevel level = otr_context_get_trust(context);
- if (level >= TRUST_UNVERIFIED) {
- char* premsg;
- if (db_byte_get(ccs->hContact, MODULENAME, "HTMLConv", 0)) {
- premsg = striphtml(newmessage);
- otrl_message_free(newmessage);
- newmessage = premsg;
- is_miralloc = true;
- }
-
- if (options.prefix_messages) {
- DWORD len = (strlen(options.prefix)+strlen(newmessage)+1)*sizeof(char);
- premsg = (char*)mir_alloc( len );
- memset(premsg, 0, len);
- strcpy(premsg, options.prefix);
- strcat(premsg, newmessage);
- (is_miralloc) ? mir_free(newmessage) : otrl_message_free(newmessage);
- newmessage = premsg;
- is_miralloc = true;
- }
- }
- }
- pre->szMessage = newmessage;
- BOOL ret = CallService(MS_PROTO_CHAINRECV, wParam, lParam);
- pre->flags = flags;
- pre->szMessage = oldmessage;
- if (is_miralloc)
- mir_free(newmessage);
- else
- otrl_message_free(newmessage);
-
- // if (free) mir_free(oldmessage_utf);
- return ret;
+ //pre->szMessage = oldmessage_utf;
+ pre->flags &= ~PREF_UNICODE;
+ pre->flags |= PREF_UTF; // just use UTF, so we do not have to recode the message
+
+ bool is_miralloc = false;
+ if (context) {
+ TrustLevel level = otr_context_get_trust(context);
+ if (level >= TRUST_UNVERIFIED) {
+ char* premsg;
+ if (db_byte_get(ccs->hContact, MODULENAME, "HTMLConv", 0)) {
+ premsg = striphtml(newmessage);
+ otrl_message_free(newmessage);
+ newmessage = premsg;
+ is_miralloc = true;
+ }
+
+ if (options.prefix_messages) {
+ DWORD len = (strlen(options.prefix)+strlen(newmessage)+1)*sizeof(char);
+ premsg = (char*)mir_alloc( len );
+ memset(premsg, 0, len);
+ strcpy(premsg, options.prefix);
+ strcat(premsg, newmessage);
+ (is_miralloc) ? mir_free(newmessage) : otrl_message_free(newmessage);
+ newmessage = premsg;
+ is_miralloc = true;
+ }
+ }
+ }
+ pre->szMessage = newmessage;
+ BOOL ret = CallService(MS_PROTO_CHAINRECV, wParam, lParam);
+ pre->flags = flags;
+ pre->szMessage = oldmessage;
+ if (is_miralloc)
+ mir_free(newmessage);
+ else
+ otrl_message_free(newmessage);
+
+ // if (free) mir_free(oldmessage_utf);
+ return ret;
}
return CallService(MS_PROTO_CHAINRECV, wParam, lParam);
}
-/* Abort the SMP protocol. Used when malformed or unexpected messages
- * are received. */
-void otr_abort_smp(ConnContext *context)
-{
- otrl_message_abort_smp(otr_user_state, &ops, context->app_data, context);
-}
-
-/* Start the Socialist Millionaires' Protocol over the current connection,
- * using the given initial secret, and optionally a question to pass to
- * the buddy. */
-void otr_start_smp(ConnContext *context, const char *question,
- const unsigned char *secret, size_t secretlen)
-{
- otrl_message_initiate_smp_q(otr_user_state, &ops, context->app_data,
- context, question, secret, secretlen);
-}
-
-/* Continue the Socialist Millionaires' Protocol over the current connection,
- * using the given initial secret (ie finish step 2). */
-void otr_continue_smp(ConnContext *context,
- const unsigned char *secret, size_t secretlen)
-{
- otrl_message_respond_smp(otr_user_state, &ops, context->app_data,
+/* Abort the SMP protocol. Used when malformed or unexpected messages
+ * are received. */
+void otr_abort_smp(ConnContext *context)
+{
+ otrl_message_abort_smp(otr_user_state, &ops, context->app_data, context);
+}
+
+/* Start the Socialist Millionaires' Protocol over the current connection,
+ * using the given initial secret, and optionally a question to pass to
+ * the buddy. */
+void otr_start_smp(ConnContext *context, const char *question,
+ const unsigned char *secret, size_t secretlen)
+{
+ otrl_message_initiate_smp_q(otr_user_state, &ops, context->app_data,
+ context, question, secret, secretlen);
+}
+
+/* Continue the Socialist Millionaires' Protocol over the current connection,
+ * using the given initial secret (ie finish step 2). */
+void otr_continue_smp(ConnContext *context,
+ const unsigned char *secret, size_t secretlen)
+{
+ otrl_message_respond_smp(otr_user_state, &ops, context->app_data,
context, secret, secretlen);
} \ No newline at end of file
diff --git a/MirOTR/svcs_proto.h b/MirOTR/svcs_proto.h
index 7040d79..fe0db53 100644
--- a/MirOTR/svcs_proto.h
+++ b/MirOTR/svcs_proto.h
@@ -1,13 +1,13 @@
#pragma once
-int SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam);
-int SVC_OTRSendMessageW(WPARAM wParam, LPARAM lParam);
-int SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam);
-
-void otr_abort_smp(ConnContext *context);
-
-void otr_start_smp(ConnContext *context, const char *question,
- const unsigned char *secret, size_t secretlen);
-
-void otr_continue_smp(ConnContext *context,
+INT_PTR SVC_OTRSendMessage(WPARAM wParam,LPARAM lParam);
+INT_PTR SVC_OTRSendMessageW(WPARAM wParam, LPARAM lParam);
+INT_PTR SVC_OTRRecvMessage(WPARAM wParam,LPARAM lParam);
+
+void otr_abort_smp(ConnContext *context);
+
+void otr_start_smp(ConnContext *context, const char *question,
+ const unsigned char *secret, size_t secretlen);
+
+void otr_continue_smp(ConnContext *context,
const unsigned char *secret, size_t secretlen); \ No newline at end of file
diff --git a/MirOTR/version.h b/MirOTR/version.h
index 5f8b2e4..c4d78db 100644
--- a/MirOTR/version.h
+++ b/MirOTR/version.h
@@ -3,19 +3,19 @@
/* VERSION DEFINITIONS */
#define VER_MAJOR 0
-#define VER_MINOR 10
-#define VER_RELEASE 3
-#define VER_BUILD 1
+#define VER_MINOR 11
+#define VER_RELEASE 0
+#define VER_BUILD 0
#define __STRINGIZE(x) #x
-#define VER_STRING "0.10.3.1"
+#define VER_STRING "0.11.0.0"
#ifdef _UNICODE
#define SHORT_NAME_STRING "Miranda OTR"
#define DESC_STRING "OTR (Off-the-Record) plugin for Miranda IM"
#else
- #define SHORT_NAME_STRING "Miranda OTR (ANSI)"
- #define DESC_STRING "OTR (Off-the-Record) plugin for Miranda IM (ANSI)"
+ #define SHORT_NAME_STRING "Miranda OTR (x64)"
+ #define DESC_STRING "OTR (Off-the-Record) plugin for Miranda IM (64Bit)"
#endif
#define LONGDESC_STRING DESC_STRING" ("__DATE__")\r\n(using some code and ideas from SecureIM, Pidgin-OTR and old Miranda OTR (by SJE))"
#define COMPANY_NAME ""
@@ -30,7 +30,7 @@
#define PRODUCT_VERSION VER_STRING
-#define AUTHOR "ProgAndy"
+#define AUTHOR "ProgAndy & CHEF-KOCH"
#define AUTHOR_MAIL ""
#define HOMEPAGE "http://progandy.co.cc"