New module loading scheme
authorMyhailo Danylenko <isbear@ukrpost.net>
Thu, 04 Mar 2010 19:50:56 +0200
changeset 27 0539bca09f11
parent 26 91987ea19f24
child 28 ff36ae7e2b1e
New module loading scheme
CMakeLists.txt
disco.c
disco.rc
--- a/CMakeLists.txt	Mon Feb 15 17:51:21 2010 +0200
+++ b/CMakeLists.txt	Thu Mar 04 19:50:56 2010 +0200
@@ -22,7 +22,6 @@
 ## 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(LM REQUIRED loudmouth-1.0)
 pkg_check_modules(MCABBER REQUIRED mcabber)
 include(CheckSymbolExists)
@@ -31,7 +30,6 @@
 set(CMAKE_REQUIRED_FLAGS ${LM_LDFLAGS} ${LM_CFLAGS})
 check_symbol_exists(lm_connection_unregister_reply_handler loudmouth/loudmouth.h HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER)
 link_directories(${GLIB_LIBRARY_DIRS}
-				 ${GMODULE_LIBRARY_DIRS}
 				 ${LM_LIBRARY_DIRS}
 				 ${MCABBER_LIBRARY_DIRS})
 
@@ -41,11 +39,9 @@
 ## Compiler setup
 configure_file(config.h.in config.h)
 include_directories(SYSTEM ${GLIB_INCLUDE_DIRS} 
-                    ${GMODULE_INCLUDE_DIRS} 
                     ${LM_INCLUDE_DIRS}
 					${MCABBER_INCLUDE_DIRS}) 
 target_link_libraries(disco ${GLIB_LIBRARIES} 
-                      ${GMODULE_LIBRARIES}
 					  ${LM_LIBRARIES}
 					  ${MCABBER_LIBRARIES})
 include_directories(${disco_SOURCE_DIR} 
--- a/disco.c	Mon Feb 15 17:51:21 2010 +0200
+++ b/disco.c	Thu Mar 04 19:50:56 2010 +0200
@@ -19,7 +19,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #include <glib.h>
-#include <gmodule.h>
 #include <loudmouth/loudmouth.h>
 #include <string.h>
 
@@ -32,12 +31,27 @@
 #include <mcabber/xmpp_defines.h>
 #include <mcabber/screen.h>
 #include <mcabber/hbuf.h>
+#include <mcabber/modules.h>
 
 #include "disco.h"
 
 #include "config.h"
 
 //
+// module description
+//
+
+static void disco_init   (void);
+static void disco_uninit (void);
+
+module_info_t info_disco = {
+	.mcabber_version = "0.10.0",
+	.requires        = NULL,
+	.init            = disco_init,
+	.uninit          = disco_uninit,
+};
+
+//
 // private types
 //
 
@@ -598,7 +612,7 @@
 	return;
 }
 
-const gchar *g_module_check_init(GModule *module)
+static void disco_init (void)
 {
 	// completion
 	disco_cid = compl_new_category ();
@@ -613,10 +627,10 @@
 	// command
 	cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL);
 
-	return NULL;
+	return;
 }
 
-void g_module_unload(GModule *module)
+static void disco_uninit (void)
 {
 	// command
 	cmd_del ("disco");
--- a/disco.rc	Mon Feb 15 17:51:21 2010 +0200
+++ b/disco.rc	Thu Mar 04 19:50:56 2010 +0200
@@ -1,3 +1,3 @@
 
-load disco
+module load disco