Merge authors: poy (poy) ------------------------------------------------------------ revno: 25 [merge] committer: poy <p...@123gen.com> branch nick: ChatPlugin timestamp: Wed 2013-05-22 21:43:30 +0200 message: merge added: packaging/ packaging/final/ packaging/final/info.xml packaging/final/make_dcext.bat packaging/packager/ packaging/packager/packager.cpp projects/vs2012/Packager.vcxproj projects/vs2012/Packager.vcxproj.filters modified: .bzrignore doc/Plugin format (dcext).txt pluginsdk/Hooks.cpp pluginsdk/Hooks.h pluginsdk/PluginDefs.h projects/make/Makefile projects/vs2012/Plugin.sln src/version.h
-- lp:~dcplusplus-team/dcpp-plugin-sdk-cpp/ChatPlugin https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/ChatPlugin Your team Dcplusplus-team is subscribed to branch lp:~dcplusplus-team/dcpp-plugin-sdk-cpp/ChatPlugin. To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/ChatPlugin/+edit-subscription
=== modified file '.bzrignore' --- .bzrignore 2013-04-28 21:08:26 +0000 +++ .bzrignore 2013-05-22 19:43:30 +0000 @@ -12,6 +12,10 @@ ./doc/build.bat ./doc/html ./doc/latex +./packaging/* +!./packaging/final +!./packaging/final/*.bat +!./packaging/packager ./projects/make/build* ./projects/vs2010/Debug ./projects/vs2010/ipch === modified file 'doc/Plugin format (dcext).txt' --- doc/Plugin format (dcext).txt 2013-04-23 18:12:02 +0000 +++ doc/Plugin format (dcext).txt 2013-05-13 17:40:06 +0000 @@ -15,8 +15,13 @@ Shared extensions are fine for testing but impractical to distribute and to have users install. Therefore, a DC plugin is preferably packaged as a .dcext file. -A .dcext file is an archive. Currently, it is required to be a tar file, either uncompressed or -compressed with bzip2 or gzip. This may be expanded in the future if needed. +A .dcext file is a ZIP archive, as defined by PKWARE's APPNOTE, either uncompressed (method 0) or +compressed with DEFLATE (method 8), with the following restrictions: +- No encryption. +- No streaming / splitting / spanning. +- No manifest file. +- No character outside of the ASCII range in file names. +- Extensions / extra fields and comments are allowed but shall be ignored. That archive must contain an XML file named "info.xml" at its root, whose contents shall validate against the schemas/dcext.xsd schema. === added directory 'packaging' === added directory 'packaging/final' === added file 'packaging/final/info.xml' --- packaging/final/info.xml 1970-01-01 00:00:00 +0000 +++ packaging/final/info.xml 2013-05-22 19:43:30 +0000 @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> + +<!-- +This file is an example info.xml to be included in the dcext package. For more +information, read "Plugin format (dcext).txt" in the "doc" directory. + +This file has been generated using the information filled in the src/version.h file. + +Edit the <Plugin> tags to include your plugin files. +If you support Windows, include pe-x64 and pe-x86 platforms. +If you support Linux, include elf-x64 and elf-x86 platforms. + +The <Files> tag is empty; should you want to distribute additional files, include them +in there within <File> tags (again, more information in the above doc file). + +When you are done editing this file, rename it to "info.xml", move the relevant files +to this directory and zip them; rename that .zip to .dcext and you are done! +--> + +<dcext> + <UUID>{f83c6829-3c25-4b32-a6a5-63d57b59a18d}</UUID> + <Name>Chat plugin</Name> + <Version>1</Version> + <ApiVersion>7</ApiVersion> + <Author>DC++</Author> + <Description>Chat formatting control: define chat expressions to match and customizations or behaviors to apply (change the font or the color, play a sound...).</Description> + <Website>http://dcplusplus.sourceforge.net/</Website> + <Plugin Platform="pe-x64">ChatPlugin-x64.dll</Plugin> + <Plugin Platform="pe-x86">ChatPlugin-x86.dll</Plugin> + <Files> + </Files> +</dcext> === added file 'packaging/final/make_dcext.bat' --- packaging/final/make_dcext.bat 1970-01-01 00:00:00 +0000 +++ packaging/final/make_dcext.bat 2013-05-22 19:43:30 +0000 @@ -0,0 +1,21 @@ +set PLUGIN_NAME=DevPlugin + +cd ..\..\projects\make + +set PATH=H:\MinGW\bin +mingw32-make + +set PATH=H:\mingw64\bin +mingw32-make + +cd ..\..\packaging\final + +copy ..\..\projects\make\build-mingw-x64\%PLUGIN_NAME%.dll %PLUGIN_NAME%-x64.dll +copy ..\..\projects\make\build-mingw-x86\%PLUGIN_NAME%.dll %PLUGIN_NAME%-x86.dll + +set PATH=C:\Cygwin\bin +zip -9 %PLUGIN_NAME%.dcext info.xml %PLUGIN_NAME%-x86.dll %PLUGIN_NAME%-x64.dll %PLUGIN_NAME%.ico + +del %PLUGIN_NAME%-x64.dll %PLUGIN_NAME%-x86.dll + +pause === added directory 'packaging/packager' === added file 'packaging/packager/packager.cpp' --- packaging/packager/packager.cpp 1970-01-01 00:00:00 +0000 +++ packaging/packager/packager.cpp 2013-05-22 19:19:41 +0000 @@ -0,0 +1,68 @@ +// Generate an info.xml template from the version.h file. + +#include <fstream> +#include <iostream> + +#include <pluginsdk/PluginDefs.h> +#include <src/version.h> + +using namespace std; + +string escape(string str) { + size_t i = 0; + while((i = str.find_first_of("<>&", i)) != string::npos) { + switch(str[i]) { + case '<': str.replace(i, 1, "<"); i += 4; break; + case '>': str.replace(i, 1, ">"); i += 4; break; + case '&': str.replace(i, 1, "&"); i += 5; break; + default: ++i; break; + } + } + return str; +} + +enum { Path = 1, LastCompulsory = Path }; + +int main(int argc, char* argv[]) { + if(argc <= LastCompulsory) { + cout << "packager: no path given by the build script" << endl; + return 1; + } + + ofstream f(argv[Path]); + if(!f.is_open()) { + cout << "packager: cannot open " << argv[Path] << endl; + return 2; + } + + f << "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>\n\n" + "<!--\n" + "This file is an example info.xml to be included in the dcext package. For more\n" + "information, read \"Plugin format (dcext).txt\" in the \"doc\" directory.\n\n" + "This file has been generated using the information filled in the src/version.h file.\n\n" + "Edit the <Plugin> tags to include your plugin files.\n" + "If you support Windows, include pe-x64 and pe-x86 platforms.\n" + "If you support Linux, include elf-x64 and elf-x86 platforms.\n\n" + "The <Files> tag is empty; should you want to distribute additional files, include them\n" + "in there within <File> tags (again, more information in the above doc file).\n\n" + "When you are done editing this file, rename it to \"info.xml\", move the relevant files\n" + "to this directory and zip them; rename that .zip to .dcext and you are done!\n" + "-->\n\n" + "<dcext>\n" + "\t<UUID>" << escape(PLUGIN_GUID).c_str() << "</UUID>\n" + "\t<Name>" << escape(PLUGIN_NAME).c_str() << "</Name>\n" + "\t<Version>" << PLUGIN_VERSION << "</Version>\n" + "\t<ApiVersion>" << DCAPI_CORE_VER << "</ApiVersion>\n" + "\t<Author>" << escape(PLUGIN_AUTHOR).c_str() << "</Author>\n" + "\t<Description>" << escape(PLUGIN_DESC).c_str() << "</Description>\n" + "\t<Website>" << escape(PLUGIN_WEB).c_str() << "</Website>\n" + "\t<Plugin Platform=\"elf-x64\">MyPlugin-x64.so</Plugin>\n" + "\t<Plugin Platform=\"elf-x86\">MyPlugin-x86.so</Plugin>\n" + "\t<Plugin Platform=\"pe-x64\">MyPlugin-x64.dll</Plugin>\n" + "\t<Plugin Platform=\"pe-x86\">MyPlugin-x86.dll</Plugin>\n" + "\t<Files>\n" + "\t</Files>\n" + "</dcext>\n"; + + return 0; +} === modified file 'pluginsdk/Hooks.cpp' --- pluginsdk/Hooks.cpp 2013-01-18 21:37:14 +0000 +++ pluginsdk/Hooks.cpp 2013-05-16 18:19:42 +0000 @@ -95,6 +95,14 @@ addEvent(HOOK_NETWORK_CONN_OUT, [f](dcptr_t pObject, dcptr_t pData, bool& bBreak) { return f(reinterpret_cast<ConnectionDataPtr>(pObject), reinterpret_cast<char*>(pData), bBreak); }); } +void Hooks::Network::onUDPDataIn(function<bool (UDPDataPtr, char*, bool&)> f) { + addEvent(HOOK_NETWORK_UDP_IN, [f](dcptr_t pObject, dcptr_t pData, bool& bBreak) { + return f(reinterpret_cast<UDPDataPtr>(pObject), reinterpret_cast<char*>(pData), bBreak); }); +} +void Hooks::Network::onUDPDataOut(function<bool (UDPDataPtr, char*, bool&)> f) { + addEvent(HOOK_NETWORK_UDP_OUT, [f](dcptr_t pObject, dcptr_t pData, bool& bBreak) { + return f(reinterpret_cast<UDPDataPtr>(pObject), reinterpret_cast<char*>(pData), bBreak); }); +} void Hooks::Queue::onAdded(function<bool (QueueDataPtr, bool&)> f) { addEvent(HOOK_QUEUE_ADDED, [f](dcptr_t pObject, dcptr_t, bool& bBreak) { === modified file 'pluginsdk/Hooks.h' --- pluginsdk/Hooks.h 2013-01-18 21:37:14 +0000 +++ pluginsdk/Hooks.h 2013-05-16 18:19:42 +0000 @@ -78,6 +78,8 @@ static void onHubDataOut(function<bool (HubDataPtr, char*, bool&)> f); static void onClientDataIn(function<bool (ConnectionDataPtr, char*, bool&)> f); static void onClientDataOut(function<bool (ConnectionDataPtr, char*, bool&)> f); + static void onUDPDataIn(function<bool (UDPDataPtr, char*, bool&)> f); + static void onUDPDataOut(function<bool (UDPDataPtr, char*, bool&)> f); }; struct Queue { === modified file 'pluginsdk/PluginDefs.h' --- pluginsdk/PluginDefs.h 2013-05-13 17:18:05 +0000 +++ pluginsdk/PluginDefs.h 2013-05-16 18:19:42 +0000 @@ -100,6 +100,8 @@ #define HOOK_NETWORK_HUB_OUT "dcpp.network.onHubDataOut" /* Outgoing protocol message to hub (obj: HubData) */ #define HOOK_NETWORK_CONN_IN "dcpp.network.onClientDataIn" /* Incoming client<->client protocol message (obj: ConnectionData) */ #define HOOK_NETWORK_CONN_OUT "dcpp.network.onClientDataOut" /* Outgoing client<->client protocol message (obj: ConnectionData) */ +#define HOOK_NETWORK_UDP_IN "dcpp.network.onUDPDataIn" /* Incoming UDP data (obj: UDPData) */ +#define HOOK_NETWORK_UDP_OUT "dcpp.network.onUDPDataOut" /* Outgoing UDP data (obj: UDPData) */ #define HOOK_QUEUE_ADDED "dcpp.queue.onAdded" /* (New) item has been added to download queue (obj: QueueData) */ #define HOOK_QUEUE_MOVED "dcpp.queue.onMoved" /* Download queue item has been moved to new location (obj: QueueData) */ @@ -246,6 +248,12 @@ Bool isManaged; /* Always True (Plugins can not lookup, or track the scope of, a specific instance) */ } ConnectionData, *ConnectionDataPtr; +/* UDP */ +typedef struct tagUDPData { + const char* ip; /* The ip address (remote) for this connection */ + uint16_t port; /* The port for this connection */ +} UDPData, *UDPDataPtr; + /* Queue items and files */ typedef struct tagQueueData { const char* target; /* The *final* location for the file */ === modified file 'projects/make/Makefile' --- projects/make/Makefile 2013-04-29 19:33:24 +0000 +++ projects/make/Makefile 2013-05-22 19:43:30 +0000 @@ -38,8 +38,10 @@ COMPILER_SPEC = $(shell $(CC) -dumpmachine) ifeq ($(findstring mingw, $(COMPILER_SPEC)),) + BINEXT = LIBEXT = .so else + BINEXT = .exe CPPFLAGS += -D_WIN32_WINNT=0x502 -DWINVER=0x502 -D_WIN32_IE=0x600 \ -DNOMINMAX -DSTRICT -DWIN32_LEAN_AND_MEAN \ -DWIN32 -D_WIN32 -DUNICODE -D_UNICODE @@ -125,11 +127,20 @@ TARGET := $(OUTPUT_DIR)/$(TARGET)$(LIBEXT) OBJS := $(addprefix $(OUTPUT_DIR)/, $(OBJS)) -all: $(TARGET) +PACKAGER = $(OUTPUT_DIR)/packaging/packager$(BINEXT) +PACK_INFO = ../../packaging/info_generated.xml + +all: $(TARGET) $(PACK_INFO) $(TARGET): $(OBJS) $(CXX) $^ $(LINKFLAGS) $(LINKXXFLAGS) $(OUTPUT_OPTION) +$(PACKAGER): $(OUTPUT_DIR)/packaging/packager/packager.o + $(CXX) $^ $(subst -shared,,$(LINKFLAGS) $(LINKXXFLAGS)) $(OUTPUT_OPTION) + +$(PACK_INFO): $(PACKAGER) + $(PACKAGER) $(PACK_INFO) + $(OUTPUT_DIR)/%.o: %.c $(COMPILE.c) $< $(OUTPUT_OPTION) @@ -141,7 +152,10 @@ $(OBJS): | $(OUTPUT_DIR) +$(PACKAGER): | $(OUTPUT_DIR) + $(OUTPUT_DIR): + $(call MKDIR,$(OUTPUT_DIR)/packaging/packager) $(call MKDIR,$(OUTPUT_DIR)/pluginsdk) $(call MKDIR,$(OUTPUT_DIR)/src) $(call MKDIR,$(OUTPUT_DIR)/boost/libs/regex/src) === added file 'projects/vs2012/Packager.vcxproj' --- projects/vs2012/Packager.vcxproj 1970-01-01 00:00:00 +0000 +++ projects/vs2012/Packager.vcxproj 2013-05-22 19:19:41 +0000 @@ -0,0 +1,101 @@ +<?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="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{D21D696B-AC15-4706-874A-D8F801202D4B}</ProjectGuid> + <Keyword>Win32Proj</Keyword> + <RootNamespace>Packager</RootNamespace> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>true</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseDebugLibraries>false</UseDebugLibraries> + <PlatformToolset>v110</PlatformToolset> + <WholeProgramOptimization>true</WholeProgramOptimization> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </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" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>true</LinkIncremental> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <PrecompiledHeader> + </PrecompiledHeader> + <WarningLevel>Level3</WarningLevel> + <Optimization>Disabled</Optimization> + <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>../../</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + </Link> + <PostBuildEvent> + <Command>$(TargetPath) ../../packaging/info_generated.xml</Command> + </PostBuildEvent> + <PostBuildEvent> + <Message>Generating info_generated.xml</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <PrecompiledHeader> + </PrecompiledHeader> + <Optimization>MaxSpeed</Optimization> + <FunctionLevelLinking>true</FunctionLevelLinking> + <IntrinsicFunctions>true</IntrinsicFunctions> + <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <AdditionalIncludeDirectories>../../</AdditionalIncludeDirectories> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <GenerateDebugInformation>true</GenerateDebugInformation> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <OptimizeReferences>true</OptimizeReferences> + </Link> + <PostBuildEvent> + <Command>$(TargetPath) ../../packaging/info_generated.xml</Command> + </PostBuildEvent> + <PostBuildEvent> + <Message>Generating info_generated.xml</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClInclude Include="..\..\src\version.h" /> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\packaging\packager\packager.cpp" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project> \ No newline at end of file === added file 'projects/vs2012/Packager.vcxproj.filters' --- projects/vs2012/Packager.vcxproj.filters 1970-01-01 00:00:00 +0000 +++ projects/vs2012/Packager.vcxproj.filters 2013-05-22 19:19:41 +0000 @@ -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="Header Files"> + <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClInclude Include="..\..\src\version.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <ClCompile Include="..\..\packaging\packager\packager.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project> \ No newline at end of file === modified file 'projects/vs2012/Plugin.sln' --- projects/vs2012/Plugin.sln 2012-11-15 18:17:16 +0000 +++ projects/vs2012/Plugin.sln 2013-05-22 19:19:41 +0000 @@ -3,6 +3,8 @@ # Visual Studio 2012 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Plugin", "Plugin.vcxproj", "{B5273AD8-8E53-46CD-8797-65FE814DBFB0}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Packager", "Packager.vcxproj", "{D21D696B-AC15-4706-874A-D8F801202D4B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -13,6 +15,10 @@ {B5273AD8-8E53-46CD-8797-65FE814DBFB0}.Debug|Win32.Build.0 = Debug|Win32 {B5273AD8-8E53-46CD-8797-65FE814DBFB0}.Release|Win32.ActiveCfg = Release|Win32 {B5273AD8-8E53-46CD-8797-65FE814DBFB0}.Release|Win32.Build.0 = Release|Win32 + {D21D696B-AC15-4706-874A-D8F801202D4B}.Debug|Win32.ActiveCfg = Debug|Win32 + {D21D696B-AC15-4706-874A-D8F801202D4B}.Debug|Win32.Build.0 = Debug|Win32 + {D21D696B-AC15-4706-874A-D8F801202D4B}.Release|Win32.ActiveCfg = Release|Win32 + {D21D696B-AC15-4706-874A-D8F801202D4B}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE === modified file 'src/version.h' --- src/version.h 2013-04-28 20:34:59 +0000 +++ src/version.h 2013-05-22 19:43:30 +0000 @@ -31,7 +31,7 @@ #define PLUGIN_AUTHOR "DC++" /* Short description of the plugin */ -#define PLUGIN_DESC "Chat formatting control: define chat expressions to match and" \ +#define PLUGIN_DESC "Chat formatting control: define chat expressions to match and " \ "customizations or behaviors to apply (change the font or the color, play a sound...)." /* Version of the plugin (note: not API version) */
_______________________________________________ Mailing list: https://launchpad.net/~linuxdcpp-team Post to : linuxdcpp-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~linuxdcpp-team More help : https://help.launchpad.net/ListHelp