diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-06-18 12:19:29 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-06-18 12:19:29 +0000 |
commit | 30d7e221818b5646e018489342fa577073e42948 (patch) | |
tree | 0f1fd7765925250899af1a9f45d3bbaee2f6115b /otr/dllmain.cpp | |
parent | 55b20b91a10fe7199a9e8263e3431cd607a7cee0 (diff) |
'end session on window close' option really ends session, rather than changing to finished state
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@204 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'otr/dllmain.cpp')
-rw-r--r-- | otr/dllmain.cpp | 33 |
1 files changed, 19 insertions, 14 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);
|