From 48540940b6c28bb4378abfeb500ec45a625b37b6 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Tue, 15 May 2012 10:38:20 +0000 Subject: initial commit git-svn-id: http://svn.miranda-ng.org/main/trunk@2 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/GTalkExt/GTalkExt.cpp | 96 ++++ protocols/GTalkExt/GTalkExt.dep | 325 ++++++++++++ protocols/GTalkExt/GTalkExt.dsp | 268 ++++++++++ protocols/GTalkExt/GTalkExt.dsw | 29 ++ protocols/GTalkExt/GTalkExt.mak | 782 ++++++++++++++++++++++++++++ protocols/GTalkExt/GTalkExt.sln | 37 ++ protocols/GTalkExt/GTalkExt.vcproj | 522 +++++++++++++++++++ protocols/GTalkExt/GTalkExt.vcxproj | 418 +++++++++++++++ protocols/GTalkExt/GTalkExt.vcxproj.filters | 102 ++++ protocols/GTalkExt/avatar.cpp | 212 ++++++++ protocols/GTalkExt/avatar.h | 25 + protocols/GTalkExt/db.cpp | 100 ++++ protocols/GTalkExt/db.h | 31 ++ protocols/GTalkExt/dllmain.cpp | 62 +++ protocols/GTalkExt/handlers.cpp | 433 +++++++++++++++ protocols/GTalkExt/handlers.h | 27 + protocols/GTalkExt/inbox.cpp | 402 ++++++++++++++ protocols/GTalkExt/inbox.h | 25 + protocols/GTalkExt/menu.cpp | 95 ++++ protocols/GTalkExt/menu.h | 24 + protocols/GTalkExt/notifications.cpp | 414 +++++++++++++++ protocols/GTalkExt/notifications.h | 42 ++ protocols/GTalkExt/options.cpp | 297 +++++++++++ protocols/GTalkExt/options.h | 39 ++ protocols/GTalkExt/popups.cpp | 104 ++++ protocols/GTalkExt/popups.h | 25 + protocols/GTalkExt/res/PopupIcon.ico | Bin 0 -> 1406 bytes protocols/GTalkExt/res/pseudoava.png | Bin 0 -> 21935 bytes protocols/GTalkExt/res/settings.rc | 84 +++ protocols/GTalkExt/resources.h | 67 +++ protocols/GTalkExt/stdafx.cpp | 25 + protocols/GTalkExt/stdafx.h | 75 +++ protocols/GTalkExt/targetver.h | 47 ++ protocols/GTalkExt/tipper_items.cpp | 157 ++++++ protocols/GTalkExt/tipper_items.h | 24 + 35 files changed, 5415 insertions(+) create mode 100644 protocols/GTalkExt/GTalkExt.cpp create mode 100644 protocols/GTalkExt/GTalkExt.dep create mode 100644 protocols/GTalkExt/GTalkExt.dsp create mode 100644 protocols/GTalkExt/GTalkExt.dsw create mode 100644 protocols/GTalkExt/GTalkExt.mak create mode 100644 protocols/GTalkExt/GTalkExt.sln create mode 100644 protocols/GTalkExt/GTalkExt.vcproj create mode 100644 protocols/GTalkExt/GTalkExt.vcxproj create mode 100644 protocols/GTalkExt/GTalkExt.vcxproj.filters create mode 100644 protocols/GTalkExt/avatar.cpp create mode 100644 protocols/GTalkExt/avatar.h create mode 100644 protocols/GTalkExt/db.cpp create mode 100644 protocols/GTalkExt/db.h create mode 100644 protocols/GTalkExt/dllmain.cpp create mode 100644 protocols/GTalkExt/handlers.cpp create mode 100644 protocols/GTalkExt/handlers.h create mode 100644 protocols/GTalkExt/inbox.cpp create mode 100644 protocols/GTalkExt/inbox.h create mode 100644 protocols/GTalkExt/menu.cpp create mode 100644 protocols/GTalkExt/menu.h create mode 100644 protocols/GTalkExt/notifications.cpp create mode 100644 protocols/GTalkExt/notifications.h create mode 100644 protocols/GTalkExt/options.cpp create mode 100644 protocols/GTalkExt/options.h create mode 100644 protocols/GTalkExt/popups.cpp create mode 100644 protocols/GTalkExt/popups.h create mode 100644 protocols/GTalkExt/res/PopupIcon.ico create mode 100644 protocols/GTalkExt/res/pseudoava.png create mode 100644 protocols/GTalkExt/res/settings.rc create mode 100644 protocols/GTalkExt/resources.h create mode 100644 protocols/GTalkExt/stdafx.cpp create mode 100644 protocols/GTalkExt/stdafx.h create mode 100644 protocols/GTalkExt/targetver.h create mode 100644 protocols/GTalkExt/tipper_items.cpp create mode 100644 protocols/GTalkExt/tipper_items.h (limited to 'protocols/GTalkExt') diff --git a/protocols/GTalkExt/GTalkExt.cpp b/protocols/GTalkExt/GTalkExt.cpp new file mode 100644 index 0000000000..ae7e06b452 --- /dev/null +++ b/protocols/GTalkExt/GTalkExt.cpp @@ -0,0 +1,96 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** +// GTalkExt.cpp : Defines the exported functions for the DLL application. +//*************************************************************************************** + +#include "stdafx.h" +#include "options.h" +#include "handlers.h" +#include "tipper_items.h" +#include "avatar.h" +#include "menu.h" + +PLUGINLINK *pluginLink; + +#define MIID_PLUGINIFACE {0x08B86253, 0xEC6E, 0x4d09, { 0xB7, 0xA9, 0x64, 0xAC, 0xDF, 0x06, 0x27, 0xB8 }} + +PLUGININFOEX pluginInfo={ + sizeof(PLUGININFOEX), + PLUGIN_DESCRIPTION, + PLUGIN_VERSION_DWORD, + "Currently only mail notifications implemented", + "bems", + "bems@vingrad.ru", + COPYRIGHT_STRING, + "http://miranda-planet.com/forum/index.php?autocom=downloads&showfile=1400", + UNICODE_AWARE, + 0, //doesn't replace anything built-in + MIID_PLUGINIFACE //{08B86253-EC6E-4d09-B7A9-64ACDF0627B8} +}; + +extern DWORD g_mirandaVersion; + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + g_mirandaVersion = mirandaVersion; + return &pluginInfo; +} + +static const MUUID interfaces[] = {MIID_PLUGINIFACE, MIID_LAST}; +extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) +{ + return interfaces; +} + +HANDLE hModulesLoaded = 0; +HANDLE hAccListChanged = 0; + +extern "C" int __declspec(dllexport) Unload(void) +{ + UnhookOptionsInitialization(); + InitMenus(FALSE); + InitAvaUnit(FALSE); + if (hAccListChanged) UnhookEvent(hAccListChanged); + if (hModulesLoaded) UnhookEvent(hModulesLoaded); + return 0; +} + +HICON g_hPopupIcon = 0; +extern HINSTANCE hInst; + +extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) +{ + g_hPopupIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_POPUP)); + + pluginLink = link; + if ( + !mir_getXI(&xi) || + !(hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded)) || + !(hAccListChanged = HookEvent(ME_PROTO_ACCLISTCHANGED, AccListChanged)) || + !InitAvaUnit(TRUE) || + !InitMenus(TRUE) + ) + {Unload(); return 1;}; + + AddTipperItem(); + + return 0; +} \ No newline at end of file diff --git a/protocols/GTalkExt/GTalkExt.dep b/protocols/GTalkExt/GTalkExt.dep new file mode 100644 index 0000000000..2f87f618c7 --- /dev/null +++ b/protocols/GTalkExt/GTalkExt.dep @@ -0,0 +1,325 @@ +# Microsoft Developer Studio Generated Dependency File, included by GTalkExt.mak + +.\avatar.cpp : \ + "..\..\include\m_avatars.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_jabber.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_netlib.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_popup.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protomod.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\m_xml.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + ".\avatar.h"\ + ".\options.h"\ + ".\resources.h"\ + ".\stdafx.h"\ + ".\targetver.h"\ + {$(INCLUDE)}"psapi.h"\ + + +.\db.cpp : \ + "..\..\include\m_avatars.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_jabber.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_netlib.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_popup.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protomod.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\m_xml.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + ".\options.h"\ + ".\resources.h"\ + ".\stdafx.h"\ + ".\targetver.h"\ + {$(INCLUDE)}"psapi.h"\ + + +.\dllmain.cpp : \ + "..\..\include\m_avatars.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_jabber.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_netlib.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_popup.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protomod.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\m_xml.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + ".\notifications.h"\ + ".\options.h"\ + ".\popups.h"\ + ".\resources.h"\ + ".\stdafx.h"\ + ".\targetver.h"\ + {$(INCLUDE)}"psapi.h"\ + + +.\GTalkExt.cpp : \ + "..\..\include\m_avatars.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_jabber.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_netlib.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_popup.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protomod.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\m_xml.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + ".\avatar.h"\ + ".\handlers.h"\ + ".\menu.h"\ + ".\options.h"\ + ".\resources.h"\ + ".\stdafx.h"\ + ".\targetver.h"\ + ".\tipper_items.h"\ + {$(INCLUDE)}"psapi.h"\ + + +.\handlers.cpp : \ + "..\..\include\m_avatars.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_jabber.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_netlib.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_popup.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protomod.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\m_xml.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + ".\db.h"\ + ".\handlers.h"\ + ".\notifications.h"\ + ".\options.h"\ + ".\popups.h"\ + ".\resources.h"\ + ".\stdafx.h"\ + ".\targetver.h"\ + {$(INCLUDE)}"psapi.h"\ + + +.\inbox.cpp : \ + "..\..\include\m_avatars.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_jabber.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_netlib.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_popup.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protomod.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\m_xml.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + ".\db.h"\ + ".\inbox.h"\ + ".\notifications.h"\ + ".\options.h"\ + ".\resources.h"\ + ".\stdafx.h"\ + ".\targetver.h"\ + {$(INCLUDE)}"psapi.h"\ + + +.\menu.cpp : \ + "..\..\include\m_avatars.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_jabber.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_netlib.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_popup.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protomod.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\m_xml.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + ".\inbox.h"\ + ".\menu.h"\ + ".\options.h"\ + ".\resources.h"\ + ".\stdafx.h"\ + ".\targetver.h"\ + {$(INCLUDE)}"psapi.h"\ + + +.\notifications.cpp : \ + "..\..\include\m_avatars.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_jabber.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_netlib.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_popup.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protomod.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\m_xml.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + ".\avatar.h"\ + ".\db.h"\ + ".\inbox.h"\ + ".\notifications.h"\ + ".\options.h"\ + ".\resources.h"\ + ".\stdafx.h"\ + ".\targetver.h"\ + {$(INCLUDE)}"psapi.h"\ + + +.\options.cpp : \ + "..\..\include\m_avatars.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_jabber.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_netlib.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_popup.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protomod.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\m_xml.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + ".\options.h"\ + ".\resources.h"\ + ".\stdafx.h"\ + ".\targetver.h"\ + {$(INCLUDE)}"psapi.h"\ + + +.\popups.cpp : \ + "..\..\include\m_avatars.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_jabber.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_netlib.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_popup.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protomod.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\m_xml.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + ".\options.h"\ + ".\popups.h"\ + ".\resources.h"\ + ".\stdafx.h"\ + ".\targetver.h"\ + {$(INCLUDE)}"psapi.h"\ + + +.\stdafx.cpp : \ + "..\..\include\m_avatars.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_jabber.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_netlib.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_popup.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protomod.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\m_xml.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + ".\stdafx.h"\ + ".\targetver.h"\ + {$(INCLUDE)}"psapi.h"\ + + +.\tipper_items.cpp : \ + "..\..\include\m_avatars.h"\ + "..\..\include\m_clist.h"\ + "..\..\include\m_database.h"\ + "..\..\include\m_jabber.h"\ + "..\..\include\m_langpack.h"\ + "..\..\include\m_netlib.h"\ + "..\..\include\m_options.h"\ + "..\..\include\m_plugins.h"\ + "..\..\include\m_popup.h"\ + "..\..\include\m_protocols.h"\ + "..\..\include\m_protomod.h"\ + "..\..\include\m_protosvc.h"\ + "..\..\include\m_system.h"\ + "..\..\include\m_utils.h"\ + "..\..\include\m_xml.h"\ + "..\..\include\newpluginapi.h"\ + "..\..\include\statusmodes.h"\ + ".\resources.h"\ + ".\stdafx.h"\ + ".\targetver.h"\ + ".\tipper_items.h"\ + {$(INCLUDE)}"psapi.h"\ + + +.\res\settings.rc : \ + ".\include\m_utils.h"\ + ".\resources.h"\ + diff --git a/protocols/GTalkExt/GTalkExt.dsp b/protocols/GTalkExt/GTalkExt.dsp new file mode 100644 index 0000000000..90e3e7a87e --- /dev/null +++ b/protocols/GTalkExt/GTalkExt.dsp @@ -0,0 +1,268 @@ +# Microsoft Developer Studio Project File - Name="GTalkExt" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 + +CFG=GTalkExt - Win32 Debug Unicode +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "GTalkExt.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "GTalkExt.mak" CFG="GTalkExt - Win32 Debug Unicode" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "GTalkExt - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "GTalkExt - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "GTalkExt - Win32 Release Unicode" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "GTalkExt - Win32 Debug Unicode" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "GTalkExt - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GTalkExt_EXPORTS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GTalkExt_EXPORTS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x5130000" /dll /map /debug /machine:I386 /out:"../../bin/release/plugins/GTalkExt.dll" /IGNORE:4089 +# SUBTRACT LINK32 /pdb:none /incremental:yes + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GTalkExt_EXPORTS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GTalkExt_EXPORTS" /Fr /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /debug /machine:I386 /out:"../../bin/debug/plugins/GTalkExt.dll" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none /incremental:no + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Release Unicode" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "GTalkExt___Win32_Release_Unicode" +# PROP BASE Intermediate_Dir "GTalkExt___Win32_Release_Unicode" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release_Unicode" +# PROP Intermediate_Dir "Release_Unicode" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GTalkExt_EXPORTS" /Yu"commonheaders.h" /FD /c +# ADD CPP /nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "UNICODE" /D "_USRDLL" /D "GTalkExt_EXPORTS" /Yu"stdafx.h" /FD /c +# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x5130000" /dll /map /debug /machine:I386 /out:"../../bin/release/plugins/GTalkExt.dll" /IGNORE:4089 +# SUBTRACT BASE LINK32 /pdb:none /incremental:yes +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x5130000" /dll /map /debug /machine:I386 /out:"../../bin/release unicode/plugins/GTalkExt.dll" /IGNORE:4089 +# SUBTRACT LINK32 /pdb:none /incremental:yes + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug Unicode" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "GTalkExt___Win32_Debug_Unicode" +# PROP BASE Intermediate_Dir "GTalkExt___Win32_Debug_Unicode" +# PROP BASE Ignore_Export_Lib 0 +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug_Unicode" +# PROP Intermediate_Dir "Debug_Unicode" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GTalkExt_EXPORTS" /Fr /Yu"commonheaders.h" /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "UNICODE" /D "_USRDLL" /D "GTalkExt_EXPORTS" /Fr /Yu"stdafx.h" /FD /GZ /c +# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /debug /machine:I386 /out:"../../bin/debug/plugins/GTalkExt.dll" /pdbtype:sept +# SUBTRACT BASE LINK32 /pdb:none /incremental:no +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /debug /machine:I386 /out:"../../bin/debug Unicode/plugins/GTalkExt.dll" /pdbtype:sept +# SUBTRACT LINK32 /pdb:none /incremental:no + +!ENDIF + +# Begin Target + +# Name "GTalkExt - Win32 Release" +# Name "GTalkExt - Win32 Debug" +# Name "GTalkExt - Win32 Release Unicode" +# Name "GTalkExt - Win32 Debug Unicode" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\avatar.cpp +# End Source File +# Begin Source File + +SOURCE=.\db.cpp +# End Source File +# Begin Source File + +SOURCE=.\dllmain.cpp +# End Source File +# Begin Source File + +SOURCE=.\GTalkExt.cpp +# End Source File +# Begin Source File + +SOURCE=.\handlers.cpp +# End Source File +# Begin Source File + +SOURCE=.\inbox.cpp +# End Source File +# Begin Source File + +SOURCE=.\menu.cpp +# End Source File +# Begin Source File + +SOURCE=.\notifications.cpp +# End Source File +# Begin Source File + +SOURCE=.\options.cpp +# End Source File +# Begin Source File + +SOURCE=.\popups.cpp +# End Source File +# Begin Source File + +SOURCE=.\stdafx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# Begin Source File + +SOURCE=.\tipper_items.cpp +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\avatar.h +# End Source File +# Begin Source File + +SOURCE=.\db.h +# End Source File +# Begin Source File + +SOURCE=.\handlers.h +# End Source File +# Begin Source File + +SOURCE=.\inbox.h +# End Source File +# Begin Source File + +SOURCE=.\menu.h +# End Source File +# Begin Source File + +SOURCE=.\notifications.h +# End Source File +# Begin Source File + +SOURCE=.\options.h +# End Source File +# Begin Source File + +SOURCE=.\popups.h +# End Source File +# Begin Source File + +SOURCE=.\resources.h +# End Source File +# Begin Source File + +SOURCE=.\stdafx.h +# End Source File +# Begin Source File + +SOURCE=.\targetver.h +# End Source File +# Begin Source File + +SOURCE=.\tipper_items.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# Begin Source File + +SOURCE=.\res\settings.rc +# End Source File +# End Group +# End Target +# End Project diff --git a/protocols/GTalkExt/GTalkExt.dsw b/protocols/GTalkExt/GTalkExt.dsw new file mode 100644 index 0000000000..7fccd102e5 --- /dev/null +++ b/protocols/GTalkExt/GTalkExt.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "GTalkExt"=.\GTalkExt.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/protocols/GTalkExt/GTalkExt.mak b/protocols/GTalkExt/GTalkExt.mak new file mode 100644 index 0000000000..1746490886 --- /dev/null +++ b/protocols/GTalkExt/GTalkExt.mak @@ -0,0 +1,782 @@ +# Microsoft Developer Studio Generated NMAKE File, Based on GTalkExt.dsp +!IF "$(CFG)" == "" +CFG=GTalkExt - Win32 Release Unicode +!MESSAGE No configuration specified. Defaulting to GTalkExt - Win32 Release Unicode. +!ENDIF + +!IF "$(CFG)" != "GTalkExt - Win32 Release" && "$(CFG)" != "GTalkExt - Win32 Debug" && "$(CFG)" != "GTalkExt - Win32 Release Unicode" && "$(CFG)" != "GTalkExt - Win32 Debug Unicode" +!MESSAGE Invalid configuration "$(CFG)" specified. +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "GTalkExt.mak" CFG="GTalkExt - Win32 Debug Unicode" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "GTalkExt - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "GTalkExt - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "GTalkExt - Win32 Release Unicode" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "GTalkExt - Win32 Debug Unicode" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE +!ERROR An invalid configuration is specified. +!ENDIF + +!IF "$(OS)" == "Windows_NT" +NULL= +!ELSE +NULL=nul +!ENDIF + +CPP=cl.exe +MTL=midl.exe +RSC=rc.exe + +!IF "$(CFG)" == "GTalkExt - Win32 Release" + +OUTDIR=.\Release +INTDIR=.\Release + +ALL : "..\..\bin\release\plugins\GTalkExt.dll" + + +CLEAN : + -@erase "$(INTDIR)\avatar.obj" + -@erase "$(INTDIR)\db.obj" + -@erase "$(INTDIR)\dllmain.obj" + -@erase "$(INTDIR)\GTalkExt.obj" + -@erase "$(INTDIR)\GTalkExt.pch" + -@erase "$(INTDIR)\handlers.obj" + -@erase "$(INTDIR)\inbox.obj" + -@erase "$(INTDIR)\menu.obj" + -@erase "$(INTDIR)\notifications.obj" + -@erase "$(INTDIR)\options.obj" + -@erase "$(INTDIR)\popups.obj" + -@erase "$(INTDIR)\settings.res" + -@erase "$(INTDIR)\stdafx.obj" + -@erase "$(INTDIR)\tipper_items.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\GTalkExt.exp" + -@erase "$(OUTDIR)\GTalkExt.lib" + -@erase "$(OUTDIR)\GTalkExt.map" + -@erase "$(OUTDIR)\GTalkExt.pdb" + -@erase "..\..\bin\release\plugins\GTalkExt.dll" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GTalkExt_EXPORTS" /Fp"$(INTDIR)\GTalkExt.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x809 /fo"$(INTDIR)\settings.res" /d "NDEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\GTalkExt.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x5130000" /dll /incremental:no /pdb:"$(OUTDIR)\GTalkExt.pdb" /map:"$(INTDIR)\GTalkExt.map" /debug /machine:I386 /out:"../../bin/release/plugins/GTalkExt.dll" /implib:"$(OUTDIR)\GTalkExt.lib" /IGNORE:4089 +LINK32_OBJS= \ + "$(INTDIR)\tipper_items.obj" \ + "$(INTDIR)\avatar.obj" \ + "$(INTDIR)\db.obj" \ + "$(INTDIR)\dllmain.obj" \ + "$(INTDIR)\GTalkExt.obj" \ + "$(INTDIR)\handlers.obj" \ + "$(INTDIR)\inbox.obj" \ + "$(INTDIR)\menu.obj" \ + "$(INTDIR)\notifications.obj" \ + "$(INTDIR)\options.obj" \ + "$(INTDIR)\popups.obj" \ + "$(INTDIR)\stdafx.obj" \ + "$(INTDIR)\settings.res" + +"..\..\bin\release\plugins\GTalkExt.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug" + +OUTDIR=.\Debug +INTDIR=.\Debug +# Begin Custom Macros +OutDir=.\Debug +# End Custom Macros + +ALL : "..\..\bin\debug\plugins\GTalkExt.dll" "$(OUTDIR)\GTalkExt.bsc" + + +CLEAN : + -@erase "$(INTDIR)\avatar.obj" + -@erase "$(INTDIR)\avatar.sbr" + -@erase "$(INTDIR)\db.obj" + -@erase "$(INTDIR)\db.sbr" + -@erase "$(INTDIR)\dllmain.obj" + -@erase "$(INTDIR)\dllmain.sbr" + -@erase "$(INTDIR)\GTalkExt.obj" + -@erase "$(INTDIR)\GTalkExt.pch" + -@erase "$(INTDIR)\GTalkExt.sbr" + -@erase "$(INTDIR)\handlers.obj" + -@erase "$(INTDIR)\handlers.sbr" + -@erase "$(INTDIR)\inbox.obj" + -@erase "$(INTDIR)\inbox.sbr" + -@erase "$(INTDIR)\menu.obj" + -@erase "$(INTDIR)\menu.sbr" + -@erase "$(INTDIR)\notifications.obj" + -@erase "$(INTDIR)\notifications.sbr" + -@erase "$(INTDIR)\options.obj" + -@erase "$(INTDIR)\options.sbr" + -@erase "$(INTDIR)\popups.obj" + -@erase "$(INTDIR)\popups.sbr" + -@erase "$(INTDIR)\settings.res" + -@erase "$(INTDIR)\stdafx.obj" + -@erase "$(INTDIR)\stdafx.sbr" + -@erase "$(INTDIR)\tipper_items.obj" + -@erase "$(INTDIR)\tipper_items.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\GTalkExt.exp" + -@erase "$(OUTDIR)\GTalkExt.lib" + -@erase "$(OUTDIR)\GTalkExt.map" + -@erase "$(OUTDIR)\GTalkExt.pdb" + -@erase "$(OUTDIR)\GTalkExt.bsc" + -@erase "..\..\bin\debug\plugins\GTalkExt.dll" + -@erase "..\..\bin\debug\plugins\GTalkExt.ilk" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GTalkExt_EXPORTS" /Fr"$(INTDIR)\\" /Fp"$(INTDIR)\GTalkExt.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x809 /fo"$(INTDIR)\settings.res" /d "_DEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\GTalkExt.bsc" +BSC32_SBRS= \ + "$(INTDIR)\tipper_items.sbr" \ + "$(INTDIR)\avatar.sbr" \ + "$(INTDIR)\db.sbr" \ + "$(INTDIR)\dllmain.sbr" \ + "$(INTDIR)\GTalkExt.sbr" \ + "$(INTDIR)\handlers.sbr" \ + "$(INTDIR)\inbox.sbr" \ + "$(INTDIR)\menu.sbr" \ + "$(INTDIR)\notifications.sbr" \ + "$(INTDIR)\options.sbr" \ + "$(INTDIR)\popups.sbr" \ + "$(INTDIR)\stdafx.sbr" + +"$(OUTDIR)\GTalkExt.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\GTalkExt.pdb" /map:"$(INTDIR)\GTalkExt.map" /debug /machine:I386 /out:"../../bin/debug/plugins/GTalkExt.dll" /implib:"$(OUTDIR)\GTalkExt.lib" /pdbtype:sept +LINK32_OBJS= \ + "$(INTDIR)\tipper_items.obj" \ + "$(INTDIR)\avatar.obj" \ + "$(INTDIR)\db.obj" \ + "$(INTDIR)\dllmain.obj" \ + "$(INTDIR)\GTalkExt.obj" \ + "$(INTDIR)\handlers.obj" \ + "$(INTDIR)\inbox.obj" \ + "$(INTDIR)\menu.obj" \ + "$(INTDIR)\notifications.obj" \ + "$(INTDIR)\options.obj" \ + "$(INTDIR)\popups.obj" \ + "$(INTDIR)\stdafx.obj" \ + "$(INTDIR)\settings.res" + +"..\..\bin\debug\plugins\GTalkExt.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Release Unicode" + +OUTDIR=.\Release_Unicode +INTDIR=.\Release_Unicode + +ALL : "..\..\bin\release unicode\plugins\GTalkExt.dll" + + +CLEAN : + -@erase "$(INTDIR)\avatar.obj" + -@erase "$(INTDIR)\db.obj" + -@erase "$(INTDIR)\dllmain.obj" + -@erase "$(INTDIR)\GTalkExt.obj" + -@erase "$(INTDIR)\GTalkExt.pch" + -@erase "$(INTDIR)\handlers.obj" + -@erase "$(INTDIR)\inbox.obj" + -@erase "$(INTDIR)\menu.obj" + -@erase "$(INTDIR)\notifications.obj" + -@erase "$(INTDIR)\options.obj" + -@erase "$(INTDIR)\popups.obj" + -@erase "$(INTDIR)\settings.res" + -@erase "$(INTDIR)\stdafx.obj" + -@erase "$(INTDIR)\tipper_items.obj" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\GTalkExt.exp" + -@erase "$(OUTDIR)\GTalkExt.lib" + -@erase "$(OUTDIR)\GTalkExt.map" + -@erase "$(OUTDIR)\GTalkExt.pdb" + -@erase "..\..\bin\release unicode\plugins\GTalkExt.dll" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "UNICODE" /D "_USRDLL" /D "GTalkExt_EXPORTS" /Fp"$(INTDIR)\GTalkExt.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c +MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x809 /fo"$(INTDIR)\settings.res" /d "NDEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\GTalkExt.bsc" +BSC32_SBRS= \ + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /base:"0x5130000" /dll /incremental:no /pdb:"$(OUTDIR)\GTalkExt.pdb" /map:"$(INTDIR)\GTalkExt.map" /debug /machine:I386 /out:"../../bin/release unicode/plugins/GTalkExt.dll" /implib:"$(OUTDIR)\GTalkExt.lib" /IGNORE:4089 +LINK32_OBJS= \ + "$(INTDIR)\tipper_items.obj" \ + "$(INTDIR)\avatar.obj" \ + "$(INTDIR)\db.obj" \ + "$(INTDIR)\dllmain.obj" \ + "$(INTDIR)\GTalkExt.obj" \ + "$(INTDIR)\handlers.obj" \ + "$(INTDIR)\inbox.obj" \ + "$(INTDIR)\menu.obj" \ + "$(INTDIR)\notifications.obj" \ + "$(INTDIR)\options.obj" \ + "$(INTDIR)\popups.obj" \ + "$(INTDIR)\stdafx.obj" \ + "$(INTDIR)\settings.res" + +"..\..\bin\release unicode\plugins\GTalkExt.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug Unicode" + +OUTDIR=.\Debug_Unicode +INTDIR=.\Debug_Unicode +# Begin Custom Macros +OutDir=.\Debug_Unicode +# End Custom Macros + +ALL : "..\..\bin\debug Unicode\plugins\GTalkExt.dll" "$(OUTDIR)\GTalkExt.bsc" + + +CLEAN : + -@erase "$(INTDIR)\avatar.obj" + -@erase "$(INTDIR)\avatar.sbr" + -@erase "$(INTDIR)\db.obj" + -@erase "$(INTDIR)\db.sbr" + -@erase "$(INTDIR)\dllmain.obj" + -@erase "$(INTDIR)\dllmain.sbr" + -@erase "$(INTDIR)\GTalkExt.obj" + -@erase "$(INTDIR)\GTalkExt.pch" + -@erase "$(INTDIR)\GTalkExt.sbr" + -@erase "$(INTDIR)\handlers.obj" + -@erase "$(INTDIR)\handlers.sbr" + -@erase "$(INTDIR)\inbox.obj" + -@erase "$(INTDIR)\inbox.sbr" + -@erase "$(INTDIR)\menu.obj" + -@erase "$(INTDIR)\menu.sbr" + -@erase "$(INTDIR)\notifications.obj" + -@erase "$(INTDIR)\notifications.sbr" + -@erase "$(INTDIR)\options.obj" + -@erase "$(INTDIR)\options.sbr" + -@erase "$(INTDIR)\popups.obj" + -@erase "$(INTDIR)\popups.sbr" + -@erase "$(INTDIR)\settings.res" + -@erase "$(INTDIR)\stdafx.obj" + -@erase "$(INTDIR)\stdafx.sbr" + -@erase "$(INTDIR)\tipper_items.obj" + -@erase "$(INTDIR)\tipper_items.sbr" + -@erase "$(INTDIR)\vc60.idb" + -@erase "$(INTDIR)\vc60.pdb" + -@erase "$(OUTDIR)\GTalkExt.exp" + -@erase "$(OUTDIR)\GTalkExt.lib" + -@erase "$(OUTDIR)\GTalkExt.map" + -@erase "$(OUTDIR)\GTalkExt.pdb" + -@erase "$(OUTDIR)\GTalkExt.bsc" + -@erase "..\..\bin\debug Unicode\plugins\GTalkExt.dll" + -@erase "..\..\bin\debug Unicode\plugins\GTalkExt.ilk" + +"$(OUTDIR)" : + if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" + +CPP_PROJ=/nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "UNICODE" /D "_USRDLL" /D "GTalkExt_EXPORTS" /Fr"$(INTDIR)\\" /Fp"$(INTDIR)\GTalkExt.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c +MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32 +RSC_PROJ=/l 0x809 /fo"$(INTDIR)\settings.res" /d "_DEBUG" +BSC32=bscmake.exe +BSC32_FLAGS=/nologo /o"$(OUTDIR)\GTalkExt.bsc" +BSC32_SBRS= \ + "$(INTDIR)\tipper_items.sbr" \ + "$(INTDIR)\avatar.sbr" \ + "$(INTDIR)\db.sbr" \ + "$(INTDIR)\dllmain.sbr" \ + "$(INTDIR)\GTalkExt.sbr" \ + "$(INTDIR)\handlers.sbr" \ + "$(INTDIR)\inbox.sbr" \ + "$(INTDIR)\menu.sbr" \ + "$(INTDIR)\notifications.sbr" \ + "$(INTDIR)\options.sbr" \ + "$(INTDIR)\popups.sbr" \ + "$(INTDIR)\stdafx.sbr" + +"$(OUTDIR)\GTalkExt.bsc" : "$(OUTDIR)" $(BSC32_SBRS) + $(BSC32) @<< + $(BSC32_FLAGS) $(BSC32_SBRS) +<< + +LINK32=link.exe +LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"$(OUTDIR)\GTalkExt.pdb" /map:"$(INTDIR)\GTalkExt.map" /debug /machine:I386 /out:"../../bin/debug Unicode/plugins/GTalkExt.dll" /implib:"$(OUTDIR)\GTalkExt.lib" /pdbtype:sept +LINK32_OBJS= \ + "$(INTDIR)\tipper_items.obj" \ + "$(INTDIR)\avatar.obj" \ + "$(INTDIR)\db.obj" \ + "$(INTDIR)\dllmain.obj" \ + "$(INTDIR)\GTalkExt.obj" \ + "$(INTDIR)\handlers.obj" \ + "$(INTDIR)\inbox.obj" \ + "$(INTDIR)\menu.obj" \ + "$(INTDIR)\notifications.obj" \ + "$(INTDIR)\options.obj" \ + "$(INTDIR)\popups.obj" \ + "$(INTDIR)\stdafx.obj" \ + "$(INTDIR)\settings.res" + +"..\..\bin\debug Unicode\plugins\GTalkExt.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) + $(LINK32) @<< + $(LINK32_FLAGS) $(LINK32_OBJS) +<< + +!ENDIF + +.c{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.obj:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.c{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cpp{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + +.cxx{$(INTDIR)}.sbr:: + $(CPP) @<< + $(CPP_PROJ) $< +<< + + +!IF "$(NO_EXTERNAL_DEPS)" != "1" +!IF EXISTS("GTalkExt.dep") +!INCLUDE "GTalkExt.dep" +!ELSE +!MESSAGE Warning: cannot find "GTalkExt.dep" +!ENDIF +!ENDIF + + +!IF "$(CFG)" == "GTalkExt - Win32 Release" || "$(CFG)" == "GTalkExt - Win32 Debug" || "$(CFG)" == "GTalkExt - Win32 Release Unicode" || "$(CFG)" == "GTalkExt - Win32 Debug Unicode" +SOURCE=.\avatar.cpp + +!IF "$(CFG)" == "GTalkExt - Win32 Release" + + +"$(INTDIR)\avatar.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug" + + +"$(INTDIR)\avatar.obj" "$(INTDIR)\avatar.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Release Unicode" + + +"$(INTDIR)\avatar.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug Unicode" + + +"$(INTDIR)\avatar.obj" "$(INTDIR)\avatar.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ENDIF + +SOURCE=.\db.cpp + +!IF "$(CFG)" == "GTalkExt - Win32 Release" + + +"$(INTDIR)\db.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug" + + +"$(INTDIR)\db.obj" "$(INTDIR)\db.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Release Unicode" + + +"$(INTDIR)\db.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug Unicode" + + +"$(INTDIR)\db.obj" "$(INTDIR)\db.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ENDIF + +SOURCE=.\dllmain.cpp + +!IF "$(CFG)" == "GTalkExt - Win32 Release" + + +"$(INTDIR)\dllmain.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug" + + +"$(INTDIR)\dllmain.obj" "$(INTDIR)\dllmain.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Release Unicode" + + +"$(INTDIR)\dllmain.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug Unicode" + + +"$(INTDIR)\dllmain.obj" "$(INTDIR)\dllmain.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ENDIF + +SOURCE=.\GTalkExt.cpp + +!IF "$(CFG)" == "GTalkExt - Win32 Release" + + +"$(INTDIR)\GTalkExt.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug" + + +"$(INTDIR)\GTalkExt.obj" "$(INTDIR)\GTalkExt.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Release Unicode" + + +"$(INTDIR)\GTalkExt.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug Unicode" + + +"$(INTDIR)\GTalkExt.obj" "$(INTDIR)\GTalkExt.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ENDIF + +SOURCE=.\handlers.cpp + +!IF "$(CFG)" == "GTalkExt - Win32 Release" + + +"$(INTDIR)\handlers.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug" + + +"$(INTDIR)\handlers.obj" "$(INTDIR)\handlers.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Release Unicode" + + +"$(INTDIR)\handlers.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug Unicode" + + +"$(INTDIR)\handlers.obj" "$(INTDIR)\handlers.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ENDIF + +SOURCE=.\inbox.cpp + +!IF "$(CFG)" == "GTalkExt - Win32 Release" + + +"$(INTDIR)\inbox.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug" + + +"$(INTDIR)\inbox.obj" "$(INTDIR)\inbox.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Release Unicode" + + +"$(INTDIR)\inbox.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug Unicode" + + +"$(INTDIR)\inbox.obj" "$(INTDIR)\inbox.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ENDIF + +SOURCE=.\menu.cpp + +!IF "$(CFG)" == "GTalkExt - Win32 Release" + + +"$(INTDIR)\menu.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug" + + +"$(INTDIR)\menu.obj" "$(INTDIR)\menu.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Release Unicode" + + +"$(INTDIR)\menu.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug Unicode" + + +"$(INTDIR)\menu.obj" "$(INTDIR)\menu.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ENDIF + +SOURCE=.\notifications.cpp + +!IF "$(CFG)" == "GTalkExt - Win32 Release" + + +"$(INTDIR)\notifications.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug" + + +"$(INTDIR)\notifications.obj" "$(INTDIR)\notifications.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Release Unicode" + + +"$(INTDIR)\notifications.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug Unicode" + + +"$(INTDIR)\notifications.obj" "$(INTDIR)\notifications.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ENDIF + +SOURCE=.\options.cpp + +!IF "$(CFG)" == "GTalkExt - Win32 Release" + + +"$(INTDIR)\options.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug" + + +"$(INTDIR)\options.obj" "$(INTDIR)\options.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Release Unicode" + + +"$(INTDIR)\options.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug Unicode" + + +"$(INTDIR)\options.obj" "$(INTDIR)\options.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ENDIF + +SOURCE=.\popups.cpp + +!IF "$(CFG)" == "GTalkExt - Win32 Release" + + +"$(INTDIR)\popups.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug" + + +"$(INTDIR)\popups.obj" "$(INTDIR)\popups.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Release Unicode" + + +"$(INTDIR)\popups.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug Unicode" + + +"$(INTDIR)\popups.obj" "$(INTDIR)\popups.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ENDIF + +SOURCE=.\stdafx.cpp + +!IF "$(CFG)" == "GTalkExt - Win32 Release" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GTalkExt_EXPORTS" /Fp"$(INTDIR)\GTalkExt.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\stdafx.obj" "$(INTDIR)\GTalkExt.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GTalkExt_EXPORTS" /Fr"$(INTDIR)\\" /Fp"$(INTDIR)\GTalkExt.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\stdafx.obj" "$(INTDIR)\stdafx.sbr" "$(INTDIR)\GTalkExt.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Release Unicode" + +CPP_SWITCHES=/nologo /MD /W3 /Zi /O1 /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "UNICODE" /D "_USRDLL" /D "GTalkExt_EXPORTS" /Fp"$(INTDIR)\GTalkExt.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c + +"$(INTDIR)\stdafx.obj" "$(INTDIR)\GTalkExt.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug Unicode" + +CPP_SWITCHES=/nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "UNICODE" /D "_USRDLL" /D "GTalkExt_EXPORTS" /Fr"$(INTDIR)\\" /Fp"$(INTDIR)\GTalkExt.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c + +"$(INTDIR)\stdafx.obj" "$(INTDIR)\stdafx.sbr" "$(INTDIR)\GTalkExt.pch" : $(SOURCE) "$(INTDIR)" + $(CPP) @<< + $(CPP_SWITCHES) $(SOURCE) +<< + + +!ENDIF + +SOURCE=.\tipper_items.cpp + +!IF "$(CFG)" == "GTalkExt - Win32 Release" + + +"$(INTDIR)\tipper_items.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug" + + +"$(INTDIR)\tipper_items.obj" "$(INTDIR)\tipper_items.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Release Unicode" + + +"$(INTDIR)\tipper_items.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug Unicode" + + +"$(INTDIR)\tipper_items.obj" "$(INTDIR)\tipper_items.sbr" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\GTalkExt.pch" + + +!ENDIF + +SOURCE=.\res\settings.rc + +!IF "$(CFG)" == "GTalkExt - Win32 Release" + + +"$(INTDIR)\settings.res" : $(SOURCE) "$(INTDIR)" + $(RSC) /l 0x809 /fo"$(INTDIR)\settings.res" /i "res" /d "NDEBUG" $(SOURCE) + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug" + + +"$(INTDIR)\settings.res" : $(SOURCE) "$(INTDIR)" + $(RSC) /l 0x809 /fo"$(INTDIR)\settings.res" /i "res" /d "_DEBUG" $(SOURCE) + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Release Unicode" + + +"$(INTDIR)\settings.res" : $(SOURCE) "$(INTDIR)" + $(RSC) /l 0x809 /fo"$(INTDIR)\settings.res" /i "res" /d "NDEBUG" $(SOURCE) + + +!ELSEIF "$(CFG)" == "GTalkExt - Win32 Debug Unicode" + + +"$(INTDIR)\settings.res" : $(SOURCE) "$(INTDIR)" + $(RSC) /l 0x809 /fo"$(INTDIR)\settings.res" /i "res" /d "_DEBUG" $(SOURCE) + + +!ENDIF + + +!ENDIF diff --git a/protocols/GTalkExt/GTalkExt.sln b/protocols/GTalkExt/GTalkExt.sln new file mode 100644 index 0000000000..9e7a697f75 --- /dev/null +++ b/protocols/GTalkExt/GTalkExt.sln @@ -0,0 +1,37 @@ +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C++ Express 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GTalkExt", "GTalkExt.vcxproj", "{2A737817-2443-48FF-A2E8-CA8D69E450F3}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug Unicode|Win32 = Debug Unicode|Win32 + Debug Unicode|x64 = Debug Unicode|x64 + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release Unicode|Win32 = Release Unicode|Win32 + Release Unicode|x64 = Release Unicode|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Debug Unicode|Win32.ActiveCfg = Debug Unicode|Win32 + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Debug Unicode|Win32.Build.0 = Debug Unicode|Win32 + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Debug Unicode|x64.ActiveCfg = Debug Unicode|x64 + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Debug Unicode|x64.Build.0 = Debug Unicode|x64 + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Debug|Win32.ActiveCfg = Debug|Win32 + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Debug|Win32.Build.0 = Debug|Win32 + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Debug|x64.ActiveCfg = Debug|x64 + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Debug|x64.Build.0 = Debug|x64 + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Release Unicode|Win32.ActiveCfg = Release Unicode|Win32 + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Release Unicode|Win32.Build.0 = Release Unicode|Win32 + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Release Unicode|x64.ActiveCfg = Release Unicode|x64 + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Release Unicode|x64.Build.0 = Release Unicode|x64 + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Release|Win32.ActiveCfg = Release|Win32 + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Release|Win32.Build.0 = Release|Win32 + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Release|x64.ActiveCfg = Release|x64 + {2A737817-2443-48FF-A2E8-CA8D69E450F3}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/protocols/GTalkExt/GTalkExt.vcproj b/protocols/GTalkExt/GTalkExt.vcproj new file mode 100644 index 0000000000..0aa27e60d4 --- /dev/null +++ b/protocols/GTalkExt/GTalkExt.vcproj @@ -0,0 +1,522 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/protocols/GTalkExt/GTalkExt.vcxproj b/protocols/GTalkExt/GTalkExt.vcxproj new file mode 100644 index 0000000000..faa1eb83f0 --- /dev/null +++ b/protocols/GTalkExt/GTalkExt.vcxproj @@ -0,0 +1,418 @@ + + + + + Debug Unicode + Win32 + + + Debug Unicode + x64 + + + Debug + Win32 + + + Debug + x64 + + + Release Unicode + Win32 + + + Release Unicode + x64 + + + Release + Win32 + + + Release + x64 + + + + {2A737817-2443-48FF-A2E8-CA8D69E450F3} + GTalkExt + Win32Proj + + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + MultiByte + true + + + DynamicLibrary + Unicode + true + + + DynamicLibrary + Unicode + true + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + Unicode + + + DynamicLibrary + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration)/Plugins\ + $(SolutionDir)$(Configuration)64/Plugins\ + $(SolutionDir)$(Configuration)/Plugins\ + $(SolutionDir)$(Configuration)64/Plugins\ + $(SolutionDir)$(Configuration)/Obj/$(ProjectName)\ + $(SolutionDir)$(Configuration)64/Obj/$(ProjectName)\ + $(SolutionDir)$(Configuration)/Obj/$(ProjectName)\ + $(SolutionDir)$(Configuration)64/Obj/$(ProjectName)\ + true + true + true + true + $(SolutionDir)$(Configuration)/Plugins\ + $(SolutionDir)$(Configuration)64/Plugins\ + $(SolutionDir)$(Configuration)/Plugins\ + $(SolutionDir)$(Configuration)64/Plugins\ + $(SolutionDir)$(Configuration)/Obj/$(ProjectName)\ + $(SolutionDir)$(Configuration)64/Obj/$(ProjectName)\ + $(SolutionDir)$(Configuration)/Obj/$(ProjectName)\ + $(SolutionDir)$(Configuration)64/Obj/$(ProjectName)\ + false + false + false + false + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + AllRules.ruleset + + + + + + + + + + + + Disabled + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;GTALKEXT_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + Use + Level3 + EditAndContinue + + + %(AdditionalLibraryDirectories) + true + Windows + MachineX86 + $(IntDir)$(TargetName).lib + + + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + + + + + Disabled + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;GTALKEXT_EXPORTS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + Use + Level3 + ProgramDatabase + + + LinkVerbose + %(AdditionalLibraryDirectories) + true + Windows + $(IntDir)$(TargetName).lib + + + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + + + + + Disabled + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;GTALKEXT_EXPORTS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + Use + Level3 + EditAndContinue + + + %(AdditionalLibraryDirectories) + true + Windows + MachineX86 + $(IntDir)$(TargetName).lib + + + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + + + + + Disabled + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;GTALKEXT_EXPORTS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebug + Use + Level3 + ProgramDatabase + + + LinkVerbose + %(AdditionalLibraryDirectories) + true + Windows + $(IntDir)$(TargetName).lib + + + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + + + + + Full + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;GTALKEXT_EXPORTS;%(PreprocessorDefinitions) + MultiThreadedDLL + true + Use + Level3 + ProgramDatabase + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + Size + + + true + Windows + true + true + MachineX86 + $(IntDir)$(TargetName).lib + + + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + + + + + Full + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;GTALKEXT_EXPORTS;%(PreprocessorDefinitions) + MultiThreadedDLL + true + Use + Level3 + ProgramDatabase + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + Size + + + true + Windows + true + true + $(IntDir)$(TargetName).lib + + + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + + + + + Full + WIN32;NDEBUG;_WINDOWS;_USRDLL;GTALKEXT_EXPORTS;%(PreprocessorDefinitions) + MultiThreadedDLL + true + Use + Level3 + ProgramDatabase + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + Size + true + + + true + Windows + true + true + MachineX86 + $(IntDir)$(TargetName).lib + + + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + + + + + Full + WIN32;NDEBUG;_WINDOWS;_USRDLL;GTALKEXT_EXPORTS;%(PreprocessorDefinitions) + MultiThreadedDLL + true + Use + Level3 + ProgramDatabase + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + Size + true + + + true + Windows + true + true + $(IntDir)$(TargetName).lib + + + ../../include;../ExternalAPI;%(AdditionalIncludeDirectories) + + + + + + + + + + + + + + + false + false + false + false + + + + + + + + + false + false + false + false + + + + + + + + + + Create + Create + Create + Create + Create + Create + Create + Create + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/protocols/GTalkExt/GTalkExt.vcxproj.filters b/protocols/GTalkExt/GTalkExt.vcxproj.filters new file mode 100644 index 0000000000..6575ce7599 --- /dev/null +++ b/protocols/GTalkExt/GTalkExt.vcxproj.filters @@ -0,0 +1,102 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + + + + + \ No newline at end of file diff --git a/protocols/GTalkExt/avatar.cpp b/protocols/GTalkExt/avatar.cpp new file mode 100644 index 0000000000..3f98188197 --- /dev/null +++ b/protocols/GTalkExt/avatar.cpp @@ -0,0 +1,212 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#include "stdafx.h" +#include "avatar.h" +#include "resources.h" +#include "options.h" + +static const LPSTR AVA_FILE_NAME_FORMAT = "%s\\%s\\AvatarCache\\Jabber\\" SHORT_PLUGIN_NAME ".pseudoava.png"; +static const LPTSTR AVA_RES_TYPE = _T("PNG"); +static const LPSTR SRMM_MODULE_NAME = "SRMM"; +static const LPSTR SRMM_AVATAR_SETTING_NAME = "Avatar"; + +static const int SET_AVATAR_INTERVAL = 2000; + +void ForceDir(LPSTR dir, int len) +{ + if (GetFileAttributesA(dir) != INVALID_FILE_ATTRIBUTES) return; + for (int i = len - 1; i >= 0; i--) + if ('\\' == dir[i]) { + dir[i] = 0; + __try { + ForceDir(dir, i); + } + __finally { + dir[i] = '\\'; + } + CreateDirectoryA(dir, NULL); + } +} + +void ForceFileDir(LPSTR file) +{ + for (int i = lstrlenA(file) - 1; i >= 0; i--) + if ('\\' == file[i]) { + file[i] = 0; + __try { + ForceDir(file, i); + } + __finally { + file[i] = '\\'; + } + break; + } +} + +LPSTR CreateAvaFile(HANDLE *hFile) +{ + char name[MAX_PATH + 2]; + char path[MAX_PATH + 2]; + char full[MAX_PATH + 2]; + + if (CallService(MS_DB_GETPROFILENAME, (WPARAM)sizeof(name), (LPARAM)&name)) + return NULL; + for (int i = lstrlenA(name); i >= 0; i--) + if ('.' == name[i]) { + name[i] = 0; + break; + } + + if (CallService(MS_DB_GETPROFILEPATH, (WPARAM)sizeof(path), (LPARAM)&path)) + return NULL; + sprintf(&full[0], AVA_FILE_NAME_FORMAT, path, name); + + ForceFileDir(&full[0]); + + HANDLE h = 0; + __try { + h = CreateFileA(&full[0], GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); + if (INVALID_HANDLE_VALUE == h) return NULL; + + if (hFile) *hFile = h; else CloseHandle(h); + h = 0; + return _strdup(&full[0]); + } + __finally { + CloseHandle(h); + } +} + +extern HINSTANCE hInst; + +BOOL SaveAvatar(HANDLE hFile) +{ + HRSRC hres = FindResource(hInst, MAKEINTRESOURCE(IDI_PSEUDOAVA), AVA_RES_TYPE); + if (!hres) return FALSE; + + HGLOBAL hglob = LoadResource(hInst, hres); + if (!hglob) return FALSE; + + PVOID p = LockResource(hglob); + if (!p) return FALSE; + + DWORD l = SizeofResource(hInst, hres); + if (!l) return FALSE; + + DWORD written; + if (!WriteFile(hFile, p, l, &written, NULL)) return FALSE; + return written == l; +} + +struct AVACHANGED { + HANDLE hTimer; + HANDLE hContact; +}; + +VOID CALLBACK CallSetAvatar(PVOID lpParameter, BOOLEAN TimerOrWaitFired) +{ + CallService(MS_SYSTEM_THREAD_PUSH, 0, 0); + __try { + AVACHANGED *ach = (AVACHANGED*)lpParameter; + __try { + SetAvatar(ach->hContact); + DeleteTimerQueueTimer(NULL, ach->hTimer, NULL); + } + __finally { + free(ach); + } + } + __finally { + CallService(MS_SYSTEM_THREAD_POP, 0, 0); + } +} + +int AvaChanged(WPARAM wParam, LPARAM lParam) +{ + if (!lParam && DBGetContactSettingByte((HANDLE)wParam, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) { + BOOL enqueued = FALSE; + AVACHANGED *ach = (AVACHANGED*)malloc(sizeof(AVACHANGED)); + __try { + ach->hContact = (HANDLE)wParam; + enqueued = CreateTimerQueueTimer(&ach->hTimer, NULL, CallSetAvatar, ach, SET_AVATAR_INTERVAL, 0, WT_EXECUTEONLYONCE); + } + __finally { + if (!enqueued) free(ach); + } + } + return 0; +} + +CRITICAL_SECTION g_csSetAvatar; +HANDLE hAvaChanged = 0; +BOOL initialized = FALSE; + +BOOL InitAvaUnit(BOOL init) +{ + if (init) { + hAvaChanged = HookEvent(ME_AV_AVATARCHANGED, AvaChanged); + InitializeCriticalSection(&g_csSetAvatar); + initialized = TRUE; + return hAvaChanged != 0; + } + else { + if (initialized) { + initialized = FALSE; + DeleteCriticalSection(&g_csSetAvatar); + } + if (hAvaChanged) { + UnhookEvent(hAvaChanged); + hAvaChanged = 0; + } + return TRUE; + } +} + +void SetAvatar(HANDLE hContact) +{ + EnterCriticalSection(&g_csSetAvatar); + __try { + avatarCacheEntry *ava = (avatarCacheEntry*)CallService(MS_AV_GETAVATARBITMAP, (WPARAM)hContact, 0); + if (ava && GetFileAttributesA(&ava->szFilename[0]) != INVALID_FILE_ATTRIBUTES) + return; + + HANDLE hFile; + LPSTR avaFile = CreateAvaFile(&hFile); + if (avaFile) + __try { + BOOL saved = SaveAvatar(hFile); + CloseHandle(hFile); hFile = 0; + if (saved){ + if (ava) CallService(MS_AV_SETAVATAR, (WPARAM)hContact, (LPARAM)""); + CallService(MS_AV_SETAVATAR, (WPARAM)hContact, (LPARAM)avaFile); + DBWriteContactSettingString(hContact, SRMM_MODULE_NAME, SRMM_AVATAR_SETTING_NAME, avaFile); + } + } + __finally { + free(avaFile); + CloseHandle(hFile); + } + } + __finally { + LeaveCriticalSection(&g_csSetAvatar); + } +} \ No newline at end of file diff --git a/protocols/GTalkExt/avatar.h b/protocols/GTalkExt/avatar.h new file mode 100644 index 0000000000..f07631deff --- /dev/null +++ b/protocols/GTalkExt/avatar.h @@ -0,0 +1,25 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#pragma once + +void SetAvatar(HANDLE hContact); +BOOL InitAvaUnit(BOOL init); \ No newline at end of file diff --git a/protocols/GTalkExt/db.cpp b/protocols/GTalkExt/db.cpp new file mode 100644 index 0000000000..a99101f719 --- /dev/null +++ b/protocols/GTalkExt/db.cpp @@ -0,0 +1,100 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#include "StdAfx.h" +#include "options.h" + +char *WtoA(LPCTSTR W) +{ + char* result = (char*)malloc(lstrlen(W) + 1); + __try { + int i; + for (i = 0; W[i]; i++) { + result[i] = W[i]; + } + + result[i] = 0; + } + __except( + free(result), + EXCEPTION_CONTINUE_SEARCH + ){} + return result; +} + +LPTSTR ReadJidSetting(LPCSTR name, LPCTSTR jid) +{ + char *ansiJid = WtoA(jid); + __try { + DBVARIANT dbv = {0}; + __try { + if (DBGetContactSettingTString(0, name, ansiJid, &dbv)) + { + LPTSTR result = (LPTSTR)malloc(2 * sizeof(TCHAR)); + result[0] = '0'; + result[1] = NULL; + return result; + } + + return _tcsdup(dbv.ptszVal); + } + __finally { + DBFreeVariant(&dbv); + } + } + __finally { + free(ansiJid); + } + + assert(false); + return NULL; // relax compiler +} + +void WriteJidSetting(LPCSTR name, LPCTSTR jid, LPCTSTR setting) +{ + char *ansiJid = WtoA(jid); + __try { + DBWriteContactSettingTString(0, name, ansiJid, setting); + } + __finally { + free(ansiJid); + } +} + +void RenewPseudocontactHandles() +{ + int count = 0; + PROTOCOLDESCRIPTOR **protos; + CallService(MS_PROTO_ENUMPROTOCOLS, (WPARAM)&count, (LPARAM)&protos); + for (int i = 0; i < count; i++) { + DBDeleteContactSetting(0, protos[i]->szName, PSEUDOCONTACT_LINK); + DBDeleteContactSetting(0, protos[i]->szName, "GMailExtNotifyContact"); // remove this + } + + HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); + while (hContact) { + if (DBGetContactSettingByte(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) { + LPCSTR proto = (LPCSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + DBWriteContactSettingDword(0, proto, PSEUDOCONTACT_LINK, (DWORD)hContact); + } + hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0); + }; +} \ No newline at end of file diff --git a/protocols/GTalkExt/db.h b/protocols/GTalkExt/db.h new file mode 100644 index 0000000000..9db6cc94ce --- /dev/null +++ b/protocols/GTalkExt/db.h @@ -0,0 +1,31 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#pragma once +#include "resources.h" + +static const LPSTR LAST_MAIL_TIME_FROM_JID = SHORT_PLUGIN_NAME ".LastMailTimeFromJid"; +static const LPSTR LAST_THREAD_ID_FROM_JID = SHORT_PLUGIN_NAME ".LastThreadIdFromJid"; + +LPTSTR ReadJidSetting(LPCSTR name, LPCTSTR jid); +void WriteJidSetting(LPCSTR name, LPCTSTR jid, LPCTSTR setting); +char *WtoA(LPCTSTR W); +void RenewPseudocontactHandles(); diff --git a/protocols/GTalkExt/dllmain.cpp b/protocols/GTalkExt/dllmain.cpp new file mode 100644 index 0000000000..e1097a3ea6 --- /dev/null +++ b/protocols/GTalkExt/dllmain.cpp @@ -0,0 +1,62 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#include "stdafx.h" +#include "notifications.h" +#include "options.h" +#include "popups.h" + +HINSTANCE hInst = 0; + +DWORD itlsSettings = TLS_OUT_OF_INDEXES; +DWORD itlsRecursion = TLS_OUT_OF_INDEXES; +DWORD itlsPopupHook = TLS_OUT_OF_INDEXES; + +BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) +{ + hInst = hinstDLL; + + switch (fdwReason) { + case DLL_PROCESS_ATTACH: + if (((itlsSettings = TlsAlloc()) == TLS_OUT_OF_INDEXES) || + ((itlsRecursion = TlsAlloc()) == TLS_OUT_OF_INDEXES) || + ((itlsPopupHook = TlsAlloc()) == TLS_OUT_OF_INDEXES)) + return FALSE; + break; + + case DLL_THREAD_ATTACH: + TlsSetValue(itlsPopupHook, + (PVOID)SetWindowsHookEx(WH_CALLWNDPROCRET, PopupHookProc, NULL, GetCurrentThreadId())); + break; + + case DLL_THREAD_DETACH: + UnhookWindowsHookEx((HHOOK)TlsGetValue(itlsPopupHook)); + break; + + case DLL_PROCESS_DETACH: + TlsFree(itlsSettings); + TlsFree(itlsRecursion); + TlsFree(itlsPopupHook); + break; + } + + return TRUE; +} diff --git a/protocols/GTalkExt/handlers.cpp b/protocols/GTalkExt/handlers.cpp new file mode 100644 index 0000000000..879e5ee820 --- /dev/null +++ b/protocols/GTalkExt/handlers.cpp @@ -0,0 +1,433 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#include "StdAfx.h" +#include "handlers.h" +#include "db.h" +#include "notifications.h" +#include "options.h" +#include "popups.h" + +static const LPCTSTR JABBER_IQID = _T("mir_"); +static const LPCTSTR JABBER_IQID_FORMAT = _T("mir_%d"); + +static const LPCTSTR NOTIFY_FEATURE_XMLNS = _T("google:mail:notify"); +static const LPCTSTR SETTING_FEATURE_XMLNS = _T("google:setting"); +static const LPCTSTR DISCOVERY_XMLNS = _T("http://jabber.org/protocol/disco#info"); + +static const LPCTSTR MESSAGE_URL_FORMAT_STANDARD = _T("%s/#inbox/%x%08x"); +static const LPCTSTR MESSAGE_URL_FORMAT_HTML = _T("%s/h/?v=c&th=%x%08x"); + +static const LPCTSTR ATTRNAME_TYPE = _T("type"); +static const LPCTSTR ATTRNAME_FROM = _T("from"); +static const LPCTSTR ATTRNAME_TO = _T("to"); +static const LPCTSTR ATTRNAME_URL = _T("url"); +static const LPCTSTR ATTRNAME_TID = _T("tid"); +static const LPCTSTR ATTRNAME_UNREAD = _T("unread"); +static const LPCTSTR ATTRNAME_XMLNS = _T("xmlns"); +static const LPCTSTR ATTRNAME_ID = _T("id"); +static const LPCTSTR ATTRNAME_TOTAL_MATCHED = _T("total-matched"); +static const LPCTSTR ATTRNAME_NAME = _T("name"); +static const LPCTSTR ATTRNAME_ADDRESS = _T("address"); +static const LPCTSTR ATTRNAME_RESULT_TIME = _T("result-time"); +static const LPCTSTR ATTRNAME_NEWER_THAN_TIME = _T("newer-than-time"); +static const LPCTSTR ATTRNAME_NEWER_THAN_TID = _T("newer-than-tid"); +static const LPCTSTR ATTRNAME_VALUE = _T("value"); +static const LPCTSTR ATTRNAME_VAR = _T("var"); + +static const LPCTSTR IQTYPE_RESULT = _T("result"); +static const LPCTSTR IQTYPE_SET = _T("set"); +static const LPCTSTR IQTYPE_GET = _T("get"); + +static const LPCTSTR NODENAME_MAILBOX = _T("mailbox"); +static const LPCTSTR NODENAME_QUERY = _T("query"); +static const LPCTSTR NODENAME_IQ = _T("iq"); +static const LPCTSTR NODENAME_USERSETTING = _T("usersetting"); +static const LPCTSTR NODENAME_MAILNOTIFICATIONS = _T("mailnotifications"); +static const LPCTSTR NODENAME_SUBJECT = _T("subject"); +static const LPCTSTR NODENAME_SNIPPET = _T("snippet"); +static const LPCTSTR NODENAME_SENDERS = _T("senders"); +static const LPCTSTR NODENAME_FEATURE = _T("feature"); +static const LPCTSTR NODENAME_NEW_MAIL = _T("new-mail"); + +static const LPCTSTR SETTING_TRUE = _T("true"); + +static const DWORD RESPONSE_TIMEOUT = 1000 * 60 * 60; +static const DWORD TIMER_INTERVAL = 1000 * 60 * 2; + +XML_API xi = {0}; + +#include + +void FormatMessageUrl(LPCTSTR format, LPTSTR buf, LPCTSTR mailbox, LPCTSTR tid) +{ + ULARGE_INTEGER iTid; iTid.QuadPart = _tstoi64(tid); + int l = lstrlen(buf); + wsprintf(buf, format, mailbox, iTid.HighPart, iTid.LowPart); + assert(l >= lstrlen(buf)); +} + +void MakeUrlHex(LPTSTR url, LPCTSTR tid) +{ + ULARGE_INTEGER iTid; iTid.QuadPart = _tstoi64(tid); + LPTSTR tidInUrl = _tcsstr(url, tid); + LPTSTR trail = tidInUrl + lstrlen(tid); + wsprintf(tidInUrl, _T("%x%08x"), iTid.HighPart, iTid.LowPart); + wmemmove(tidInUrl + lstrlen(tidInUrl), trail, lstrlen(trail) + 1); +} + +LPTSTR ExtractJid(LPCTSTR jidWithRes) +{ + int l; + for (l = 0; jidWithRes[l] && jidWithRes[l] != '/'; l++) {}; + assert('/' == jidWithRes[l]); + + LPTSTR result = (LPTSTR)malloc((l + 1) * sizeof(TCHAR)); + __try { + memcpy(result, jidWithRes, l * sizeof(TCHAR)); + result[l] = 0; + } + __except ( + free(result), + EXCEPTION_CONTINUE_SEARCH + ) {}; + + return result; +} + +BOOL TimerHandler(IJabberInterface *ji, HXML node, void *pUserData); + +BOOL InternalListHandler(IJabberInterface *ji, HXML node, LPCTSTR jid, LPCTSTR mailboxUrl) +{ + ULONGLONG maxTid = 0; + LPCTSTR sMaxTid = NULL; + int unreadCount = 0; + for (int i = 0; i < xi.getChildCount(node); i++) { + LPCTSTR sTid = xi.getAttrValue(xi.getChild(node, i), ATTRNAME_TID); + ULONGLONG tid = _tcstoui64(sTid, NULL, 10); + if (tid > maxTid) { + maxTid = tid; + sMaxTid = sTid; + } + + HXML senders = xi.getChildByPath(xi.getChild(node, i), NODENAME_SENDERS, FALSE); + for (int j = 0; j < xi.getChildCount(senders); j++) + if (xi.getAttrValue(xi.getChild(senders, j), ATTRNAME_UNREAD)) { + unreadCount++; + break; + } + } + + LPCSTR acc = GetJidAcc(jid); + if (!acc) return FALSE; + + if (!unreadCount) { + SetupPseudocontact(jid, xi.getAttrValue(node, ATTRNAME_TOTAL_MATCHED), acc); + return TRUE; + } + + DWORD settings = ReadNotificationSettings(acc); + + if (unreadCount > 5) { + CloseNotifications(acc, mailboxUrl, jid, FALSE); + UnreadMailNotification(acc, jid, mailboxUrl, xi.getAttrValue(node, ATTRNAME_TOTAL_MATCHED)); + } + else + for (int i = 0; i < xi.getChildCount(node); i++) { + MAIL_THREAD_NOTIFICATION mtn = {0}; + HXML thread = xi.getChild(node, i); + + mtn.subj = xi.getText(xi.getChildByPath(thread, NODENAME_SUBJECT, FALSE)); + mtn.snip = xi.getText(xi.getChildByPath(thread, NODENAME_SNIPPET, FALSE)); + + int threadUnreadCount = 0; + HXML senders = xi.getChildByPath(thread, NODENAME_SENDERS, FALSE); + for (int j = 0; threadUnreadCount < SENDER_COUNT && j < xi.getChildCount(senders); j++) { + HXML sender = xi.getChild(senders, j); + if (xi.getAttrValue(sender, ATTRNAME_UNREAD)) { + mtn.senders[threadUnreadCount].name = xi.getAttrValue(sender, ATTRNAME_NAME); + mtn.senders[threadUnreadCount].addr = xi.getAttrValue(sender, ATTRNAME_ADDRESS); + threadUnreadCount++; + } + } + + LPCTSTR url = xi.getAttrValue(thread, ATTRNAME_URL); + LPCTSTR tid = xi.getAttrValue(thread, ATTRNAME_TID); + + if (ReadCheckbox(0, IDC_STANDARDVIEW, settings)) + FormatMessageUrl(MESSAGE_URL_FORMAT_STANDARD, (LPTSTR)url, mailboxUrl, tid); + else + if (ReadCheckbox(0, IDC_HTMLVIEW, settings)) + FormatMessageUrl(MESSAGE_URL_FORMAT_HTML, (LPTSTR)url, mailboxUrl, tid); + else + MakeUrlHex((LPTSTR)url, tid); + + CloseNotifications(acc, url, jid, i); + UnreadThreadNotification(acc, jid, url, xi.getAttrValue(node, ATTRNAME_TOTAL_MATCHED), &mtn); + } + + LPCTSTR time = xi.getAttrValue(node, ATTRNAME_RESULT_TIME); + WriteJidSetting(LAST_MAIL_TIME_FROM_JID, jid, time); + WriteJidSetting(LAST_THREAD_ID_FROM_JID, jid, sMaxTid); + return TRUE; +} + +BOOL MailListHandler(IJabberInterface *ji, HXML node, void *pUserData) +{ + LPCTSTR jidWithRes = xi.getAttrValue(node, ATTRNAME_TO); + __try { + if (!node || lstrcmp(xi.getAttrValue(node, ATTRNAME_TYPE), IQTYPE_RESULT)) return TRUE; + + LPCTSTR jid = xi.getAttrValue(node, ATTRNAME_FROM); + assert(jid); + + node = xi.getChildByPath(node, NODENAME_MAILBOX, FALSE); + if (!node) return TRUE; // empty list + + LPCTSTR url = xi.getAttrValue(node, ATTRNAME_URL); + + return InternalListHandler(ji, node, jid, url); + } + __finally { + if (jidWithRes) + ji->Net()->AddTemporaryIqHandler(TimerHandler, JABBER_IQ_TYPE_RESULT, 0, + (PVOID)_tcsdup(jidWithRes), TIMER_INTERVAL); + // Never get a real result stanza. Results elapsed request after WAIT_TIMER_INTERVAL ms + } +} + +void RequestMail(LPCTSTR jidWithRes, IJabberInterface *ji) +{ + HXML child = NULL; + HXML node = xi.createNode(NODENAME_IQ, NULL, FALSE); + __try { + xi.addAttr(node, ATTRNAME_TYPE, IQTYPE_GET); + xi.addAttr(node, ATTRNAME_FROM, jidWithRes); + + UINT uID; + LPTSTR lastMailTime = NULL; + LPTSTR lastThreadId = NULL; + __try { + LPTSTR jid = ExtractJid(jidWithRes); + __try { + xi.addAttr(node, ATTRNAME_TO, jid); + lastMailTime = ReadJidSetting(LAST_MAIL_TIME_FROM_JID, jid); + lastThreadId = ReadJidSetting(LAST_THREAD_ID_FROM_JID, jid); + } + __finally { + free(jid); + } + + LPTSTR id = (LPTSTR)malloc((_tcslen(JABBER_IQID) + 10 + 1) * sizeof(id[0])); // max int fits 10 chars + __try { + wsprintf(id, JABBER_IQID_FORMAT, uID = ji->Net()->SerialNext()); + xi.addAttr(node, ATTRNAME_ID, id); + } + __finally { + free(id); + } + + child = xi.addChild(node, NODENAME_QUERY, NULL); + xi.addAttr(child, ATTRNAME_XMLNS, NOTIFY_FEATURE_XMLNS); + xi.addAttr(child, ATTRNAME_NEWER_THAN_TIME, lastMailTime); + xi.addAttr(child, ATTRNAME_NEWER_THAN_TID, lastThreadId); + } + __finally { + if (lastMailTime) free(lastMailTime); + if (lastThreadId) free(lastThreadId); + } + + IJabberNetInterface* piNet = ji->Net(); + if ( piNet ) + if (piNet->SendXmlNode(node)) + piNet->AddTemporaryIqHandler(MailListHandler, JABBER_IQ_TYPE_RESULT, (int)uID, NULL, RESPONSE_TIMEOUT); + } + __finally { + if (child) xi.destroyNode(child); + if (node) xi.destroyNode(node); + } +} + +BOOL TimerHandler(IJabberInterface *ji, HXML node, void *pUserData) +{ + __try { + assert(!node); // should not intercept real "mir_0" id + RequestMail((LPCTSTR)pUserData, ji); + return FALSE; + } + __finally { + free(pUserData); + } +} + +BOOL NewMailHandler(IJabberInterface *ji, HXML node, void *pUserData) +{ + HXML response = xi.createNode(NODENAME_IQ, NULL, FALSE); + __try { + xi.addAttr(response, ATTRNAME_TYPE, IQTYPE_RESULT); + + LPCTSTR attr = xi.getAttrValue(node, ATTRNAME_ID); + if (!attr) return FALSE; + xi.addAttr(response, ATTRNAME_ID, attr); + + attr = xi.getAttrValue(node, ATTRNAME_FROM); + if (attr) xi.addAttr(response, ATTRNAME_TO, attr); + + attr = xi.getAttrValue(node, ATTRNAME_TO); + if (!attr) return FALSE; + xi.addAttr(response, ATTRNAME_FROM, attr); + + int bytesSent = ji->Net()->SendXmlNode(response); + RequestMail(attr, ji); + return bytesSent > 0; + } + __finally { + xi.destroyNode(response); + } +} + +void SetNotificationSetting(LPCTSTR jidWithResource, IJabberInterface *ji) +{ + HXML child = NULL; + HXML node = xi.createNode(NODENAME_IQ, NULL, FALSE); + __try { + xi.addAttr(node, ATTRNAME_TYPE, IQTYPE_SET); + xi.addAttr(node, ATTRNAME_FROM, jidWithResource); + + LPTSTR jid = ExtractJid(jidWithResource); + __try { + xi.addAttr(node, ATTRNAME_TO, jid); + } + __finally { + free(jid); + } + + LPTSTR id = (LPTSTR)malloc((_tcslen(JABBER_IQID) + 10 + 1) * sizeof(id[0])); // max int fits 10 chars + __try { + wsprintf(id, JABBER_IQID_FORMAT, ji->Net()->SerialNext()); + xi.addAttr(node, ATTRNAME_ID, id); + } + __finally { + free(id); + } + + child = xi.addChild(node, NODENAME_USERSETTING, NULL); + xi.addAttr(child, ATTRNAME_XMLNS, SETTING_FEATURE_XMLNS); + + child = xi.addChild(child, NODENAME_MAILNOTIFICATIONS, NULL); + xi.addAttr(child, ATTRNAME_VALUE, SETTING_TRUE); + + ji->Net()->SendXmlNode(node); + } + __finally { + if (child) xi.destroyNode(child); + if (node) xi.destroyNode(node); + } +} + +BOOL DiscoverHandler(IJabberInterface *ji, HXML node, void *pUserData) +{ + if (!node) return FALSE; + + LPCTSTR jid = xi.getAttrValue(node, ATTRNAME_TO); + assert(jid); + node = xi.getChildByAttrValue(node, NODENAME_QUERY, ATTRNAME_XMLNS, DISCOVERY_XMLNS); + + HXML child = xi.getChildByAttrValue(node, NODENAME_FEATURE, ATTRNAME_VAR, SETTING_FEATURE_XMLNS); + if (child) SetNotificationSetting(jid, ji); + + child = xi.getChildByAttrValue(node, NODENAME_FEATURE, ATTRNAME_VAR, NOTIFY_FEATURE_XMLNS); + if (child) { + ji->Net()->AddIqHandler(NewMailHandler, JABBER_IQ_TYPE_SET, NOTIFY_FEATURE_XMLNS, NODENAME_NEW_MAIL); + RequestMail(jid, ji); + } + + return FALSE; +} + +extern DWORD itlsRecursion; + +BOOL SendHandler(IJabberInterface *ji, HXML node, void *pUserData) +{ + HXML queryNode = xi.getChildByAttrValue(node, NODENAME_QUERY, ATTRNAME_XMLNS, DISCOVERY_XMLNS); + if (!queryNode) return FALSE; + if (lstrcmp(xi.getName(node), NODENAME_IQ)) return FALSE; + if (lstrcmp(xi.getAttrValue(node, ATTRNAME_TYPE), IQTYPE_GET)) return FALSE; + + if (TlsGetValue(itlsRecursion)) return FALSE; + TlsSetValue(itlsRecursion, (PVOID)TRUE); + __try { + UINT id = ji->Net()->SerialNext(); + HXML newNode = xi.createNode(NODENAME_IQ, NULL, FALSE); + __try { + xi.addAttr(newNode, ATTRNAME_TYPE, IQTYPE_GET); + xi.addAttr(newNode, ATTRNAME_TO, xi.getAttrValue(node, ATTRNAME_TO)); + + LPTSTR idAttr = (LPTSTR)malloc(((int)_tcslen(JABBER_IQID) + 10) * sizeof(TCHAR)); + __try { + wsprintf(idAttr, JABBER_IQID_FORMAT, id); + xi.addAttr(newNode, ATTRNAME_ID, idAttr); + } + __finally { + free(idAttr); + } + + xi.addAttr(xi.addChild(newNode, NODENAME_QUERY, NULL), ATTRNAME_XMLNS, DISCOVERY_XMLNS); + ji->Net()->SendXmlNode(newNode); + } + __finally { + xi.destroyNode(newNode); + } + + ji->Net()->AddTemporaryIqHandler(DiscoverHandler, JABBER_IQ_TYPE_RESULT, id, NULL, RESPONSE_TIMEOUT); + return FALSE; + } + __finally { + TlsSetValue(itlsRecursion, (PVOID)FALSE); + } +} + +int AccListChanged(WPARAM wParam, LPARAM lParam) +{ + if (PRAC_ADDED == wParam) { + IJabberInterface *japi = getJabberApi(((PROTOACCOUNT*)lParam)->szModuleName); + if (japi) japi->Net()->AddSendHandler(SendHandler); + } + return 0; +} + +int ModulesLoaded(WPARAM wParam, LPARAM lParam) +{ + RenewPseudocontactHandles(); + DetectPopupModule(); + + int count; + PROTOCOLDESCRIPTOR **protos; + CallService(MS_PROTO_ENUMPROTOCOLS, (WPARAM)&count, (LPARAM)&protos); + for (int i = 0; i < count; i++) { + IJabberInterface *japi = getJabberApi(protos[i]->szName); + if (japi) japi->Net()->AddSendHandler(SendHandler); + } + + HookOptionsInitialization(); + + return 0; +} \ No newline at end of file diff --git a/protocols/GTalkExt/handlers.h b/protocols/GTalkExt/handlers.h new file mode 100644 index 0000000000..10ffa8cb81 --- /dev/null +++ b/protocols/GTalkExt/handlers.h @@ -0,0 +1,27 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#pragma once + +extern HANDLE hModulesLoaded; + +int ModulesLoaded(WPARAM wParam, LPARAM lParam); +int AccListChanged(WPARAM wParam, LPARAM lParam); \ No newline at end of file diff --git a/protocols/GTalkExt/inbox.cpp b/protocols/GTalkExt/inbox.cpp new file mode 100644 index 0000000000..9317fbc6cf --- /dev/null +++ b/protocols/GTalkExt/inbox.cpp @@ -0,0 +1,402 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#include "stdafx.h" +#include "inbox.h" +#include "notifications.h" +#include "db.h" +#include "options.h" + +static const LPTSTR COMMON_GMAIL_HOST1 = _T("gmail.com"); +static const LPTSTR COMMON_GMAIL_HOST2 = _T("googlemail.com"); + +static const LPSTR AUTH_REQUEST_URL = "https://www.google.com/accounts/ClientAuth"; +static const LPSTR AUTH_REQUEST_PARAMS = "Email=%s&Passwd=%s&" + "accountType=HOSTED_OR_GOOGLE&" + "skipvpage=true&" + "PersistentCookie=false"; + +static const LPSTR ISSUE_TOKEN_REQUEST_URL = "https://www.google.com/accounts/IssueAuthToken"; +static const LPSTR ISSUE_TOKEN_REQUEST_PARAMS = "SID=%s&LSID=%s&" + "Session=true&" + "skipvpage=true&" + "service=gaia"; + +static const LPSTR TOKEN_AUTH_URL = "https://www.google.com/accounts/TokenAuth?"\ + "auth=%s&" + "service=mail&" + "continue=%s&" + "source=googletalk"; + + +static const NETLIBHTTPHEADER HEADER_URL_ENCODED = {"Content-Type", "application/x-www-form-urlencoded"}; +static const int HTTP_OK = 200; + +static const LPSTR SID_KEY_NAME = "SID="; +static const LPSTR LSID_KEY_NAME = "LSID="; + +static const LPSTR LOGIN_PASS_SETTING_NAME = "LoginPassword"; + +static const LPTSTR INBOX_URL_FORMAT = _T("https://mail.google.com/%s%s/#inbox"); + +static const DWORD SIZE_OF_JABBER_OPTIONS = 243 * sizeof(DWORD); + +// 3 lines from netlib.h +#define GetNetlibHandleType(h) (h?*(int*)h:NLH_INVALID) +#define NLH_INVALID 0 +#define NLH_USER 'USER' + +char to_hex(char code) { + static char hex[] = "0123456789abcdef"; + return hex[code & 15]; +} + +char *url_encode(char *str) { + char *pstr = str, *buf = (char*)malloc(strlen(str) * 3 + 1), *pbuf = buf; + while (*pstr) { + if (isalnum(*pstr) || *pstr == '-' || *pstr == '_' || *pstr == '.' || *pstr == ',' || *pstr == '~') + *pbuf++ = *pstr; + else if (*pstr == ' ') + *pbuf++ = '+'; + else + *pbuf++ = '%', *pbuf++ = to_hex(*pstr >> 4), *pbuf++ = to_hex(*pstr & 15); + pstr++; + } + *pbuf = '\0'; + return buf; +} + +LPSTR HttpPost(HANDLE hUser, LPSTR reqUrl, LPSTR reqParams) +{ + NETLIBHTTPREQUEST nlhr = {0}; + nlhr.cbSize = sizeof(nlhr); + nlhr.requestType = REQUEST_POST; + nlhr.flags = NLHRF_GENERATEHOST | NLHRF_SMARTAUTHHEADER | NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMP | NLHRF_NODUMPHEADERS; + nlhr.szUrl = reqUrl; + nlhr.headers = (NETLIBHTTPHEADER*)&HEADER_URL_ENCODED; + nlhr.headersCount = 1; + nlhr.pData = reqParams; + nlhr.dataLength = lstrlenA(reqParams); + + NETLIBHTTPREQUEST *pResp = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hUser, (LPARAM)&nlhr); + if (!pResp) return NULL; + __try { + if (HTTP_OK == pResp->resultCode) + return _strdup(pResp->pData); + else + return NULL; + } + __finally { + CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pResp); + } +} + +LPSTR MakeRequest(HANDLE hUser, LPSTR reqUrl, LPSTR reqParamsFormat, LPSTR p1, LPSTR p2) +{ + LPSTR encodedP1 = url_encode(p1); + __try { + LPSTR encodedP2 = url_encode(p2); + __try { + LPSTR reqParams = (LPSTR)malloc(lstrlenA(reqParamsFormat) + 1 + lstrlenA(encodedP1) + lstrlenA(encodedP2)); + __try { + sprintf(reqParams, reqParamsFormat, encodedP1, encodedP2); + return HttpPost(hUser, reqUrl, reqParams); + } + __finally { + free(reqParams); + } + } + __finally { + free(encodedP2); + } + } + __finally { + free(encodedP1); + } +} + +LPSTR FindSid(LPSTR resp, LPSTR *LSID) +{ + LPSTR SID = strstr(resp, SID_KEY_NAME); + *LSID = strstr(resp, LSID_KEY_NAME); + if (!SID || !*LSID) return NULL; + + if (SID - 1 == *LSID) SID = strstr(SID + 1, SID_KEY_NAME); + if (!SID) return NULL; + + SID += lstrlenA(SID_KEY_NAME); + LPSTR term = strstr(SID, "\n"); + if (term) term[0] = 0; + + *LSID += lstrlenA(LSID_KEY_NAME); + term = strstr(*LSID, "\n"); + if (term) term[0] = 0; + + return SID; +} + +void DoOpenUrl(LPSTR tokenResp, LPSTR url) +{ + LPSTR encodedUrl = url_encode(url); + __try { + LPSTR encodedToken = url_encode(tokenResp); + __try { + LPSTR composedUrl = (LPSTR)malloc(lstrlenA(TOKEN_AUTH_URL) + 1 + lstrlenA(encodedToken) + lstrlenA(encodedUrl)); + __try { + sprintf(composedUrl, TOKEN_AUTH_URL, encodedToken, encodedUrl); + ShellExecuteA(0, NULL, composedUrl, NULL, NULL, SW_SHOW); + } + __finally { + free(composedUrl); + } + } + __finally { + free(encodedToken); + } + } + __finally { + free(encodedUrl); + } +} + +BOOL AuthAndOpen(HANDLE hUser, LPSTR url, LPSTR mailbox, LPSTR pwd) +{ + LPSTR authResp = MakeRequest(hUser, AUTH_REQUEST_URL, AUTH_REQUEST_PARAMS, mailbox, pwd); + if (!authResp) return FALSE; + + __try { + LPSTR LSID; + LPSTR SID = FindSid(authResp, &LSID); + LPSTR tokenResp = MakeRequest(hUser, ISSUE_TOKEN_REQUEST_URL, ISSUE_TOKEN_REQUEST_PARAMS, SID, LSID); + if (!tokenResp) return FALSE; + + __try { + DoOpenUrl(tokenResp, url); + return TRUE; + } + __finally { + free(tokenResp); + } + } + __finally { + free(authResp); + } +} + +struct OPEN_URL_HEADER { + LPSTR url; + LPSTR mailbox; + LPSTR pwd; + LPCSTR acc; +}; + +HANDLE FindNetUserHandle(LPCSTR acc) +{ + IJabberInterface *ji = getJabberApi(acc); + if (!ji) return NULL; + + PBYTE m_psProto = *(PBYTE*)((PBYTE)ji + sizeof(*ji)); // see CJabberInterface in jabber_proto.h + + PHANDLE pResult = (PHANDLE)(m_psProto + // see CJabberProto in jabber_proto.h + sizeof(PVOID) + // skip vtable ptr + sizeof(PVOID) + // skip m_ThreadInfo + SIZE_OF_JABBER_OPTIONS); // skip m_options + + for (int i=0; i < 100; i++) { + __try { + if (GetNetlibHandleType(*pResult) == NLH_USER) + break; + } + __except (EXCEPTION_EXECUTE_HANDLER){ + } + pResult++; + } + + assert(GetNetlibHandleType(*pResult) == NLH_USER); + return *pResult; +} + +unsigned __stdcall OpenUrlThread(OPEN_URL_HEADER* data) +{ + __try { + HANDLE hUser = FindNetUserHandle(data->acc); + if (!hUser || !AuthAndOpen(hUser, data->url, data->mailbox, data->pwd)) + ShellExecuteA(0, NULL, data->url, NULL, NULL, SW_SHOW); + } + __finally { + free(data); + } + return 0; +} + +void __forceinline DecryptString(LPSTR str, int len) +{ + for (--len; len >= 0; len--) + { + const char c = str[len] ^ 0xc3; + if (c) str[len] = c; + } +} + +int GetMailboxPwd(LPCSTR acc, LPCTSTR mailbox, LPSTR *pwd, int buffSize) +{ + char buff[256]; + + DBCONTACTGETSETTING cgs; + DBVARIANT dbv; + cgs.szModule = acc; + cgs.szSetting = LOGIN_PASS_SETTING_NAME; + cgs.pValue = &dbv; + dbv.type = DBVT_ASCIIZ; + dbv.pszVal = &buff[0]; + dbv.cchVal = sizeof(buff); + if (CallService(MS_DB_CONTACT_GETSETTINGSTATIC, 0, (LPARAM)&cgs)) + return 0; + + int result = dbv.cchVal; + + if (pwd) { + if (buffSize < result + 1) result = buffSize - 1; + memcpy(*pwd, &buff, result + 1); + DecryptString(*pwd, result); + } + + return result; +} + +BOOL OpenUrlWithAuth(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url) +{ + int pwdLen = GetMailboxPwd(acc, mailbox, NULL, 0); + if (!pwdLen++) return FALSE; + + int urlLen = lstrlen(url) + 1; + int mailboxLen = lstrlen(mailbox) + 1; + + OPEN_URL_HEADER *data = (OPEN_URL_HEADER*)malloc(sizeof(OPEN_URL_HEADER) + urlLen + mailboxLen + pwdLen); + __try { + data->url = (LPSTR)data + sizeof(OPEN_URL_HEADER); + LPSTR ansi = WtoA(url); + __try { + memcpy(data->url, ansi, urlLen); + } + __finally { + free(ansi); + } + + data->mailbox = data->url + urlLen; + ansi = WtoA(mailbox); + __try { + memcpy(data->mailbox, ansi, mailboxLen); + } + __finally { + free(ansi); + } + + data->pwd = data->mailbox + mailboxLen; + if (!GetMailboxPwd(acc, mailbox, &data->pwd, pwdLen)) return FALSE; + + data->acc = acc; + + if (HANDLE h = mir_forkthreadex((pThreadFuncEx)OpenUrlThread, data, 0, NULL)) { + CloseHandle(h); + data = NULL; + } + else return FALSE; + } + __finally { + free(data); + } + + return TRUE; +} + +unsigned __stdcall ShellExecuteThread(PVOID param) +{ + __try { + ShellExecute(0, NULL, (LPTSTR)param, NULL, NULL, SW_SHOW); + } + __finally { + free(param); + } + return 0; +} + +void StartShellExecuteThread(LPCTSTR url) +{ + LPTSTR urlCopy = _tcsdup(url); + __try { + if (HANDLE h = mir_forkthreadex(ShellExecuteThread, urlCopy, 0, NULL)) { + CloseHandle(h); + urlCopy = NULL; + } + } + __finally { + free(urlCopy); + } +} + +void OpenUrl(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url) +{ + extern DWORD itlsSettings; + if (!ReadCheckbox(0, IDC_AUTHONMAILBOX, (DWORD)TlsGetValue(itlsSettings)) || + !OpenUrlWithAuth(acc, mailbox, url)) + StartShellExecuteThread(url); +} + +LPTSTR CraftInboxUrl(LPTSTR jid) +{ + LPTSTR host = _tcsstr(jid, _T("@")) + 1; + + LPTSTR result = (LPTSTR)malloc((lstrlen(INBOX_URL_FORMAT) + 1 + lstrlen(jid)) * sizeof(TCHAR)); + __try { + if (lstrcmpi(host, COMMON_GMAIL_HOST1) && lstrcmpi(host, COMMON_GMAIL_HOST2)) + wsprintf(result, INBOX_URL_FORMAT, _T("a/"), host); // hosted + else + wsprintf(result, INBOX_URL_FORMAT, NULL, _T("mail")); // common + } + __except ( + free(result), + EXCEPTION_CONTINUE_SEARCH + ) {} + + return result; +} + +void OpenContactInbox(HANDLE hContact) +{ + LPSTR acc = (LPSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + if (!acc) return; + + DBVARIANT dbv; + if (!DBGetContactSettingTString(0, acc, "jid", &dbv)) + __try { + LPTSTR url = CraftInboxUrl(dbv.ptszVal); + __try { + OpenUrl(acc, dbv.ptszVal, url); + } + __finally { + free(url); + } + } + __finally { + DBFreeVariant(&dbv); + } +} \ No newline at end of file diff --git a/protocols/GTalkExt/inbox.h b/protocols/GTalkExt/inbox.h new file mode 100644 index 0000000000..0b00128ab9 --- /dev/null +++ b/protocols/GTalkExt/inbox.h @@ -0,0 +1,25 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#pragma once + +void OpenUrl(LPCSTR acc, LPCTSTR mailbox, LPCTSTR url); +void OpenContactInbox(HANDLE hContact); \ No newline at end of file diff --git a/protocols/GTalkExt/menu.cpp b/protocols/GTalkExt/menu.cpp new file mode 100644 index 0000000000..fc1a2f5503 --- /dev/null +++ b/protocols/GTalkExt/menu.cpp @@ -0,0 +1,95 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#include "stdafx.h" +#include "menu.h" +#include "resources.h" +#include "options.h" +#include "inbox.h" + +static const LPSTR MS_GTALKEXT_OPENMAILBOX = SHORT_PLUGIN_NAME "/OpenMailbox"; +static const LPTSTR _T(OPEN_MAILBOX_ITEM_CAPTION) = _T("Open mailbox"); + +HANDLE hOpenMailboxService = 0; +HANDLE hOpenMailboxMenuItem = 0; +HANDLE hOnPrebuildMenu = 0; + +INT_PTR OpenMailboxMenuHandler(WPARAM wParam, LPARAM lParam) +{ + if (DBGetContactSettingByte((HANDLE)wParam, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) + OpenContactInbox((HANDLE)wParam); + return 0; +} + +int OnPrebuildMenu(WPARAM wParam, LPARAM lParam) +{ + CLISTMENUITEM cmi = {0}; + cmi.cbSize = sizeof(cmi); + cmi.flags = CMIM_FLAGS; + if (!DBGetContactSettingByte((HANDLE)wParam, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) + cmi.flags |= CMIF_HIDDEN; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hOpenMailboxMenuItem, (LPARAM)&cmi); + return 0; +} + +BOOL InitMenus(BOOL init) +{ + if (init) { + hOpenMailboxService = (HANDLE)CreateServiceFunction(MS_GTALKEXT_OPENMAILBOX, OpenMailboxMenuHandler); + if (!hOpenMailboxService) { + InitMenus(FALSE); + return FALSE; + } + + extern HICON g_hPopupIcon; + + CLISTMENUITEM cmi = {0}; + cmi.cbSize = sizeof(cmi); + cmi.flags = CMIF_TCHAR; + cmi.hIcon = g_hPopupIcon; + cmi.ptszName = _T(OPEN_MAILBOX_ITEM_CAPTION); + cmi.pszService = MS_GTALKEXT_OPENMAILBOX; + hOpenMailboxMenuItem = (HANDLE)CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM)&cmi); + + if (!hOpenMailboxMenuItem) { + InitMenus(FALSE); + return FALSE; + } + + hOnPrebuildMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildMenu); + if (!hOnPrebuildMenu) { + InitMenus(FALSE); + return FALSE; + } + } + else { + if (hOnPrebuildMenu) { + UnhookEvent(hOnPrebuildMenu); + hOnPrebuildMenu = 0; + } + if (hOpenMailboxService) { + DestroyServiceFunction(hOpenMailboxService); + hOpenMailboxService = 0; + } + } + + return TRUE; +} \ No newline at end of file diff --git a/protocols/GTalkExt/menu.h b/protocols/GTalkExt/menu.h new file mode 100644 index 0000000000..c06457672a --- /dev/null +++ b/protocols/GTalkExt/menu.h @@ -0,0 +1,24 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#pragma once + +BOOL InitMenus(BOOL init); \ No newline at end of file diff --git a/protocols/GTalkExt/notifications.cpp b/protocols/GTalkExt/notifications.cpp new file mode 100644 index 0000000000..70c15cee1b --- /dev/null +++ b/protocols/GTalkExt/notifications.cpp @@ -0,0 +1,414 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#include "StdAfx.h" +#include "notifications.h" +#include "db.h" +#include "options.h" +#include "avatar.h" +#include "inbox.h" + +static const LPTSTR TEMP_WINDOW_CLASS_NAME = _T("AntiShittyFullscreenDetectionWindowClass"); +static const LPTSTR _T(NUMBER_EMAILS_MESSAGE) = _T("You've received an e-mail\n%s unread threads"); + +static const LPTSTR PLUGIN_DATA_PROP_NAME = _T("{DB5CE833-C3AC-4851-831C-DDEBD9FA0508}"); +static const LPTSTR EVT_DELETED_HOOK_PROP_NAME = _T("{87CBD2BC-8806-413C-8FD5-1D61ABCA4AF8}"); + +#define EVENT_DELETED_MSG RegisterWindowMessage(_T("{B9B00536-86A0-4BCE-B2FE-4ABD409C22AE}")) +#define MESSAGE_CLOSEPOPUP RegisterWindowMessage(_T("{7A60EA87-3E77-41DF-8A69-59B147F0C9C6}")) + +static const LPSTR CLIST_MODULE_NAME = "CList"; +static const LPSTR CONTACT_DISPLAY_NAME_SETTING = "MyHandle"; +static const LPSTR STATUS_MSG_SETTING = "StatusMsg"; +static const LPSTR UNREAD_THREADS_SETTING = "UnreadThreads"; + +struct POPUP_DATA_HEADER { + BOOL MarkRead; + HANDLE hDbEvent; + HANDLE hContact; + LPTSTR jid; + LPTSTR url; +}; + +extern DWORD itlsSettings; +BOOL isOriginalPopups = FALSE; + +LRESULT CALLBACK WndProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_NCCREATE: + return 1; + + case WM_GETMINMAXINFO: + PMINMAXINFO info = (PMINMAXINFO)lParam; + info->ptMaxPosition.x = -100; + info->ptMaxPosition.y = -100; + info->ptMaxSize.x = 10; + info->ptMaxSize.y = 10; + info->ptMaxTrackSize.x = 10; + info->ptMaxTrackSize.y = 10; + info->ptMinTrackSize.x = 10; + info->ptMinTrackSize.y = 10; + return 0; + } + return DefWindowProc(wnd, msg, wParam, lParam); +} + +LPCSTR GetJidAcc(LPCTSTR jid) +{ + int count = 0; + PROTOCOLDESCRIPTOR **protos; + CallService(MS_PROTO_ENUMPROTOCOLS, (WPARAM)&count, (LPARAM)&protos); + + DBVARIANT dbv; + for (int i = 0; i < count; i++) + if (getJabberApi(protos[i]->szName)) + if (!DBGetContactSettingTString(0, protos[i]->szName, "jid", &dbv)) + __try { + if (!lstrcmpi(jid, dbv.ptszVal)) return protos[i]->szName; + } + __finally { + DBFreeVariant(&dbv); + } + + return NULL; +} + +void MarkEventRead(HANDLE hCnt, HANDLE hEvt) +{ + DWORD settings = (DWORD)TlsGetValue(itlsSettings); + if (ReadCheckbox(0, IDC_POPUPSENABLED, settings) && + ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, settings) && + ReadCheckbox(0, IDC_MARKEVENTREAD, settings) && + (CallService(MS_DB_EVENT_MARKREAD, (WPARAM)hCnt, (LPARAM)hEvt) != (INT_PTR)-1)) + CallService(MS_CLIST_REMOVEEVENT, (WPARAM)hCnt, (LPARAM)hEvt); + +} + +int OnEventDeleted(WPARAM hContact, LPARAM hDbEvent, LPARAM wnd) +{ + if (DBGetContactSettingByte((HANDLE)hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) { + CallService(MS_CLIST_REMOVEEVENT, hContact, hDbEvent); + PostMessage((HWND)wnd, EVENT_DELETED_MSG, hContact, hDbEvent); + } + + return 0; +} + +LRESULT CALLBACK PopupProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + if (EVENT_DELETED_MSG == msg) { + POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)PUGetPluginData(wnd); + if ((HANDLE)lParam == ppdh->hDbEvent) ppdh->hDbEvent = NULL; + return 0; + } + else + if (MESSAGE_CLOSEPOPUP == msg) { + POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)PUGetPluginData(wnd); + ppdh->MarkRead = TRUE; + PUDeletePopUp(wnd); + } + + switch (msg) { + case UM_INITPOPUP: { + POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)PUGetPluginData(wnd); + SetProp(wnd, PLUGIN_DATA_PROP_NAME, (HANDLE)ppdh); + SetProp(wnd, EVT_DELETED_HOOK_PROP_NAME, + HookEventParam(ME_DB_EVENT_DELETED, OnEventDeleted, (LPARAM)wnd)); + return 0; + } + + case UM_FREEPLUGINDATA: { + HANDLE hHook = GetProp(wnd, EVT_DELETED_HOOK_PROP_NAME); + RemoveProp(wnd, EVT_DELETED_HOOK_PROP_NAME); + UnhookEvent(hHook); + + LPCSTR acc = NULL; + POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)PUGetPluginData(wnd); + __try { + if (ppdh->MarkRead && ppdh->hDbEvent && (acc = GetJidAcc(ppdh->jid))) { + ReadNotificationSettings(acc); + MarkEventRead(ppdh->hContact, ppdh->hDbEvent); + CallService(MS_CLIST_REMOVEEVENT, (WPARAM)ppdh->hContact, (LPARAM)ppdh->hDbEvent); + } + + } + __finally { + RemoveProp(wnd, PLUGIN_DATA_PROP_NAME); + free(ppdh); + } + + return 0; + } + + case WM_LBUTTONUP: { + LPCSTR acc = NULL; + POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)PUGetPluginData(wnd); + __try { + if (!(acc = GetJidAcc(ppdh->jid))) return 0; + + ReadNotificationSettings(acc); + OpenUrl(acc, ppdh->jid, ppdh->url); + } + __finally { + CloseNotifications(acc, ppdh->url, ppdh->jid, TRUE); + } + return 0; + } + + case WM_RBUTTONUP: + SendMessage(wnd, MESSAGE_CLOSEPOPUP, 0, 0); + return 0; + } + return DefWindowProc(wnd, msg, wParam, lParam); +} + +HWND DoAddPopup(POPUPDATAT *data) +{ + WNDCLASS cls = {0}; + cls.lpfnWndProc = WndProc; + cls.lpszClassName = TEMP_WINDOW_CLASS_NAME; + + HWND result = 0; + HWND handle = 0; + __try { + if (ReadCheckbox(0, IDC_POPUPSINFULLSCREEN, (DWORD)TlsGetValue(itlsSettings))) { + RegisterClass(&cls); + handle = CreateWindowEx(WS_EX_TOOLWINDOW, TEMP_WINDOW_CLASS_NAME, NULL, WS_OVERLAPPED | WS_VISIBLE, + -100, -100, 10, 10, NULL, NULL, NULL, NULL); + if (handle) { + ShowWindow(handle, SW_MINIMIZE); + ShowWindow(handle, SW_RESTORE); + } + } + result = (HWND)CallService(MS_POPUP_ADDPOPUPT, (WPARAM) data, APF_RETURN_HWND); + } + __finally { + if (handle) DestroyWindow(handle); + } + + return result; +} + +void FormatPseudocontactDisplayName(LPTSTR buff, LPCTSTR jid, LPCTSTR unreadCount) +{ + if (lstrcmp(unreadCount, _T("0"))) + wsprintf(buff, _T("%s [%s]"), jid, unreadCount); + else + wsprintf(buff, _T("%s"), jid); +} + +HANDLE SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTSTR displayName) +{ + HANDLE result = (HANDLE)DBGetContactSettingDword(0, acc, PSEUDOCONTACT_LINK, 0); + if (!result || !DBGetContactSettingByte(result, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) { + result = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + DBWriteContactSettingDword(0, acc, PSEUDOCONTACT_LINK, (DWORD)result); + DBWriteContactSettingByte(result, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 1); + CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)result, (LPARAM)acc); + } + + SetAvatar(result); + + BOOL allocateName = !displayName; + __try { + if (allocateName) { + displayName = (LPCTSTR)malloc((lstrlen(jid) + lstrlen(unreadCount) + 3 + 1) * sizeof(TCHAR)); + FormatPseudocontactDisplayName((LPTSTR)displayName, jid, unreadCount); + } + + DBWriteContactSettingTString(result, CLIST_MODULE_NAME, CONTACT_DISPLAY_NAME_SETTING, displayName); + } + __finally { + if (allocateName) free((PVOID)displayName); + } + + DBWriteContactSettingTString(result, CLIST_MODULE_NAME, STATUS_MSG_SETTING, TranslateT(MAIL_NOTIFICATIONS)); + DBWriteContactSettingTString(result, SHORT_PLUGIN_NAME, UNREAD_THREADS_SETTING, unreadCount); + + return result; +} + +HANDLE AddCListNotification(HANDLE hContact, LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount) +{ + int lurl = (lstrlen(url) + 1) * sizeof(WCHAR); + LPSTR utf8 = (LPSTR)malloc(sizeof(data->lptzText) + sizeof(WCHAR) * 2 + lurl); + __try { + DBEVENTINFO dbei = {0}; + + dbei.cbBlob = WideCharToMultiByte(CP_UTF8, 0, &data->lptzText[0], -1, utf8, sizeof(data->lptzText), NULL, NULL) - 1; + + if (utf8[dbei.cbBlob - 1] != 10) { + utf8[dbei.cbBlob++] = 13; + utf8[dbei.cbBlob++] = 10; + } + + dbei.cbBlob += WideCharToMultiByte(CP_UTF8, 0, url, -1, utf8 + dbei.cbBlob, lurl, NULL, NULL); + + dbei.pBlob = (PBYTE)utf8; + dbei.cbSize = sizeof(dbei); + dbei.szModule = (LPSTR)acc; + dbei.timestamp = time(NULL); + dbei.flags = DBEF_UTF; + dbei.eventType = EVENTTYPE_MESSAGE; + return (HANDLE)CallService(MS_DB_EVENT_ADD, (WPARAM)hContact, (LPARAM)&dbei); + } + __finally { + free(utf8); + } +} + +BOOL UsePopups() +{ + return ServiceExists(MS_POPUP_QUERY) && + CallService(MS_POPUP_QUERY, PUQS_GETSTATUS, 0) && + ReadCheckbox(0, IDC_POPUPSENABLED, (DWORD)TlsGetValue(itlsSettings)); +} + +void ShowNotification(LPCSTR acc, POPUPDATAT *data, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount) +{ + HANDLE hCnt = SetupPseudocontact(jid, unreadCount, acc, &data->lptzContactName[0]); + HANDLE hEvt = ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, (DWORD)TlsGetValue(itlsSettings)) + ? AddCListNotification(hCnt, acc, data, jid, url, unreadCount) : NULL; + + if (!UsePopups()) return; + + extern HICON g_hPopupIcon; + data->lchIcon = g_hPopupIcon; + data->iSeconds = (int)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0); + data->colorBack = (COLORREF)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0); + data->colorText = (COLORREF)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0); + if (data->colorBack == data->colorText) { + data->colorBack = 0; + data->colorText = 0; + } + + data->PluginWindowProc = PopupProc; + int lurl = (lstrlen(url) + 1) * sizeof(TCHAR); + int ljid = (lstrlen(jid) + 1) * sizeof(TCHAR); + data->PluginData = malloc(sizeof(POPUP_DATA_HEADER) + lurl + ljid); + __try { + POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)data->PluginData; + + ppdh->MarkRead = FALSE; + ppdh->hContact = hCnt; + ppdh->hDbEvent = hEvt; + + ppdh->jid = (LPTSTR)((PBYTE)ppdh + sizeof(*ppdh)); + memcpy(ppdh->jid, jid, ljid); + + ppdh->url = (LPTSTR)((PBYTE)ppdh->jid + ljid); + memcpy(ppdh->url, url, lurl); + + HWND code = DoAddPopup(data); + if ((code == (HWND)-1) || (isOriginalPopups && !code)) + return; + data->PluginData = NULL; // freed in popup wndproc + } + __finally { + free(data->PluginData); + } +} + +void UnreadMailNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount) +{ + POPUPDATAT data = {0}; + + FormatPseudocontactDisplayName(&data.lptzContactName[0], jid, unreadCount); + wsprintf(&data.lptzText[0], TranslateT(NUMBER_EMAILS_MESSAGE), unreadCount); + + ShowNotification(acc, &data, jid, url, unreadCount); +} + +void UnreadThreadNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount, const MAIL_THREAD_NOTIFICATION *mtn) +{ + POPUPDATAT data = {0}; + + FormatPseudocontactDisplayName(&data.lptzContactName[0], jid, unreadCount); + LPTSTR senders = (LPTSTR)malloc(SENDER_COUNT * 100 * sizeof(TCHAR)); + LPTSTR currSender = senders; + __try { + for (int i = 0; i < SENDER_COUNT && mtn->senders[i].addr; i++) { + wsprintf(currSender, _T(" %s <%s>\n"), mtn->senders[i].name, mtn->senders[i].addr); + currSender += lstrlen(currSender); + } + + if (ReadCheckbox(0, IDC_ADDSNIP, (DWORD)TlsGetValue(itlsSettings))) + wsprintf(&data.lptzText[0], TranslateT(FULL_NOTIFICATION_FORMAT), mtn->subj, senders, mtn->snip); + else + wsprintf(&data.lptzText[0], TranslateT(SHORT_NOTIFICATION_FORMAT), mtn->subj, senders); + } + __finally { + free(senders); + } + + ShowNotification(acc, &data, jid, url, unreadCount); +} + +void ClearNotificationContactHistory(LPCSTR acc) +{ + HANDLE hEvent = 0; + HANDLE hContact = (HANDLE)DBGetContactSettingDword(0, acc, PSEUDOCONTACT_LINK, 0); + if (hContact && DBGetContactSettingByte(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) + while ((hEvent = (HANDLE)CallService(MS_DB_EVENT_FINDLAST, (WPARAM)hContact, 0)) && + !CallService(MS_DB_EVENT_DELETE, (WPARAM)hContact, (LPARAM)hEvent)){}; +} + +DWORD ReadNotificationSettings(LPCSTR acc) +{ + DWORD result = ReadCheckboxes(0, acc); + TlsSetValue(itlsSettings, (PVOID)result); + return result; +} + +struct POPUP_IDENT_STRINGS { + LPCTSTR url; + LPCTSTR jid; +}; + +BOOL CALLBACK ClosePopupFunc(__in HWND hwnd, __in LPARAM lParam) +{ + DWORD pid = 0; + GetWindowThreadProcessId(hwnd, &pid); + if (pid != GetCurrentProcessId()) return TRUE; + + POPUP_IDENT_STRINGS *ppis = (POPUP_IDENT_STRINGS*)lParam; + POPUP_DATA_HEADER *ppdh = (POPUP_DATA_HEADER*)GetProp(hwnd, PLUGIN_DATA_PROP_NAME); + if (!ppdh) return TRUE; + + if (!lstrcmpi(ppis->url, ppdh->url) && !lstrcmpi(ppis->jid, ppdh->jid)) + SendMessage(hwnd, MESSAGE_CLOSEPOPUP, 0, 0); + + return TRUE; +} + +void CloseNotifications(LPCSTR acc, LPCTSTR url, LPCTSTR jid, BOOL PopupsOnly) +{ + DWORD settings = (DWORD)TlsGetValue(itlsSettings); + if (acc && + !PopupsOnly && + ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, settings) && + ReadCheckbox(0, IDC_CLEARPSEUDOCONTACTLOG, settings)) + ClearNotificationContactHistory(acc); + + POPUP_IDENT_STRINGS pis = {url, jid}; + EnumWindows(ClosePopupFunc, (LPARAM)&pis); +} \ No newline at end of file diff --git a/protocols/GTalkExt/notifications.h b/protocols/GTalkExt/notifications.h new file mode 100644 index 0000000000..94d6e6353f --- /dev/null +++ b/protocols/GTalkExt/notifications.h @@ -0,0 +1,42 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#pragma once + +static const int SENDER_COUNT = 10; + +struct SENDER { + LPCTSTR name; + LPCTSTR addr; +}; + +struct MAIL_THREAD_NOTIFICATION { + LPCTSTR subj; + LPCTSTR snip; + SENDER senders[SENDER_COUNT]; +}; + +void UnreadMailNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount); +void UnreadThreadNotification(LPCSTR acc, LPCTSTR jid, LPCTSTR url, LPCTSTR unreadCount, const MAIL_THREAD_NOTIFICATION *mtn); +void CloseNotifications(LPCSTR acc, LPCTSTR url, LPCTSTR jid, BOOL PopupsOnly); +DWORD ReadNotificationSettings(LPCSTR acc); +HANDLE SetupPseudocontact(LPCTSTR jid, LPCTSTR unreadCount, LPCSTR acc, LPCTSTR displayName = NULL); +LPCSTR GetJidAcc(LPCTSTR jid); \ No newline at end of file diff --git a/protocols/GTalkExt/options.cpp b/protocols/GTalkExt/options.cpp new file mode 100644 index 0000000000..c7321de8a8 --- /dev/null +++ b/protocols/GTalkExt/options.cpp @@ -0,0 +1,297 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#include "stdafx.h" +#include "options.h" + +static const LPTSTR ACCOUNT_PROP_NAME = _T("{BF447EBA-27AE-4DB7-893C-FC42A3F74D75}"); +static const LPTSTR DIALOG_INITIALIZED_PROP_NAME = _T("{5EE59FE5-679A-4A29-B0A1-03092E7AC20E}"); + +static const LPTSTR POPUPS_OPTIONS_GROUP = _T("Popups"); +static const LPTSTR NETWORK_OPTIONS_GROUP = _T("Network"); + +static const LPSTR NOTIFY_SETTINGS_FROM_MOD_NAME = SHORT_PLUGIN_NAME ".NotifySettingsFromModName"; + +static const LPTSTR TEST_LETTER_SUBJECT = _T("Why C sucks"); +static const LPTSTR TEST_LETTER_INBOX = _T("brickstrace@gmail.com [1]"); +static const LPTSTR TEST_LETTER_SENDER = _T(" bems \n"); +static const LPTSTR TEST_LETTER_SNIP = + _T("* Primitive type system\n") + _T("* No overloading\n") + _T("* Limited possibility of data abstraction, polymorphism, subtyping and code reuse\n") + _T("* No metaprogramming except preprocessor macros\n") + _T("* No exceptions"); + +HANDLE hOptionsHook = 0; +extern HINSTANCE hInst; + +void CheckControlsEnabled(HWND wnd) +{ + BOOL PopupsEnabled = (SendMessage(GetDlgItem(wnd, IDC_POPUPSENABLED), BM_GETSTATE, 0, 0) & BST_CHECKED) == BST_CHECKED; + EnableWindow(GetDlgItem(wnd, IDC_POPUPSINFULLSCREEN), PopupsEnabled); + EnableWindow(GetDlgItem(wnd, IDC_POPUPSINFULLSCREENLABEL), PopupsEnabled); + + BOOL CListEnabled = (SendMessage(GetDlgItem(wnd, IDC_PSEUDOCONTACTENABLED), BM_GETSTATE, 0, 0) & BST_CHECKED) == BST_CHECKED; + EnableWindow(GetDlgItem(wnd, IDC_CLEARPSEUDOCONTACTLOG), CListEnabled); + EnableWindow(GetDlgItem(wnd, IDC_SUPRESSFOREIGN), CListEnabled); + + EnableWindow(GetDlgItem(wnd, IDC_MARKEVENTREAD), PopupsEnabled && CListEnabled); + EnableWindow(GetDlgItem(wnd, IDC_ADDSNIP), PopupsEnabled || CListEnabled); + + EnableWindow(GetDlgItem(wnd, IDC_MAILBOXVIEWLABEL), PopupsEnabled || CListEnabled); + EnableWindow(GetDlgItem(wnd, IDC_UNKNOWNVIEW), PopupsEnabled || CListEnabled); + EnableWindow(GetDlgItem(wnd, IDC_STANDARDVIEW), PopupsEnabled || CListEnabled); + EnableWindow(GetDlgItem(wnd, IDC_HTMLVIEW), PopupsEnabled || CListEnabled); +} + +BOOL ReadCheckbox(HWND wnd, int id, DWORD controls) +{ + BOOL result = ((controls >> (id - IDC_BASE)) & 1); + if (id != IDC_STANDARDVIEW && id != IDC_HTMLVIEW) result = !result; + if (wnd) Button_SetCheck(GetDlgItem(wnd, id), result); + return result; +} + +DWORD ReadCheckboxes(HWND wnd, LPCSTR mod) +{ + DWORD controls = DBGetContactSettingDword(0, NOTIFY_SETTINGS_FROM_MOD_NAME, mod, 0); + ReadCheckbox(wnd, IDC_POPUPSENABLED, controls); + ReadCheckbox(wnd, IDC_PSEUDOCONTACTENABLED, controls); + ReadCheckbox(wnd, IDC_CLEARPSEUDOCONTACTLOG, controls); + ReadCheckbox(wnd, IDC_POPUPSINFULLSCREEN, controls); + ReadCheckbox(wnd, IDC_SUPRESSFOREIGN, controls); + ReadCheckbox(wnd, IDC_MARKEVENTREAD, controls); + ReadCheckbox(wnd, IDC_AUTHONMAILBOX, controls); + ReadCheckbox(wnd, IDC_ADDSNIP, controls); + ReadCheckbox(wnd, IDC_UNKNOWNVIEW, controls); + ReadCheckbox(wnd, IDC_STANDARDVIEW, controls); + ReadCheckbox(wnd, IDC_HTMLVIEW, controls); + return controls; +} + +DWORD GetCheckboxSaveValue(HWND wnd, int id) +{ + BOOL val = Button_GetCheck(GetDlgItem(wnd, id)); + if (id != IDC_STANDARDVIEW && id != IDC_HTMLVIEW) val = !val; + return val ? (1 << (id - IDC_BASE)) : 0; +} + +void SaveControls(HWND wnd, LPCSTR mod) +{ + DWORD controls = GetCheckboxSaveValue(wnd, IDC_CLEARPSEUDOCONTACTLOG) | + GetCheckboxSaveValue(wnd, IDC_POPUPSINFULLSCREEN) | + GetCheckboxSaveValue(wnd, IDC_POPUPSENABLED) | + GetCheckboxSaveValue(wnd, IDC_PSEUDOCONTACTENABLED) | + GetCheckboxSaveValue(wnd, IDC_SUPRESSFOREIGN) | + GetCheckboxSaveValue(wnd, IDC_MARKEVENTREAD) | + GetCheckboxSaveValue(wnd, IDC_AUTHONMAILBOX) | + GetCheckboxSaveValue(wnd, IDC_ADDSNIP) | + GetCheckboxSaveValue(wnd, IDC_UNKNOWNVIEW) | + GetCheckboxSaveValue(wnd, IDC_STANDARDVIEW) | + GetCheckboxSaveValue(wnd, IDC_HTMLVIEW); + + DBWriteContactSettingDword(0, NOTIFY_SETTINGS_FROM_MOD_NAME, mod, controls); +} + +INT_PTR CALLBACK AccOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_INITDIALOG: + SetProp(wnd, ACCOUNT_PROP_NAME, (HANDLE)lParam); + TranslateDialogDefault(wnd); + ReadCheckboxes(wnd, (LPCSTR)lParam); + CheckControlsEnabled(wnd); + break; + + case WM_CTLCOLORSTATIC: + if (GetDlgItem(wnd, IDC_WARNBAR) == (HWND)lParam) + return (INT_PTR)CreateSolidBrush(0x55AAFF); // orange + break; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_POPUPSENABLED: + case IDC_PSEUDOCONTACTENABLED: + if (HIWORD(wParam) == BN_CLICKED) CheckControlsEnabled(wnd); + // no break + + case IDC_CLEARPSEUDOCONTACTLOG: + case IDC_POPUPSINFULLSCREEN: + case IDC_SUPRESSFOREIGN: + case IDC_MARKEVENTREAD: + case IDC_AUTHONMAILBOX: + case IDC_ADDSNIP: + case IDC_UNKNOWNVIEW: + case IDC_STANDARDVIEW: + case IDC_HTMLVIEW: + if (HIWORD(wParam) == BN_CLICKED) PropSheet_Changed(GetParent(wnd), wnd); + } + break; + + case WM_NOTIFY: + if (!((LPNMHDR)lParam)->idFrom && ((LPNMHDR)lParam)->code == PSN_APPLY) + SaveControls(wnd, (LPCSTR)GetProp(wnd, ACCOUNT_PROP_NAME)); + break; + } + return 0; +} + +void ShowTestPopup(HWND wnd) +{ + POPUPDATAT data = {0}; + wsprintf(&data.lptzContactName[0], TEST_LETTER_INBOX); + wsprintf(&data.lptzText[0], TranslateT(FULL_NOTIFICATION_FORMAT), + TEST_LETTER_SUBJECT, TEST_LETTER_SENDER, TEST_LETTER_SNIP); + + int len = SendMessage(GetDlgItem(wnd, IDC_TIMEOUTEDIT), WM_GETTEXTLENGTH, 0, 0) + 1; + LPTSTR timeout = (LPTSTR)malloc(len * sizeof(TCHAR)); + __try { + SendMessage(GetDlgItem(wnd, IDC_TIMEOUTEDIT), WM_GETTEXT, len, (LPARAM)timeout); + data.iSeconds = _ttoi(timeout); + } + __finally { + free(timeout); + } + + extern HICON g_hPopupIcon; + data.lchIcon = g_hPopupIcon; + data.colorBack = (COLORREF)SendMessage(GetDlgItem(wnd, IDC_BACKCOLORPICKER), CPM_GETCOLOUR, 0, 0); + data.colorText = (COLORREF)SendMessage(GetDlgItem(wnd, IDC_TEXTCOLORPICKER), CPM_GETCOLOUR, 0, 0); + if (data.colorBack == data.colorText) { + data.colorBack = 0; + data.colorText = 0; + } + CallService(MS_POPUP_ADDPOPUPT, (WPARAM)&data, 0); +} + +INT_PTR CALLBACK PopupsOptionsDlgProc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(wnd); + SendMessage(GetDlgItem(wnd, IDC_BACKCOLORPICKER), CPM_SETCOLOUR, 0, + (LPARAM)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, 0)); + SendMessage(GetDlgItem(wnd, IDC_TEXTCOLORPICKER), CPM_SETCOLOUR, 0, + (LPARAM)DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, 0)); + + {LPTSTR timeout = (LPTSTR)malloc(11 * sizeof(TCHAR)); + __try { + wsprintf(timeout, _T("%d"), DBGetContactSettingDword(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, 0)); + SendMessage(GetDlgItem(wnd, IDC_TIMEOUTEDIT), WM_SETTEXT, 0, (LPARAM)timeout); + } + __finally { + free(timeout); + }} + + SetProp(wnd, DIALOG_INITIALIZED_PROP_NAME, (HANDLE)TRUE); + break; + + case WM_COMMAND: + if (LOWORD(wParam) == IDC_TESTBUTTON && HIWORD(wParam) == BN_CLICKED) + ShowTestPopup(wnd); + + if (GetProp(wnd, DIALOG_INITIALIZED_PROP_NAME)) + switch (LOWORD(wParam)) { + case IDC_BACKCOLORPICKER: + case IDC_TEXTCOLORPICKER: + if (HIWORD(wParam) == CPN_COLOURCHANGED) PropSheet_Changed(GetParent(wnd), wnd); + break; + + case IDC_TIMEOUTEDIT: + if (HIWORD(wParam) == EN_CHANGE) PropSheet_Changed(GetParent(wnd), wnd); + } + break; + + case WM_NOTIFY: + if (!((LPNMHDR)lParam)->idFrom && ((LPNMHDR)lParam)->code == PSN_APPLY) + DBWriteContactSettingDword(0, SHORT_PLUGIN_NAME, BACK_COLOR_SETTING, + (DWORD)SendMessage(GetDlgItem(wnd, IDC_BACKCOLORPICKER), CPM_GETCOLOUR, 0, 0)); + DBWriteContactSettingDword(0, SHORT_PLUGIN_NAME, TEXT_COLOR_SETTING, + (DWORD)SendMessage(GetDlgItem(wnd, IDC_TEXTCOLORPICKER), CPM_GETCOLOUR, 0, 0)); + + int len = SendMessage(GetDlgItem(wnd, IDC_TIMEOUTEDIT), WM_GETTEXTLENGTH, 0, 0) + 1; + LPTSTR timeout = (LPTSTR)malloc(len * sizeof(TCHAR)); + __try { + SendMessage(GetDlgItem(wnd, IDC_TIMEOUTEDIT), WM_GETTEXT, len, (LPARAM)timeout); + DBWriteContactSettingDword(0, SHORT_PLUGIN_NAME, TIMEOUT_SETTING, _ttoi(timeout)); + } + __finally { + free(timeout); + } + break; + } + return 0; +} + +void AddPopupsPage(WPARAM wParam) +{ + OPTIONSDIALOGPAGE odp = {0}; + odp.cbSize = sizeof(odp); + odp.ptszTitle = _T(MAIL_NOTIFICATIONS); + odp.pfnDlgProc = PopupsOptionsDlgProc; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_POPUPSETTINGS); + odp.hInstance = hInst; + odp.ptszGroup = POPUPS_OPTIONS_GROUP; + odp.flags = ODPF_UNICODE | ODPF_USERINFOTAB; + + CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp); +} + +void AddAccPage(LPCTSTR acc, LPCSTR mod, WPARAM wParam) +{ + OPTIONSDIALOGPAGE odp = {0}; + odp.cbSize = sizeof(odp); + odp.pszTitle = (LPSTR)acc; + odp.pfnDlgProc = AccOptionsDlgProc; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_MAILSETTINGS); + odp.hInstance = hInst; + odp.ptszGroup = NETWORK_OPTIONS_GROUP; + odp.flags = ODPF_UNICODE | ODPF_USERINFOTAB; + odp.ptszTab =_T(MAIL_NOTIFICATIONS); + odp.dwInitParam = (LPARAM)mod; + + CallService(MS_OPT_ADDPAGE, wParam, (LPARAM)&odp); +} + +int OptionsInitialization(WPARAM wParam, LPARAM lParam) +{ + int count; + PROTOACCOUNT **accs; + CallService(MS_PROTO_ENUMACCOUNTS, (WPARAM)&count, (LPARAM)&accs); + for (int i = 0; i < count; i++) + if (getJabberApi(accs[i]->szModuleName)) AddAccPage(accs[i]->tszAccountName, accs[i]->szModuleName, wParam); + + if (ServiceExists(MS_POPUP_ADDPOPUPT)) AddPopupsPage(wParam); + return FALSE; +} + +BOOL HookOptionsInitialization() +{ + return (hOptionsHook = HookEvent(ME_OPT_INITIALISE, OptionsInitialization)) != 0; +} + +void UnhookOptionsInitialization() +{ + if (hOptionsHook) { + UnhookEvent(hOptionsHook); + hOptionsHook = 0; + } +} \ No newline at end of file diff --git a/protocols/GTalkExt/options.h b/protocols/GTalkExt/options.h new file mode 100644 index 0000000000..d213bcbb47 --- /dev/null +++ b/protocols/GTalkExt/options.h @@ -0,0 +1,39 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#pragma once + +#include "resources.h" + +static const LPTSTR _T(MAIL_NOTIFICATIONS) = _T("GMail notifications"); +static const LPTSTR _T(FULL_NOTIFICATION_FORMAT) = _T("subject\n %s\nfrom\n%s\n%s\n"); +static const LPTSTR _T(SHORT_NOTIFICATION_FORMAT) = _T("subject\n %s\nfrom\n%s"); + +static const LPSTR PSEUDOCONTACT_LINK = "GTalkExtNotifyContact"; +static const LPSTR PSEUDOCONTACT_FLAG = "IsNotifyContact"; +static const LPSTR BACK_COLOR_SETTING = "BackColor"; +static const LPSTR TEXT_COLOR_SETTING = "TextColor"; +static const LPSTR TIMEOUT_SETTING = "Timeout"; + +BOOL HookOptionsInitialization(); +void UnhookOptionsInitialization(); +DWORD ReadCheckboxes(HWND wnd, LPCSTR mod); +BOOL ReadCheckbox(HWND wnd, int id, DWORD controls); \ No newline at end of file diff --git a/protocols/GTalkExt/popups.cpp b/protocols/GTalkExt/popups.cpp new file mode 100644 index 0000000000..99ab94470b --- /dev/null +++ b/protocols/GTalkExt/popups.cpp @@ -0,0 +1,104 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#include "stdafx.h" +#include "popups.h" +#include "options.h" + +static const LPTSTR YAPP_WND_CLASS1 = _T("YAPPYAPPWindowClass"); +static const LPTSTR YAPP_WND_CLASS2 = _T("YAPPWinClass"); + +extern BOOL isOriginalPopups; + +LRESULT CALLBACK PopupHookProc(int nCode, WPARAM wParam, LPARAM lParam) +{ + PCWPRETSTRUCT cs = (PCWPRETSTRUCT)lParam; + if ((HC_ACTION == nCode) && + (WM_CREATE == cs->message) && + (-1 != cs->lResult) && + ServiceExists(MS_POPUP_GETCONTACT)) { + + // with YAPP we can't call MS_POPUP_GETCONTACT on a random window + TCHAR ClassName[32]; + GetClassName(cs->hwnd, ClassName, sizeof(ClassName) / sizeof(TCHAR)); + if (isOriginalPopups || + !lstrcmp(YAPP_WND_CLASS1, ClassName) || + !lstrcmp(YAPP_WND_CLASS2, ClassName)) { + + HANDLE hContact = (HANDLE)CallService(MS_POPUP_GETCONTACT, (WPARAM)cs->hwnd, 0); + if (hContact != (HANDLE)-1 && + hContact != (HANDLE)0x80000000 && + DBGetContactSettingByte(hContact, SHORT_PLUGIN_NAME, PSEUDOCONTACT_FLAG, 0)) { + LPCSTR proto = (LPCSTR)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + DWORD checkboxes = ReadCheckboxes(0, proto); + if (ReadCheckbox(0, IDC_PSEUDOCONTACTENABLED, checkboxes) && + ReadCheckbox(0, IDC_SUPRESSFOREIGN, checkboxes)) + PostMessage(cs->hwnd, WM_CLOSE, 0, 0); + } + } + } + return CallNextHookEx(0, nCode, wParam, lParam); +} + +typedef PLUGININFOEX* (MIRANDAPLUGININFOEX) (DWORD mirandaVersion); + +static GUID POPUP_GUID1 = {0x26a9125d, 0x7863, 0x4e01, {0xaf, 0xe, 0xd1, 0x4e, 0xf9, 0x5c, 0x50, 0x54}}; +static GUID POPUP_GUID2 = {0x26a9125d, 0x7863, 0x4e01, {0xaf, 0xe, 0xd1, 0x4e, 0xf9, 0x5c, 0x50, 0x53}}; + +DWORD g_mirandaVersion = 0; + +BOOL IsOriginalPopupModule(HMODULE hMod) +{ + MIRANDAPLUGININFOEX *MirandaPluginInfoEx = (MIRANDAPLUGININFOEX*)GetProcAddress(hMod, "MirandaPluginInfoEx"); + if (!MirandaPluginInfoEx) return FALSE; + + PLUGININFOEX *PluginInfoEx = MirandaPluginInfoEx(g_mirandaVersion); + if (!PluginInfoEx) return FALSE; + + GUID *guid1 = (GUID*)&PluginInfoEx->uuid; + GUID *guid2 = (GUID*)&POPUP_GUID1; + GUID *guid3 = (GUID*)&POPUP_GUID2; + return (IsEqualGUID(*guid1, *guid2) || IsEqualGUID(*guid1, *guid3)); +} + +extern BOOL isOriginalPopups; + +void DetectPopupModule() +{ + DWORD bytesNeeded; + if (!EnumProcessModules(GetCurrentProcess(), NULL, 0, &bytesNeeded)) + return; + + HMODULE *mods = (HMODULE*)malloc(bytesNeeded); + __try { + if (!EnumProcessModules(GetCurrentProcess(), mods, bytesNeeded, &bytesNeeded)) + return; + + for (DWORD i = 0; i < (bytesNeeded / sizeof(HMODULE)); i++) + if (IsOriginalPopupModule(mods[i])) { + isOriginalPopups = TRUE; + break; + } + } + __finally { + free(mods); + } +} diff --git a/protocols/GTalkExt/popups.h b/protocols/GTalkExt/popups.h new file mode 100644 index 0000000000..f9e142e0e6 --- /dev/null +++ b/protocols/GTalkExt/popups.h @@ -0,0 +1,25 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#pragma once + +LRESULT CALLBACK PopupHookProc(int nCode, WPARAM wParam, LPARAM lParam); +void DetectPopupModule(); \ No newline at end of file diff --git a/protocols/GTalkExt/res/PopupIcon.ico b/protocols/GTalkExt/res/PopupIcon.ico new file mode 100644 index 0000000000..7cf441be59 Binary files /dev/null and b/protocols/GTalkExt/res/PopupIcon.ico differ diff --git a/protocols/GTalkExt/res/pseudoava.png b/protocols/GTalkExt/res/pseudoava.png new file mode 100644 index 0000000000..26f7b8f2af Binary files /dev/null and b/protocols/GTalkExt/res/pseudoava.png differ diff --git a/protocols/GTalkExt/res/settings.rc b/protocols/GTalkExt/res/settings.rc new file mode 100644 index 0000000000..3e8eb0f0e0 --- /dev/null +++ b/protocols/GTalkExt/res/settings.rc @@ -0,0 +1,84 @@ +#include "resources.h" +#include "winres.h" +#include "m_utils.h" + +IDD_MAILSETTINGS DIALOGEX 0, 0, 304, 228 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +{ + CONTROL "", IDC_WARNBAR, STATIC, SS_LEFT, 30, 9, 3, 26 + CONTROL "NOTE\n\nThis will work only if this Jabber account is actually GTalk", IDC_NOTE, STATIC, SS_LEFT, 40, 9, 230, 26 + CONTROL "Popup notifications (needs popup plugin)", IDC_POPUPSENABLED, BUTTON, BS_AUTOCHECKBOX | WS_TABSTOP, 3, 36, 271, 14 + CONTROL "Notify in fullscreen mode too", IDC_POPUPSINFULLSCREEN, BUTTON, BS_AUTOCHECKBOX | WS_TABSTOP, 17, 51, 254, 15 + CONTROL "Use this if your popup plugin does not correctly detect fullscreen mode. It will take away your keyboard focus", IDC_POPUPSINFULLSCREENLABEL, STATIC, SS_LEFT, 30, 65, 270, 22 + CONTROL "Notify in contact list", IDC_PSEUDOCONTACTENABLED, BUTTON, BS_AUTOCHECKBOX | WS_TABSTOP, 3, 83, 271, 14 + CONTROL "Clear pseudocontact history before adding new events", IDC_CLEARPSEUDOCONTACTLOG, BUTTON, BS_AUTOCHECKBOX | WS_TABSTOP, 17, 97, 254, 15 + CONTROL "Supress foreign popups for pseudocontact", IDC_SUPRESSFOREIGN, BUTTON, BS_AUTOCHECKBOX | WS_TABSTOP, 17, 111, 254, 15 + CONTROL "Mark history event read when popup closed", IDC_MARKEVENTREAD, BUTTON, BS_AUTOCHECKBOX | WS_TABSTOP, 3, 128, 300, 15 + CONTROL "Add message snip to notification", IDC_ADDSNIP, BUTTON, BS_AUTOCHECKBOX | WS_TABSTOP, 3, 146, 300, 15 + CONTROL "Try to login before open mailbox", IDC_AUTHONMAILBOX, BUTTON, BS_AUTOCHECKBOX | WS_TABSTOP, 3, 164, 300, 15 + CONTROL "This works only if password is saved in the database. Has no effect on links in pseudocontact message log", IDC_AUTHONMAILBOXLABEL, STATIC, SS_LEFT, 15, 178, 280, 26 + CONTROL "Choose GMail view you use in web interface", IDC_MAILBOXVIEWLABEL, STATIC, SS_LEFT, 3, 200, 280, 15 + CONTROL "I don't know", IDC_UNKNOWNVIEW, BUTTON, BS_AUTORADIOBUTTON | WS_TABSTOP, 17, 212, 50, 8 + CONTROL "Standard view", IDC_STANDARDVIEW, BUTTON, BS_AUTORADIOBUTTON | WS_TABSTOP, 80, 212, 60, 8 + CONTROL "Basic HTML", IDC_HTMLVIEW, BUTTON, BS_AUTORADIOBUTTON | WS_TABSTOP, 150, 212, 60, 8 +} + +IDD_POPUPSETTINGS DIALOGEX 0, 0, 304, 55 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +{ + GROUPBOX "", IDC_GROUP, 0, 0, 304, 55 + CONTROL "Background color", IDC_BACKCOLORLABEL, STATIC, SS_LEFT, 10, 10, 60, 15 + CONTROL "", IDC_BACKCOLORPICKER, WNDCLASS_COLOURPICKER, WS_TABSTOP, 70, 10, 39, 10 + CONTROL "Text color", IDC_TEXTCOLORLABEL, STATIC, SS_LEFT, 10, 25, 50, 15 + CONTROL "", IDC_TEXTCOLORPICKER, WNDCLASS_COLOURPICKER, WS_TABSTOP, 70, 25, 39, 10 + CONTROL "Timeout", IDC_TIMEOUTLABEL, STATIC, SS_LEFT, 10, 40, 50, 13 + CONTROL "", IDC_TIMEOUTEDIT, EDIT, WS_TABSTOP | WS_BORDER | ES_NUMBER, 70, 40, 39, 10 + CONTROL "If both colors set to the same value, default colors will be used", IDC_DEFCOLORSLABEL, STATIC, SS_LEFT, 120, 10, 120, 25 + CONTROL "0 means default timeout", IDC_DEFTIMEOUTLABEL, STATIC, SS_LEFT, 120, 40, 120, 10 + CONTROL "Test", IDC_TESTBUTTON, BUTTON, WS_TABSTOP, 245, 17, 50, 25 +} + +LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US + + + + +VS_VERSION_INFO VERSIONINFO + FILEVERSION PLUGIN_FILE_VERSION + PRODUCTVERSION PLUGIN_FILE_VERSION + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +{ + BLOCK "StringFileInfo" + { + BLOCK "040904b0" + { + VALUE "FileDescription", PLUGIN_DESCRIPTION + VALUE "FileVersion", PLUGIN_VERSION_STRING + VALUE "InternalName", SHORT_PLUGIN_NAME + VALUE "LegalCopyright", COPYRIGHT_STRING + VALUE "OriginalFilename", SHORT_PLUGIN_NAME ".dll" + VALUE "PrivateBuild", "Yes" + VALUE "ProductName", PLUGIN_DESCRIPTION + VALUE "ProductVersion", PLUGIN_VERSION_STRING + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x409, 1200 + } +} + +IDI_POPUP ICON "res\\PopupIcon.ico" +IDI_PSEUDOAVA PNG "res\\pseudoava.png" \ No newline at end of file diff --git a/protocols/GTalkExt/resources.h b/protocols/GTalkExt/resources.h new file mode 100644 index 0000000000..d72e34dcef --- /dev/null +++ b/protocols/GTalkExt/resources.h @@ -0,0 +1,67 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#pragma once + +#define SHORT_PLUGIN_NAME "GTalkExt" + +#define IDD_MAILSETTINGS 2001 + +#define IDC_BASE 1001 +#define IDC_POPUPSENABLED IDC_BASE + 0 +#define IDC_PSEUDOCONTACTENABLED IDC_BASE + 1 +#define IDC_CLEARPSEUDOCONTACTLOG IDC_BASE + 2 +#define IDC_POPUPSINFULLSCREEN IDC_BASE + 3 +#define IDC_SUPRESSFOREIGN IDC_BASE + 4 +#define IDC_MARKEVENTREAD IDC_BASE + 5 +#define IDC_AUTHONMAILBOX IDC_BASE + 6 +#define IDC_ADDSNIP IDC_BASE + 7 +#define IDC_UNKNOWNVIEW IDC_BASE + 8 +#define IDC_STANDARDVIEW IDC_BASE + 9 +#define IDC_HTMLVIEW IDC_BASE + 10 +#define IDC_POPUPSINFULLSCREENLABEL IDC_BASE + 32 +#define IDC_NOTE IDC_BASE + 33 +#define IDC_WARNBAR IDC_BASE + 34 +#define IDC_AUTHONMAILBOXLABEL IDC_BASE + 35 +#define IDC_MAILBOXVIEWLABEL IDC_BASE + 36 + +#define IDD_POPUPSETTINGS 2002 + +#define IDC_BACKCOLORLABEL 1001 +#define IDC_BACKCOLORPICKER 1002 +#define IDC_TEXTCOLORLABEL 1003 +#define IDC_TEXTCOLORPICKER 1004 +#define IDC_TIMEOUTLABEL 1005 +#define IDC_TIMEOUTEDIT 1006 +#define IDC_DEFCOLORSLABEL 1007 +#define IDC_DEFTIMEOUTLABEL 1008 +#define IDC_TESTBUTTON 1009 +#define IDC_GROUP 1010 + +#define IDI_POPUP 3001 +#define IDI_PSEUDOAVA 3002 + +#define PLUGIN_VERSION_STRING "0.0.0.20 BETA" +#define PLUGIN_FILE_VERSION 0, 0, 0, 20 +#define PLUGIN_VERSION_DWORD PLUGIN_MAKE_VERSION(0, 0, 0, 20) + +#define PLUGIN_DESCRIPTION "GTalk extensions for Jabber protocol" +#define COPYRIGHT_STRING "2010, 11 bems" diff --git a/protocols/GTalkExt/stdafx.cpp b/protocols/GTalkExt/stdafx.cpp new file mode 100644 index 0000000000..bdf32c5876 --- /dev/null +++ b/protocols/GTalkExt/stdafx.cpp @@ -0,0 +1,25 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/protocols/GTalkExt/stdafx.h b/protocols/GTalkExt/stdafx.h new file mode 100644 index 0000000000..a5e11b980b --- /dev/null +++ b/protocols/GTalkExt/stdafx.h @@ -0,0 +1,75 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#define _CRT_SECURE_NO_WARNINGS + +#if defined( UNICODE ) && !defined( _UNICODE ) + #define _UNICODE +#endif + +#include +#include +#include +#include +#include + +// Windows Header Files: +#include +#include +#include +#include + +#include +#pragma comment(lib, "psapi.lib") + +#include + +// Miranda&Plugins API +#include +#include + +#pragma warning(push) +#pragma warning(disable:4996) + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#pragma warning(pop) + +#if _MSC_VER < 1400 + #define _tstoi64 _ttoi + #define _tcstoui64(A,B,C) _ttoi(A) +#endif + +#define WNDCLASS_COLOURPICKER _T("ColourPicker") \ No newline at end of file diff --git a/protocols/GTalkExt/targetver.h b/protocols/GTalkExt/targetver.h new file mode 100644 index 0000000000..710b0599f1 --- /dev/null +++ b/protocols/GTalkExt/targetver.h @@ -0,0 +1,47 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#pragma once + +// The following macros define the minimum required platform. The minimum required platform +// is the earliest version of Windows, Internet Explorer etc. that has the necessary features to run +// your application. The macros work by enabling all features available on platform versions up to and +// including the version specified. + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Specifies that the minimum required platform is Windows Vista. +#define WINVER 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista. +#define _WIN32_WINNT 0x0600 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINDOWS // Specifies that the minimum required platform is Windows 98. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Specifies that the minimum required platform is Internet Explorer 7.0. +#define _WIN32_IE 0x0700 // Change this to the appropriate value to target other versions of IE. +#endif + +#define MIRANDA_VER 0x800 diff --git a/protocols/GTalkExt/tipper_items.cpp b/protocols/GTalkExt/tipper_items.cpp new file mode 100644 index 0000000000..f09be10b32 --- /dev/null +++ b/protocols/GTalkExt/tipper_items.cpp @@ -0,0 +1,157 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#include "StdAfx.h" +#include "tipper_items.h" +#include "resources.h" + +static const int MAX_TIPPER_ITEM_PROP = 6 ; + +static const LPSTR VALUE_SETTING_PROP = "DIValue%d"; +static const LPSTR LABEL_SETTING_PROP = "DILabel%d"; + +static const LPSTR LAST_WRITTEN_LABEL_SETTING = "LastWrittenTipperLabel"; + +static LPSTR TipperItemProps[MAX_TIPPER_ITEM_PROP] = { + LABEL_SETTING_PROP, + "DILineAbove%d", + "DITipperVarsFirst%d", + "DIValNewline%d", + VALUE_SETTING_PROP, + "DIVisible%d" +}; + +static const LPSTR TIPPER_ITEMS_MOD_NAME = "Tipper_Items"; +static const LPSTR TIPPER_ITEM_COUNT_SETTING = "DINumValues"; +static const LPTSTR UNREAD_THREADS_RAW = _T("%raw:") _T(SHORT_PLUGIN_NAME) _T("/UnreadThreads%"); +static const LPTSTR UNREAD_THREADS_LABEL = _T("Unread threads:"); + +void ShiftTipperSettings(LPSTR buff, int count, LPSTR format) +{ + for (int i = count; i > 0; i--) { + DBCONTACTWRITESETTING cws; + DBCONTACTGETSETTING cgs; + cgs.szModule = TIPPER_ITEMS_MOD_NAME; + sprintf(buff, format, i - 1); + cgs.szSetting = buff; + cgs.pValue = &cws.value; + + if (CallService(MS_DB_CONTACT_GETSETTING, 0, (LPARAM)&cgs)) break; + __try { + if (DBVT_ASCIIZ == cws.value.type) { + DBFreeVariant(&cws.value); + cws.value.type = DBVT_WCHAR; + if (CallService(MS_DB_CONTACT_GETSETTING_STR, 0, (LPARAM)&cgs)) break; + } + + if (CallService(MS_DB_CONTACT_GETSETTING_STR, 0, (LPARAM)&cgs)) break; + + cws.szModule = TIPPER_ITEMS_MOD_NAME; + sprintf(buff, format, i); + cws.szSetting = buff; + CallService(MS_DB_CONTACT_WRITESETTING, 0, (LPARAM)&cws); + } + __finally { + DBFreeVariant(&cws.value); + } + } +} + +void SetLabelProp(int index, LPSTR setting) +{ + sprintf(setting, LABEL_SETTING_PROP, index); + + DBVARIANT dbv1 = {0}; + if (!DBGetContactSettingTString(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv1)) + __try { + DBVARIANT dbv2 = {0}; + if (!DBGetContactSettingTString(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, &dbv2)) + __try { + if (!lstrcmp(dbv1.ptszVal, dbv2.ptszVal)) { + LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL); + DBWriteContactSettingTString(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label); + DBWriteContactSettingTString(0, TIPPER_ITEMS_MOD_NAME, setting, label); + } + } + __finally { + DBFreeVariant(&dbv2); + } + } + __finally { + DBFreeVariant(&dbv1); + } +} + +void AddTipperItem() +{ + unsigned short itemCount = DBGetContactSettingWord(0, TIPPER_ITEMS_MOD_NAME, + TIPPER_ITEM_COUNT_SETTING , unsigned short(-1)); + if (unsigned short(-1) == itemCount) return; + + int i, l = 0; + for (i = itemCount; i > 0; i /= 10) l++; // var setting path + l += 30; // const setting part + + LPSTR setting = (LPSTR)malloc(l * sizeof(TCHAR)); + __try { + for (i = 0; i < itemCount; i++) { + sprintf(setting, VALUE_SETTING_PROP, i); + + DBVARIANT dbv = {0}; + if (!DBGetContactSettingTString(0, TIPPER_ITEMS_MOD_NAME, setting, &dbv)) + __try { + if (!lstrcmp(UNREAD_THREADS_RAW, dbv.ptszVal)) { + SetLabelProp(i, setting); + return; + } + } + __finally { + DBFreeVariant(&dbv); + } + } + + for (i = 0; i < MAX_TIPPER_ITEM_PROP; i++) + ShiftTipperSettings(setting, itemCount, TipperItemProps[i]); + + #define WRITE_TIPPER_PROP(type, index, value)\ + sprintf(setting, TipperItemProps[##index##], 0);\ + DBWriteContactSetting##type##(0, TIPPER_ITEMS_MOD_NAME, setting, ##value##) + + LPTSTR label = TranslateTS(UNREAD_THREADS_LABEL); + + DBWriteContactSettingTString(0, SHORT_PLUGIN_NAME, LAST_WRITTEN_LABEL_SETTING, label); + + WRITE_TIPPER_PROP(TString, 0, label); + WRITE_TIPPER_PROP(Byte, 1, 0); + WRITE_TIPPER_PROP(Byte, 2, 0); + WRITE_TIPPER_PROP(Byte, 3, 0); + WRITE_TIPPER_PROP(TString, 4, UNREAD_THREADS_RAW); + WRITE_TIPPER_PROP(Byte, 5, 1); + + #undef WRITE_TIPPER_PROP + } + __finally { + free(setting); + } + + DBWriteContactSettingWord(0, TIPPER_ITEMS_MOD_NAME, + TIPPER_ITEM_COUNT_SETTING, itemCount + 1); +} \ No newline at end of file diff --git a/protocols/GTalkExt/tipper_items.h b/protocols/GTalkExt/tipper_items.h new file mode 100644 index 0000000000..0b94d1fd24 --- /dev/null +++ b/protocols/GTalkExt/tipper_items.h @@ -0,0 +1,24 @@ +//*************************************************************************************** +// +// Google Extension plugin for the Miranda IM's Jabber protocol +// Copyright (c) 2011 bems@jabber.org, George Hazan (ghazan@jabber.ru) +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//*************************************************************************************** + +#pragma once + +void AddTipperItem(); \ No newline at end of file -- cgit v1.2.3