summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/YahooGroups/YahooGroups.cpp80
-rw-r--r--plugins/YahooGroups/YahooGroups.rc98
-rw-r--r--plugins/YahooGroups/YahooGroups.vcxproj187
-rw-r--r--plugins/YahooGroups/YahooGroups.vcxproj.filters74
-rw-r--r--plugins/YahooGroups/commonheaders.h59
-rw-r--r--plugins/YahooGroups/dlg_handlers.cpp84
-rw-r--r--plugins/YahooGroups/dlg_handlers.h29
-rw-r--r--plugins/YahooGroups/hooked_events.cpp71
-rw-r--r--plugins/YahooGroups/hooked_events.h36
-rw-r--r--plugins/YahooGroups/list.cpp106
-rw-r--r--plugins/YahooGroups/list.h54
-rw-r--r--plugins/YahooGroups/resource.h19
-rw-r--r--plugins/YahooGroups/services.cpp213
-rw-r--r--plugins/YahooGroups/services.h39
-rw-r--r--plugins/YahooGroups/utils.cpp454
-rw-r--r--plugins/YahooGroups/utils.h64
-rw-r--r--plugins/YahooGroups/version.h45
-rw-r--r--plugins/YahooGroups/version.rc100
18 files changed, 1812 insertions, 0 deletions
diff --git a/plugins/YahooGroups/YahooGroups.cpp b/plugins/YahooGroups/YahooGroups.cpp
new file mode 100644
index 0000000000..38f5656335
--- /dev/null
+++ b/plugins/YahooGroups/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/YahooGroups.rc b/plugins/YahooGroups/YahooGroups.rc
new file mode 100644
index 0000000000..aca5381683
--- /dev/null
+++ b/plugins/YahooGroups/YahooGroups.rc
@@ -0,0 +1,98 @@
+// 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
new file mode 100644
index 0000000000..bdcfeecaa2
--- /dev/null
+++ b/plugins/YahooGroups/YahooGroups.vcxproj
@@ -0,0 +1,187 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{0E73244B-30D7-4A62-B4B3-9A32B96EC1B7}</ProjectGuid>
+ <RootNamespace>YahooGroups</RootNamespace>
+ <Keyword>Win32Proj</Keyword>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>NotSet</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>NotSet</CharacterSet>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>NotSet</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+ <ConfigurationType>DynamicLibrary</ConfigurationType>
+ <CharacterSet>NotSet</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup>
+ <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Plugins\</OutDir>
+ <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Plugins\</OutDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\Obj\$(ProjectName)\</IntDir>
+ <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\</IntDir>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+ <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;_DEBUG;_WINDOWS;_USRDLL;YAHOOGROUPS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <MinimalRebuild>true</MinimalRebuild>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+ <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <TargetMachine>MachineX86</TargetMachine>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN64;_DEBUG;_WINDOWS;_USRDLL;YAHOOGROUPS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <Optimization>MinSpace</Optimization>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN32;NDEBUG;_WINDOWS;_USRDLL;YAHOOGROUPS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <TargetMachine>MachineX86</TargetMachine>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <Optimization>MinSpace</Optimization>
+ <FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;WIN64;NDEBUG;_WINDOWS;_USRDLL;YAHOOGROUPS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <PrecompiledHeader>
+ </PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+ <AdditionalIncludeDirectories>..\..\include;..\..\plugins\ExternalAPI;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ </ClCompile>
+ <Link>
+ <GenerateDebugInformation>true</GenerateDebugInformation>
+ <SubSystem>Windows</SubSystem>
+ <OptimizeReferences>true</OptimizeReferences>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <ImportLibrary>$(IntDir)$(TargetName).lib</ImportLibrary>
+ <AdditionalLibraryDirectories>$(ProfileDir)..\..\bin10\lib</AdditionalLibraryDirectories>
+ </Link>
+ </ItemDefinitionGroup>
+ <ItemGroup>
+ <ClCompile Include="dlg_handlers.cpp" />
+ <ClCompile Include="hooked_events.cpp" />
+ <ClCompile Include="list.cpp" />
+ <ClCompile Include="services.cpp" />
+ <ClCompile Include="utils.cpp" />
+ <ClCompile Include="YahooGroups.cpp" />
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="commonheaders.h" />
+ <ClInclude Include="dlg_handlers.h" />
+ <ClInclude Include="hooked_events.h" />
+ <ClInclude Include="list.h" />
+ <ClInclude Include="resource.h" />
+ <ClInclude Include="services.h" />
+ <ClInclude Include="utils.h" />
+ <ClInclude Include="version.h" />
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="version.rc" />
+ <ResourceCompile Include="YahooGroups.rc" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\docs\YahooGroups_readme.txt" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ </ImportGroup>
+</Project> \ No newline at end of file
diff --git a/plugins/YahooGroups/YahooGroups.vcxproj.filters b/plugins/YahooGroups/YahooGroups.vcxproj.filters
new file mode 100644
index 0000000000..fdfc99125f
--- /dev/null
+++ b/plugins/YahooGroups/YahooGroups.vcxproj.filters
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <Filter Include="Source Files">
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+ </Filter>
+ <Filter Include="Header Files">
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
+ </Filter>
+ <Filter Include="Resource Files">
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
+ </Filter>
+ </ItemGroup>
+ <ItemGroup>
+ <ClCompile Include="dlg_handlers.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="hooked_events.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="list.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="services.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="utils.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="YahooGroups.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ClInclude Include="commonheaders.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="dlg_handlers.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="hooked_events.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="list.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="resource.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="services.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="utils.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ <ClInclude Include="version.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
+ </ItemGroup>
+ <ItemGroup>
+ <ResourceCompile Include="version.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ <ResourceCompile Include="YahooGroups.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\docs\YahooGroups_readme.txt" />
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/plugins/YahooGroups/commonheaders.h b/plugins/YahooGroups/commonheaders.h
new file mode 100644
index 0000000000..6a0c0b3c8d
--- /dev/null
+++ b/plugins/YahooGroups/commonheaders.h
@@ -0,0 +1,59 @@
+/*
+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 <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <windows.h>
+#include <time.h>
+
+#include "version.h"
+#include "utils.h"
+#include "services.h"
+#include "dlg_handlers.h"
+
+#include "resource.h"
+
+#include <newpluginapi.h>
+#include <m_database.h>
+#include <m_system.h>
+#include <m_clist.h>
+#include <m_clui.h>
+#include <m_contacts.h>
+#include <m_langpack.h>
+#include <m_options.h>
+#include <m_protosvc.h>
+#include <m_protocols.h>
+#include <m_popup.h>
+#include <m_utils.h>
+#include <m_message.h>
+#include <m_statusplugins.h>
+
+#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
new file mode 100644
index 0000000000..df5e69f2ee
--- /dev/null
+++ b/plugins/YahooGroups/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 "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
new file mode 100644
index 0000000000..77dbb1948e
--- /dev/null
+++ b/plugins/YahooGroups/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/hooked_events.cpp b/plugins/YahooGroups/hooked_events.cpp
new file mode 100644
index 0000000000..9df180f5c5
--- /dev/null
+++ b/plugins/YahooGroups/hooked_events.cpp
@@ -0,0 +1,71 @@
+/*
+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
new file mode 100644
index 0000000000..224667a78a
--- /dev/null
+++ b/plugins/YahooGroups/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/list.cpp b/plugins/YahooGroups/list.cpp
new file mode 100644
index 0000000000..b5f6c34653
--- /dev/null
+++ b/plugins/YahooGroups/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 "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
new file mode 100644
index 0000000000..2bc3c160a8
--- /dev/null
+++ b/plugins/YahooGroups/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/resource.h b/plugins/YahooGroups/resource.h
new file mode 100644
index 0000000000..1f15e3a8a1
--- /dev/null
+++ b/plugins/YahooGroups/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/services.cpp b/plugins/YahooGroups/services.cpp
new file mode 100644
index 0000000000..702a5f5a18
--- /dev/null
+++ b/plugins/YahooGroups/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 "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
new file mode 100644
index 0000000000..4e7b424fee
--- /dev/null
+++ b/plugins/YahooGroups/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/utils.cpp b/plugins/YahooGroups/utils.cpp
new file mode 100644
index 0000000000..d037d81a63
--- /dev/null
+++ b/plugins/YahooGroups/utils.cpp
@@ -0,0 +1,454 @@
+/*
+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
new file mode 100644
index 0000000000..f2f0411de7
--- /dev/null
+++ b/plugins/YahooGroups/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 <stdarg.h>
+#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
new file mode 100644
index 0000000000..cae2c6fa1f
--- /dev/null
+++ b/plugins/YahooGroups/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/version.rc b/plugins/YahooGroups/version.rc
new file mode 100644
index 0000000000..effbb6fe04
--- /dev/null
+++ b/plugins/YahooGroups/version.rc
@@ -0,0 +1,100 @@
+// 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
+