summaryrefslogtreecommitdiff
path: root/plugins/WinterSpeak
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-06-19 19:49:16 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-06-19 19:49:16 +0000
commitc67f96aa215ed9144c445643780b2419285769a3 (patch)
tree2724f20339e4a4be8a2be6a0060579e9851c5091 /plugins/WinterSpeak
parent4c814798c7bc7f6a0f92c21b027b26290622aa2f (diff)
Winter Speak:
- Fixed message window detection (fixes #943) git-svn-id: http://svn.miranda-ng.org/main/trunk@14271 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/WinterSpeak')
-rw-r--r--plugins/WinterSpeak/src/SpeakAnnounce.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins/WinterSpeak/src/SpeakAnnounce.cpp b/plugins/WinterSpeak/src/SpeakAnnounce.cpp
index 4a7ca4de9b..d054bae1ff 100644
--- a/plugins/WinterSpeak/src/SpeakAnnounce.cpp
+++ b/plugins/WinterSpeak/src/SpeakAnnounce.cpp
@@ -145,7 +145,7 @@ void SpeakAnnounce::status(const std::wstring &sentence, MCONTACT user)
bool SpeakAnnounce::readMessage(MCONTACT contact)
{
// Check if message window exists
- if (m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogOpen)) {
+ if (m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogOpen) || m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogFocused)) {
// Do not notify if window is already open
MessageWindowInputData mwid;
mwid.cbSize = sizeof(MessageWindowInputData);
@@ -154,7 +154,13 @@ bool SpeakAnnounce::readMessage(MCONTACT contact)
MessageWindowData mwd;
mwd.cbSize = sizeof(MessageWindowData);
mwd.hContact = contact;
- return ((CallService(MS_MSG_GETWINDOWDATA, (WPARAM) &mwid, (LPARAM) &mwd)) || ((mwd.hwndWindow != NULL) && (mwd.uState & MSG_WINDOW_STATE_EXISTS)));
+ //returns 0 on success and returns non-zero (1) on error or if no window data exists for that hcontact
+ if (CallService(MS_MSG_GETWINDOWDATA, (WPARAM) &mwid, (LPARAM) &mwd) == 0) {
+ if (m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogOpen))
+ return ((mwd.uState & MSG_WINDOW_STATE_EXISTS) != 0);
+ else if (m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogOpen))
+ return ((mwd.uState & MSG_WINDOW_STATE_FOCUS) != 0);
+ }
}
return true;
}