From ce7f2837be73bf8d75a64205f5fae7fd62e772cf Mon Sep 17 00:00:00 2001 From: MikalaiR Date: Wed, 19 Aug 2015 08:23:41 +0000 Subject: Toaster: fix for chats open git-svn-id: http://svn.miranda-ng.org/main/trunk@14992 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Toaster/src/services.cpp | 23 ++++++++++++++++++++++- plugins/Toaster/src/stdafx.h | 7 ++++--- 2 files changed, 26 insertions(+), 4 deletions(-) (limited to 'plugins/Toaster/src') 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(&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 #include -#include #include - +#include #include #include #include @@ -21,12 +20,14 @@ #include #include #include +#include #include "version.h" #include "resource.h" +#include 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" -- cgit v1.2.3