summary refs log tree commit diff stats
path: root/plugins/winamp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/winamp')
-rw-r--r--plugins/winamp/makefile.mak18
-rw-r--r--plugins/winamp/winamp.c189
-rw-r--r--plugins/winamp/winamp.def3
-rw-r--r--plugins/winamp/winamp.vcxproj106
-rw-r--r--plugins/winamp/winamp.vcxproj.filters23
-rw-r--r--plugins/winamp/winamp.vcxproj.user3
6 files changed, 342 insertions, 0 deletions
diff --git a/plugins/winamp/makefile.mak b/plugins/winamp/makefile.mak
new file mode 100644
index 00000000..79adf87e
--- /dev/null
+++ b/plugins/winamp/makefile.mak
@@ -0,0 +1,18 @@
+include "..\..\src\makeinc.mak"

+

+all: winamp.obj winamp.def

+	link $(LDFLAGS) $(LIBS) /dll /out:xcwinamp.dll /def:winamp.def winamp.obj

+

+winamp.def:

+	echo EXPORTS > winamp.def

+	echo xchat_plugin_init >> winamp.def

+	echo xchat_plugin_deinit >> winamp.def

+

+winamp.obj: winamp.c makefile.mak

+	cl $(CFLAGS) /I.. winamp.c

+

+clean:

+	del *.obj

+	del *.dll

+	del *.exp

+	del *.lib

diff --git a/plugins/winamp/winamp.c b/plugins/winamp/winamp.c
new file mode 100644
index 00000000..7201a875
--- /dev/null
+++ b/plugins/winamp/winamp.c
@@ -0,0 +1,189 @@
+/********************* Winamp Plugin 0.3******************************
+ *
+ *   Distribution: GPL
+ *
+ *   Originally written by: Leo - leo.nard@free.fr
+ *   Modified by: SilvereX - SilvereX@karklas.mif.vu.lt
+ *   Modified again by: Derek Buitenhuis - daemon404@gmail.com
+ *   Modified yet again by: Berke Viktor - berkeviktor@aol.com
+ *********************************************************************/
+
+#include "windows.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "xchat-plugin.h"
+
+#define PLAYING 1
+#define PAUSED 3
+
+static xchat_plugin *ph;   /* plugin handle */
+
+BOOL winamp_found = FALSE;
+
+int status = 0;
+
+/* Slightly modified from X-Chat's log_escape_strcpy */
+static char *
+song_strcpy (char *dest, char *src)
+{
+	while (*src)
+	{
+		*dest = *src;
+		dest++;
+		src++;
+
+		if (*src == '%')
+		{
+			dest[0] = '%';
+			dest++;
+		}
+	}
+
+	dest[0] = 0;
+	return dest - 1;
+}
+
+static int
+winamp(char *word[], char *word_eol[], void *userdata)
+{
+
+char current_play[2048], *p;
+char p_esc[2048];
+char cur_esc[2048];
+char truc[2048];
+HWND hwndWinamp = FindWindow("Winamp v1.x",NULL);
+
+    if (hwndWinamp)
+	{
+	    {
+	        if (!stricmp("PAUSE", word[2]))
+			{
+			   if (SendMessage(hwndWinamp,WM_USER, 0, 104))
+				{
+			   	   SendMessage(hwndWinamp, WM_COMMAND, 40046, 0);
+			
+			       if (SendMessage(hwndWinamp, WM_USER, 0, 104) == PLAYING)
+			   	       xchat_printf(ph, "Winamp: playing");
+			       else
+                       xchat_printf(ph, "Winamp: paused");
+				}
+            }
+			else
+		        if (!stricmp("STOP", word[2]))
+			    {
+			       SendMessage(hwndWinamp, WM_COMMAND, 40047, 0);
+			       xchat_printf(ph, "Winamp: stopped");
+			    }
+			else
+			    if (!stricmp("PLAY", word[2]))
+			    {
+			         SendMessage(hwndWinamp, WM_COMMAND, 40045, 0);
+			         xchat_printf(ph, "Winamp: playing");
+			    }
+        	else
+
+			    if (!stricmp("NEXT", word[2]))
+			    {
+			         SendMessage(hwndWinamp, WM_COMMAND, 40048, 0);
+			         xchat_printf(ph, "Winamp: next playlist entry");
+			    }
+			else
+
+                if (!stricmp("PREV", word[2]))
+			    {
+			         SendMessage(hwndWinamp, WM_COMMAND, 40044, 0);
+			         xchat_printf(ph, "Winamp: previous playlist entry");
+			    }
+		    else
+
+                if (!stricmp("START", word[2]))
+			    {
+			         SendMessage(hwndWinamp, WM_COMMAND, 40154, 0);
+			         xchat_printf(ph, "Winamp: playlist start");
+			    }
+
+		    else
+
+                if (!word_eol[2][0])
+			    {
+					GetWindowText(hwndWinamp, current_play, sizeof(current_play));
+
+					if (strchr(current_play, '-'))
+					{
+	
+					p = current_play + strlen(current_play) - 8;
+					while (p >= current_play)
+					{
+						if (!strnicmp(p, "- Winamp", 8)) break;
+							p--;
+					}
+
+					if (p >= current_play) p--;
+	
+					while (p >= current_play && *p == ' ') p--;
+						*++p=0;
+	
+	
+					p = strchr(current_play, '.') + 1;
+
+ 					song_strcpy(p_esc, p);
+ 					song_strcpy(cur_esc, current_play);
+	
+					if (p)
+					{
+						sprintf(truc, "me is now playing:%s", p_esc);
+					}
+					else
+					{
+						sprintf(truc, "me is now playing:%s", cur_esc);
+					}
+	
+	   				xchat_commandf(ph, truc);
+	
+				}
+				else xchat_print(ph, "Winamp: Nothing being played.");
+			}
+		    else
+                xchat_printf(ph, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START]\n");
+         }
+
+	}
+	else
+	{
+       xchat_print(ph, "Winamp not found.\n");
+	}
+	return XCHAT_EAT_ALL;
+}
+
+int
+xchat_plugin_init(xchat_plugin *plugin_handle,
+                      char **plugin_name,
+                      char **plugin_desc,
+                      char **plugin_version,
+                      char *arg)
+{
+	/* we need to save this for use with any xchat_* functions */
+	ph = plugin_handle;
+
+	*plugin_name = "Winamp";
+	*plugin_desc = "Winamp plugin for XChat";
+	*plugin_version = "0.5";
+
+	xchat_hook_command (ph, "WINAMP", XCHAT_PRI_NORM, winamp, "Usage: /WINAMP [PAUSE|PLAY|STOP|NEXT|PREV|START] - control Winamp or show what's currently playing", 0);
+   	xchat_command (ph, "MENU -ietc\\music.png ADD \"Window/Display Current Song (Winamp)\" \"WINAMP\"");
+
+	xchat_print (ph, "Winamp plugin loaded\n");
+
+	return 1;       /* return 1 for success */
+}
+
+int
+xchat_plugin_deinit(void)
+{
+	xchat_command (ph, "MENU DEL \"Window/Display Current Song (Winamp)\"");
+	xchat_print (ph, "Winamp plugin unloaded\n");
+	return 1;
+}
diff --git a/plugins/winamp/winamp.def b/plugins/winamp/winamp.def
new file mode 100644
index 00000000..77670bf2
--- /dev/null
+++ b/plugins/winamp/winamp.def
@@ -0,0 +1,3 @@
+EXPORTS 

+xchat_plugin_init 

+xchat_plugin_deinit 

diff --git a/plugins/winamp/winamp.vcxproj b/plugins/winamp/winamp.vcxproj
new file mode 100644
index 00000000..2b5f3633
--- /dev/null
+++ b/plugins/winamp/winamp.vcxproj
@@ -0,0 +1,106 @@
+<?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="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>{E78C0D9A-798E-4BF6-B0CC-6FECB8CA2FCE}</ProjectGuid>

+    <Keyword>Win32Proj</Keyword>

+    <RootNamespace>winamp</RootNamespace>

+  </PropertyGroup>

+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />

+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">

+    <ConfigurationType>DynamicLibrary</ConfigurationType>

+    <UseDebugLibraries>false</UseDebugLibraries>

+    <WholeProgramOptimization>true</WholeProgramOptimization>

+    <CharacterSet>MultiByte</CharacterSet>

+    <PlatformToolset>WDK7</PlatformToolset>

+  </PropertyGroup>

+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">

+    <ConfigurationType>DynamicLibrary</ConfigurationType>

+    <UseDebugLibraries>false</UseDebugLibraries>

+    <WholeProgramOptimization>true</WholeProgramOptimization>

+    <CharacterSet>MultiByte</CharacterSet>

+    <PlatformToolset>WDK7</PlatformToolset>

+  </PropertyGroup>

+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

+  <ImportGroup Label="ExtensionSettings">

+  </ImportGroup>

+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />

+    <Import Project="..\..\win32\xchat.props" />

+  </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" />

+    <Import Project="..\..\win32\xchat.props" />

+  </ImportGroup>

+  <PropertyGroup Label="UserMacros" />

+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

+    <LinkIncremental>false</LinkIncremental>

+    <TargetName>xcwinamp</TargetName>

+    <OutDir>$(SolutionDir)build\$(PlatformName)\bin</OutDir>

+    <IntDir>$(SolutionDir)build\$(PlatformName)\obj\$(ProjectName)</IntDir>

+  </PropertyGroup>

+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

+    <LinkIncremental>false</LinkIncremental>

+    <TargetName>xcwinamp</TargetName>

+    <OutDir>$(SolutionDir)build\$(PlatformName)\bin</OutDir>

+    <IntDir>$(SolutionDir)build\$(PlatformName)\obj\$(ProjectName)</IntDir>

+  </PropertyGroup>

+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

+    <ClCompile>

+      <WarningLevel>Level1</WarningLevel>

+      <PrecompiledHeader>

+      </PrecompiledHeader>

+      <Optimization>MaxSpeed</Optimization>

+      <FunctionLevelLinking>true</FunctionLevelLinking>

+      <IntrinsicFunctions>true</IntrinsicFunctions>

+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WINAMP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>

+      <MultiProcessorCompilation>true</MultiProcessorCompilation>

+      <AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

+    </ClCompile>

+    <Link>

+      <SubSystem>Windows</SubSystem>

+      <GenerateDebugInformation>true</GenerateDebugInformation>

+      <EnableCOMDATFolding>true</EnableCOMDATFolding>

+      <OptimizeReferences>true</OptimizeReferences>

+      <ModuleDefinitionFile>winamp.def</ModuleDefinitionFile>

+    </Link>

+  </ItemDefinitionGroup>

+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

+    <ClCompile>

+      <WarningLevel>Level1</WarningLevel>

+      <PrecompiledHeader>

+      </PrecompiledHeader>

+      <Optimization>MaxSpeed</Optimization>

+      <FunctionLevelLinking>true</FunctionLevelLinking>

+      <IntrinsicFunctions>true</IntrinsicFunctions>

+      <PreprocessorDefinitions>WIN32;_WIN64;NDEBUG;_WINDOWS;_USRDLL;WINAMP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>

+      <MultiProcessorCompilation>true</MultiProcessorCompilation>

+      <AdditionalIncludeDirectories>..;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

+    </ClCompile>

+    <Link>

+      <SubSystem>Windows</SubSystem>

+      <GenerateDebugInformation>true</GenerateDebugInformation>

+      <EnableCOMDATFolding>true</EnableCOMDATFolding>

+      <OptimizeReferences>true</OptimizeReferences>

+      <ModuleDefinitionFile>winamp.def</ModuleDefinitionFile>

+    </Link>

+  </ItemDefinitionGroup>

+  <ItemGroup>

+    <None Include="winamp.def" />

+  </ItemGroup>

+  <ItemGroup>

+    <ClCompile Include="winamp.c" />

+  </ItemGroup>

+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

+  <ImportGroup Label="ExtensionTargets">

+  </ImportGroup>

+</Project>
\ No newline at end of file
diff --git a/plugins/winamp/winamp.vcxproj.filters b/plugins/winamp/winamp.vcxproj.filters
new file mode 100644
index 00000000..1a800a33
--- /dev/null
+++ b/plugins/winamp/winamp.vcxproj.filters
@@ -0,0 +1,23 @@
+<?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="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;mfcribbon-ms</Extensions>

+    </Filter>

+  </ItemGroup>

+  <ItemGroup>

+    <None Include="winamp.def">

+      <Filter>Resource Files</Filter>

+    </None>

+  </ItemGroup>

+  <ItemGroup>

+    <ClCompile Include="winamp.c">

+      <Filter>Source Files</Filter>

+    </ClCompile>

+  </ItemGroup>

+</Project>
\ No newline at end of file
diff --git a/plugins/winamp/winamp.vcxproj.user b/plugins/winamp/winamp.vcxproj.user
new file mode 100644
index 00000000..695b5c78
--- /dev/null
+++ b/plugins/winamp/winamp.vcxproj.user
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>

+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

+</Project>
\ No newline at end of file