From e9bfd222064176e6084b57be778fe5ffee169703 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Sun, 7 Apr 2013 07:34:36 +0000 Subject: - YahooGroups added to MSVC 2010 solutions, added precompiled header, overal project adjustment git-svn-id: http://svn.miranda-ng.org/main/trunk@4355 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/YahooGroups/YahooGroups.cpp | 80 ---- plugins/YahooGroups/YahooGroups.rc | 98 ----- plugins/YahooGroups/YahooGroups.vcxproj | 187 --------- plugins/YahooGroups/YahooGroups.vcxproj.filters | 74 ---- plugins/YahooGroups/YahooGroups_10.vcxproj | 214 ++++++++++ plugins/YahooGroups/YahooGroups_10.vcxproj.filters | 74 ++++ plugins/YahooGroups/YahooGroups_11.vcxproj | 219 ++++++++++ plugins/YahooGroups/YahooGroups_11.vcxproj.filters | 74 ++++ plugins/YahooGroups/commonheaders.h | 59 --- plugins/YahooGroups/dlg_handlers.cpp | 84 ---- plugins/YahooGroups/dlg_handlers.h | 29 -- plugins/YahooGroups/hooked_events.cpp | 71 ---- plugins/YahooGroups/hooked_events.h | 36 -- plugins/YahooGroups/list.cpp | 106 ----- plugins/YahooGroups/list.h | 54 --- plugins/YahooGroups/res/YahooGroups.rc | 98 +++++ plugins/YahooGroups/res/version.rc | 100 +++++ plugins/YahooGroups/resource.h | 19 - plugins/YahooGroups/services.cpp | 213 ---------- plugins/YahooGroups/services.h | 39 -- plugins/YahooGroups/src/YahooGroups.cpp | 80 ++++ plugins/YahooGroups/src/commonheaders.h | 62 +++ plugins/YahooGroups/src/dlg_handlers.cpp | 84 ++++ plugins/YahooGroups/src/dlg_handlers.h | 29 ++ plugins/YahooGroups/src/hooked_events.cpp | 70 ++++ plugins/YahooGroups/src/hooked_events.h | 36 ++ plugins/YahooGroups/src/list.cpp | 106 +++++ plugins/YahooGroups/src/list.h | 54 +++ plugins/YahooGroups/src/resource.h | 19 + plugins/YahooGroups/src/services.cpp | 213 ++++++++++ plugins/YahooGroups/src/services.h | 39 ++ plugins/YahooGroups/src/stdafx.cpp | 18 + plugins/YahooGroups/src/utils.cpp | 453 ++++++++++++++++++++ plugins/YahooGroups/src/utils.h | 64 +++ plugins/YahooGroups/src/version.h | 45 ++ plugins/YahooGroups/utils.cpp | 454 --------------------- plugins/YahooGroups/utils.h | 64 --- plugins/YahooGroups/version.h | 45 -- plugins/YahooGroups/version.rc | 100 ----- 39 files changed, 2151 insertions(+), 1812 deletions(-) delete mode 100644 plugins/YahooGroups/YahooGroups.cpp delete mode 100644 plugins/YahooGroups/YahooGroups.rc delete mode 100644 plugins/YahooGroups/YahooGroups.vcxproj delete mode 100644 plugins/YahooGroups/YahooGroups.vcxproj.filters create mode 100644 plugins/YahooGroups/YahooGroups_10.vcxproj create mode 100644 plugins/YahooGroups/YahooGroups_10.vcxproj.filters create mode 100644 plugins/YahooGroups/YahooGroups_11.vcxproj create mode 100644 plugins/YahooGroups/YahooGroups_11.vcxproj.filters delete mode 100644 plugins/YahooGroups/commonheaders.h delete mode 100644 plugins/YahooGroups/dlg_handlers.cpp delete mode 100644 plugins/YahooGroups/dlg_handlers.h delete mode 100644 plugins/YahooGroups/hooked_events.cpp delete mode 100644 plugins/YahooGroups/hooked_events.h delete mode 100644 plugins/YahooGroups/list.cpp delete mode 100644 plugins/YahooGroups/list.h create mode 100644 plugins/YahooGroups/res/YahooGroups.rc create mode 100644 plugins/YahooGroups/res/version.rc delete mode 100644 plugins/YahooGroups/resource.h delete mode 100644 plugins/YahooGroups/services.cpp delete mode 100644 plugins/YahooGroups/services.h create mode 100644 plugins/YahooGroups/src/YahooGroups.cpp create mode 100644 plugins/YahooGroups/src/commonheaders.h create mode 100644 plugins/YahooGroups/src/dlg_handlers.cpp create mode 100644 plugins/YahooGroups/src/dlg_handlers.h create mode 100644 plugins/YahooGroups/src/hooked_events.cpp create mode 100644 plugins/YahooGroups/src/hooked_events.h create mode 100644 plugins/YahooGroups/src/list.cpp create mode 100644 plugins/YahooGroups/src/list.h create mode 100644 plugins/YahooGroups/src/resource.h create mode 100644 plugins/YahooGroups/src/services.cpp create mode 100644 plugins/YahooGroups/src/services.h create mode 100644 plugins/YahooGroups/src/stdafx.cpp create mode 100644 plugins/YahooGroups/src/utils.cpp create mode 100644 plugins/YahooGroups/src/utils.h create mode 100644 plugins/YahooGroups/src/version.h delete mode 100644 plugins/YahooGroups/utils.cpp delete mode 100644 plugins/YahooGroups/utils.h delete mode 100644 plugins/YahooGroups/version.h delete mode 100644 plugins/YahooGroups/version.rc (limited to 'plugins') diff --git a/plugins/YahooGroups/YahooGroups.cpp b/plugins/YahooGroups/YahooGroups.cpp deleted file mode 100644 index 38f5656335..0000000000 --- a/plugins/YahooGroups/YahooGroups.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* -YahooGroups plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 "commonheaders.h" - -char ModuleName[] = "YahooGroups"; -HINSTANCE hInstance; - -UINT currentCodePage = 0; -int hLangpack = 0; - -PLUGININFOEX pluginInfo = { - sizeof(PLUGININFOEX), - __PLUGIN_DISPLAY_NAME, - VERSION, - __DESC, - __AUTHOR, - __AUTHOREMAIL, - __COPYRIGHT, - __AUTHORWEB, - 0, //unicode aware - {0x2f3fe8b9, 0x7327, 0x4008, {0xa6, 0x0d, 0x93, 0xf0, 0xf4, 0xf7, 0xf0, 0xf1}} //{2f3fe8b9-7327-4008-a60d-93f0f4f7f0f1} -}; //not used - - -extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion) -{ - return &pluginInfo; -} - -extern "C" int __declspec(dllexport) Load() -{ - mir_getLP(&pluginInfo); - LogInit(); - - currentCodePage = (UINT) CallService(MS_LANGPACK_GETCODEPAGE, 0, 0); - - InitServices(); - - HookEvents(); - - return 0; -} - -extern "C" int __declspec(dllexport) Unload() -{ - DestroyServices(); - - UnhookEvents(); - - return 0; -} - -bool WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) -{ - hInstance = hinstDLL; - if (fdwReason == DLL_PROCESS_ATTACH) - { - DisableThreadLibraryCalls(hinstDLL); - } - - return TRUE; -} diff --git a/plugins/YahooGroups/YahooGroups.rc b/plugins/YahooGroups/YahooGroups.rc deleted file mode 100644 index aca5381683..0000000000 --- a/plugins/YahooGroups/YahooGroups.rc +++ /dev/null @@ -1,98 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_OPTIONS DIALOGEX 0, 0, 231, 46 -STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Dialog" -FONT 8, "MS Shell Dlg", 400, 0, 0x1 -BEGIN - PUSHBUTTON "Move yahoo contacts to groups now",IDC_YAHOOGROUPS,4,5,223,14 - CONTROL "Move Yahoo contacts automatically on startup",IDC_MOVEAUTOMATICALLY, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,25,223,10 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_OPTIONS, DIALOG - BEGIN - LEFTMARGIN, 4 - RIGHTMARGIN, 227 - TOPMARGIN, 5 - BOTTOMMARGIN, 42 - END -END -#endif // APSTUDIO_INVOKED - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/plugins/YahooGroups/YahooGroups.vcxproj b/plugins/YahooGroups/YahooGroups.vcxproj deleted file mode 100644 index bdcfeecaa2..0000000000 --- a/plugins/YahooGroups/YahooGroups.vcxproj +++ /dev/null @@ -1,187 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {0E73244B-30D7-4A62-B4B3-9A32B96EC1B7} - YahooGroups - Win32Proj - - - - DynamicLibrary - NotSet - true - - - DynamicLibrary - NotSet - true - - - DynamicLibrary - NotSet - - - DynamicLibrary - NotSet - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.40219.1 - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - true - true - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - false - false - - - - Disabled - _CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL;YAHOOGROUPS_EXPORTS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - - - true - Windows - MachineX86 - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin10\lib - - - - - Disabled - _CRT_SECURE_NO_DEPRECATE;WIN64;_DEBUG;_WINDOWS;_USRDLL;YAHOOGROUPS_EXPORTS;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - - - true - Windows - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin10\lib - - - - - MinSpace - Size - _CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL;YAHOOGROUPS_EXPORTS;%(PreprocessorDefinitions) - MultiThreaded - - - Level3 - ProgramDatabase - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - - - true - Windows - true - true - MachineX86 - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin10\lib - - - - - MinSpace - Size - _CRT_SECURE_NO_DEPRECATE;WIN64;NDEBUG;_WINDOWS;_USRDLL;YAHOOGROUPS_EXPORTS;%(PreprocessorDefinitions) - MultiThreaded - - - Level3 - ProgramDatabase - ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) - - - true - Windows - true - true - $(IntDir)$(TargetName).lib - $(ProfileDir)..\..\bin10\lib - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/plugins/YahooGroups/YahooGroups.vcxproj.filters b/plugins/YahooGroups/YahooGroups.vcxproj.filters deleted file mode 100644 index fdfc99125f..0000000000 --- a/plugins/YahooGroups/YahooGroups.vcxproj.filters +++ /dev/null @@ -1,74 +0,0 @@ - - - - - {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 - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Resource Files - - - Resource Files - - - - - - \ No newline at end of file diff --git a/plugins/YahooGroups/YahooGroups_10.vcxproj b/plugins/YahooGroups/YahooGroups_10.vcxproj new file mode 100644 index 0000000000..1a73cb5e3d --- /dev/null +++ b/plugins/YahooGroups/YahooGroups_10.vcxproj @@ -0,0 +1,214 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {0E73244B-30D7-4A62-B4B3-9A32B96EC1B7} + YahooGroups + Win32Proj + YahooGroups + + + + DynamicLibrary + NotSet + true + + + DynamicLibrary + NotSet + true + + + DynamicLibrary + NotSet + + + DynamicLibrary + NotSet + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + true + true + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + false + false + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + Use + Level3 + EditAndContinue + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + commonheaders.h + false + + + true + Windows + $(IntDir)$(TargetName).lib + $(ProfileDir)..\..\bin10\lib + false + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Disabled + WIN64;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + Use + Level3 + ProgramDatabase + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + commonheaders.h + false + + + true + Windows + $(IntDir)$(TargetName).lib + $(ProfileDir)..\..\bin10\lib + false + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Full + Size + WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + Use + Level3 + ProgramDatabase + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + commonheaders.h + true + true + OnlyExplicitInline + + + true + Windows + true + true + $(IntDir)$(TargetName).lib + $(ProfileDir)..\..\bin10\lib + false + /PDBALTPATH:%_PDB% %(AdditionalOptions) + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Full + Size + WIN64;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + Use + Level3 + ProgramDatabase + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + commonheaders.h + true + true + OnlyExplicitInline + + + true + Windows + true + true + $(IntDir)$(TargetName).lib + $(ProfileDir)..\..\bin10\lib + false + /PDBALTPATH:%_PDB% %(AdditionalOptions) + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + \ No newline at end of file diff --git a/plugins/YahooGroups/YahooGroups_10.vcxproj.filters b/plugins/YahooGroups/YahooGroups_10.vcxproj.filters new file mode 100644 index 0000000000..ced8752d3c --- /dev/null +++ b/plugins/YahooGroups/YahooGroups_10.vcxproj.filters @@ -0,0 +1,74 @@ + + + + + {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 + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + Resource Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/plugins/YahooGroups/YahooGroups_11.vcxproj b/plugins/YahooGroups/YahooGroups_11.vcxproj new file mode 100644 index 0000000000..c9b98c60be --- /dev/null +++ b/plugins/YahooGroups/YahooGroups_11.vcxproj @@ -0,0 +1,219 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {0E73244B-30D7-4A62-B4B3-9A32B96EC1B7} + YahooGroups + Win32Proj + YahooGroups + + + + DynamicLibrary + NotSet + v110_xp + true + + + DynamicLibrary + NotSet + v110_xp + true + + + DynamicLibrary + NotSet + v110_xp + + + DynamicLibrary + NotSet + v110_xp + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + true + true + $(SolutionDir)$(Configuration)\Plugins\ + $(SolutionDir)$(Configuration)64\Plugins\ + $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ + $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ + false + false + + + + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + Use + Level3 + EditAndContinue + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + commonheaders.h + false + + + true + Windows + $(IntDir)$(TargetName).lib + $(ProfileDir)..\..\bin11\lib + false + false + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Disabled + WIN64;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + Use + Level3 + ProgramDatabase + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + commonheaders.h + false + + + true + Windows + $(IntDir)$(TargetName).lib + $(ProfileDir)..\..\bin11\lib + false + + + _DEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Full + Size + WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + Use + Level3 + ProgramDatabase + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + commonheaders.h + true + true + OnlyExplicitInline + + + true + Windows + true + true + $(IntDir)$(TargetName).lib + $(ProfileDir)..\..\bin11\lib + false + /PDBALTPATH:%_PDB% %(AdditionalOptions) + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + Full + Size + WIN64;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + Use + Level3 + ProgramDatabase + ..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories) + commonheaders.h + true + true + OnlyExplicitInline + + + true + Windows + true + true + $(IntDir)$(TargetName).lib + $(ProfileDir)..\..\bin11\lib + false + /PDBALTPATH:%_PDB% %(AdditionalOptions) + + + NDEBUG;%(PreprocessorDefinitions) + ..\..\include\msapi + + + + + + + + + + + + + + + + + + + + + + + Create + + + + + + + + \ No newline at end of file diff --git a/plugins/YahooGroups/YahooGroups_11.vcxproj.filters b/plugins/YahooGroups/YahooGroups_11.vcxproj.filters new file mode 100644 index 0000000000..ced8752d3c --- /dev/null +++ b/plugins/YahooGroups/YahooGroups_11.vcxproj.filters @@ -0,0 +1,74 @@ + + + + + {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 + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + Resource Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/plugins/YahooGroups/commonheaders.h b/plugins/YahooGroups/commonheaders.h deleted file mode 100644 index 6a0c0b3c8d..0000000000 --- a/plugins/YahooGroups/commonheaders.h +++ /dev/null @@ -1,59 +0,0 @@ -/* -YahooGroups plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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. -*/ - - -#ifndef M_YAHOOGROUPS_COMMONHEADERS_H -#define M_YAHOOGROUPS_COMMONHEADERS_H - -#include -#include -#include -#include -#include - -#include "version.h" -#include "utils.h" -#include "services.h" -#include "dlg_handlers.h" - -#include "resource.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "hooked_events.h" - -extern char ModuleName[]; -extern HINSTANCE hInstance; -extern UINT currentCodePage; - -#endif //M_YAHOOGROUPS_COMMONHEADERS_H \ No newline at end of file diff --git a/plugins/YahooGroups/dlg_handlers.cpp b/plugins/YahooGroups/dlg_handlers.cpp deleted file mode 100644 index df5e69f2ee..0000000000 --- a/plugins/YahooGroups/dlg_handlers.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* -YahooGroups plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 "dlg_handlers.h" - -INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) -{ - switch (msg) - { - case WM_INITDIALOG: - { - TranslateDialogDefault(hWnd); - - int autoMove = db_get_b(NULL, ModuleName, "MoveAutomatically", 0); - CheckDlgButton(hWnd, IDC_MOVEAUTOMATICALLY, autoMove ? BST_CHECKED : BST_UNCHECKED); - - return 0; - break; - } - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_YAHOOGROUPS: - { - YahooGroupsMoveService(0,0); - break; - } - - case IDC_MOVEAUTOMATICALLY: - { - SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); - break; - } - } - - break; - } - - case WM_NOTIFY: - { - switch(((LPNMHDR)lParam)->idFrom) - { - case 0: - { - switch (((LPNMHDR)lParam)->code) - { - case PSN_APPLY: - { - int autoMove = IsDlgButtonChecked(hWnd, IDC_MOVEAUTOMATICALLY); - db_set_b(NULL, ModuleName, "MoveAutomatically", autoMove); - break; - } - } - - break; - } - } - - break; - } - - } - - return 0; -} \ No newline at end of file diff --git a/plugins/YahooGroups/dlg_handlers.h b/plugins/YahooGroups/dlg_handlers.h deleted file mode 100644 index 77dbb1948e..0000000000 --- a/plugins/YahooGroups/dlg_handlers.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -YahooGroups plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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. -*/ - -#ifndef M_YAHOOGROUPS_DLGHANDLERS_H -#define M_YAHOOGROUPS_DLGHANDLERS_H - -#include "commonheaders.h" - -INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); - - -#endif //M_YAHOOGROUPS_DLG_HANDLERS_H \ No newline at end of file diff --git a/plugins/YahooGroups/hooked_events.cpp b/plugins/YahooGroups/hooked_events.cpp deleted file mode 100644 index 9df180f5c5..0000000000 --- a/plugins/YahooGroups/hooked_events.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* -YahooGroups plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 "hooked_events.h" -#include "services.h" - -HANDLE hModulesLoaded; -HANDLE hOptionsInitialize; - - -int HookEvents() -{ - hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OnOptionsInitialise); - - return 0; -} - -int UnhookEvents() -{ - UnhookEvent(hModulesLoaded); - UnhookEvent(hOptionsInitialize); - - return 0; -} - -int OnModulesLoaded(WPARAM wParam, LPARAM lParam) -{ - int autoMove = db_get_b(NULL, ModuleName, "MoveAutomatically", 0); - if (autoMove) - { - YahooGroupsMoveService(0,0); - } - - return 0; -} - -int OnOptionsInitialise(WPARAM wParam, LPARAM) -{ - OPTIONSDIALOGPAGE odp = {0}; - - odp.cbSize = sizeof(odp); - odp.position = 100000000; - odp.hInstance = hInstance; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); - odp.ptszTitle = LPGENT("Yahoo Groups"); - odp.ptszGroup = LPGENT("Plugins"); - odp.groupPosition = 810000000; - odp.flags= ODPF_BOLDGROUPS | ODPF_TCHAR; - odp.pfnDlgProc = DlgProcOptions; - Options_AddPage(wParam, &odp); - - return 0; -} diff --git a/plugins/YahooGroups/hooked_events.h b/plugins/YahooGroups/hooked_events.h deleted file mode 100644 index 224667a78a..0000000000 --- a/plugins/YahooGroups/hooked_events.h +++ /dev/null @@ -1,36 +0,0 @@ -/* -YahooGroups plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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. -*/ - - -#ifndef M_YAHOOGROUPS_HOOKED_EVENTS_H -#define M_YAHOOGROUPS_HOOKED_EVENTS_H - -#include "commonheaders.h" - -extern HANDLE hModulesLoaded; -extern HANDLE hOptionsInitialise; - -int HookEvents(); -int UnhookEvents(); - -int OnModulesLoaded(WPARAM wParam, LPARAM lParam); -int OnOptionsInitialise(WPARAM wParam, LPARAM lParam); - -#endif \ No newline at end of file diff --git a/plugins/YahooGroups/list.cpp b/plugins/YahooGroups/list.cpp deleted file mode 100644 index b5f6c34653..0000000000 --- a/plugins/YahooGroups/list.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/* -YahooGroups plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 "list.h" - -CGroupsList &availableGroups = CGroupsList(); - -void CGroupsList::Enlarge(int amount) -{ - size += amount; - groups = (char **) realloc(groups, size * sizeof(char *)); -} - -void CGroupsList::EnsureCapacity() -{ - if (count >= size - 1) - { - Enlarge(size / 2); - } -} - -CGroupsList::CGroupsList() -{ - groups = NULL; - size = 0; - count = 0; - Enlarge(10); -} - -CGroupsList::~CGroupsList() -{ - Clear(); - - free(groups); - groups = NULL; -} - -void CGroupsList::Clear() -{ - if (groups) - { - for (int i = 0; i < count; i++) - { - delete groups[i]; - } - - count = 0; - } -} - -void CGroupsList::Add(char *group) -{ - EnsureCapacity(); - groups[count++] = group; -} - -char *CGroupsList::operator [](int index) -{ - if ((index < 0) || (index >= count)) - { - return NULL; - } - - return groups[index]; -} - -int CGroupsList::Count() -{ - return count; -} - -int CGroupsList::Contains(char *group) -{ - return (Index(group) >= 0); -} - -int CGroupsList::Index(char *group) -{ - int i; - for (i = 0; i < count; i++) - { - if (_stricmp(groups[i], group) == 0) - { - return i; - } - } - - return -1; -} \ No newline at end of file diff --git a/plugins/YahooGroups/list.h b/plugins/YahooGroups/list.h deleted file mode 100644 index 2bc3c160a8..0000000000 --- a/plugins/YahooGroups/list.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -YahooGroups plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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. -*/ - -#ifndef M_YAHOOGROUPS_LIST_H -#define M_YAHOOGROUPS_LIST_H - -#include "commonheaders.h" - - -class CGroupsList -{ - protected: - char **groups; - int size; - int count; - - void Enlarge(int amount); - void EnsureCapacity(); - - public: - CGroupsList(); - ~CGroupsList(); - - void Add(char *group); - void Clear(); - - int Count(); - - int Contains(char *group); - int Index(char *group); - - char *operator [](int index); -}; - -extern CGroupsList &availableGroups; - -#endif //M_VIUPLOADER_LIST_H \ No newline at end of file diff --git a/plugins/YahooGroups/res/YahooGroups.rc b/plugins/YahooGroups/res/YahooGroups.rc new file mode 100644 index 0000000000..850df9e92d --- /dev/null +++ b/plugins/YahooGroups/res/YahooGroups.rc @@ -0,0 +1,98 @@ +// Microsoft Visual C++ generated resource script. +// +#include "..\src\resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_OPTIONS DIALOGEX 0, 0, 231, 46 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + PUSHBUTTON "Move yahoo contacts to groups now",IDC_YAHOOGROUPS,4,5,223,14 + CONTROL "Move Yahoo contacts automatically on startup",IDC_MOVEAUTOMATICALLY, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,25,223,10 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_OPTIONS, DIALOG + BEGIN + LEFTMARGIN, 4 + RIGHTMARGIN, 227 + TOPMARGIN, 5 + BOTTOMMARGIN, 42 + END +END +#endif // APSTUDIO_INVOKED + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/plugins/YahooGroups/res/version.rc b/plugins/YahooGroups/res/version.rc new file mode 100644 index 0000000000..dcab769d88 --- /dev/null +++ b/plugins/YahooGroups/res/version.rc @@ -0,0 +1,100 @@ +// Microsoft Visual C++ generated resource script. +// +#include "..\src\resource.h" +#include "..\src\version.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION __PLUGINVERSION_STRING + PRODUCTVERSION __PLUGINVERSION_STRING + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "Author", __AUTHOR + VALUE "FileDescription", __DESC + VALUE "FileVersion", __VERSION_STRING + VALUE "InternalName", __PLUGIN_DISPLAY_NAME + VALUE "LegalCopyright", __COPYRIGHT + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/plugins/YahooGroups/resource.h b/plugins/YahooGroups/resource.h deleted file mode 100644 index 1f15e3a8a1..0000000000 --- a/plugins/YahooGroups/resource.h +++ /dev/null @@ -1,19 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by YahooGroups.rc -// -#define IDD_OPTIONS 101 -#define IDC_YAHOOGROUPS 1001 -#define IDC_CHECK1 1003 -#define IDC_MOVEAUTOMATICALLY 1003 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1004 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/plugins/YahooGroups/services.cpp b/plugins/YahooGroups/services.cpp deleted file mode 100644 index 702a5f5a18..0000000000 --- a/plugins/YahooGroups/services.cpp +++ /dev/null @@ -1,213 +0,0 @@ -/* -YahooGroups plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 "services.h" - -#define CLIST_GROUPS "CListGroups" - -HANDLE hsYGMove = NULL; -HANDLE hsYGReset = NULL; - -int InitServices() -{ - hsYGMove = CreateServiceFunction(MS_YAHOOGROUPS_MOVE, YahooGroupsMoveService); - hsYGReset = CreateServiceFunction(MS_YAHOOGROUPS_RESET, YahooGroupsResetService); - - ReadAvailableGroups(); - - return 0; -} - -int DestroyServices() -{ - DestroyServiceFunction(hsYGMove); - DestroyServiceFunction(hsYGReset); - - return 0; -} - -void ReadAvailableGroups() -{ - int ok = 1; - int index = 0; - - char group[1024] = {0}; - char tmp[128] = {0}; - - while (ok) - { - mir_snprintf(tmp, sizeof(tmp), "%d", index); - GetStringFromDatabase(NULL, CLIST_GROUPS, tmp, NULL, group, sizeof(group)); - if (strlen(group) > 0) - { - availableGroups.Add(_strdup(group + 1)); - index += 1; - } - else{ - ok = 0; - } - } -} - -int GetNextGroupIndex() -{ - int index = 0; - int found = 0; - - char buffer[1024] = {0}; - char tmp[128] = {0}; - - while (!found) - { - mir_snprintf(tmp, sizeof(tmp), "%d", index++); - - if (GetStringFromDatabase(NULL, CLIST_GROUPS, tmp, NULL, buffer, sizeof(buffer))) - { - found = 1; - } - } - - return index - 1; -} - -void AddNewGroup(char *newGroup) -{ - int index = GetNextGroupIndex(); - - char tmp[128] = {0}; - char group[1024] = {0}; - *group = 1; - mir_snprintf(group + 1, sizeof(group) - 1, "%s", newGroup); - - mir_snprintf(tmp, sizeof(tmp), "%d", index); - const int MAX_SIZE = 1024; - wchar_t wide[MAX_SIZE] = {0}; - *wide = 1; - MultiByteToWideChar(currentCodePage, 0, group + 1, -1, wide + 1, MAX_SIZE - 1); - DBWriteContactSettingWString(NULL, CLIST_GROUPS, tmp, wide); - - availableGroups.Add(_strdup(group + 1)); -} - -void AddContactToGroup(HANDLE hContact, char *group) -{ - const int MAX_SIZE = 1024; - wchar_t wide[MAX_SIZE] = {0}; - MultiByteToWideChar(currentCodePage, 0, group, -1, wide, MAX_SIZE); - DBWriteContactSettingWString(hContact, "CList", "Group", wide); -} - -void CreateGroup(char *group) -{ - char *p = group; - char *sub = group; - char buffer[1024] = {0}; - - while ((p = strchr(sub, '\\'))) - { - *p = 0; - if (strlen(buffer) > 0) - { - strncat(buffer, "\\", sizeof(buffer)); - strncat(buffer, sub, sizeof(buffer)); - } - else{ - mir_snprintf(buffer, sizeof(buffer), "%s", sub); - } - - if (!availableGroups.Contains(buffer)) - { - AddNewGroup(buffer); - } - - *p++ = '\\'; - sub = p; - } - - if (sub) - { - if (strlen(buffer) > 0) - { - strncat(buffer, "\\", sizeof(buffer)); - strncat(buffer, sub, sizeof(buffer)); - } - else{ - mir_snprintf(buffer, sizeof(buffer), "%s", sub); - } - - if (!availableGroups.Contains(buffer)) - { - AddNewGroup(buffer); - } - } -} - -void ProcessContacts(void (*callback)(HANDLE, char *), char *protocol) -{ - HANDLE hContact = db_find_first(); - while (hContact) - { - callback(hContact, protocol); - hContact = db_find_next(hContact); - } -} - -void YahooMoveCallback(HANDLE hContact, char *unused) -{ - char protocol[128] = {0}; - GetContactProtocol(hContact, protocol, sizeof(protocol)); - - if (strlen(protocol) > 0) - { - char ygroup[128] = {0}; - - if (!GetStringFromDatabase(hContact, protocol, "YGroup", NULL, ygroup, sizeof(ygroup))) - { - CreateGroup(ygroup); - AddContactToGroup(hContact, ygroup); - } - } -} - -void ResetGroupCallback(HANDLE hContact, char *protocol) -{ - char p[128] = {0}; - - GetContactProtocol(hContact, p, sizeof(protocol)); - - if ((!protocol) || (_stricmp(protocol, p) == 0)) - { - db_unset(hContact, "CList", "Group"); - } -} - -INT_PTR YahooGroupsMoveService(WPARAM wParam, LPARAM lParam) -{ - ProcessContacts(YahooMoveCallback, NULL); - - return 0; -} - -INT_PTR YahooGroupsResetService(WPARAM wParam, LPARAM lParam) -{ - ProcessContacts(ResetGroupCallback, NULL); - - return 0; -} diff --git a/plugins/YahooGroups/services.h b/plugins/YahooGroups/services.h deleted file mode 100644 index 4e7b424fee..0000000000 --- a/plugins/YahooGroups/services.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -YahooGroups plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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. -*/ - - -#ifndef M_YAHOOGROUPS_SERVICES_H -#define M_YAHOOGROUPS_SERVICES_H - -#include "commonheaders.h" -#include "list.h" - -#define MS_YAHOOGROUPS_MOVE "YahooGroups/Groups/MoveToOfficialGroups" -#define MS_YAHOOGROUPS_RESET "YahooGroups/Groups/Reset" - -int InitServices(); -int DestroyServices(); - -INT_PTR YahooGroupsMoveService(WPARAM wParam, LPARAM lParam); -INT_PTR YahooGroupsResetService(WPARAM wParam, LPARAM lParam); - -void ReadAvailableGroups(); - -#endif //M_CMDLINE_SERVICES_H diff --git a/plugins/YahooGroups/src/YahooGroups.cpp b/plugins/YahooGroups/src/YahooGroups.cpp new file mode 100644 index 0000000000..38f5656335 --- /dev/null +++ b/plugins/YahooGroups/src/YahooGroups.cpp @@ -0,0 +1,80 @@ +/* +YahooGroups plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 "commonheaders.h" + +char ModuleName[] = "YahooGroups"; +HINSTANCE hInstance; + +UINT currentCodePage = 0; +int hLangpack = 0; + +PLUGININFOEX pluginInfo = { + sizeof(PLUGININFOEX), + __PLUGIN_DISPLAY_NAME, + VERSION, + __DESC, + __AUTHOR, + __AUTHOREMAIL, + __COPYRIGHT, + __AUTHORWEB, + 0, //unicode aware + {0x2f3fe8b9, 0x7327, 0x4008, {0xa6, 0x0d, 0x93, 0xf0, 0xf4, 0xf7, 0xf0, 0xf1}} //{2f3fe8b9-7327-4008-a60d-93f0f4f7f0f1} +}; //not used + + +extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion) +{ + return &pluginInfo; +} + +extern "C" int __declspec(dllexport) Load() +{ + mir_getLP(&pluginInfo); + LogInit(); + + currentCodePage = (UINT) CallService(MS_LANGPACK_GETCODEPAGE, 0, 0); + + InitServices(); + + HookEvents(); + + return 0; +} + +extern "C" int __declspec(dllexport) Unload() +{ + DestroyServices(); + + UnhookEvents(); + + return 0; +} + +bool WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) +{ + hInstance = hinstDLL; + if (fdwReason == DLL_PROCESS_ATTACH) + { + DisableThreadLibraryCalls(hinstDLL); + } + + return TRUE; +} diff --git a/plugins/YahooGroups/src/commonheaders.h b/plugins/YahooGroups/src/commonheaders.h new file mode 100644 index 0000000000..20125002f1 --- /dev/null +++ b/plugins/YahooGroups/src/commonheaders.h @@ -0,0 +1,62 @@ +/* +YahooGroups plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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. +*/ + + +#ifndef M_YAHOOGROUPS_COMMONHEADERS_H +#define M_YAHOOGROUPS_COMMONHEADERS_H + +#define _CRT_SECURE_NO_WARNINGS + +#include +#include +#include +#include +#include + +#include "version.h" +#include "dlg_handlers.h" +#include "hooked_events.h" +#include "services.h" +#include "list.h" +#include "services.h" +#include "utils.h" + +#include "resource.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern char ModuleName[]; +extern HINSTANCE hInstance; +extern UINT currentCodePage; + +#endif //M_YAHOOGROUPS_COMMONHEADERS_H \ No newline at end of file diff --git a/plugins/YahooGroups/src/dlg_handlers.cpp b/plugins/YahooGroups/src/dlg_handlers.cpp new file mode 100644 index 0000000000..4c23c92f9b --- /dev/null +++ b/plugins/YahooGroups/src/dlg_handlers.cpp @@ -0,0 +1,84 @@ +/* +YahooGroups plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 "commonheaders.h" + +INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + switch (msg) + { + case WM_INITDIALOG: + { + TranslateDialogDefault(hWnd); + + int autoMove = db_get_b(NULL, ModuleName, "MoveAutomatically", 0); + CheckDlgButton(hWnd, IDC_MOVEAUTOMATICALLY, autoMove ? BST_CHECKED : BST_UNCHECKED); + + return 0; + break; + } + + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDC_YAHOOGROUPS: + { + YahooGroupsMoveService(0,0); + break; + } + + case IDC_MOVEAUTOMATICALLY: + { + SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); + break; + } + } + + break; + } + + case WM_NOTIFY: + { + switch(((LPNMHDR)lParam)->idFrom) + { + case 0: + { + switch (((LPNMHDR)lParam)->code) + { + case PSN_APPLY: + { + int autoMove = IsDlgButtonChecked(hWnd, IDC_MOVEAUTOMATICALLY); + db_set_b(NULL, ModuleName, "MoveAutomatically", autoMove); + break; + } + } + + break; + } + } + + break; + } + + } + + return 0; +} \ No newline at end of file diff --git a/plugins/YahooGroups/src/dlg_handlers.h b/plugins/YahooGroups/src/dlg_handlers.h new file mode 100644 index 0000000000..77dbb1948e --- /dev/null +++ b/plugins/YahooGroups/src/dlg_handlers.h @@ -0,0 +1,29 @@ +/* +YahooGroups plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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. +*/ + +#ifndef M_YAHOOGROUPS_DLGHANDLERS_H +#define M_YAHOOGROUPS_DLGHANDLERS_H + +#include "commonheaders.h" + +INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); + + +#endif //M_YAHOOGROUPS_DLG_HANDLERS_H \ No newline at end of file diff --git a/plugins/YahooGroups/src/hooked_events.cpp b/plugins/YahooGroups/src/hooked_events.cpp new file mode 100644 index 0000000000..76b31d4802 --- /dev/null +++ b/plugins/YahooGroups/src/hooked_events.cpp @@ -0,0 +1,70 @@ +/* +YahooGroups plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 "commonheaders.h" + +HANDLE hModulesLoaded; +HANDLE hOptionsInitialize; + + +int HookEvents() +{ + hModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); + hOptionsInitialize = HookEvent(ME_OPT_INITIALISE, OnOptionsInitialise); + + return 0; +} + +int UnhookEvents() +{ + UnhookEvent(hModulesLoaded); + UnhookEvent(hOptionsInitialize); + + return 0; +} + +int OnModulesLoaded(WPARAM wParam, LPARAM lParam) +{ + int autoMove = db_get_b(NULL, ModuleName, "MoveAutomatically", 0); + if (autoMove) + { + YahooGroupsMoveService(0,0); + } + + return 0; +} + +int OnOptionsInitialise(WPARAM wParam, LPARAM) +{ + OPTIONSDIALOGPAGE odp = {0}; + + odp.cbSize = sizeof(odp); + odp.position = 100000000; + odp.hInstance = hInstance; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); + odp.ptszTitle = LPGENT("Yahoo Groups"); + odp.ptszGroup = LPGENT("Plugins"); + odp.groupPosition = 810000000; + odp.flags= ODPF_BOLDGROUPS | ODPF_TCHAR; + odp.pfnDlgProc = DlgProcOptions; + Options_AddPage(wParam, &odp); + + return 0; +} diff --git a/plugins/YahooGroups/src/hooked_events.h b/plugins/YahooGroups/src/hooked_events.h new file mode 100644 index 0000000000..224667a78a --- /dev/null +++ b/plugins/YahooGroups/src/hooked_events.h @@ -0,0 +1,36 @@ +/* +YahooGroups plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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. +*/ + + +#ifndef M_YAHOOGROUPS_HOOKED_EVENTS_H +#define M_YAHOOGROUPS_HOOKED_EVENTS_H + +#include "commonheaders.h" + +extern HANDLE hModulesLoaded; +extern HANDLE hOptionsInitialise; + +int HookEvents(); +int UnhookEvents(); + +int OnModulesLoaded(WPARAM wParam, LPARAM lParam); +int OnOptionsInitialise(WPARAM wParam, LPARAM lParam); + +#endif \ No newline at end of file diff --git a/plugins/YahooGroups/src/list.cpp b/plugins/YahooGroups/src/list.cpp new file mode 100644 index 0000000000..364f468926 --- /dev/null +++ b/plugins/YahooGroups/src/list.cpp @@ -0,0 +1,106 @@ +/* +YahooGroups plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 "commonheaders.h" + +CGroupsList &availableGroups = CGroupsList(); + +void CGroupsList::Enlarge(int amount) +{ + size += amount; + groups = (char **) realloc(groups, size * sizeof(char *)); +} + +void CGroupsList::EnsureCapacity() +{ + if (count >= size - 1) + { + Enlarge(size / 2); + } +} + +CGroupsList::CGroupsList() +{ + groups = NULL; + size = 0; + count = 0; + Enlarge(10); +} + +CGroupsList::~CGroupsList() +{ + Clear(); + + free(groups); + groups = NULL; +} + +void CGroupsList::Clear() +{ + if (groups) + { + for (int i = 0; i < count; i++) + { + delete groups[i]; + } + + count = 0; + } +} + +void CGroupsList::Add(char *group) +{ + EnsureCapacity(); + groups[count++] = group; +} + +char *CGroupsList::operator [](int index) +{ + if ((index < 0) || (index >= count)) + { + return NULL; + } + + return groups[index]; +} + +int CGroupsList::Count() +{ + return count; +} + +int CGroupsList::Contains(char *group) +{ + return (Index(group) >= 0); +} + +int CGroupsList::Index(char *group) +{ + int i; + for (i = 0; i < count; i++) + { + if (_stricmp(groups[i], group) == 0) + { + return i; + } + } + + return -1; +} \ No newline at end of file diff --git a/plugins/YahooGroups/src/list.h b/plugins/YahooGroups/src/list.h new file mode 100644 index 0000000000..2bc3c160a8 --- /dev/null +++ b/plugins/YahooGroups/src/list.h @@ -0,0 +1,54 @@ +/* +YahooGroups plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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. +*/ + +#ifndef M_YAHOOGROUPS_LIST_H +#define M_YAHOOGROUPS_LIST_H + +#include "commonheaders.h" + + +class CGroupsList +{ + protected: + char **groups; + int size; + int count; + + void Enlarge(int amount); + void EnsureCapacity(); + + public: + CGroupsList(); + ~CGroupsList(); + + void Add(char *group); + void Clear(); + + int Count(); + + int Contains(char *group); + int Index(char *group); + + char *operator [](int index); +}; + +extern CGroupsList &availableGroups; + +#endif //M_VIUPLOADER_LIST_H \ No newline at end of file diff --git a/plugins/YahooGroups/src/resource.h b/plugins/YahooGroups/src/resource.h new file mode 100644 index 0000000000..1f15e3a8a1 --- /dev/null +++ b/plugins/YahooGroups/src/resource.h @@ -0,0 +1,19 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by YahooGroups.rc +// +#define IDD_OPTIONS 101 +#define IDC_YAHOOGROUPS 1001 +#define IDC_CHECK1 1003 +#define IDC_MOVEAUTOMATICALLY 1003 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1004 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/plugins/YahooGroups/src/services.cpp b/plugins/YahooGroups/src/services.cpp new file mode 100644 index 0000000000..b896f5598f --- /dev/null +++ b/plugins/YahooGroups/src/services.cpp @@ -0,0 +1,213 @@ +/* +YahooGroups plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 "commonheaders.h" + +#define CLIST_GROUPS "CListGroups" + +HANDLE hsYGMove = NULL; +HANDLE hsYGReset = NULL; + +int InitServices() +{ + hsYGMove = CreateServiceFunction(MS_YAHOOGROUPS_MOVE, YahooGroupsMoveService); + hsYGReset = CreateServiceFunction(MS_YAHOOGROUPS_RESET, YahooGroupsResetService); + + ReadAvailableGroups(); + + return 0; +} + +int DestroyServices() +{ + DestroyServiceFunction(hsYGMove); + DestroyServiceFunction(hsYGReset); + + return 0; +} + +void ReadAvailableGroups() +{ + int ok = 1; + int index = 0; + + char group[1024] = {0}; + char tmp[128] = {0}; + + while (ok) + { + mir_snprintf(tmp, sizeof(tmp), "%d", index); + GetStringFromDatabase(NULL, CLIST_GROUPS, tmp, NULL, group, sizeof(group)); + if (strlen(group) > 0) + { + availableGroups.Add(_strdup(group + 1)); + index += 1; + } + else{ + ok = 0; + } + } +} + +int GetNextGroupIndex() +{ + int index = 0; + int found = 0; + + char buffer[1024] = {0}; + char tmp[128] = {0}; + + while (!found) + { + mir_snprintf(tmp, sizeof(tmp), "%d", index++); + + if (GetStringFromDatabase(NULL, CLIST_GROUPS, tmp, NULL, buffer, sizeof(buffer))) + { + found = 1; + } + } + + return index - 1; +} + +void AddNewGroup(char *newGroup) +{ + int index = GetNextGroupIndex(); + + char tmp[128] = {0}; + char group[1024] = {0}; + *group = 1; + mir_snprintf(group + 1, sizeof(group) - 1, "%s", newGroup); + + mir_snprintf(tmp, sizeof(tmp), "%d", index); + const int MAX_SIZE = 1024; + wchar_t wide[MAX_SIZE] = {0}; + *wide = 1; + MultiByteToWideChar(currentCodePage, 0, group + 1, -1, wide + 1, MAX_SIZE - 1); + DBWriteContactSettingWString(NULL, CLIST_GROUPS, tmp, wide); + + availableGroups.Add(_strdup(group + 1)); +} + +void AddContactToGroup(HANDLE hContact, char *group) +{ + const int MAX_SIZE = 1024; + wchar_t wide[MAX_SIZE] = {0}; + MultiByteToWideChar(currentCodePage, 0, group, -1, wide, MAX_SIZE); + DBWriteContactSettingWString(hContact, "CList", "Group", wide); +} + +void CreateGroup(char *group) +{ + char *p = group; + char *sub = group; + char buffer[1024] = {0}; + + while ((p = strchr(sub, '\\'))) + { + *p = 0; + if (strlen(buffer) > 0) + { + strncat(buffer, "\\", sizeof(buffer)); + strncat(buffer, sub, sizeof(buffer)); + } + else{ + mir_snprintf(buffer, sizeof(buffer), "%s", sub); + } + + if (!availableGroups.Contains(buffer)) + { + AddNewGroup(buffer); + } + + *p++ = '\\'; + sub = p; + } + + if (sub) + { + if (strlen(buffer) > 0) + { + strncat(buffer, "\\", sizeof(buffer)); + strncat(buffer, sub, sizeof(buffer)); + } + else{ + mir_snprintf(buffer, sizeof(buffer), "%s", sub); + } + + if (!availableGroups.Contains(buffer)) + { + AddNewGroup(buffer); + } + } +} + +void ProcessContacts(void (*callback)(HANDLE, char *), char *protocol) +{ + HANDLE hContact = db_find_first(); + while (hContact) + { + callback(hContact, protocol); + hContact = db_find_next(hContact); + } +} + +void YahooMoveCallback(HANDLE hContact, char *unused) +{ + char protocol[128] = {0}; + GetContactProtocol(hContact, protocol, sizeof(protocol)); + + if (strlen(protocol) > 0) + { + char ygroup[128] = {0}; + + if (!GetStringFromDatabase(hContact, protocol, "YGroup", NULL, ygroup, sizeof(ygroup))) + { + CreateGroup(ygroup); + AddContactToGroup(hContact, ygroup); + } + } +} + +void ResetGroupCallback(HANDLE hContact, char *protocol) +{ + char p[128] = {0}; + + GetContactProtocol(hContact, p, sizeof(protocol)); + + if ((!protocol) || (_stricmp(protocol, p) == 0)) + { + db_unset(hContact, "CList", "Group"); + } +} + +INT_PTR YahooGroupsMoveService(WPARAM wParam, LPARAM lParam) +{ + ProcessContacts(YahooMoveCallback, NULL); + + return 0; +} + +INT_PTR YahooGroupsResetService(WPARAM wParam, LPARAM lParam) +{ + ProcessContacts(ResetGroupCallback, NULL); + + return 0; +} diff --git a/plugins/YahooGroups/src/services.h b/plugins/YahooGroups/src/services.h new file mode 100644 index 0000000000..4e7b424fee --- /dev/null +++ b/plugins/YahooGroups/src/services.h @@ -0,0 +1,39 @@ +/* +YahooGroups plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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. +*/ + + +#ifndef M_YAHOOGROUPS_SERVICES_H +#define M_YAHOOGROUPS_SERVICES_H + +#include "commonheaders.h" +#include "list.h" + +#define MS_YAHOOGROUPS_MOVE "YahooGroups/Groups/MoveToOfficialGroups" +#define MS_YAHOOGROUPS_RESET "YahooGroups/Groups/Reset" + +int InitServices(); +int DestroyServices(); + +INT_PTR YahooGroupsMoveService(WPARAM wParam, LPARAM lParam); +INT_PTR YahooGroupsResetService(WPARAM wParam, LPARAM lParam); + +void ReadAvailableGroups(); + +#endif //M_CMDLINE_SERVICES_H diff --git a/plugins/YahooGroups/src/stdafx.cpp b/plugins/YahooGroups/src/stdafx.cpp new file mode 100644 index 0000000000..e7e41dae3c --- /dev/null +++ b/plugins/YahooGroups/src/stdafx.cpp @@ -0,0 +1,18 @@ +/* +Copyright (C) 2012-13 Miranda NG Project (http://miranda-ng.org) + +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 version 2 +of the License. + +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, see . +*/ + +#include "commonheaders.h" \ No newline at end of file diff --git a/plugins/YahooGroups/src/utils.cpp b/plugins/YahooGroups/src/utils.cpp new file mode 100644 index 0000000000..a2108af1f0 --- /dev/null +++ b/plugins/YahooGroups/src/utils.cpp @@ -0,0 +1,453 @@ +/* +YahooGroups plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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 "commonheaders.h" + +int LogInit() +{ +#ifdef USE_LOG + //FILE *fout = fopen(LOG_FILE, "wt"); + //fclose(fout); + Log("********************** Miranda started **********************"); +#endif + return 0; +} + +int Log(char *format, ...) +{ +#ifdef USE_LOG + char str[4096]; + va_list vararg; + int tBytes; + FILE *fout = fopen(LOG_FILE, "at"); + if (!fout) + { +// MessageBox(0, "can't open file", NULL, MB_OK); + return -1; + } + time_t tNow = time(NULL); + struct tm *now = localtime(&tNow); + strftime(str, sizeof(str), "%d %b %Y @ %H:%M:%S: ", now); + fputs(str, fout); + va_start(vararg, format); + + tBytes = _vsnprintf(str, sizeof(str), format, vararg); + if (tBytes > 0) + { + str[tBytes] = 0; + } + + va_end(vararg); + if (str[strlen(str) - 1] != '\n') + { + strcat(str, "\n"); + } + fputs(str, fout); + fclose(fout); +#endif + return 0; +} + +int Info(char *title, char *format, ...) +{ + char str[4096]; + va_list vararg; + int tBytes; + va_start(vararg, format); + tBytes = _vsnprintf(str, sizeof(str), format, vararg); + if (tBytes > 0) + { + str[tBytes] = 0; + } + va_end(vararg); + return MessageBoxA(0, str, title, MB_OK | MB_ICONINFORMATION); +} + +int MyPUShowMessage(char *lpzText, BYTE kind) +{ + if (ServiceExists(MS_POPUP_SHOWMESSAGE)) + { + return PUShowMessage(lpzText, kind); + } + else{ + char *title = (kind == SM_NOTIFY) ? Translate("Notify") : Translate("Warning"); + + return MessageBox(NULL, lpzText, title, MB_OK | (kind == SM_NOTIFY) ? MB_ICONINFORMATION : MB_ICONEXCLAMATION); + } +} + +#define HEX_SIZE 8 + +char *BinToHex(int size, PBYTE data) +{ + char *szresult = NULL; + char buffer[32] = {0}; //should be more than enough + int maxSize = size * 2 + HEX_SIZE + 1; + szresult = (char *) new char[ maxSize ]; + memset(szresult, 0, maxSize); + sprintf(buffer, "%0*X", HEX_SIZE, size); + strcpy(szresult, buffer); + int i; + for (i = 0; i < size; i++) + { + sprintf(buffer, "%02X", data[i]); + strcpy(szresult + (HEX_SIZE + i * 2), buffer); + } + return szresult; +} + +void HexToBin(char *inData, ULONG &size, LPBYTE &outData) +{ + char buffer[32] = {0}; + strcpy(buffer, "0x"); + STRNCPY(buffer + 2, inData, HEX_SIZE); + sscanf(buffer, "%x", &size); + outData = (unsigned char*)new char[size*2]; + UINT i; + //size = i; + char *tmp = inData + HEX_SIZE; + buffer[4] = '\0'; //mark the end of the string + for (i = 0; i < size; i++) + { + STRNCPY(buffer + 2, &tmp[i * 2], 2); + sscanf(buffer, "%x", &outData[i]); + } + i = size; +} + +int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, char *szError, char *szResult, int size) +{ + DBVARIANT dbv = {0}; + int res = 1; + int len; + dbv.type = DBVT_ASCIIZ; + if (db_get_ts(hContact, szModule, szSettingName, &dbv) == 0) + { + res = 0; + int tmp = strlen(dbv.pszVal); + len = (tmp < size - 1) ? tmp : size - 1; + strncpy(szResult, dbv.pszVal, len); + szResult[len] = '\0'; + mir_free(dbv.pszVal); + } + else{ + res = 1; + if (szError) + { + int tmp = strlen(szError); + len = (tmp < size - 1) ? tmp : size - 1; + strncpy(szResult, szError, len); + szResult[len] = '\0'; + } + else{ + szResult[0] = '\0'; + } + } + return res; +} + +int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, int count) +{ + DBVARIANT dbv = {0}; + int res = 1; + int len; + dbv.type = DBVT_WCHAR; + if (DBGetContactSettingWString(hContact, szModule, szSettingName, &dbv) == 0) + { + res = 0; + if (dbv.type != DBVT_WCHAR) + { + MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, szResult, count); + } + else{ + int tmp = wcslen(dbv.pwszVal); + len = (tmp < count - 1) ? tmp : count - 1; + wcsncpy(szResult, dbv.pwszVal, len); + szResult[len] = L'\0'; + } + mir_free(dbv.pwszVal); + } + else{ + res = 1; + if (szError) + { + int tmp = wcslen(szError); + len = (tmp < count - 1) ? tmp : count - 1; + wcsncpy(szResult, szError, len); + szResult[len] = L'\0'; + } + else{ + szResult[0] = L'\0'; + } + } + return res; +} + +int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, int size) +{ + return GetStringFromDatabase(NULL, ModuleName, szSettingName, szError, szResult, size); +} + +int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, int count) +{ + return GetStringFromDatabase(NULL, ModuleName, szSettingName, szError, szResult, count); +} + +#pragma warning (disable: 4312) +TCHAR *GetContactName(HANDLE hContact, char *szProto) +{ + CONTACTINFO ctInfo; + char proto[200]; + + ZeroMemory((void *) &ctInfo, sizeof(ctInfo)); + ctInfo.cbSize = sizeof(ctInfo); + if (szProto) + { + ctInfo.szProto = szProto; + } + else{ + GetContactProtocol(hContact, proto, sizeof(proto)); + ctInfo.szProto = proto; + } + ctInfo.dwFlag = CNF_DISPLAY | CNF_TCHAR; + ctInfo.hContact = hContact; + //_debug_message("retrieving contact name for %d", hContact); + INT_PTR ret = CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) &ctInfo); + //_debug_message(" contact name %s", ctInfo.pszVal); + TCHAR *buffer; + if (!ret) + { + buffer = _tcsdup(ctInfo.pszVal); + } + mir_free(ctInfo.pszVal); + if (!ret) + { + return buffer; + } + else{ + return NULL; + } + return buffer; +} +#pragma warning (default: 4312) + +#pragma warning (disable: 4312) +void GetContactProtocol(HANDLE hContact, char *szProto, int size) +{ + GetStringFromDatabase(hContact, "Protocol", "p", NULL, szProto, size); +} +#pragma warning (default: 4312) + +#pragma warning (disable: 4312) +TCHAR *GetContactID(HANDLE hContact) +{ + char protocol[256]; + GetContactProtocol(hContact, protocol, sizeof(protocol)); + + return GetContactID(hContact, protocol); +} + +TCHAR *GetContactID(HANDLE hContact, char *szProto) +{ + CONTACTINFO ctInfo; + + ZeroMemory((void *) &ctInfo, sizeof(ctInfo)); + ctInfo.cbSize = sizeof(ctInfo); + ctInfo.szProto = szProto; + ctInfo.dwFlag = CNF_DISPLAY | CNF_TCHAR; + ctInfo.hContact = hContact; + INT_PTR ret = CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) &ctInfo); + TCHAR *buffer; + if (!ret) + { + TCHAR tmp[16]; + switch (ctInfo.type) + { + case CNFT_BYTE: + { + _stprintf(tmp, _T("%d"), ctInfo.bVal); + buffer = _tcsdup(tmp); + + break; + } + + case CNFT_WORD: + { + _stprintf(tmp, _T("%d"), ctInfo.wVal); + buffer = _tcsdup(tmp); + + break; + } + + case CNFT_DWORD: + { + _stprintf(tmp, _T("%ld"), ctInfo.dVal); + buffer = _tcsdup(tmp); + + break; + } + + case CNFT_ASCIIZ: + default: + { + buffer = _tcsdup(ctInfo.pszVal); + + break; + } + } + + + } + mir_free(ctInfo.pszVal); + if (!ret) + { + return buffer; + } + else{ + return NULL; + } +} +#pragma warning (default: 4312) + +#pragma warning (disable: 4312) +HANDLE GetContactFromID(TCHAR *szID, char *szProto) +{ + HANDLE hContact = db_find_first(); + TCHAR *szHandle; + TCHAR dispName[1024]; + char cProtocol[256]; + char *tmp; + + int found = 0; + while (hContact) + { + GetContactProtocol(hContact, cProtocol, sizeof(cProtocol)); + szHandle = GetContactID(hContact, cProtocol); + + tmp = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0); + STRNCPY(dispName, tmp, sizeof(dispName)); + + if ((szHandle) && ((_tcsicmp(szHandle, szID) == 0) || (_tcsicmp(dispName, szID) == 0)) && ((szProto == NULL) || (_stricmp(szProto, cProtocol) == 0))) + { + found = 1; + } + if (szHandle) { free(szHandle); } + + if (found) { break; } + hContact = db_find_next(hContact); + } + + return hContact; +} +#pragma warning (default: 4312) + +#pragma warning (disable: 4312) +HANDLE GetContactFromID(TCHAR *szID, wchar_t *szProto) +{ + char protocol[1024]; + WideCharToMultiByte(CP_ACP, 0, szProto, -1, protocol, sizeof(protocol), NULL, NULL); + return GetContactFromID(szID, protocol); +} +#pragma warning (default: 4312) + +void ScreenToClient(HWND hWnd, LPRECT rect) +{ + POINT pt; + int cx = rect->right - rect->left; + int cy = rect->bottom - rect->top; + pt.x = rect->left; + pt.y = rect->top; + ScreenToClient(hWnd, &pt); + rect->left = pt.x; + rect->top = pt.y; + rect->right = pt.x + cx; + rect->bottom = pt.y + cy; +} + +void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors) +{ + RECT rParent; + RECT rChild; + + if (parentPos->flags & SWP_NOSIZE) + { + return; + } + GetWindowRect(parentPos->hwnd, &rParent); + rChild = AnchorCalcPos(window, &rParent, parentPos, anchors); + MoveWindow(window, rChild.left, rChild.top, rChild.right - rChild.left, rChild.bottom - rChild.top, FALSE); +} + +RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int anchors) +{ + RECT rChild; + RECT rTmp; + + GetWindowRect(window, &rChild); + ScreenToClient(parentPos->hwnd, &rChild); + + int cx = rParent->right - rParent->left; + int cy = rParent->bottom - rParent->top; + if ((cx == parentPos->cx) && (cy == parentPos->cy)) + { + return rChild; + } + if (parentPos->flags & SWP_NOSIZE) + { + return rChild; + } + + rTmp.left = parentPos->x - rParent->left; + rTmp.right = (parentPos->x + parentPos->cx) - rParent->right; + rTmp.bottom = (parentPos->y + parentPos->cy) - rParent->bottom; + rTmp.top = parentPos->y - rParent->top; + + cx = (rTmp.left) ? -rTmp.left : rTmp.right; + cy = (rTmp.top) ? -rTmp.top : rTmp.bottom; + + rChild.right += cx; + rChild.bottom += cy; + //expanded the window accordingly, now we need to enforce the anchors + if ((anchors & ANCHOR_LEFT) && (!(anchors & ANCHOR_RIGHT))) + { + rChild.right -= cx; + } + if ((anchors & ANCHOR_TOP) && (!(anchors & ANCHOR_BOTTOM))) + { + rChild.bottom -= cy; + } + if ((anchors & ANCHOR_RIGHT) && (!(anchors & ANCHOR_LEFT))) + { + rChild.left += cx; + } + if ((anchors & ANCHOR_BOTTOM) && (!(anchors & ANCHOR_TOP))) + { + rChild.top += cy; + } + return rChild; +} + +inline char *STRNCPY(char *output, const char *input, size_t size) +{ + char *res = strncpy(output, input, size); + output[size - 1] = 0; + + return res; +} \ No newline at end of file diff --git a/plugins/YahooGroups/src/utils.h b/plugins/YahooGroups/src/utils.h new file mode 100644 index 0000000000..f2f0411de7 --- /dev/null +++ b/plugins/YahooGroups/src/utils.h @@ -0,0 +1,64 @@ +/* +YahooGroups plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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. +*/ + + +#ifndef M_YAHOOGROUPS_UTILS_H +#define M_YAHOOGROUPS_UTILS_H + +#include +#include "commonheaders.h" + +//#define USE_LOG +#define LOG_FILE "yahoogroups.log" + +#define ANCHOR_LEFT 0x000001 +#define ANCHOR_RIGHT 0x000002 +#define ANCHOR_TOP 0x000004 +#define ANCHOR_BOTTOM 0x000008 +#define ANCHOR_ALL ANCHOR_LEFT | ANCHOR_RIGHT | ANCHOR_TOP | ANCHOR_BOTTOM + +int LogInit(); +int Log(char *format, ...); +int Info(char *title, char *format, ...); + +char *BinToHex(int size, PBYTE data); +void HexToBin(char *inData, ULONG &size, PBYTE &outData); + +void ScreenToClient(HWND hWnd, LPRECT rect); +void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors); +RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int anchors); + +int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, char *szError, char *szResult, int size); +int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, int count); +int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, int size); +int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, int count); + +TCHAR *GetContactName(HANDLE hContact, char *szProto); +TCHAR *GetContactID(HANDLE hContact); +TCHAR *GetContactID(HANDLE hContact, char *szProto); +HANDLE GetContactFromID(TCHAR *szID, char *szProto); +HANDLE GetContactFromID(TCHAR *szID, wchar_t *szProto); +void GetContactProtocol(HANDLE hContact, char *szProto, int size); + +int MyPUShowMessage(char *lpzText, BYTE kind); + +inline char *STRNCPY(char *output, const char *input, size_t size); + +#endif \ No newline at end of file diff --git a/plugins/YahooGroups/src/version.h b/plugins/YahooGroups/src/version.h new file mode 100644 index 0000000000..cae2c6fa1f --- /dev/null +++ b/plugins/YahooGroups/src/version.h @@ -0,0 +1,45 @@ +/* +YahooGroups plugin for Miranda IM + +Copyright © 2007 Cristian Libotean + +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. +*/ + +#ifndef M_CMDLINE_VERSION_H +#define M_CMDLINE_VERSION_H + +#define __MAJOR_VERSION 0 +#define __MINOR_VERSION 0 +#define __RELEASE_NUM 1 +#define __BUILD_NUM 1 + +#define VERSION PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM) + +#define __PLUGINVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM +#define __PLUGINVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM +#define __STRINGIFY_(x) #x +#define __STRINGIFY(x) __STRINGIFY_(x) +#define __VERSION_STRING __STRINGIFY(__PLUGINVERSION_STRING_DOTS) + +#define __DESC "This plugin imports and creates the Yahoo groups defined in Yahoo Messenger." +#define __AUTHOR "Cristian Libotean" +#define __AUTHOREMAIL "eblis102@yahoo.com" +#define __COPYRIGHT "© 2007 Cristian Libotean" +#define __AUTHORWEB "http://www.miranda-im.org/" + +#define __PLUGIN_DISPLAY_NAME "Yahoo Groups" + +#endif //M_CMDLINE_VERSION_H diff --git a/plugins/YahooGroups/utils.cpp b/plugins/YahooGroups/utils.cpp deleted file mode 100644 index d037d81a63..0000000000 --- a/plugins/YahooGroups/utils.cpp +++ /dev/null @@ -1,454 +0,0 @@ -/* -YahooGroups plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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 "utils.h" - -int LogInit() -{ -#ifdef USE_LOG - //FILE *fout = fopen(LOG_FILE, "wt"); - //fclose(fout); - Log("********************** Miranda started **********************"); -#endif - return 0; -} - -int Log(char *format, ...) -{ -#ifdef USE_LOG - char str[4096]; - va_list vararg; - int tBytes; - FILE *fout = fopen(LOG_FILE, "at"); - if (!fout) - { -// MessageBox(0, "can't open file", NULL, MB_OK); - return -1; - } - time_t tNow = time(NULL); - struct tm *now = localtime(&tNow); - strftime(str, sizeof(str), "%d %b %Y @ %H:%M:%S: ", now); - fputs(str, fout); - va_start(vararg, format); - - tBytes = _vsnprintf(str, sizeof(str), format, vararg); - if (tBytes > 0) - { - str[tBytes] = 0; - } - - va_end(vararg); - if (str[strlen(str) - 1] != '\n') - { - strcat(str, "\n"); - } - fputs(str, fout); - fclose(fout); -#endif - return 0; -} - -int Info(char *title, char *format, ...) -{ - char str[4096]; - va_list vararg; - int tBytes; - va_start(vararg, format); - tBytes = _vsnprintf(str, sizeof(str), format, vararg); - if (tBytes > 0) - { - str[tBytes] = 0; - } - va_end(vararg); - return MessageBoxA(0, str, title, MB_OK | MB_ICONINFORMATION); -} - -int MyPUShowMessage(char *lpzText, BYTE kind) -{ - if (ServiceExists(MS_POPUP_SHOWMESSAGE)) - { - return PUShowMessage(lpzText, kind); - } - else{ - char *title = (kind == SM_NOTIFY) ? Translate("Notify") : Translate("Warning"); - - return MessageBox(NULL, lpzText, title, MB_OK | (kind == SM_NOTIFY) ? MB_ICONINFORMATION : MB_ICONEXCLAMATION); - } -} - -#define HEX_SIZE 8 - -char *BinToHex(int size, PBYTE data) -{ - char *szresult = NULL; - char buffer[32] = {0}; //should be more than enough - int maxSize = size * 2 + HEX_SIZE + 1; - szresult = (char *) new char[ maxSize ]; - memset(szresult, 0, maxSize); - sprintf(buffer, "%0*X", HEX_SIZE, size); - strcpy(szresult, buffer); - int i; - for (i = 0; i < size; i++) - { - sprintf(buffer, "%02X", data[i]); - strcpy(szresult + (HEX_SIZE + i * 2), buffer); - } - return szresult; -} - -void HexToBin(char *inData, ULONG &size, LPBYTE &outData) -{ - char buffer[32] = {0}; - strcpy(buffer, "0x"); - STRNCPY(buffer + 2, inData, HEX_SIZE); - sscanf(buffer, "%x", &size); - outData = (unsigned char*)new char[size*2]; - UINT i; - //size = i; - char *tmp = inData + HEX_SIZE; - buffer[4] = '\0'; //mark the end of the string - for (i = 0; i < size; i++) - { - STRNCPY(buffer + 2, &tmp[i * 2], 2); - sscanf(buffer, "%x", &outData[i]); - } - i = size; -} - -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, char *szError, char *szResult, int size) -{ - DBVARIANT dbv = {0}; - int res = 1; - int len; - dbv.type = DBVT_ASCIIZ; - if (db_get_ts(hContact, szModule, szSettingName, &dbv) == 0) - { - res = 0; - int tmp = strlen(dbv.pszVal); - len = (tmp < size - 1) ? tmp : size - 1; - strncpy(szResult, dbv.pszVal, len); - szResult[len] = '\0'; - mir_free(dbv.pszVal); - } - else{ - res = 1; - if (szError) - { - int tmp = strlen(szError); - len = (tmp < size - 1) ? tmp : size - 1; - strncpy(szResult, szError, len); - szResult[len] = '\0'; - } - else{ - szResult[0] = '\0'; - } - } - return res; -} - -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, int count) -{ - DBVARIANT dbv = {0}; - int res = 1; - int len; - dbv.type = DBVT_WCHAR; - if (DBGetContactSettingWString(hContact, szModule, szSettingName, &dbv) == 0) - { - res = 0; - if (dbv.type != DBVT_WCHAR) - { - MultiByteToWideChar(CP_ACP, 0, dbv.pszVal, -1, szResult, count); - } - else{ - int tmp = wcslen(dbv.pwszVal); - len = (tmp < count - 1) ? tmp : count - 1; - wcsncpy(szResult, dbv.pwszVal, len); - szResult[len] = L'\0'; - } - mir_free(dbv.pwszVal); - } - else{ - res = 1; - if (szError) - { - int tmp = wcslen(szError); - len = (tmp < count - 1) ? tmp : count - 1; - wcsncpy(szResult, szError, len); - szResult[len] = L'\0'; - } - else{ - szResult[0] = L'\0'; - } - } - return res; -} - -int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, int size) -{ - return GetStringFromDatabase(NULL, ModuleName, szSettingName, szError, szResult, size); -} - -int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, int count) -{ - return GetStringFromDatabase(NULL, ModuleName, szSettingName, szError, szResult, count); -} - -#pragma warning (disable: 4312) -TCHAR *GetContactName(HANDLE hContact, char *szProto) -{ - CONTACTINFO ctInfo; - char proto[200]; - - ZeroMemory((void *) &ctInfo, sizeof(ctInfo)); - ctInfo.cbSize = sizeof(ctInfo); - if (szProto) - { - ctInfo.szProto = szProto; - } - else{ - GetContactProtocol(hContact, proto, sizeof(proto)); - ctInfo.szProto = proto; - } - ctInfo.dwFlag = CNF_DISPLAY | CNF_TCHAR; - ctInfo.hContact = hContact; - //_debug_message("retrieving contact name for %d", hContact); - INT_PTR ret = CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) &ctInfo); - //_debug_message(" contact name %s", ctInfo.pszVal); - TCHAR *buffer; - if (!ret) - { - buffer = _tcsdup(ctInfo.pszVal); - } - mir_free(ctInfo.pszVal); - if (!ret) - { - return buffer; - } - else{ - return NULL; - } - return buffer; -} -#pragma warning (default: 4312) - -#pragma warning (disable: 4312) -void GetContactProtocol(HANDLE hContact, char *szProto, int size) -{ - GetStringFromDatabase(hContact, "Protocol", "p", NULL, szProto, size); -} -#pragma warning (default: 4312) - -#pragma warning (disable: 4312) -TCHAR *GetContactID(HANDLE hContact) -{ - char protocol[256]; - GetContactProtocol(hContact, protocol, sizeof(protocol)); - - return GetContactID(hContact, protocol); -} - -TCHAR *GetContactID(HANDLE hContact, char *szProto) -{ - CONTACTINFO ctInfo; - - ZeroMemory((void *) &ctInfo, sizeof(ctInfo)); - ctInfo.cbSize = sizeof(ctInfo); - ctInfo.szProto = szProto; - ctInfo.dwFlag = CNF_DISPLAY | CNF_TCHAR; - ctInfo.hContact = hContact; - INT_PTR ret = CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) &ctInfo); - TCHAR *buffer; - if (!ret) - { - TCHAR tmp[16]; - switch (ctInfo.type) - { - case CNFT_BYTE: - { - _stprintf(tmp, _T("%d"), ctInfo.bVal); - buffer = _tcsdup(tmp); - - break; - } - - case CNFT_WORD: - { - _stprintf(tmp, _T("%d"), ctInfo.wVal); - buffer = _tcsdup(tmp); - - break; - } - - case CNFT_DWORD: - { - _stprintf(tmp, _T("%ld"), ctInfo.dVal); - buffer = _tcsdup(tmp); - - break; - } - - case CNFT_ASCIIZ: - default: - { - buffer = _tcsdup(ctInfo.pszVal); - - break; - } - } - - - } - mir_free(ctInfo.pszVal); - if (!ret) - { - return buffer; - } - else{ - return NULL; - } -} -#pragma warning (default: 4312) - -#pragma warning (disable: 4312) -HANDLE GetContactFromID(TCHAR *szID, char *szProto) -{ - HANDLE hContact = db_find_first(); - TCHAR *szHandle; - TCHAR dispName[1024]; - char cProtocol[256]; - char *tmp; - - int found = 0; - while (hContact) - { - GetContactProtocol(hContact, cProtocol, sizeof(cProtocol)); - szHandle = GetContactID(hContact, cProtocol); - - tmp = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) hContact, 0); - STRNCPY(dispName, tmp, sizeof(dispName)); - - if ((szHandle) && ((_tcsicmp(szHandle, szID) == 0) || (_tcsicmp(dispName, szID) == 0)) && ((szProto == NULL) || (_stricmp(szProto, cProtocol) == 0))) - { - found = 1; - } - if (szHandle) { free(szHandle); } - - if (found) { break; } - hContact = db_find_next(hContact); - } - - return hContact; -} -#pragma warning (default: 4312) - -#pragma warning (disable: 4312) -HANDLE GetContactFromID(TCHAR *szID, wchar_t *szProto) -{ - char protocol[1024]; - WideCharToMultiByte(CP_ACP, 0, szProto, -1, protocol, sizeof(protocol), NULL, NULL); - return GetContactFromID(szID, protocol); -} -#pragma warning (default: 4312) - -void ScreenToClient(HWND hWnd, LPRECT rect) -{ - POINT pt; - int cx = rect->right - rect->left; - int cy = rect->bottom - rect->top; - pt.x = rect->left; - pt.y = rect->top; - ScreenToClient(hWnd, &pt); - rect->left = pt.x; - rect->top = pt.y; - rect->right = pt.x + cx; - rect->bottom = pt.y + cy; -} - -void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors) -{ - RECT rParent; - RECT rChild; - - if (parentPos->flags & SWP_NOSIZE) - { - return; - } - GetWindowRect(parentPos->hwnd, &rParent); - rChild = AnchorCalcPos(window, &rParent, parentPos, anchors); - MoveWindow(window, rChild.left, rChild.top, rChild.right - rChild.left, rChild.bottom - rChild.top, FALSE); -} - -RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int anchors) -{ - RECT rChild; - RECT rTmp; - - GetWindowRect(window, &rChild); - ScreenToClient(parentPos->hwnd, &rChild); - - int cx = rParent->right - rParent->left; - int cy = rParent->bottom - rParent->top; - if ((cx == parentPos->cx) && (cy == parentPos->cy)) - { - return rChild; - } - if (parentPos->flags & SWP_NOSIZE) - { - return rChild; - } - - rTmp.left = parentPos->x - rParent->left; - rTmp.right = (parentPos->x + parentPos->cx) - rParent->right; - rTmp.bottom = (parentPos->y + parentPos->cy) - rParent->bottom; - rTmp.top = parentPos->y - rParent->top; - - cx = (rTmp.left) ? -rTmp.left : rTmp.right; - cy = (rTmp.top) ? -rTmp.top : rTmp.bottom; - - rChild.right += cx; - rChild.bottom += cy; - //expanded the window accordingly, now we need to enforce the anchors - if ((anchors & ANCHOR_LEFT) && (!(anchors & ANCHOR_RIGHT))) - { - rChild.right -= cx; - } - if ((anchors & ANCHOR_TOP) && (!(anchors & ANCHOR_BOTTOM))) - { - rChild.bottom -= cy; - } - if ((anchors & ANCHOR_RIGHT) && (!(anchors & ANCHOR_LEFT))) - { - rChild.left += cx; - } - if ((anchors & ANCHOR_BOTTOM) && (!(anchors & ANCHOR_TOP))) - { - rChild.top += cy; - } - return rChild; -} - -inline char *STRNCPY(char *output, const char *input, size_t size) -{ - char *res = strncpy(output, input, size); - output[size - 1] = 0; - - return res; -} \ No newline at end of file diff --git a/plugins/YahooGroups/utils.h b/plugins/YahooGroups/utils.h deleted file mode 100644 index f2f0411de7..0000000000 --- a/plugins/YahooGroups/utils.h +++ /dev/null @@ -1,64 +0,0 @@ -/* -YahooGroups plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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. -*/ - - -#ifndef M_YAHOOGROUPS_UTILS_H -#define M_YAHOOGROUPS_UTILS_H - -#include -#include "commonheaders.h" - -//#define USE_LOG -#define LOG_FILE "yahoogroups.log" - -#define ANCHOR_LEFT 0x000001 -#define ANCHOR_RIGHT 0x000002 -#define ANCHOR_TOP 0x000004 -#define ANCHOR_BOTTOM 0x000008 -#define ANCHOR_ALL ANCHOR_LEFT | ANCHOR_RIGHT | ANCHOR_TOP | ANCHOR_BOTTOM - -int LogInit(); -int Log(char *format, ...); -int Info(char *title, char *format, ...); - -char *BinToHex(int size, PBYTE data); -void HexToBin(char *inData, ULONG &size, PBYTE &outData); - -void ScreenToClient(HWND hWnd, LPRECT rect); -void AnchorMoveWindow(HWND window, const WINDOWPOS *parentPos, int anchors); -RECT AnchorCalcPos(HWND window, const RECT *rParent, const WINDOWPOS *parentPos, int anchors); - -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, char *szError, char *szResult, int size); -int GetStringFromDatabase(HANDLE hContact, char *szModule, char *szSettingName, WCHAR *szError, WCHAR *szResult, int count); -int GetStringFromDatabase(char *szSettingName, char *szError, char *szResult, int size); -int GetStringFromDatabase(char *szSettingName, WCHAR *szError, WCHAR *szResult, int count); - -TCHAR *GetContactName(HANDLE hContact, char *szProto); -TCHAR *GetContactID(HANDLE hContact); -TCHAR *GetContactID(HANDLE hContact, char *szProto); -HANDLE GetContactFromID(TCHAR *szID, char *szProto); -HANDLE GetContactFromID(TCHAR *szID, wchar_t *szProto); -void GetContactProtocol(HANDLE hContact, char *szProto, int size); - -int MyPUShowMessage(char *lpzText, BYTE kind); - -inline char *STRNCPY(char *output, const char *input, size_t size); - -#endif \ No newline at end of file diff --git a/plugins/YahooGroups/version.h b/plugins/YahooGroups/version.h deleted file mode 100644 index cae2c6fa1f..0000000000 --- a/plugins/YahooGroups/version.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -YahooGroups plugin for Miranda IM - -Copyright © 2007 Cristian Libotean - -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. -*/ - -#ifndef M_CMDLINE_VERSION_H -#define M_CMDLINE_VERSION_H - -#define __MAJOR_VERSION 0 -#define __MINOR_VERSION 0 -#define __RELEASE_NUM 1 -#define __BUILD_NUM 1 - -#define VERSION PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM) - -#define __PLUGINVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM -#define __PLUGINVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM -#define __STRINGIFY_(x) #x -#define __STRINGIFY(x) __STRINGIFY_(x) -#define __VERSION_STRING __STRINGIFY(__PLUGINVERSION_STRING_DOTS) - -#define __DESC "This plugin imports and creates the Yahoo groups defined in Yahoo Messenger." -#define __AUTHOR "Cristian Libotean" -#define __AUTHOREMAIL "eblis102@yahoo.com" -#define __COPYRIGHT "© 2007 Cristian Libotean" -#define __AUTHORWEB "http://www.miranda-im.org/" - -#define __PLUGIN_DISPLAY_NAME "Yahoo Groups" - -#endif //M_CMDLINE_VERSION_H diff --git a/plugins/YahooGroups/version.rc b/plugins/YahooGroups/version.rc deleted file mode 100644 index effbb6fe04..0000000000 --- a/plugins/YahooGroups/version.rc +++ /dev/null @@ -1,100 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" -#include "version.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION __PLUGINVERSION_STRING - PRODUCTVERSION __PLUGINVERSION_STRING - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Author", __AUTHOR - VALUE "FileDescription", __DESC - VALUE "FileVersion", __VERSION_STRING - VALUE "InternalName", __PLUGIN_DISPLAY_NAME - VALUE "LegalCopyright", __COPYRIGHT - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - -- cgit v1.2.3