From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/Plugins/SDK/irctell/api__irctell.h | 7 + Src/Plugins/SDK/irctell/dde.cpp | 50 +++++ Src/Plugins/SDK/irctell/dde.h | 9 + Src/Plugins/SDK/irctell/irctell.cpp | 122 ++++++++++++ Src/Plugins/SDK/irctell/irctell.h | 29 +++ Src/Plugins/SDK/irctell/irctell.rc | 74 ++++++++ Src/Plugins/SDK/irctell/irctell.sln | 24 +++ Src/Plugins/SDK/irctell/irctell.vcxproj | 243 ++++++++++++++++++++++++ Src/Plugins/SDK/irctell/irctell.vcxproj.filters | 44 +++++ Src/Plugins/SDK/irctell/resource.h | 17 ++ Src/Plugins/SDK/irctell/version.rc2 | 39 ++++ 11 files changed, 658 insertions(+) create mode 100644 Src/Plugins/SDK/irctell/api__irctell.h create mode 100644 Src/Plugins/SDK/irctell/dde.cpp create mode 100644 Src/Plugins/SDK/irctell/dde.h create mode 100644 Src/Plugins/SDK/irctell/irctell.cpp create mode 100644 Src/Plugins/SDK/irctell/irctell.h create mode 100644 Src/Plugins/SDK/irctell/irctell.rc create mode 100644 Src/Plugins/SDK/irctell/irctell.sln create mode 100644 Src/Plugins/SDK/irctell/irctell.vcxproj create mode 100644 Src/Plugins/SDK/irctell/irctell.vcxproj.filters create mode 100644 Src/Plugins/SDK/irctell/resource.h create mode 100644 Src/Plugins/SDK/irctell/version.rc2 (limited to 'Src/Plugins/SDK/irctell') diff --git a/Src/Plugins/SDK/irctell/api__irctell.h b/Src/Plugins/SDK/irctell/api__irctell.h new file mode 100644 index 00000000..c28bfc1a --- /dev/null +++ b/Src/Plugins/SDK/irctell/api__irctell.h @@ -0,0 +1,7 @@ +/* copyright 2006 Ben Allison */ +#ifndef NULLSOFT_APIH +#define NULLSOFT_APIH + +#include + +#endif \ No newline at end of file diff --git a/Src/Plugins/SDK/irctell/dde.cpp b/Src/Plugins/SDK/irctell/dde.cpp new file mode 100644 index 00000000..790ffa09 --- /dev/null +++ b/Src/Plugins/SDK/irctell/dde.cpp @@ -0,0 +1,50 @@ +#include +#include "dde.h" +#include + +HDDEDATA CALLBACK DdeGenericCallback(UINT uType, UINT uFmt,HCONV hconv, HSZ hsz1, + HSZ hsz2, HDDEDATA hdata, DWORD dwData1, + DWORD dwData2) +{ + return ((HDDEDATA)0); +} + +void DdeCom::sendCommand(wchar_t *application, wchar_t *command, DWORD minInterval) +{ + static DWORD lastCmd=0, now; + HSZ string1,string2,string3; + wchar_t line[512]; + HCONV ddeConv; + DWORD result; + + now = GetTickCount(); + if (now < lastCmd + minInterval) + return; + + StringCchCopy(line, 512, command); + + DWORD DDE=0; + + if (DdeInitialize(&DDE, DdeGenericCallback, CBF_SKIP_ALLNOTIFICATIONS+ST_CLIENT,0) != DMLERR_NO_ERROR) + { + MessageBox(NULL,L"DDE INITIALIZE", L"Error", MB_OK); + + return; + } + + string1 = DdeCreateStringHandle(DDE, application, CP_WINANSI); + string2 = DdeCreateStringHandle(DDE, L"COMMAND", CP_WINANSI); + + if ((ddeConv = DdeConnect(DDE, string1, string2, 0)) != 0) + { + string3 = DdeCreateStringHandle(DDE, L"None", CP_WINANSI); + DdeClientTransaction((LPBYTE)line, (wcslen(line)+1)*sizeof(line[0]), ddeConv, string3, CF_UNICODETEXT, XTYP_POKE, 1000, &result); + DdeFreeStringHandle(DDE, string3); + DdeDisconnect(ddeConv); + lastCmd = now; + } + + DdeFreeStringHandle(DDE, string1); + DdeFreeStringHandle(DDE, string2); + DdeUninitialize(DDE); +} diff --git a/Src/Plugins/SDK/irctell/dde.h b/Src/Plugins/SDK/irctell/dde.h new file mode 100644 index 00000000..3f14eb3e --- /dev/null +++ b/Src/Plugins/SDK/irctell/dde.h @@ -0,0 +1,9 @@ +#ifndef __DDECOM_H +#define __DDECOM_H + +class DdeCom { +public: + static void sendCommand(wchar_t *application, wchar_t *command, DWORD minInterval); +}; + +#endif diff --git a/Src/Plugins/SDK/irctell/irctell.cpp b/Src/Plugins/SDK/irctell/irctell.cpp new file mode 100644 index 00000000..92f333b8 --- /dev/null +++ b/Src/Plugins/SDK/irctell/irctell.cpp @@ -0,0 +1,122 @@ +#include +#include "irctell.h" +#include +#include +#include "api__irctell.h" +#include +#include "dde.h" +#include + +static WACIrctell Irctell; +extern "C" __declspec(dllexport) ifc_wa5component *GetWinamp5SystemComponent() +{ + return &Irctell; +} + +bool dotell=true; +api_syscb *sysCallbackApi=0; +api_core *core=0; +api_service *WASABI_API_SVC = 0; + +void WACIrctell::RegisterServices(api_service *service) +{ + WASABI_API_SVC = service; + waServiceFactory *sf = WASABI_API_SVC->service_getServiceByGuid(syscbApiServiceGuid); + if (sf) sysCallbackApi = reinterpret_cast(sf->getInterface()); + + sysCallbackApi->syscb_registerCallback(static_cast(this)); + sf = WASABI_API_SVC->service_getServiceByGuid(coreApiServiceGuid); + if (sf) core = reinterpret_cast(sf->getInterface()); + + if (core) + core->core_addCallback(0, this); +} + +void WACIrctell::DeregisterServices(api_service *service) +{ + // be sure to delete all your windows etc HERE, not in the destructor + // because the API pointer might be invalid in the destructor +// if (core) + // core->core_delCallback(0, this); +} + +/* +void WACIrctell::onRegisterServices() { +dotell.setName("Enabled"); +dotell=0; +registerAttribute(&dotell); + +appstr.setName("DDE Target"); +appstr="mIRC"; +registerAttribute(&appstr); + +cmdstr.setName("DDE Command"); +cmdstr="/me is listening to %s"; +registerAttribute(&cmdstr); +} +*/ + +int WACIrctell::ccb_notify(int msg, int param1, int param2) +{ + if (msg==TITLECHANGE && dotell) + { + const wchar_t *title = (const wchar_t *)param1; + const wchar_t *cur=core->core_getCurrent(0); + + wchar_t msg[256]; + StringCchPrintfW(msg, 256, L"/describe #winamp is now listening to \"%s\"", title); + DdeCom::sendCommand(L"mIRC", msg, 1000); + } + return 0; +} + +FOURCC WACIrctell::getEventType() +{ + return SysCallback::SERVICE; +} + +int WACIrctell::notify(int msg, int param1, int param2) +{ + switch(msg) + { + case SvcCallback::ONREGISTER: + { + waServiceFactory *sf = (waServiceFactory *)param2; + if (sf->getGuid() == coreApiServiceGuid) + { + core = reinterpret_cast(sf->getInterface()); + core->core_addCallback(0, this); + } + } + break; + + case SvcNotify::ONDEREGISTERED: + { + waServiceFactory *sf = (waServiceFactory *)param2; + if (sf->getGuid() == coreApiServiceGuid) + { + if (core) + core->core_delCallback(0, this); + core = 0; + } + } + break; + + } + return 0; + +} + +#define CBCLASS WACIrctell +START_MULTIPATCH; +START_PATCH(patch_wa5) +M_VCB(patch_wa5, ifc_wa5component, API_WA5COMPONENT_REGISTERSERVICES, RegisterServices); +M_VCB(patch_wa5, ifc_wa5component, API_WA5COMPONENT_DEREEGISTERSERVICES, DeregisterServices); +NEXT_PATCH(patch_core) +M_CB(patch_core, CoreCallback, CCB_NOTIFY, ccb_notify); +NEXT_PATCH(patch_svc) +M_CB(patch_svc, SysCallback, SYSCALLBACK_GETEVENTTYPE, getEventType); +M_CB(patch_svc, SysCallback, SYSCALLBACK_NOTIFY, notify); +END_PATCH +END_MULTIPATCH; +#undef CBCLASS diff --git a/Src/Plugins/SDK/irctell/irctell.h b/Src/Plugins/SDK/irctell/irctell.h new file mode 100644 index 00000000..3054aec1 --- /dev/null +++ b/Src/Plugins/SDK/irctell/irctell.h @@ -0,0 +1,29 @@ +#ifndef _GENERIC_H +#define _GENERIC_H + + +#include +#include +#include "../Agave/Component/ifc_wa5component.h" +#include + +enum { patch_wa5, patch_core, patch_svc}; +class WACIrctell :public MultiPatch, + public MultiPatch, + public MultiPatch +{ + +public: + void RegisterServices(api_service *service); + void DeregisterServices(api_service *service); + + int ccb_notify(int msg, int param1=0, int param2=0); + + FOURCC getEventType(); + int notify(int msg, int param1 = 0, int param2 = 0); + +protected: + RECVS_MULTIPATCH; +}; + +#endif diff --git a/Src/Plugins/SDK/irctell/irctell.rc b/Src/Plugins/SDK/irctell/irctell.rc new file mode 100644 index 00000000..15455697 --- /dev/null +++ b/Src/Plugins/SDK/irctell/irctell.rc @@ -0,0 +1,74 @@ +// 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 + "#include ""version.rc2""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + 65535 "{9E398E5F-EDEC-4dd8-A40D-E29B385A88C0}" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Src/Plugins/SDK/irctell/irctell.sln b/Src/Plugins/SDK/irctell/irctell.sln new file mode 100644 index 00000000..0e2e720f --- /dev/null +++ b/Src/Plugins/SDK/irctell/irctell.sln @@ -0,0 +1,24 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.32802.440 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "irctell", "irctell.vcxproj", "{8F034E55-D388-416D-8575-5D765255CFF6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8F034E55-D388-416D-8575-5D765255CFF6}.Debug|x86.ActiveCfg = Debug|Win32 + {8F034E55-D388-416D-8575-5D765255CFF6}.Debug|x86.Build.0 = Debug|Win32 + {8F034E55-D388-416D-8575-5D765255CFF6}.Release|x86.ActiveCfg = Release|Win32 + {8F034E55-D388-416D-8575-5D765255CFF6}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {23036EDD-9085-419F-AF16-2AC1EE49B96D} + EndGlobalSection +EndGlobal diff --git a/Src/Plugins/SDK/irctell/irctell.vcxproj b/Src/Plugins/SDK/irctell/irctell.vcxproj new file mode 100644 index 00000000..02b68c80 --- /dev/null +++ b/Src/Plugins/SDK/irctell/irctell.vcxproj @@ -0,0 +1,243 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {8F034E55-D388-416D-8575-5D765255CFF6} + Win32Proj + 10.0.19041.0 + + + + DynamicLibrary + v142 + Unicode + + + DynamicLibrary + v142 + Unicode + + + DynamicLibrary + v142 + Unicode + + + DynamicLibrary + v142 + Unicode + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>16.0.32629.160 + + + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + false + MinimumRecommendedRules.ruleset + + + $(IncludePath) + $(LibraryPath) + .w5s + + + false + MinimumRecommendedRules.ruleset + + + $(IncludePath) + $(LibraryPath) + .w5s + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + + + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + false + MinimumRecommendedRules.ruleset + + + $(IncludePath) + $(LibraryPath) + .w5s + + + false + MinimumRecommendedRules.ruleset + + + $(IncludePath) + $(LibraryPath) + .w5s + $(PlatformShortName)_$(Configuration)\ + $(PlatformShortName)_$(Configuration)\ + + + false + + + Debug + + + + Disabled + ..\..;..\..\..\Wasabi;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;IRCTELL_EXPORTS;%(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDebugDLL + + Level3 + ProgramDatabase + true + $(IntDir)$(TargetName).pdb + + + $(OutDir)$(TargetName)$(TargetExt) + true + $(IntDir)$(TargetName).pdb + Windows + $(IntDir)$(TargetName).lib + MachineX86 + false + + + + + Disabled + ..\..;..\..\..\Wasabi;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;_USRDLL;IRCTELL_EXPORTS;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + true + $(IntDir)$(TargetName).pdb + + + $(OutDir)$(TargetName)$(TargetExt) + true + $(IntDir)$(TargetName).pdb + Windows + $(IntDir)$(TargetName).lib + false + + + + + MinSpace + Size + true + ..\..;..\..\..\Wasabi;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;IRCTELL_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + true + true + true + + Level3 + None + true + $(IntDir)$(TargetName).pdb + + + $(OutDir)$(TargetName)$(TargetExt) + msvcprt.lib;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + $(IntDir)$(TargetName).lib + MachineX86 + $(IntDir)$(TargetName).pdb + false + + + + + MinSpace + Size + true + ..\..;..\..\..\Wasabi;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;_USRDLL;IRCTELL_EXPORTS;%(PreprocessorDefinitions) + true + MultiThreadedDLL + true + true + true + true + + + Level3 + None + true + $(IntDir)$(TargetName).pdb + + + $(OutDir)$(TargetName)$(TargetExt) + msvcprt.lib;%(IgnoreSpecificDefaultLibraries) + true + Windows + true + true + $(IntDir)$(TargetName).lib + $(IntDir)$(TargetName).pdb + false + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Src/Plugins/SDK/irctell/irctell.vcxproj.filters b/Src/Plugins/SDK/irctell/irctell.vcxproj.filters new file mode 100644 index 00000000..90d52bb5 --- /dev/null +++ b/Src/Plugins/SDK/irctell/irctell.vcxproj.filters @@ -0,0 +1,44 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;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 + + + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/Src/Plugins/SDK/irctell/resource.h b/Src/Plugins/SDK/irctell/resource.h new file mode 100644 index 00000000..f5925f2f --- /dev/null +++ b/Src/Plugins/SDK/irctell/resource.h @@ -0,0 +1,17 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by irctell.rc +// +#define IDS_STRING0 1 +#define IDC_BUTTON1 1001 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1002 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Src/Plugins/SDK/irctell/version.rc2 b/Src/Plugins/SDK/irctell/version.rc2 new file mode 100644 index 00000000..ed40cd10 --- /dev/null +++ b/Src/Plugins/SDK/irctell/version.rc2 @@ -0,0 +1,39 @@ + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// +#include "..\..\..\Winamp\buildType.h" +VS_VERSION_INFO VERSIONINFO + FILEVERSION WINAMP_PRODUCTVER + PRODUCTVERSION WINAMP_PRODUCTVER + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Winamp SA" + VALUE "FileDescription", "Winamp 5.x System Component" + VALUE "FileVersion", STR_WINAMP_PRODUCTVER + VALUE "InternalName", "irctell.w5s" + VALUE "LegalCopyright", "Copyright © 2005-2023 Winamp SA" + VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA" + VALUE "OriginalFilename", "irctell.w5s" + VALUE "ProductName", "Winamp IRC Notifier Service" + VALUE "ProductVersion", STR_WINAMP_PRODUCTVER + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END -- cgit