summary refs log tree commit diff stats
path: root/plugins/doat
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/doat')
-rw-r--r--plugins/doat/doat.c94
-rw-r--r--plugins/doat/doat.def3
-rw-r--r--plugins/doat/doat.vcxproj106
-rw-r--r--plugins/doat/doat.vcxproj.filters23
-rw-r--r--plugins/doat/doat.vcxproj.user3
-rw-r--r--plugins/doat/makefile.mak18
6 files changed, 247 insertions, 0 deletions
diff --git a/plugins/doat/doat.c b/plugins/doat/doat.c
new file mode 100644
index 00000000..a0b5707a
--- /dev/null
+++ b/plugins/doat/doat.c
@@ -0,0 +1,94 @@
+/* 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 = strdup( token );
+				
+			delimiter = strchr( channel, '/' );
+
+			server = NULL;
+			if( delimiter != NULL ) {
+				*delimiter = '\0';
+
+				if( strlen( delimiter + 1 ) > 0 ) {
+					server = strdup( delimiter + 1 );
+				}
+			}
+
+			/* /Network form */
+			if( strlen( channel ) == 0 ) {
+				free( channel );
+				channel = NULL;
+			}
+
+/*			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] );
+				}
+			}
+
+			if( channel != NULL ) {
+				free( channel );
+			}
+
+			if( server != NULL ) {
+				free( server );
+			}
+		}
+	}
+	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.0001";
+	*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/doat.def b/plugins/doat/doat.def
new file mode 100644
index 00000000..77670bf2
--- /dev/null
+++ b/plugins/doat/doat.def
@@ -0,0 +1,3 @@
+EXPORTS 

+xchat_plugin_init 

+xchat_plugin_deinit 

diff --git a/plugins/doat/doat.vcxproj b/plugins/doat/doat.vcxproj
new file mode 100644
index 00000000..33969fc3
--- /dev/null
+++ b/plugins/doat/doat.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>{4980AF24-9D42-427D-A8E6-0DF3B97C455D}</ProjectGuid>

+    <Keyword>Win32Proj</Keyword>

+    <RootNamespace>doat</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>xcdoat</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>xcdoat</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;DOAT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>

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

+      <MultiProcessorCompilation>true</MultiProcessorCompilation>

+    </ClCompile>

+    <Link>

+      <SubSystem>Windows</SubSystem>

+      <GenerateDebugInformation>true</GenerateDebugInformation>

+      <EnableCOMDATFolding>true</EnableCOMDATFolding>

+      <OptimizeReferences>true</OptimizeReferences>

+      <ModuleDefinitionFile>doat.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;DOAT_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>

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

+      <MultiProcessorCompilation>true</MultiProcessorCompilation>

+    </ClCompile>

+    <Link>

+      <SubSystem>Windows</SubSystem>

+      <GenerateDebugInformation>true</GenerateDebugInformation>

+      <EnableCOMDATFolding>true</EnableCOMDATFolding>

+      <OptimizeReferences>true</OptimizeReferences>

+      <ModuleDefinitionFile>doat.def</ModuleDefinitionFile>

+    </Link>

+  </ItemDefinitionGroup>

+  <ItemGroup>

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

+  </ItemGroup>

+  <ItemGroup>

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

+  </ItemGroup>

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

+  <ImportGroup Label="ExtensionTargets">

+  </ImportGroup>

+</Project>
\ No newline at end of file
diff --git a/plugins/doat/doat.vcxproj.filters b/plugins/doat/doat.vcxproj.filters
new file mode 100644
index 00000000..43ea8307
--- /dev/null
+++ b/plugins/doat/doat.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>

+    <ClCompile Include="doat.c">

+      <Filter>Source Files</Filter>

+    </ClCompile>

+  </ItemGroup>

+  <ItemGroup>

+    <None Include="doat.def">

+      <Filter>Resource Files</Filter>

+    </None>

+  </ItemGroup>

+</Project>
\ No newline at end of file
diff --git a/plugins/doat/doat.vcxproj.user b/plugins/doat/doat.vcxproj.user
new file mode 100644
index 00000000..695b5c78
--- /dev/null
+++ b/plugins/doat/doat.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
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