# HG changeset patch # User Myhailo Danylenko # Date 1266246732 -7200 # Node ID df9cedcdb3b21a30e1923384b3dd16b1317f986e # Parent dca6d8e9d8c1d30d2149525e7ab6b77c24bc5822 Use pkg-config to find mcabber headers * use pkg-config to find mcabber headers * check pep module headers * use new interfaces unconditionally diff -r dca6d8e9d8c1 -r df9cedcdb3b2 CMakeLists.txt --- a/CMakeLists.txt Tue Jan 26 13:03:50 2010 +0200 +++ b/CMakeLists.txt Mon Feb 15 17:12:12 2010 +0200 @@ -26,12 +26,15 @@ pkg_check_modules(GMODULE REQUIRED gmodule-2.0) pkg_check_modules(LM REQUIRED loudmouth-1.0) pkg_check_modules(PNG REQUIRED libpng12) +pkg_check_modules(MCABBER REQUIRED mcabber) set(AALIB_LIBRARY_DIRS "/usr/lib" CACHE FILEPATH "Path, where AAlib is located") set(AALIB_INCLUDE_DIRS "/usr/include" CACHE FILEPATH "Path to AAlib includes") set(AALIB_LIBRARIES "-laa" CACHE TEXT "Libraries, necessary to link with AAlib") -find_program(GREP_EXECUTABLE grep DOC "Grep binary to detect 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) +include(CheckIncludeFile) +set(CMAKE_REQUIRED_INCLUDES ${MCABBER_INCLUDE_DIRS}) +check_include_file(mcabber/pep.h HAVE_MCABBER_PEP_H) +if(NOT HAVE_MCABBER_PEP_H) + message(SEND_ERROR "Pep module header not found") endif() include(CheckSymbolExists) set(CMAKE_REQUIRED_INCLUDES ${LM_INCLUDE_DIRS}) @@ -42,7 +45,8 @@ ${GMODULE_LIBRARY_DIRS} ${LM_LIBRARY_DIRS} ${PNG_LIBRARY_DIRS} - ${AALIB_LIBRARY_DIRS}) + ${AALIB_LIBRARY_DIRS} + ${MCABBER_LIBRARY_DIRS}) ## Target definitions add_library(avatar MODULE avatar.c) @@ -54,12 +58,13 @@ ${LM_INCLUDE_DIRS} ${PNG_INCLUDE_DIRS} ${AALIB_INCLUDE_DIRS} - ${MCABBER_INCLUDE_DIR}) + ${MCABBER_INCLUDE_DIRS}) target_link_libraries(avatar ${GLIB_LIBRARIES} ${GMODULE_LIBRARIES} ${LM_LIBRARIES} ${PNG_LIBRARIES} - ${AALIB_LIBRARIES}) + ${AALIB_LIBRARIES} + ${MCABBER_LIBRARIES}) include_directories(${avatar_SOURCE_DIR} ${avatar_BINARY_DIR}) @@ -88,4 +93,4 @@ install(FILES avatar.rc COPYING TODO README DESTINATION share/doc/${CPACK_PACKAGE_NAME}) install(DIRECTORY help DESTINATION share/mcabber) -## The End ## vim: se ts=4: ## +## The End ## vim: se ts=4 sw=4: ## diff -r dca6d8e9d8c1 -r df9cedcdb3b2 avatar.c --- a/avatar.c Tue Jan 26 13:03:50 2010 +0200 +++ b/avatar.c Mon Feb 15 17:12:12 2010 +0200 @@ -1107,21 +1107,12 @@ // release handlers before reconnect static void avatar_hh (guint32 hid, hk_arg_t *args, gpointer userdata) { -#ifndef HOOK_POST_CONNECT - hk_arg_t *arg; + if (hid == HOOK_PRE_DISCONNECT) - for (arg = args; arg->name; arg++) { - if (!strcmp (arg->name, "hook")) { - if (!strcmp (arg->value, "hook-pre-disconnect")) { -#else - if (hid == HOOK_PRE_DISCONNECT) { -#endif avatar_free_reply_handlers (); -#ifndef HOOK_POST_CONNECT - } else if (publish_delayed && !strcmp (arg -> value, "hook-post-connect")) { -#else - } else if (hid == HOOK_POST_CONNECT && publish_delayed) { -#endif + + else if (hid == HOOK_POST_CONNECT && publish_delayed) { + char *tmp_data = publish_data; scr_LogPrint (LPRINT_DEBUG, "avatar: Publishing delayed data."); @@ -1132,12 +1123,6 @@ avatar_publish (publish_data, publish_len); g_free (tmp_data); -#ifndef HOOK_POST_CONNECT - } - - return; - } -#endif } } @@ -1148,11 +1133,7 @@ cmd_add ("avatar", "", COMPL_FILENAME, 0, do_avatar, NULL); -#ifdef HOOK_PRE_DISCONNECT hk_add_handler (avatar_hh, HOOK_PRE_DISCONNECT | HOOK_POST_CONNECT, NULL); -#else - hk_add_handler (avatar_hh, HOOK_INTERNAL, NULL); -#endif xmpp_add_feature (NS_AVATAR_METADATA); xmpp_add_feature (NS_AVATAR_METADATA_NOTIFY); diff -r dca6d8e9d8c1 -r df9cedcdb3b2 config.h.in --- a/config.h.in Tue Jan 26 13:03:50 2010 +0200 +++ b/config.h.in Mon Feb 15 17:12:12 2010 +0200 @@ -4,17 +4,5 @@ #cmakedefine HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER -#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 -