← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 3002: plugins

 

------------------------------------------------------------
revno: 3002
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2012-07-19 23:58:04 +0200
message:
  plugins
renamed:
  plugins/SamplePlugin/ => plugins/Example/
  plugins/SamplePlugin/SamplePlugin.rc => plugins/Example/resource.rc
modified:
  SConstruct
  plugins/Example/Plugin.c
  plugins/Example/Plugin.def
  plugins/Example/Plugin.h
  plugins/Example/SConscript
  plugins/Example/main.c
  plugins/Example/version.h
  plugins/SConscript
  plugins/Example/resource.rc


--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk

Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'SConstruct'
--- SConstruct	2012-07-02 21:37:23 +0000
+++ SConstruct	2012-07-19 21:58:04 +0000
@@ -78,7 +78,7 @@
 	'release' : ['NDEBUG']
 }
 
-# --- cut ---
+plugins = filter(lambda x: os.path.isfile(os.path.join('plugins', x, 'SConscript')), os.listdir('plugins'))
 
 # defEnv will hold a temporary Environment used to get options that can't be set after the actual
 # Environment has been created
@@ -97,7 +97,7 @@
 	BoolVariable('webhelp', 'Build help files for the web (requires help=1)', 'no'),
 	('prefix', 'Prefix to use when cross compiling', ''),
 	EnumVariable('arch', 'Target architecture', 'x86', ['x86', 'x64', 'ia64']),
-	BoolVariable('plugins', 'Build plugins', 'no'),
+	ListVariable('plugins', 'The plugins to compile', 'all', plugins),
 	BoolVariable('msvcproj', 'Build MSVC project files', 'no'),
 	BoolVariable('distro', 'Produce the official distro (forces tools=mingw, mode=release, unicode=1, i18n=1, help=1, webhelp=1, arch=x86)', 'no')
 )

=== renamed directory 'plugins/SamplePlugin' => 'plugins/Example'
=== modified file 'plugins/Example/Plugin.c'
--- plugins/SamplePlugin/Plugin.c	2012-07-08 05:20:00 +0000
+++ plugins/Example/Plugin.c	2012-07-19 21:58:04 +0000
@@ -18,6 +18,7 @@
 
 #include "stdafx.h"
 #include "Plugin.h"
+#include "version.h"
 
 #ifndef __cplusplus
 # include <stdio.h>
@@ -112,9 +113,9 @@
 
 	if(stricmp(cmd->command, "help") == 0 && stricmp(cmd->params, "plugins") == 0) {
 		const char* help =
-			"\t\t\t Help: SamplePlugin \t\t\t\n"
+			"\t\t\t Help: Example plugin \t\t\t\n"
 			"\t /pluginhelp \t\t\t Prints info about the purpose of this plugin\n"
-			"\t /plugininfo \t\t\t Prints info about the sample plugin\n"
+			"\t /plugininfo \t\t\t Prints info about the example plugin\n"
 			"\t /unhook <index> \t\t Hooks test\n"
 			"\t /rehook <index> \t\t Hooks test\n"
 			"\t /send <text> \t\t\t Chat message test\n";
@@ -123,8 +124,8 @@
 		return True;
 	} else if(stricmp(cmd->command, "pluginhelp") == 0) {
 		const char* pluginhelp =
-			"\t\t\t Plugin Help: SamplePlugin \t\t\t\n"
-			"\t The sample plugin project is intended to both demostrate the use and test the implementation of the API\n"
+			"\t\t\t Plugin help: Example plugin \t\t\t\n"
+			"\t The example plugin project is intended to both demonstrate the use and test the implementation of the API\n"
 			"\t as such the plugin itself does nothing useful but it can be used to verify whether an implementation works\n"
 			"\t with the API or not, however, it is by no means intended to be a comprehensive testing tool for the API.\n";
 
@@ -132,7 +133,7 @@
 		return True;
 	} else if(stricmp(cmd->command, "plugininfo") == 0) {
 		const char* info =
-			"\t\t\t Plugin Info: SamplePlugin \t\t\t\n"
+			"\t\t\t Plugin info: Example plugin \t\t\t\n"
 			"\t Name: \t\t\t\t" PLUGIN_NAME "\n"
 			"\t Author: \t\t\t" PLUGIN_AUTHOR "\n"
 			"\t Version: \t\t\t" STRINGIZE(PLUGIN_VERSION) "\n"
@@ -237,7 +238,7 @@
 	return FALSE;
 }
 
-BOOL CALLBACK configProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
+INT_PTR CALLBACK configProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
 	UNREFERENCED_PARAMETER(lParam);
 	switch(uMsg) {
 		case WM_INITDIALOG:
@@ -257,7 +258,7 @@
 
 Bool onConfig(dcptr_t hWnd) {
 #ifdef _WIN32
-	DialogBox(hInst, MAKEINTRESOURCE(IDD_PLUGINDLG), (HWND)hWnd, (DLGPROC)&configProc);
+	DialogBox(hInst, MAKEINTRESOURCE(IDD_PLUGINDLG), (HWND)hWnd, configProc);
 	return True;
 #else
 	return False;

=== modified file 'plugins/Example/Plugin.def'
--- plugins/SamplePlugin/Plugin.def	2012-07-02 21:37:23 +0000
+++ plugins/Example/Plugin.def	2012-07-19 21:58:04 +0000
@@ -1,4 +1,2 @@
-LIBRARY	"SamplePlugin"
-
 EXPORTS
 	pluginInit = _pluginInit@4 @1

=== modified file 'plugins/Example/Plugin.h'
--- plugins/SamplePlugin/Plugin.h	2012-07-08 05:20:00 +0000
+++ plugins/Example/Plugin.h	2012-07-19 21:58:04 +0000
@@ -19,8 +19,6 @@
 #ifndef PLUGIN_H
 #define PLUGIN_H
 
-#include "version.h"
-
 #ifdef _WIN32
 extern HINSTANCE hInst;
 #endif

=== modified file 'plugins/Example/SConscript'
--- plugins/SamplePlugin/SConscript	2012-07-03 17:17:03 +0000
+++ plugins/Example/SConscript	2012-07-19 21:58:04 +0000
@@ -1,6 +1,6 @@
 Import('dev source_path')
 
-env, target, sources = dev.prepare_build(source_path, 'SamplePlugin', source_glob = '*.c', in_bin = False)
+env, target, sources = dev.prepare_build(source_path, 'ExamplePlugin', source_glob = '*.c', in_bin = False)
 
 env.Append(CPPPATH = ['#/dcpp'])
 
@@ -13,3 +13,4 @@
 	sources.append('Plugin.def')
 
 ret = dev.build_lib(env, target, [sources, res], shared = True)
+Return('ret')

=== modified file 'plugins/Example/main.c'
--- plugins/SamplePlugin/main.c	2012-07-02 21:37:23 +0000
+++ plugins/Example/main.c	2012-07-19 21:58:04 +0000
@@ -18,6 +18,7 @@
 
 #include "stdafx.h"
 #include "Plugin.h"
+#include "version.h"
 
 const char* dependencies[] = {
 	/* Plugins with these GUID's must have been loaded *before* this plugin */
@@ -53,10 +54,10 @@
 #ifdef _WIN32
 HINSTANCE hInst = NULL;
 
-BOOL APIENTRY DllMain(HANDLE hModule, DWORD reason, LPVOID lpReserved) {
-	UNREFERENCED_PARAMETER(reason);
-	UNREFERENCED_PARAMETER(lpReserved);
-	hInst = (HINSTANCE)hModule;
+BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) {
+	UNREFERENCED_PARAMETER(fdwReason);
+	UNREFERENCED_PARAMETER(lpvReserved);
+	hInst = hinstDLL;
 	return TRUE;
 }
 #endif

=== renamed file 'plugins/SamplePlugin/SamplePlugin.rc' => 'plugins/Example/resource.rc'
--- plugins/SamplePlugin/SamplePlugin.rc	2012-07-02 21:37:23 +0000
+++ plugins/Example/resource.rc	2012-07-19 21:58:04 +0000
@@ -69,12 +69,13 @@
     BEGIN
         BLOCK "080004b0"
         BEGIN
-            VALUE "FileDescription", "SamplePlugin Dynamic Link Library"
+            VALUE "Comments", "http://dcplusplus.sourceforge.net";
+            VALUE "FileDescription", "Example plugin for DC++"
             VALUE "FileVersion", "1, 0, 0, 0"
-            VALUE "InternalName", "SamplePlugin"
+            VALUE "InternalName", "ExamplePlugin"
             VALUE "LegalCopyright", "Copyright (C) 2012 Jacek Sieka"
-            VALUE "OriginalFilename", "SamplePlugin.dll"
-            VALUE "ProductName", "SamplePlugin Dynamic Link Library"
+            VALUE "OriginalFilename", "ExamplePlugin.dll"
+            VALUE "ProductName", "Example plugin for DC++"
             VALUE "ProductVersion", "1, 0, 0, 0"
         END
     END
@@ -92,7 +93,7 @@
 
 IDD_PLUGINDLG DIALOGEX 0, 0, 244, 75
 STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "SamplePlugin Settings"
+CAPTION "Example plugin settings"
 FONT 8, "MS Shell Dlg", 400, 0, 0x1
 BEGIN
     DEFPUSHBUTTON   "OK",IDOK,132,54,50,14

=== modified file 'plugins/Example/version.h'
--- plugins/SamplePlugin/version.h	2012-07-02 21:37:23 +0000
+++ plugins/Example/version.h	2012-07-19 21:58:04 +0000
@@ -19,12 +19,22 @@
 #ifndef VERSION_H
 #define VERSION_H
 
-#define PLUGIN_GUID "{5fa64766-ab6e-4d79-8439-dad40fda9738}"	/* UUID/GUID for this plugin project */
-
-#define PLUGIN_NAME "Sample Plugin"								/* Name of the plugin */
-#define PLUGIN_AUTHOR "dcplusplus-team"							/* Author of the plugin */
-#define PLUGIN_DESC "Sample plugin project"						/* Short description about the plugin */
-#define PLUGIN_VERSION 1.00										/* Version of the plugin (note: not api version) */
-#define PLUGIN_WEB "http://dcplusplus.sourceforge.net/";			/* Plugin website, set to "N/A" if none */
+/* UUID/GUID for this plugin project */
+#define PLUGIN_GUID "{5fa64766-ab6e-4d79-8439-dad40fda9738}"
+
+/* Name of the plugin */
+#define PLUGIN_NAME "Example plugin"
+
+/* Author of the plugin */
+#define PLUGIN_AUTHOR "DC++"
+
+/* Short description of the plugin */
+#define PLUGIN_DESC "Example project"
+
+/* Version of the plugin (note: not API version) */
+#define PLUGIN_VERSION 1.0
+
+/* Plugin website, set to "N/A" if none */
+#define PLUGIN_WEB "http://dcplusplus.sourceforge.net/";
 
 #endif /* VERSION_H */

=== modified file 'plugins/SConscript'
--- plugins/SConscript	2012-07-02 21:37:23 +0000
+++ plugins/SConscript	2012-07-19 21:58:04 +0000
@@ -1,8 +1,7 @@
 Import('dev source_path')
 
-if not dev.env['plugins']:
-	Return()
-
-ret = dev.build('SamplePlugin/')
+ret = []
+for plugin in dev.env['plugins']:
+	ret.append(dev.build(plugin + '/'))
 
 Return('ret')