New module loading scheme
authorMyhailo Danylenko <isbear@ukrpost.net>
Thu, 04 Mar 2010 19:50:39 +0200
changeset 15 891fc0779d50
parent 14 706e77af2947
child 16 19d13d97b3a1
New module loading scheme
CMakeLists.txt
cmd.c
cmd.rc
--- a/CMakeLists.txt	Mon Feb 15 19:34:14 2010 +0200
+++ b/CMakeLists.txt	Thu Mar 04 19:50:39 2010 +0200
@@ -22,10 +22,8 @@
 ## Check for build dependencies
 find_package(PkgConfig REQUIRED) 
 pkg_check_modules(GLIB REQUIRED glib-2.0) 
-pkg_check_modules(GMODULE REQUIRED gmodule-2.0) 
 pkg_check_modules(MCABBER REQUIRED mcabber)
 link_directories(${GLIB_LIBRARY_DIRS}
-				 ${GMODULE_LIBRARY_DIRS}
 				 ${MCABBER_LIBRARY_DIRS})
 
 ## Target definitions
@@ -33,10 +31,8 @@
 
 ## Compiler setup
 include_directories(SYSTEM ${GLIB_INCLUDE_DIRS} 
-                    ${GMODULE_INCLUDE_DIRS} 
                     ${MCABBER_INCLUDE_DIRS})
 target_link_libraries(cmd ${GLIB_LIBRARIES} 
-                      ${GMODULE_LIBRARIES}
 					  ${MCABBER_LIBRARIES})
 include_directories(${cmd_SOURCE_DIR} 
                     ${cmd_BINARY_DIR})
--- a/cmd.c	Mon Feb 15 19:34:14 2010 +0200
+++ b/cmd.c	Thu Mar 04 19:50:39 2010 +0200
@@ -21,7 +21,6 @@
 
 #include <stdlib.h>
 #include <glib.h>
-#include <gmodule.h>
 #include <unistd.h>
 #include <errno.h>
 
@@ -32,6 +31,17 @@
 #include <mcabber/hbuf.h>
 #include <mcabber/xmpp.h>
 #include <mcabber/roster.h>
+#include <mcabber/modules.h>
+
+static void mcmd_init   (void);
+static void mcmd_uninit (void);
+
+module_info_t info_cmd = {
+	.mcabber_version = "0.10.0",
+	.requires        = NULL,
+	.init            = mcmd_init,
+	.uninit          = mcmd_uninit,
+};
 
 typedef struct {
 	gchar      *jid;
@@ -299,14 +309,12 @@
 	}
 }
 
-const gchar *g_module_check_init(GModule *module)
+static void mcmd_init (void)
 {
 	cmd_add ("cmd", "", 0, 0, do_cmd, NULL);
-
-	return NULL;
 }
 
-void g_module_unload(GModule *module)
+static void mcmd_uninit (void)
 {
 	GSList *sel;
 
--- a/cmd.rc	Mon Feb 15 19:34:14 2010 +0200
+++ b/cmd.rc	Thu Mar 04 19:50:39 2010 +0200
@@ -15,5 +15,5 @@
 # Use room-like behaviour even on non-room buddies.
 set cmd_header_inline = 0
 
-load cmd
+module load cmd