diff options
-rw-r--r-- | build/release-x64.bat | 1 | ||||
-rw-r--r-- | build/release-x86.bat | 1 | ||||
-rw-r--r-- | plugins/doat/doat.c | 80 | ||||
-rw-r--r-- | plugins/doat/makefile.mak | 18 | ||||
-rw-r--r-- | plugins/makefile.mak | 4 |
5 files changed, 104 insertions, 0 deletions
diff --git a/build/release-x64.bat b/build/release-x64.bat index 47ba3589..e96b01e2 100644 --- a/build/release-x64.bat +++ b/build/release-x64.bat @@ -47,6 +47,7 @@ copy %DEPS_ROOT%\bin\cert.pem %XCHAT_DEST% copy %DEPS_ROOT%\bin\libenchant.dll %XCHAT_DEST% xcopy /q /s /i %DEPS_ROOT%\lib\enchant\libenchant_myspell.dll %XCHAT_DEST%\lib\enchant\ xcopy /q /s /i ..\plugins\checksum\xcchecksum.dll %XCHAT_DEST%\plugins\ +copy ..\plugins\doat\xcdoat.dll %XCHAT_DEST%\plugins copy ..\plugins\lua\xclua.dll %XCHAT_DEST%\plugins ::copy ..\plugins\gtkpref\xcgtkpref.dll %XCHAT_DEST%\plugins copy ..\plugins\mpcinfo\xcmpcinfo.dll %XCHAT_DEST%\plugins diff --git a/build/release-x86.bat b/build/release-x86.bat index c7223fe0..ddd1ff0c 100644 --- a/build/release-x86.bat +++ b/build/release-x86.bat @@ -47,6 +47,7 @@ copy %DEPS_ROOT%\bin\cert.pem %XCHAT_DEST% copy %DEPS_ROOT%\bin\libenchant.dll %XCHAT_DEST% xcopy /q /s /i %DEPS_ROOT%\lib\enchant\libenchant_myspell.dll %XCHAT_DEST%\lib\enchant\ xcopy /q /s /i ..\plugins\checksum\xcchecksum.dll %XCHAT_DEST%\plugins\ +copy ..\plugins\doat\xcdoat.dll %XCHAT_DEST%\plugins copy ..\plugins\lua\xclua.dll %XCHAT_DEST%\plugins ::copy ..\plugins\gtkpref\xcgtkpref.dll %XCHAT_DEST%\plugins copy ..\plugins\mpcinfo\xcmpcinfo.dll %XCHAT_DEST%\plugins diff --git a/plugins/doat/doat.c b/plugins/doat/doat.c new file mode 100644 index 00000000..e03507f1 --- /dev/null +++ b/plugins/doat/doat.c @@ -0,0 +1,80 @@ +/* This program is free software. It comes without any warranty, to + * the extent permitted by applicable law. You can redistribute it + * and/or modify it under the terms of the Do What The Fuck You Want + * To Public License, Version 2, as published by Sam Hocevar. See + * http://sam.zoy.org/wtfpl/COPYING or http://lwsitu.com/xchat/COPYING + * for more details. */ + +#include <stdlib.h> +#include <string.h> +#include <stdio.h> +#include "xchat-plugin.h" + +static xchat_plugin *ph; + +static int +parse_command( char *word[], char *word_eol[], void *userdata ) { + char *channel = NULL, *server = NULL, *token = NULL; +/* char *save_ptr1 = NULL;*/ + char *str1 = NULL; + char *delimiter = NULL; + + xchat_context *ctx = NULL; + + if( word[2] != NULL && word[3] != NULL ) { + for( str1 = word[2]; ; str1 = NULL ) { +/* token = strtok_r( str1, ",", &save_ptr1 );*/ + token = strtok( str1, "," ); +/* printf( "token: %s\n", token );*/ + + if( token == NULL ) { + break; + } + + channel = malloc( strlen( token ) + 1 ); + strcpy( channel, token ); + + delimiter = strchr( channel, '/' ); + + server = NULL; + if( delimiter != NULL ) { + *delimiter = '\0'; + server = delimiter + 1; + } + +/* printf( "channel[%s] server[%s]\n", channel, server );*/ + + if( (ctx = xchat_find_context( ph, server, channel ) ) != NULL ) { + if( xchat_set_context( ph, ctx ) ) { + xchat_command( ph, word_eol[3] ); + } + } + + free( channel ); + } + } + return XCHAT_EAT_XCHAT; +} + +int +xchat_plugin_init( xchat_plugin * plugin_handle, char **plugin_name, + char **plugin_desc, char **plugin_version, char *arg ) { + + ph = plugin_handle; + *plugin_name = "Do At"; + *plugin_version = "1.0"; + *plugin_desc = "Perform an arbitrary command on multiple channels"; + + xchat_hook_command( ph, "doat", XCHAT_PRI_NORM, parse_command, "DOAT [channel,list,/network] [command], perform a command on multiple contexts", NULL ); + + xchat_print (ph, "Do At plugin loaded\n"); + + return 1; +} + +int +xchat_plugin_deinit (void) +{ + xchat_print (ph, "Do At plugin unloaded\n"); + return 1; +} diff --git a/plugins/doat/makefile.mak b/plugins/doat/makefile.mak new file mode 100644 index 00000000..960cae27 --- /dev/null +++ b/plugins/doat/makefile.mak @@ -0,0 +1,18 @@ +include "..\..\src\makeinc.mak" + +all: doat.obj doat.def + link $(LDFLAGS) $(LIBS) /dll /out:xcdoat.dll /def:doat.def doat.obj + +doat.def: + echo EXPORTS > doat.def + echo xchat_plugin_init >> doat.def + echo xchat_plugin_deinit >> doat.def + +doat.obj: doat.c makefile.mak + cl $(CFLAGS) $(GLIB) /I.. doat.c + +clean: + del *.obj + del *.dll + del *.exp + del *.lib diff --git a/plugins/makefile.mak b/plugins/makefile.mak index 2ac155df..b08917ab 100644 --- a/plugins/makefile.mak +++ b/plugins/makefile.mak @@ -3,6 +3,8 @@ all: @-$(MAKE) /nologo /s /f makefile.mak $@ # @cd ..\gtkpref # @-$(MAKE) /nologo /s /f makefile.mak $@ + @cd ..\doat + @-$(MAKE) /nologo /s /f makefile.mak $@ @cd ..\lua @-$(MAKE) /nologo /s /f makefile.mak $@ @cd ..\mpcinfo @@ -25,6 +27,8 @@ clean: @-$(MAKE) /nologo /s /f makefile.mak clean $@ # @cd ..\gtkpref # @-$(MAKE) /nologo /s /f makefile.mak clean $@ + @cd ..\doat + @-$(MAKE) /nologo /s /f makefile.mak clean $@ @cd ..\lua @-$(MAKE) /nologo /s /f makefile.mak clean $@ @cd ..\mpcinfo |