← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcpp-plugin-sdk-c/ExamplePlugin] Rev 14: merge

 

Merge authors:
  poy (poy)
------------------------------------------------------------
revno: 14 [merge]
committer: poy <poy@xxxxxxxxxx>
branch nick: ExamplePlugin
timestamp: Thu 2013-04-25 19:55:51 +0200
message:
  merge
added:
  doc/Plugin format (dcext).txt
modified:
  pluginsdk/Config.c
  pluginsdk/Config.h
  pluginsdk/PluginDefs.h


--
lp:~dcplusplus-team/dcpp-plugin-sdk-c/ExamplePlugin
https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-c/ExamplePlugin

Your team Dcplusplus-team is subscribed to branch lp:~dcplusplus-team/dcpp-plugin-sdk-c/ExamplePlugin.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-c/ExamplePlugin/+edit-subscription
=== added file 'doc/Plugin format (dcext).txt'
--- doc/Plugin format (dcext).txt	1970-01-01 00:00:00 +0000
+++ doc/Plugin format (dcext).txt	2013-04-23 18:11:29 +0000
@@ -0,0 +1,70 @@
+This document describes the way DC plugins are packaged and distributed.
+
+More resources:
+- C SDK: <https://launchpad.net/dcpp-plugin-sdk-c>.
+- C++ SDK: <https://launchpad.net/dcpp-plugin-sdk-cpp>.
+- Implementation details: dcpp/Plugin* files.
+
+Alternative names for a DC plugin: DC extension, DC++ plugin, DC++ extension - stemming from the
+host-agnostic design of the DC plugin API.
+
+A DC plugin is, at the very least, a shared extension (.so Linux file, .dll Windows file) that
+defines a "pluginInit" function and handles basic events from the plugin API (ON_INSTALL, ON_LOAD,
+etc). It can then subscribe to interfaces such as DCHooks to catch more events.
+
+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.
+
+That archive must contain an XML file named "info.xml" at its root, whose contents shall validate
+against the schemas/dcext.xsd schema.
+
+Description of the XML tags:
+
+- "dcext" (compulsory): Root tag.
+
+- "UUID" (compulsory): UUID to uniquely identify this plugin.
+- "Name" (compulsory): Friendly name of the plugin.
+- "Version" (compulsory): Version of the plugin; used for updates.
+- "ApiVersion" (compulsory): Plugin API version the plugin has been built with.
+
+- "Author" (optional): Author of the plugin.
+- "Description" (optional): Short description of the plugin.
+- "Website" (optional): Plugin website.
+
+- "Plugin" (compulsory): Location of the loadable shared extension within the archive. The required
+	"Platform" attribute of this tag must be a value from the "Platform codes" list below. Multiple
+	"Plugin" tags may be provided for different platforms.
+- "Files" (optional): Additional files required by the plugin, each within a "File" tag. "File"
+	tags may contain an optional "Platform" attribute which must be a value from the "Platform
+	codes" list below; in its absence, files are assumed to be platform-independant by default.
+
+Platform codes:
+- elf-x64: ELF format, x64 architecture.
+- elf-x86: ELF format, x86 architecture.
+- pe-x64: PE format, x64 architecture.
+- pe-x86: PE format, x86 architecture.
+
+Example info.xml:
+
+<?xml version="1.0" encoding="utf-8" standalone="yes"?>
+<dcext>
+	<UUID>{f62ed829-def5-4332-a0d7-84d2ec692006}</UUID>
+	<Name>Test plugin</Name>
+	<Version>2.3</Version>
+	<ApiVersion>6</ApiVersion>
+	<Author>Test team</Author>
+	<Description>Plugin to do X</Description>
+	<Website>http://example.com</Website>
+	<Plugin Platform="elf-x64">x64/TestPlugin.so</Plugin>
+	<Plugin Platform="elf-x86">x86/TestPlugin.so</Plugin>
+	<Plugin Platform="pe-x64">x64/TestPlugin.dll</Plugin>
+	<Plugin Platform="pe-x86">x86/TestPlugin.dll</Plugin>
+	<Files>
+		<File>icons/TestPlugin.ico</File>
+		<File>fonts/cool.font</File>
+		<File Platform="elf-x64">FasterHash.so</File>
+	</Files>
+</dcext>

=== modified file 'pluginsdk/Config.c'
--- pluginsdk/Config.c	2013-01-18 21:37:28 +0000
+++ pluginsdk/Config.c	2013-04-23 18:11:29 +0000
@@ -100,3 +100,14 @@
 void DCAPI free_core_cfg(ConfigValuePtr val) { config->release(val); }
 
 const char* DCAPI get_cfg_path(PathType path) { return config->get_path(path); }
+
+char* DCAPI get_install_path() {
+	ConfigStrPtr val = config->get_install_path(guid);
+	size_t len = strlen(val->value) + 1;
+	char* value = (char*)memset(malloc(len), 0, len);
+
+	strncpy(value, val->value, len);
+	config->release((ConfigValuePtr)val);
+
+	return value;
+}

=== modified file 'pluginsdk/Config.h'
--- pluginsdk/Config.h	2013-01-18 21:37:28 +0000
+++ pluginsdk/Config.h	2013-04-23 18:11:29 +0000
@@ -39,4 +39,6 @@
 
 const char* DCAPI get_cfg_path(PathType path);
 
+char* DCAPI get_install_path();
+
 #endif

=== modified file 'pluginsdk/PluginDefs.h'
--- pluginsdk/PluginDefs.h	2013-03-03 19:23:58 +0000
+++ pluginsdk/PluginDefs.h	2013-04-23 18:11:29 +0000
@@ -32,7 +32,7 @@
 #endif
 
 /* Version of the plugin api (must change if old plugins simply can't be seen as viably working) */
-#define DCAPI_CORE_VER				6
+#define DCAPI_CORE_VER				7
 
 #ifdef _WIN32
 # define DCAPI __stdcall
@@ -58,7 +58,7 @@
 
 /* Recommended interfaces */
 #define DCINTF_CONFIG				"generic.plugins.DCConfig"	/* Config management */
-#define DCINTF_CONFIG_VER			1
+#define DCINTF_CONFIG_VER			2
 
 #define DCINTF_LOGGING				"generic.plugins.DCLog"		/* Logging functions */
 #define DCINTF_LOGGING_VER			1
@@ -74,10 +74,10 @@
 #define DCINTF_DCPP_QUEUE_VER		2
 
 #define DCINTF_DCPP_UTILS			"dcpp.utils.DCUtils"		/* Utility and convenience functions */
-#define DCINTF_DCPP_UTILS_VER		2
+#define DCINTF_DCPP_UTILS_VER		1
 
 #define DCINTF_DCPP_TAGGER			"dcpp.xml.DCTagger"			/* Manipulation of an XML tagger */
-#define DCINTF_DCPP_TAGGER_VER		2
+#define DCINTF_DCPP_TAGGER_VER		1
 
 #define DCINTF_DCPP_UI				"dcpp.ui.DCUI"				/* User interface */
 #define DCINTF_DCPP_UI_VER			1
@@ -336,6 +336,9 @@
 
 	ConfigValuePtr		(DCAPI *copy)				(const ConfigValuePtr val);
 	void				(DCAPI *release)			(ConfigValuePtr val);
+
+	/* Version 2 functions */
+	ConfigStrPtr	(DCAPI *get_install_path)	(const char* guid);
 } DCConfig, *DCConfigPtr;
 
 /* Logging functions */
@@ -426,10 +429,9 @@
 	/* Tagger API version */
 	uint32_t apiVersion;
 
+	const char*	(DCAPI *get_text)					(TagDataPtr hTags);
+
 	void		(DCAPI *add_tag)					(TagDataPtr hTags, size_t start, size_t end, const char* id, const char* attributes);
-
-	/* Version 2 functions */
-	const char*	(DCAPI *get_text)					(TagDataPtr hTags);
 	void		(DCAPI *replace_text)				(TagDataPtr hTags, size_t start, size_t end, const char* replacement);
 } DCTagger, *DCTaggerPtr;
 
@@ -440,7 +442,10 @@
 	/* User interface API version */
 	uint32_t apiVersion;
 
-	void		(DCAPI *add_command)				(const char* name, DCCommandFunc command);
+	/* Add a command identified by "name".
+	"icon" is optional; it is the path to an icon file used to illustrate the command. */
+	void		(DCAPI *add_command)				(const char* name, DCCommandFunc command, const char* icon);
+	/* Remove a command previously added with add_command. */
 	void		(DCAPI *remove_command)				(const char* name);
 
 	void		(DCAPI *play_sound)					(const char* path);