diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-08-19 08:23:41 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-08-19 08:23:41 +0000 |
commit | ce7f2837be73bf8d75a64205f5fae7fd62e772cf (patch) | |
tree | 8436c577ccff11b5631ab9c7b7db90cbd9722f29 | |
parent | 6440934f69bcf910042b47e0aad62c4a7b26c3de (diff) |
Toaster: fix for chats open
git-svn-id: http://svn.miranda-ng.org/main/trunk@14992 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Toaster/src/services.cpp | 23 | ||||
-rw-r--r-- | plugins/Toaster/src/stdafx.h | 7 |
2 files changed, 26 insertions, 4 deletions
diff --git a/plugins/Toaster/src/services.cpp b/plugins/Toaster/src/services.cpp index e92256b656..fab8a4cd64 100644 --- a/plugins/Toaster/src/services.cpp +++ b/plugins/Toaster/src/services.cpp @@ -1,10 +1,31 @@ #include "stdafx.h"
+__forceinline bool isChatRoom(MCONTACT hContact)
+{ return db_get_b(hContact, ptrA(GetContactProto(hContact)), "ChatRoom", 0);
+}
+
static void __cdecl OnToastNotificationClicked(void* arg)
{
MCONTACT hContact = (MCONTACT)arg;
if (hContact)
- CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, (LPARAM)"");
+ {
+ if (!isChatRoom(hContact))
+ {
+ CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, (LPARAM)"");
+ }
+ else
+ {
+ ptrA szProto(GetContactProto(hContact));
+ ptrT szChatRoom(db_get_tsa(hContact, szProto, "ChatRoomID"));
+ GCDEST gcd = { szProto, szChatRoom, GC_EVENT_CONTROL }; + GCEVENT gce = { sizeof(gce), &gcd }; + + gcd.iType = GC_EVENT_CONTROL;
+ gce.time = time(NULL);
+
+ CallServiceSync(MS_GC_EVENT, WINDOW_VISIBLE, reinterpret_cast<LPARAM>(&gce));
+ }
+ }
}
static void ShowToastNotification(TCHAR* text, TCHAR* title, MCONTACT hContact)
diff --git a/plugins/Toaster/src/stdafx.h b/plugins/Toaster/src/stdafx.h index cdefdc6ccd..a113024828 100644 --- a/plugins/Toaster/src/stdafx.h +++ b/plugins/Toaster/src/stdafx.h @@ -5,9 +5,8 @@ #include <Windows.h>
#include <SDKDDKVer.h>
-#include <strsafe.h>
#include <intsafe.h>
-
+#include <time.h>
#include <roapi.h>
#include <wrl\client.h>
#include <wrl\implements.h>
@@ -21,12 +20,14 @@ #include <m_protocols.h>
#include <m_popup.h>
#include <m_message.h>
+#include <m_chat.h>
#include "version.h"
#include "resource.h"
+#include <strsafe.h>
typedef void(__cdecl *pEventHandler)(void*);
-const wchar_t AppUserModelID[] = L"MirandaNG";
+const wchar_t AppUserModelID[] = _T("MirandaNG");
#include "string_reference_wrapper.h"
#include "toast_event_handler.h"
|