--- a/CMakeLists.txt Sun Jan 17 12:08:53 2010 +0200
+++ b/CMakeLists.txt Wed Jan 20 19:47:58 2010 +0200
@@ -25,6 +25,10 @@
pkg_check_modules(GLIB REQUIRED glib-2.0)
pkg_check_modules(GMODULE REQUIRED gmodule-2.0)
pkg_check_modules(LM REQUIRED loudmouth-1.0)
+find_program(GREP_EXECUTABLE grep DOC "Grep binary to find functions in headers")
+if(GREP_EXECUTABLE)
+ execute_process(COMMAND ${GREP_EXECUTABLE} xmpp_is_online ${MCABBER_INCLUDE_DIR}/mcabber/xmpp.h OUTPUT_VARIABLE HAVE_XMPP_IS_ONLINE ERROR_QUIET)
+endif()
link_directories(${GLIB_LIBRARY_DIRS}
${GMODULE_LIBRARY_DIRS})
@@ -32,6 +36,7 @@
add_library(cmd MODULE cmd.c)
## Compiler setup
+configure_file(config.h.in config.h)
include_directories(SYSTEM ${GLIB_INCLUDE_DIRS}
${GMODULE_INCLUDE_DIRS}
${LM_INCLUDE_DIRS}
--- a/cmd.c Sun Jan 17 12:08:53 2010 +0200
+++ b/cmd.c Wed Jan 20 19:47:58 2010 +0200
@@ -33,6 +33,8 @@
#include <mcabber/xmpp.h>
#include <mcabber/roster.h>
+#include "config.h"
+
typedef struct {
gchar *jid;
GString *input;
@@ -104,7 +106,7 @@
g_string_append_len (input, buf, endpos);
- if (!lm_connection_is_authenticated (lconnection)) {
+ if (!xmpp_is_online ()) {
scr_LogPrint (LPRINT_LOGNORM, "cmd: Connection is not ready, delaying data");
return TRUE;
}
--- a/config.h Sun Jan 17 12:08:53 2010 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-
-#ifndef LOCAL_CONFIG_H
-#define LOCAL_CONFIG_H
-
-#define MODULES_ENABLE 1
-
-# endif
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/config.h.in Wed Jan 20 19:47:58 2010 +0200
@@ -0,0 +1,18 @@
+
+#ifndef LOCAL_CONFIG_H
+#define LOCAL_CONFIG_H
+
+#cmakedefine HAVE_XMPP_IS_ONLINE
+
+#ifndef HAVE_XMPP_IS_ONLINE
+inline gboolean xmpp_is_online (void)
+{
+ if (lconnection && lm_connection_is_authenticated(lconnection))
+ return TRUE;
+ else
+ return FALSE;
+}
+#endif
+
+#endif
+