diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-04-06 16:27:56 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-04-06 16:27:56 +0000 |
commit | 8ae92af56cc1d9a7337d34b0a542e8ccb93966c7 (patch) | |
tree | 1bc73711d6616fc6cfd1d36cbc266443a77c9b03 /plugins | |
parent | a22377d6fd401c4d02d606cd67b6cb4341b67620 (diff) |
WinterSpeak:
- Fixed open message window detection
git-svn-id: http://svn.miranda-ng.org/main/trunk@12636 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/WinterSpeak/src/SpeakAnnounce.cpp | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/plugins/WinterSpeak/src/SpeakAnnounce.cpp b/plugins/WinterSpeak/src/SpeakAnnounce.cpp index 29407e6fb2..0de3c7c0c1 100644 --- a/plugins/WinterSpeak/src/SpeakAnnounce.cpp +++ b/plugins/WinterSpeak/src/SpeakAnnounce.cpp @@ -144,30 +144,18 @@ void SpeakAnnounce::status(const std::wstring &sentence, MCONTACT user) //------------------------------------------------------------------------------
bool SpeakAnnounce::readMessage(MCONTACT contact)
{
- std::wstring title = m_user_info.nameString(contact) + L" (" + m_user_info.statusModeString(contact) + L"): ";
-
- HWND window = FindWindow(L"#32770", (title + TranslateW(L"Message Session")).c_str());
- if (window) {
- // check if we dont want to read message if dialog is open
- if (m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogOpen))
- return false;
-
- // check if we dont want to read message if dialog if focused
- if ((window == GetForegroundWindow()) && m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogFocused))
- return false;
- }
-
- window = FindWindow(L"#32770", (title + TranslateW(L"Message Received")).c_str());
- if (window) {
- // check if we dont want to read message if dialog is open
- if (m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogOpen))
- return false;
-
- // check if we dont want to read message if dialog if focused
- if ((window == GetForegroundWindow()) && m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogFocused))
- return false;
+ // Check if message window exists
+ if (m_db.getEventFlag(AnnounceDatabase::EventFlag_DialogOpen)) {
+ // Do not notify if window is already open
+ MessageWindowInputData mwid;
+ mwid.cbSize = sizeof(MessageWindowInputData);
+ mwid.hContact = contact;
+ mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH;
+ 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)));
}
-
return true;
}
|