linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #06855
[Branch ~dcplusplus-team/dcpp-plugin-sdk-cpp/SpellPlugin] Rev 26: merge
Merge authors:
poy (poy)
------------------------------------------------------------
revno: 26 [merge]
committer: poy <poy@xxxxxxxxxx>
branch nick: SpellPlugin
timestamp: Mon 2013-05-13 19:43:12 +0200
message:
merge
modified:
doc/Plugin format (dcext).txt
pluginsdk/PluginDefs.h
pluginsdk/UI.cpp
pluginsdk/UI.h
src/Plugin.cpp
--
lp:~dcplusplus-team/dcpp-plugin-sdk-cpp/SpellPlugin
https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/SpellPlugin
Your team Dcplusplus-team is subscribed to branch lp:~dcplusplus-team/dcpp-plugin-sdk-cpp/SpellPlugin.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/SpellPlugin/+edit-subscription
=== 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.
=== modified file 'pluginsdk/PluginDefs.h'
--- pluginsdk/PluginDefs.h 2013-04-28 21:08:26 +0000
+++ pluginsdk/PluginDefs.h 2013-05-13 17:18:05 +0000
@@ -444,9 +444,9 @@
/* 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);
+ void (DCAPI *add_command) (const char* guid, 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 *remove_command) (const char* guid, const char* name);
void (DCAPI *play_sound) (const char* path);
void (DCAPI *notify) (const char* title, const char* message);
=== modified file 'pluginsdk/UI.cpp'
--- pluginsdk/UI.cpp 2013-04-23 18:12:02 +0000
+++ pluginsdk/UI.cpp 2013-05-13 17:27:19 +0000
@@ -25,23 +25,24 @@
namespace dcapi {
DCUIPtr UI::ui;
+string UI::guid;
unordered_map<string, pair<UI::Command, string>> UI::commands;
-bool UI::init() {
+bool UI::init(string pluginGuid) {
if(!Core::handle()) { return false; }
- init(reinterpret_cast<DCUIPtr>(Core::handle()->query_interface(DCINTF_DCPP_UI, DCINTF_DCPP_UI_VER)));
+ init(reinterpret_cast<DCUIPtr>(Core::handle()->query_interface(DCINTF_DCPP_UI, DCINTF_DCPP_UI_VER)), move(pluginGuid));
return ui;
}
-void UI::init(DCUIPtr coreUI) { ui = coreUI; }
+void UI::init(DCUIPtr coreUI, string pluginGuid) { ui = coreUI; guid = move(pluginGuid); }
DCUIPtr UI::handle() { return ui; }
void UI::addCommand(string name, Command command, string icon) {
const auto& iter = commands.insert(std::make_pair(move(name), std::make_pair(command, move(icon)))).first;
- ui->add_command(iter->first.c_str(), commandCallback, iter->second.second.c_str());
+ ui->add_command(guid.c_str(), iter->first.c_str(), commandCallback, iter->second.second.c_str());
}
void UI::removeCommand(const string& name) {
- ui->remove_command(name.c_str());
+ ui->remove_command(guid.c_str(), name.c_str());
commands.erase(name);
}
=== modified file 'pluginsdk/UI.h'
--- pluginsdk/UI.h 2013-04-23 18:12:02 +0000
+++ pluginsdk/UI.h 2013-05-13 17:27:19 +0000
@@ -37,8 +37,8 @@
class UI
{
public:
- static bool init();
- static void init(DCUIPtr coreUI);
+ static bool init(string pluginGuid);
+ static void init(DCUIPtr coreUI, string pluginGuid);
static DCUIPtr handle();
typedef function<void ()> Command;
@@ -50,6 +50,7 @@
static DCUIPtr ui;
+ static string guid;
static unordered_map<string, pair<UI::Command, string>> commands;
};
=== modified file 'src/Plugin.cpp'
--- src/Plugin.cpp 2013-05-11 15:34:09 +0000
+++ src/Plugin.cpp 2013-05-13 17:43:12 +0000
@@ -52,18 +52,12 @@
const auto MAX_SUGGESTION_CHARS = 10; // max chars to provide suggestions (memory intensive)
const auto MAX_CACHE = 4096; // max suggestions to keep in cache (multiple of 4)
-string commandName = PLUGIN_NAME ": Configure";
-
Plugin::Plugin() : hook(nullptr) {
}
Plugin::~Plugin() {
Hooks::clear();
- if(UI::handle()) {
- UI::removeCommand(commandName);
- }
-
if(hook) {
UnhookWindowsHookEx(hook);
}
@@ -105,7 +99,7 @@
/* Initialization phase. Initiate additional interfaces that you may have included from the
plugin SDK. */
Core::init(core);
- if(!Config::init(PLUGIN_GUID) || !Hooks::init() || !Logger::init() || !UI::init() || !Util::init()) {
+ if(!Config::init(PLUGIN_GUID) || !Hooks::init() || !Logger::init() || !UI::init(PLUGIN_GUID) || !Util::init()) {
return false;
}
@@ -119,7 +113,6 @@
// Start the plugin logic here; add hooks with functions from the Hooks interface.
initSpell();
Hooks::UI::onCreated([this](dcptr_t, bool&) { return onUiCreated(); });
- UI::addCommand(commandName, [this] { onConfigure(); }, Config::getInstallPath() + "SpellPlugin.ico");
return true;
}