summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--otr/dllmain.cpp32
-rw-r--r--otr/options.cpp3
-rw-r--r--otr/options.h1
-rw-r--r--otr/otr.mdsp30
-rw-r--r--otr/otr_private.h4
-rw-r--r--otr/otr_private.rc173
-rw-r--r--otr/resource.h1
7 files changed, 188 insertions, 56 deletions
diff --git a/otr/dllmain.cpp b/otr/dllmain.cpp
index eac42dc..708c4ae 100644
--- a/otr/dllmain.cpp
+++ b/otr/dllmain.cpp
@@ -31,6 +31,7 @@ char private_key_filename[MAX_PATH];
OtrlUserState otr_user_state = 0;
+#define TIMER_ID_CLEAR_FINISHED 0x101
// plugin stuff
PLUGININFOEX pluginInfo={
sizeof(PLUGININFOEX),
@@ -493,6 +494,34 @@ void Disconnect(ConnContext *context) {
/// Miranda filter plugin stuff
//////////////////////////////////////////////////
+void CALLBACK ClearFinishedSessions(HWND, UINT, UINT, DWORD) {
+ KillTimer(0, TIMER_ID_CLEAR_FINISHED);
+
+ HANDLE hContact;
+ ConnContext *context = otr_user_state->context_root;
+ while(context) {
+ if(context->msgstate == OTRL_MSGSTATE_FINISHED) {
+ hContact = context->app_data;
+
+ char *uproto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ char *uname = (char *)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, 0);
+ if(uproto && uname)
+ otrl_message_disconnect(otr_user_state, &ops, hContact, MODULE, uproto, uname);
+
+ //otrl_context_force_finished(context);
+
+ SetEncryptionStatus(hContact, false);
+
+ }
+ context = context->next;
+ }
+}
+
+void ResetFinishedTimer() {
+ KillTimer(0, TIMER_ID_CLEAR_FINISHED);
+ SetTimer(0, TIMER_ID_CLEAR_FINISHED, DBGetContactSettingDword(0, MODULE, "SessionTimeout", 10000), ClearFinishedSessions);
+}
+
// if it's a protocol going offline, attempt to send terminate session to all contacts of that protocol
// (this would be hooked as the ME_CLIST_STATUSMODECHANGE handler except that event is sent *after* the proto goes offline)
int StatusModeChange(WPARAM wParam, LPARAM lParam) {
@@ -557,6 +586,7 @@ int SettingChanged(WPARAM wParam, LPARAM lParam) {
// FINISHED is not 'unencrypted', for e.g. srmm icon (still need to be able to 'stop OTR')
otrl_context_force_finished(context);
+ if(options.timeout_finished) ResetFinishedTimer();
// removed - don't need a popup everytime an OTR user goes offline!
//char buff[512];
@@ -787,6 +817,8 @@ int RecvMessage(WPARAM wParam,LPARAM lParam){
else
ShowPopup(Translate("OTR Information"), buff, 0);
+ if(options.timeout_finished) ResetFinishedTimer();
+
return 1;
}
diff --git a/otr/options.cpp b/otr/options.cpp
index fd7d5bc..4e8db52 100644
--- a/otr/options.cpp
+++ b/otr/options.cpp
@@ -110,6 +110,7 @@ void LoadOptions() {
strcpy(options.prefix, "OTR: ");
options.delete_history = (DBGetContactSettingByte(0, MODULE, "DeleteHistory", 1) == 1);
+ options.timeout_finished = (DBGetContactSettingByte(0, MODULE, "TimeoutFinished", 0) == 1);
LoadFilenames();
}
@@ -127,6 +128,7 @@ void SaveOptions(ContactPolicyMap *contact_policies) {
DBWriteContactSettingStringUtf(0, MODULE, "Prefix", options.prefix);
DBWriteContactSettingByte(0, MODULE, "DeleteHistory", options.delete_history ? 1 : 0);
+ DBWriteContactSettingByte(0, MODULE, "TimeoutFinished", options.timeout_finished ? 1 : 0);
}
ContactFingerprintMap strlist; // temp storage for fingerprint string pointers
@@ -350,6 +352,7 @@ INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
return TRUE;
case IDC_CHK_PREFIX:
+ case IDC_CHK_TIMEFINISH:
case IDC_CHK_MSGINLINE:
SendMessage( GetParent( hwndDlg ), PSM_CHANGED, 0, 0 );
return TRUE;
diff --git a/otr/options.h b/otr/options.h
index 475e566..f4534c8 100644
--- a/otr/options.h
+++ b/otr/options.h
@@ -13,6 +13,7 @@ typedef struct {
char prefix[64];
bool delete_history;
+ bool timeout_finished;
} Options;
extern Options options;
diff --git a/otr/otr.mdsp b/otr/otr.mdsp
index 0c4277f..2828ed3 100644
--- a/otr/otr.mdsp
+++ b/otr/otr.mdsp
@@ -128,28 +128,8 @@ extraResourceOptions=
29=..\..\include\m_metacontacts.h
30=..\..\include\m_updater.h
[History]
-libotr\src\userstate.c,0
-libotr\src\tlv.c,0
-libotr\src\tests.c,0
-libotr\src\proto.c,0
-libotr\src\privkey.c,0
-libotr\src\auth.c,0
-otr_private.h,149
-libotr\src\message.c,29277
-libotr\src\userstate.h,1679
-libotr\src\proto.h,5014
-libotr\src\message.h,2451
-libotr\src\context.c,10303
-libotr\src\context.h,4987
-common.h,2043
-utils.cpp,7128
-..\..\include\m_icolib.h,0
-libotr\src\auth.h,6007
-options.cpp,10862
-..\..\include\m_protocols.h,7232
-..\..\include\m_message.h,1619
-..\..\include\m_popup.h,11116
-..\..\include\m_metacontacts.h,1769
-menu.cpp,3112
-..\..\include\m_updater.h,3816
-dllmain.cpp,40412
+libotr\src\message.c,36257
+dllmain.cpp,17923
+options.cpp,12506
+options.h,304
+otr_private.h,171
diff --git a/otr/otr_private.h b/otr/otr_private.h
index b6bf23d..bc67828 100644
--- a/otr/otr_private.h
+++ b/otr/otr_private.h
@@ -4,8 +4,8 @@
/* VERSION DEFINITIONS */
#define VER_MAJOR 0
#define VER_MINOR 5
-#define VER_RELEASE 2
-#define VER_BUILD 0
+#define VER_RELEASE 3
+#define VER_BUILD 1
#define __STRINGIZE(x) #x
#define VER_STRING __STRINGIZE( VER_MAJOR.VER_MINOR.VER_RELEASE.VER_BUILD )
diff --git a/otr/otr_private.rc b/otr/otr_private.rc
index 0f774cb..e01a35b 100644
--- a/otr/otr_private.rc
+++ b/otr/otr_private.rc
@@ -1,35 +1,150 @@
-/* THIS FILE WILL BE OVERWRITTEN BY DEV-C++ */
-/* DO NOT EDIT! */
+// Microsoft Visual C++ generated resource script.
+//
+#include "resrc1.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#define APSTUDIO_HIDDEN_SYMBOLS
+#include "windows.h"
+#undef APSTUDIO_HIDDEN_SYMBOLS
+#include "resource.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
-#include "otr_private.h"
-#include "resource.rc"
+/////////////////////////////////////////////////////////////////////////////
+// English (Australia) resources
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
//
-// TO CHANGE VERSION INFORMATION, EDIT PROJECT OPTIONS...
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_START ICON "start.ico"
+IDI_STOP ICON "stop.ico"
+
+/////////////////////////////////////////////////////////////////////////////
//
+// Dialog
+//
+
+IDD_OPT1 DIALOGEX 0, 0, 288, 217
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 0, 0, 0x0
+BEGIN
+ CONTROL "List1",IDC_CLIST,"SysListView32",LVS_REPORT | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,8,7,271,104
+ GROUPBOX "Default Policy",IDC_STATIC,8,140,109,59
+ CONTROL "Manual",IDC_RAD_MANUAL,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,16,150,95,10
+ CONTROL "Opportunistic",IDC_RAD_OPP,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,16,162,95,10
+ CONTROL "Always",IDC_RAD_ALWAYS,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,16,174,95,10
+ CONTROL "Never",IDC_RAD_NEVER,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,16,185,95,10
+ LISTBOX IDC_LIST_PROTOS,127,114,152,60,WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_ED_FINGERPRINT,127,175,152,12,ES_AUTOHSCROLL | ES_READONLY
+ PUSHBUTTON "New Private Key",IDC_BUT_NEWKEY,127,190,152,10,WS_DISABLED
+ CONTROL "Prefix:",IDC_CHK_PREFIX,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,115,48,10
+ CONTROL "Show start/stop inline",IDC_CHK_MSGINLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,127,110,10
+ EDITTEXT IDC_ED_PREFIX,64,114,53,12,ES_AUTOHSCROLL
+ CONTROL "Timeout finished sessions automatically (TAKE CARE!)",IDC_CHK_TIMEFINISH,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,35,203,217,10
+END
+
+IDD_GENKEYNOTIFY DIALOG 0, 0, 200, 80
+STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_CENTER | WS_POPUP | WS_CHILD | WS_CAPTION | WS_SYSMENU | WS_GROUP
+CAPTION "OTR Generating Private Key"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ CTEXT "Generating new private key - please wait.",IDC_STATIC,10,35,180,10
+END
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resrc1.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
+ "#include ""windows.h""\r\n"
+ "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
+ "#include ""resource.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
1 VERSIONINFO
-FILEVERSION VER_MAJOR,VER_MINOR,VER_RELEASE,VER_BUILD
-PRODUCTVERSION VER_MAJOR,VER_MINOR,VER_RELEASE,VER_BUILD
-FILETYPE VFT_DLL
-{
- BLOCK "StringFileInfo"
- {
- BLOCK "0C0904E4"
- {
- VALUE "CompanyName", COMPANY_NAME
- VALUE "FileVersion", FILE_VERSION
- VALUE "FileDescription", FILE_DESCRIPTION
- VALUE "InternalName", INTERNAL_NAME
- VALUE "LegalCopyright", LEGAL_COPYRIGHT
- VALUE "LegalTrademarks", LEGAL_TRADEMARKS
- VALUE "OriginalFilename", ORIGINAL_FILENAME
- VALUE "ProductName", PRODUCT_NAME
- VALUE "ProductVersion", PRODUCT_VERSION
- }
- }
- BLOCK "VarFileInfo"
- {
- VALUE "Translation", 0x0C09, 1252
- }
-}
+ FILEVERSION 0,5,2,0
+ PRODUCTVERSION 0,5,2,0
+ FILEFLAGSMASK 0x0L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x0L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "0C0904E4"
+ BEGIN
+ VALUE "FileVersion", "VER_MAJOR.VER_MINOR.VER_RELEASE.VER_BUILD"
+ VALUE "FileDescription", "OTR (Off-the-Record) plugin for Miranda IM"
+ VALUE "LegalCopyright", "© Scott Ellis 2005"
+ VALUE "OriginalFilename", "otr.dll"
+ VALUE "ProductName", "OTR (Off-the-Record) plugin for Miranda IM"
+ VALUE "ProductVersion", "VER_MAJOR.VER_MINOR.VER_RELEASE.VER_BUILD"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0xc09, 1252
+ END
+END
+
+#endif // English (Australia) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
diff --git a/otr/resource.h b/otr/resource.h
index 45e58dc..8b4194c 100644
--- a/otr/resource.h
+++ b/otr/resource.h
@@ -11,6 +11,7 @@
#define IDC_CHK_PREFIX 1010
#define IDC_CHK_MSGINLINE 1011
#define IDC_ED_PREFIX 1012
+#define IDC_CHK_TIMEFINISH 1013
#define IDD_GENKEYNOTIFY 102