summaryrefslogtreecommitdiff
path: root/otr
diff options
context:
space:
mode:
Diffstat (limited to 'otr')
-rw-r--r--otr/dllmain.cpp33
-rw-r--r--otr/otr.mdsp4
-rw-r--r--otr/otr_private.h2
-rw-r--r--otr/resource.rc9
4 files changed, 26 insertions, 22 deletions
diff --git a/otr/dllmain.cpp b/otr/dllmain.cpp
index d3aad33..bddefee 100644
--- a/otr/dllmain.cpp
+++ b/otr/dllmain.cpp
@@ -572,6 +572,21 @@ void FinishSession(HANDLE hContact) {
lib_cs_unlock();
}
+void EndSession(HANDLE hContact) {
+ HANDLE hSub;
+ if(ServiceExists(MS_MC_GETMOSTONLINECONTACT) && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) {
+ hContact = hSub;
+ }
+
+ char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ char *uname = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0);
+ if(!proto || !uname) return; // error
+
+ lib_cs_lock();
+ otrl_message_disconnect(otr_user_state, &ops, hContact, MODULE, proto, uname);
+ lib_cs_unlock();
+}
+
int SettingChanged(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE)wParam;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
@@ -1060,25 +1075,15 @@ int StartOTR(WPARAM wParam, LPARAM lParam) {
}
int StopOTR(WPARAM wParam, LPARAM lParam) {
-
- // prevent this filter from acting on injeceted messages for metas, when they are passed though the subcontact's proto send chain
- HANDLE hContact = (HANDLE)wParam, hSub;
- if(ServiceExists(MS_MC_GETMOSTONLINECONTACT) && (hSub = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0)) != 0) {
- hContact = hSub;
- }
+ HANDLE hContact = (HANDLE)wParam;
- char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
- char *uname = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0);
- if(!proto || !uname) return 1; // error
-
- lib_cs_lock();
- otrl_message_disconnect(otr_user_state, &ops, hContact, MODULE, proto, uname);
- lib_cs_unlock();
+ // prevent this filter from acting on injeceted messages for metas, when they are passed though the subcontact's proto send chain
+ EndSession(hContact);
SetEncryptionStatus(hContact, false);
char buff[256];
- mir_snprintf(buff, 256, Translate("OTR session terminated"), uname);
+ mir_snprintf(buff, 256, Translate("OTR session terminated"), (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0));
//MessageBox(0, buff, Translate("OTR Information"), MB_OK);
if(options.msg_inline)
ShowMessageInline(hContact, buff);
diff --git a/otr/otr.mdsp b/otr/otr.mdsp
index d23135d..cce836e 100644
--- a/otr/otr.mdsp
+++ b/otr/otr.mdsp
@@ -128,7 +128,5 @@ extraResourceOptions=
29=..\..\include\m_metacontacts.h
30=..\..\include\m_updater.h
[History]
-otr_private.rc,874
-resource.rc,556
-dllmain.cpp,39372
+dllmain.cpp,37925
otr_private.h,171
diff --git a/otr/otr_private.h b/otr/otr_private.h
index a2a18f5..15ed9b9 100644
--- a/otr/otr_private.h
+++ b/otr/otr_private.h
@@ -5,7 +5,7 @@
#define VER_MAJOR 0
#define VER_MINOR 5
#define VER_RELEASE 4
-#define VER_BUILD 1
+#define VER_BUILD 3
#define __STRINGIZE(x) #x
#define VER_STRING __STRINGIZE( VER_MAJOR.VER_MINOR.VER_RELEASE.VER_BUILD )
diff --git a/otr/resource.rc b/otr/resource.rc
index 170dd38..401da8a 100644
--- a/otr/resource.rc
+++ b/otr/resource.rc
@@ -49,11 +49,12 @@ BEGIN
CONTROL "Opportunistic",IDC_RAD_OPP,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,16,172,95,10
CONTROL "Always",IDC_RAD_ALWAYS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,16,184,95,10
CONTROL "Never",IDC_RAD_NEVER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,16,195,95,10
- LISTBOX IDC_LIST_PROTOS,127,125,152,51,WS_VSCROLL | WS_TABSTOP
- EDITTEXT IDC_ED_FINGERPRINT,127,185,152,12,ES_AUTOHSCROLL | ES_READONLY
+ LISTBOX IDC_LIST_PROTOS,127,125,152,59,WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_ED_FINGERPRINT,127,186,152,12,ES_AUTOHSCROLL | ES_READONLY
PUSHBUTTON "New Private Key",IDC_BUT_NEWKEY,127,200,152,10,WS_DISABLED
CONTROL "End Sessions on window close",IDC_CHK_ENDCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,112,117,10
- CONTROL "End sessions when contacts go offline",IDC_CHK_ENDOFFLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,112,136,10
+ CONTROL "End sessions when contacts go offline",IDC_CHK_ENDOFFLINE,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,127,112,136,10
CONTROL "Prefix:",IDC_CHK_PREFIX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,125,50,10
CONTROL "Show OTR messages inline",IDC_CHK_MSGINLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,137,110,10
EDITTEXT IDC_ED_PREFIX,61,124,57,12,ES_AUTOHSCROLL
@@ -76,7 +77,7 @@ END
1 TEXTINCLUDE
BEGIN
- "resourcec.h\0"
+ "resource.h\0"
END
2 TEXTINCLUDE