replace easywinampcontrol with winamp

This commit is contained in:
berkeviktor@aol.com 2010-10-09 20:46:20 +02:00
parent 5bc5505618
commit 77292b4254
6 changed files with 226 additions and 11 deletions

View File

@ -41,4 +41,5 @@ copy ..\plugins\tcl\xctcl.dll %XCHAT_DEST%\plugins\xctcl.dll.x64
copy ..\plugins\upd\xcupd.dll %XCHAT_DEST%\plugins\xcupd.dll.x64
copy ..\plugins\xdcc\xcxdcc.dll %XCHAT_DEST%\plugins\xcxdcc.dll.x64
copy ..\plugins\xtray\xtray.dll %XCHAT_DEST%\plugins\xtray.dll.x64
copy ..\plugins\winamp\xcwinamp.dll %XCHAT_DEST%\plugins\xcwinamp.dll.x64
copy %LUA_BIN%\lua51.dll %XCHAT_DEST%\lua51.dll.x64

View File

@ -45,7 +45,7 @@ copy %SSL_BIN%\zlib1.dll %XCHAT_DEST%
copy %SSL_BIN%\cert.pem %XCHAT_DEST%
copy %ENCHANT_BIN%\libenchant.dll %XCHAT_DEST%
xcopy /q /s /i %ENCHANT_BIN%\..\lib\enchant\libenchant_myspell.dll %XCHAT_DEST%\lib\enchant\
xcopy /q /s /i ..\plugins\ewc\xcewc.dll %XCHAT_DEST%\plugins\
::xcopy /q /s /i ..\plugins\ewc\xcewc.dll %XCHAT_DEST%\plugins\
copy ..\plugins\lua\xclua.dll %XCHAT_DEST%\plugins
copy ..\plugins\perl\xcperl-510.dll %XCHAT_DEST%\plugins
copy ..\plugins\perl\xcperl-512.dll %XCHAT_DEST%\plugins
@ -54,6 +54,7 @@ copy ..\plugins\tcl\xctcl.dll %XCHAT_DEST%\plugins
copy ..\plugins\upd\xcupd.dll %XCHAT_DEST%\plugins
copy ..\plugins\xdcc\xcxdcc.dll %XCHAT_DEST%\plugins
copy ..\plugins\xtray\xtray.dll %XCHAT_DEST%\plugins
copy ..\plugins\winamp\xcwinamp.dll %XCHAT_DEST%\plugins
copy %LUA_BIN%\lua51.dll %XCHAT_DEST%
xcopy /q /s /i ..\po\locale %XCHAT_DEST%\locale
xcopy /q /s /i %GTK_BIN%\..\share\locale %XCHAT_DEST%\share\locale

View File

@ -39,8 +39,9 @@ Name: "libs"; Description: "XChat-WDK"; Types: normal full custom; Flags: fixed
Name: "translations"; Description: "Translations"; Types: normal full custom; Flags: disablenouninstallwarning
Name: "spelling"; Description: "Spelling Dictionaries"; Types: full custom; Flags: disablenouninstallwarning
Name: "plugins"; Description: "Plugins"; Types: full custom; Flags: disablenouninstallwarning
Name: "plugins\ewc"; Description: "EasyWinampControl"; Types: full custom; Flags: disablenouninstallwarning
;Name: "plugins\ewc"; Description: "EasyWinampControl"; Types: full custom; Flags: disablenouninstallwarning
Name: "plugins\upd"; Description: "Update Checker"; Types: normal full custom; Flags: disablenouninstallwarning
Name: "plugins\winamp"; Description: "Winamp"; Types: full custom; Flags: disablenouninstallwarning
Name: "plugins\xdcc"; Description: "XDCC"; Types: full custom; Flags: disablenouninstallwarning
Name: "langs"; Description: "Language Interfaces"; Types: full custom; Flags: disablenouninstallwarning
Name: "langs\lua"; Description: "Lua"; Types: full custom; Flags: disablenouninstallwarning
@ -184,12 +185,15 @@ Source: "lib\gtk-2.0\modules\libgail.dll.x64"; DestDir: "{app}\lib\gtk-2.0\modul
Source: "plugins\xcewc.dll"; DestDir: "{app}\plugins"; Components: plugins\ewc; Tasks: x86
Source: "plugins\xcewc.dll.x64"; DestDir: "{app}\plugins"; DestName: "xcewc.dll"; Components: plugins\ewc; Tasks: x64
;Source: "plugins\xcewc.dll"; DestDir: "{app}\plugins"; Components: plugins\ewc; Tasks: x86
;Source: "plugins\xcewc.dll.x64"; DestDir: "{app}\plugins"; DestName: "xcewc.dll"; Components: plugins\ewc; Tasks: x64
Source: "plugins\xcupd.dll"; DestDir: "{app}\plugins"; Components: plugins\upd; Tasks: x86
Source: "plugins\xcupd.dll.x64"; DestDir: "{app}\plugins"; DestName: "xcupd.dll"; Components: plugins\upd; Tasks: x64
Source: "plugins\xcwinamp.dll"; DestDir: "{app}\plugins"; Components: plugins\ewc; Tasks: x86
Source: "plugins\xcwinamp.dll.x64"; DestDir: "{app}\plugins"; DestName: "xcwinamp.dll"; Components: plugins\ewc; Tasks: x64
Source: "plugins\xcxdcc.dll"; DestDir: "{app}\plugins"; Components: plugins\xdcc; Tasks: x86
Source: "plugins\xcxdcc.dll.x64"; DestDir: "{app}\plugins"; DestName: "xcxdcc.dll"; Components: plugins\xdcc; Tasks: x64

View File

@ -1,6 +1,6 @@
all:
@cd ewc
@-$(MAKE) /nologo /s /f makefile.mak $@
# @cd ewc
# @-$(MAKE) /nologo /s /f makefile.mak $@
@cd ..\lua
@-$(MAKE) /nologo /s /f makefile.mak $@
@cd ..\python
@ -13,13 +13,15 @@ all:
@-$(MAKE) /nologo /s /f makefile.mak $@
@cd ..\xtray
@-$(MAKE) /nologo /s /f makefile.mak $@
@cd ..\winamp
@-$(MAKE) /nologo /s /f makefile.mak $@
clean:
@del ewc\*.def
@del ewc\*.dll
@del ewc\*.exp
@del ewc\*.lib
@del ewc\*.obj
# @del ewc\*.def
# @del ewc\*.dll
# @del ewc\*.exp
# @del ewc\*.lib
# @del ewc\*.obj
@del lua\*.def
@del lua\*.dll
@del lua\*.exp
@ -50,3 +52,8 @@ clean:
@del xtray\*.exp
@del xtray\*.lib
@del xtray\*.obj
@del winamp\*.def
@del winamp\*.dll
@del winamp\*.exp
@del winamp\*.lib
@del winamp\*.obj

View File

@ -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) winamp.c
clean:
del *.obj
del *.dll
del *.exp
del *.lib

184
plugins/winamp/winamp.c Normal file
View File

@ -0,0 +1,184 @@
/********************* 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: /wa [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.4";
xchat_hook_command(ph, "WA", XCHAT_PRI_NORM, winamp, "Usage: /WA [PAUSE|PLAY|STOP|NEXT|PREV|START] - control Winamp or show what's currently playing", 0);
xchat_print(ph, "Winamp plugin loaded\n");
return 1; /* return 1 for success */
}
int xchat_plugin_deinit(void)
{
xchat_print(ph, "Winamp plugin unloaded\n");
return 1;
}