Use pkg-config to find mcabber headers
* use pkg-config to find mcabber headers
* unconditionally use adopted by mainstream features
--- a/CMakeLists.txt Thu Jan 21 15:43:39 2010 +0200
+++ b/CMakeLists.txt Mon Feb 15 18:52:58 2010 +0200
@@ -18,16 +18,17 @@
project(pep C)
## User settable options
-set(MCABBER_INCLUDE_DIR "/usr/include" CACHE FILEPATH "Path to mcabber headers")
## 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)
link_directories(${GLIB_LIBRARY_DIRS}
${GMODULE_LIBRARY_DIRS}
- ${LM_LIBRARY_DIRS})
+ ${LM_LIBRARY_DIRS}
+ ${MCABBER_LIBRARY_DIRS})
## Target definitions
add_library(pep MODULE pep.c)
@@ -36,10 +37,11 @@
include_directories(SYSTEM ${GLIB_INCLUDE_DIRS}
${GMODULE_INCLUDE_DIRS}
${LM_INCLUDE_DIRS}
- ${MCABBER_INCLUDE_DIR})
+ ${MCABBER_INCLUDE_DIRS})
target_link_libraries(pep ${GLIB_LIBRARIES}
${GMODULE_LIBRARIES}
- ${LM_LIBRARIES})
+ ${LM_LIBRARIES}
+ ${MCABBER_LIBRARIES})
include_directories(${pep_SOURCE_DIR}
${pep_BINARY_DIR})
--- a/pep.c Thu Jan 21 15:43:39 2010 +0200
+++ b/pep.c Mon Feb 15 18:52:58 2010 +0200
@@ -161,24 +161,10 @@
// release handlers before reconnect
static void pep_hh (guint32 hid, hk_arg_t *args, gpointer userdata)
{
-#ifdef HOOK_POST_CONNECT
if (hid == HOOK_POST_CONNECT)
pep_register_handlers ();
else if (hid == HOOK_PRE_DISCONNECT)
pep_unregister_handlers ();
-#else
- hk_arg_t *arg;
-
- for (arg = args; arg->name; ++arg) {
- if (!strcmp (arg->name, "hook")) {
- if (!strcmp (arg->value, "hook-pre-disconnect"))
- pep_unregister_handlers ();
- else if (!strcmp (arg->value, "hook-post-connect"))
- pep_register_handlers ();
- return;
- }
- }
-#endif
}
const gchar *g_module_check_init (GModule *module)
@@ -188,11 +174,7 @@
pep_iq_handler = lm_message_handler_new (pep_iq_pubsub_handler, NULL, NULL);
// register hook handler
-#ifdef HOOK_POST_CONNECT
hk_add_handler (pep_hh, HOOK_POST_CONNECT | HOOK_PRE_DISCONNECT, NULL);
-#else
- hk_add_handler (pep_hh, HOOK_INTERNAL, NULL);
-#endif
// register handlers to connection
pep_register_handlers ();