← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcpp-plugin-sdk-cpp/InserterPlugin] Rev 25: unhook

 

------------------------------------------------------------
revno: 25
committer: poy <poy@xxxxxxxxxx>
branch nick: InserterPlugin
timestamp: Tue 2013-06-04 19:09:12 +0200
message:
  unhook
modified:
  packaging/info.xml
  src/Plugin.cpp
  src/version.h


--
lp:~dcplusplus-team/dcpp-plugin-sdk-cpp/InserterPlugin
https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/InserterPlugin

Your team Dcplusplus-team is subscribed to branch lp:~dcplusplus-team/dcpp-plugin-sdk-cpp/InserterPlugin.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/InserterPlugin/+edit-subscription
=== modified file 'packaging/info.xml'
--- packaging/info.xml	2013-06-03 17:31:31 +0000
+++ packaging/info.xml	2013-06-04 17:09:12 +0000
@@ -21,7 +21,7 @@
 <dcext>
 	<UUID>{c71036f2-ab7f-4bfd-bfee-f242b55f82f1}</UUID>
 	<Name>Inserter plugin</Name>
-	<Version>1</Version>
+	<Version>1.1</Version>
 	<ApiVersion>8</ApiVersion>
 	<Author>DC++</Author>
 	<Description>Register keyboard shortcuts to insert preconfigured text.</Description>

=== modified file 'src/Plugin.cpp'
--- src/Plugin.cpp	2013-06-03 17:31:31 +0000
+++ src/Plugin.cpp	2013-06-04 17:09:12 +0000
@@ -27,7 +27,6 @@
 #include <pluginsdk/Core.h>
 #include <pluginsdk/Hooks.h>
 #include <pluginsdk/Logger.h>
-#include <pluginsdk/UI.h>
 #include <pluginsdk/Util.h>
 
 #include <windowsx.h>
@@ -37,7 +36,6 @@
 using dcapi::Core;
 using dcapi::Hooks;
 using dcapi::Logger;
-using dcapi::UI;
 using dcapi::Util;
 
 Plugin::Plugin() : hook(nullptr) {
@@ -45,6 +43,10 @@
 
 Plugin::~Plugin() {
 	Hooks::clear();
+
+	if(hook) {
+		UnhookWindowsHookEx(hook);
+	}
 }
 
 Bool DCAPI Plugin::main(PluginState state, DCCorePtr core, dcptr_t) {
@@ -84,7 +86,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(PLUGIN_GUID) || !Util::init()) {
+	if(!Config::init(PLUGIN_GUID) || !Hooks::init() || !Logger::init() || !Util::init()) {
 		return false;
 	}
 
@@ -95,12 +97,11 @@
 		onConfigure();
 	}
 
-	if(runtime) {
-		// If the plugin doesn't support being enabled at runtime, cancel its loading here.
-	}
-
 	// Start the plugin logic here; add hooks with functions from the Hooks interface.
 	Hooks::UI::onCreated([this](dcptr_t, bool&) { return onUiCreated(); });
+	if(runtime) {
+		onUiCreated();
+	}
 
 	return true;
 }

=== modified file 'src/version.h'
--- src/version.h	2013-05-03 17:03:28 +0000
+++ src/version.h	2013-06-04 17:09:12 +0000
@@ -34,7 +34,7 @@
 #define PLUGIN_DESC "Register keyboard shortcuts to insert preconfigured text."
 
 /* Version of the plugin (note: not API version) */
-#define PLUGIN_VERSION 1.0
+#define PLUGIN_VERSION 1.1
 
 /* Plugin website, set to "N/A" if none */
 #define PLUGIN_WEB "http://dcplusplus.sourceforge.net/";