diff options
-rw-r--r-- | otr/dllmain.cpp | 27 | ||||
-rw-r--r-- | otr/otr.mdsp | 8 | ||||
-rw-r--r-- | otr/otr_private.h | 2 |
3 files changed, 23 insertions, 14 deletions
diff --git a/otr/dllmain.cpp b/otr/dllmain.cpp index cd99563..c3f39b3 100644 --- a/otr/dllmain.cpp +++ b/otr/dllmain.cpp @@ -177,8 +177,15 @@ void SetEncryptionStatus(HANDLE hContact, bool encrypted) { // OTR stuff
///////////////////////////////////////////////
+void set_context_contact(void *data, ConnContext *context) {
+ HANDLE hContact = get_contact(context->protocol, context->username);
+ context->app_data = hContact;
+}
+
void add_appdata(void *data, ConnContext *context) {
- if(context) context->app_data = data; // data is hContact
+ if(context) {
+ context->app_data = data; // data is hContact
+ }
}
void lib_cs_lock() {
@@ -496,22 +503,24 @@ void Disconnect(ConnContext *context) { void CALLBACK ClearFinishedSessions(HWND, UINT, UINT, DWORD) {
KillTimer(0, TIMER_ID_CLEAR_FINISHED);
+ lib_cs_lock();
//PUShowMessage("Clearing finished sessions", SM_NOTIFY);
HANDLE hContact;
ConnContext *context = otr_user_state->context_root;
while(context) {
if(context->msgstate == OTRL_MSGSTATE_FINISHED) {
- //hContact = context->app_data; // why is this broken?
- hContact = get_contact(context->protocol, context->username);
- SetEncryptionStatus(hContact, false);
- //PUShowMessage("Cleared a finished session", SM_NOTIFY);
-
- lib_cs_lock();
+ hContact = context->app_data;
+ //hContact = get_contact(context->protocol, context->username);
+ if(hContact) {
+ SetEncryptionStatus(hContact, false);
+ //PUShowMessage("Cleared a finished session", SM_NOTIFY);
+ } //else
+ //PUShowMessage("Cleared a finished session - but hCcontact is null", SM_NOTIFY);
otrl_context_force_plaintext(context);
- lib_cs_unlock();
}
context = context->next;
}
+ lib_cs_unlock();
}
void ResetFinishedTimer() {
@@ -1203,7 +1212,7 @@ int IconPressed(WPARAM wParam, LPARAM lParam) { void ReadPrivkeyFiles() {
lib_cs_lock();
otrl_privkey_read(otr_user_state, private_key_filename);
- otrl_privkey_read_fingerprints(otr_user_state, fingerprint_store_filename, 0, 0);
+ otrl_privkey_read_fingerprints(otr_user_state, fingerprint_store_filename, set_context_contact, 0);
lib_cs_unlock();
}
diff --git a/otr/otr.mdsp b/otr/otr.mdsp index 556db95..2f7d52e 100644 --- a/otr/otr.mdsp +++ b/otr/otr.mdsp @@ -129,8 +129,8 @@ extraResourceOptions= 30=..\..\include\m_updater.h
31=..\..\include\m_database.h
[History]
-otr_private.h,171
-..\..\..\..\..\..\..\msys\home\sje\libotr\src\context.h,1683
-..\..\..\..\..\..\..\msys\home\sje\libotr\src\message.h,9228
+dllmain.cpp,18082
options.cpp,2758
-dllmain.cpp,43543
+..\..\..\..\..\..\..\msys\home\sje\libotr\src\message.h,9228
+..\..\..\..\..\..\..\msys\home\sje\libotr\src\context.h,1683
+otr_private.h,171
diff --git a/otr/otr_private.h b/otr/otr_private.h index d67e25b..d0cd189 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 8
-#define VER_BUILD 0
+#define VER_BUILD 1
#define __STRINGIZE(x) #x
#define VER_STRING __STRINGIZE( VER_MAJOR.VER_MINOR.VER_RELEASE.VER_BUILD )
|