[avv] Update avv description, minor cosmetics default tip
authorMyhailo Danylenko <isbear@ukrpost.net>
Thu, 13 Nov 2014 18:50:18 +0200
changeset 63 d644c08bbc27
parent 62 f4ad0e7bf1ef
[avv] Update avv description, minor cosmetics
CMakeLists.txt
config.h.in
disco.avv.in
disco.c
--- a/CMakeLists.txt	Sun Feb 17 06:58:49 2013 +0200
+++ b/CMakeLists.txt	Thu Nov 13 18:50:18 2014 +0200
@@ -30,17 +30,11 @@
 set(CMAKE_REQUIRED_LIBRARIES ${LM_LIBRARIES})
 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)
-include(CheckCSourceCompiles)
 set(CMAKE_REQUIRED_INCLUDES ${MCABBER_INCLUDE_DIRS})
 set(CMAKE_REQUIRED_LIBRARIES ${MCABBER_LIBRARIES})
 set(CMAKE_REQUIRED_FLAGS ${MCABBER_LDFLAGS} ${MCABBER_CFLAGS})
-check_c_source_compiles("
-	#include <glib.h>
-	#include <mcabber/api.h>
-	#ifdef MCABBER_API_HAVE_COMPL_FLAGS
-	int main (void) { return 0; }
-	#endif
-	" HAVE_MCABBER_COMPLETION_FLAGS)
+check_symbol_exists(MCABBER_API_HAVE_COMPL_FLAGS mcabber/api.h HAVE_MCABBER_COMPLETION_FLAGS)
+check_symbol_exists(MCABBER_API_HAVE_CMD_ID      mcabber/api.h HAVE_MCABBER_CMD_ID)
 link_directories(${GLIB_LIBRARY_DIRS}
 				 ${LM_LIBRARY_DIRS}
 				 ${MCABBER_LIBRARY_DIRS})
@@ -80,10 +74,16 @@
 set(CPACK_SOURCE_IGNORE_FILES "/\\\\..*;\\\\.swp;~$;/build/;\\\\.tar\\\\.;\\\\.deb;\\\\.so")
 include(CPack)
 
+## AVV build-time dependent requirements
 if(HAVE_MCABBER_COMPLETION_FLAGS)
-		set(AVV_COMPL_VERSION "compl:4")
+	set(AVV_COMPL_VERSION "compl:6 | compl:5 | compl:4")
 else()
-		set(AVV_COMPL_VERSION "compl:2 | compl:3")
+	set(AVV_COMPL_VERSION "compl:3 | compl:2")
+endif()
+if(HAVE_MCABBER_CMD_ID)
+	set(AVV_COMMANDS_VERSION "commands:5 | commands:4 | commands:3")
+else()
+	set(AVV_COMMANDS_VERSION "commands:2 | commands:1")
 endif()
 configure_file(disco.avv.in disco.avv)
 
@@ -94,4 +94,4 @@
 install(DIRECTORY help DESTINATION share/mcabber)
 install(FILES ${PROJECT_BINARY_DIR}/disco.avv DESTINATION share/mcabber/avv/modules RENAME disco)
 
-## The End ## vim: se ts=4: ##
+## The End ## vim: se ts=4 sw=4: ##
--- a/config.h.in	Sun Feb 17 06:58:49 2013 +0200
+++ b/config.h.in	Thu Nov 13 18:50:18 2014 +0200
@@ -2,7 +2,10 @@
 #ifndef LOCAL_CONFIG_H
 #define LOCAL_CONFIG_H
 
-#cmakedefine HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER
+#cmakedefine HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER @HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER@
+
+#cmakedefine HAVE_MCABBER_CMD_ID           @HAVE_MCABBER_CMD_ID@
+#cmakedefine HAVE_MCABBER_COMPLETION_FLAGS @HAVE_MCABBER_COMPLETION_FLAGS@
 
 #define PROJECT_VERSION ( "${PROJECT_VERSION}" )
 
--- a/disco.avv.in	Sun Feb 17 06:58:49 2013 +0200
+++ b/disco.avv.in	Thu Nov 13 18:50:18 2014 +0200
@@ -4,13 +4,15 @@
 Version:     ${PROJECT_VERSION}
 Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
 # Right now it does not require caps, but may require in future
-# commands depend on building envioronment: 4+3, 2+1
-Requires:    ( commands:4 | commands:3 ) + ( ${AVV_COMPL_VERSION} ) +
-             ( roster:4 | roster:3 | roster:2 | roster:1 ) + utils:2 +
-	     ( hooks:5 | hooks:4 | hooks:3 | hooks:2 ) +
-	     ( xmpp:6 | xmpp:5 | xmpp:4 | xmpp:3 | xmpp:2 | xmpp:1 ) + logprint:3 +
-	     ( screen:10 | screen:9 | screen:8 | screen:7 | screen:6 | screen:5 | screen:4 ) +
-	     ( hbuf:3 | hbuf:2 | hbuf:1 )
+Requires:    ( ${AVV_COMMANDS_VERSION} ) + 
+             ( ${AVV_COMPL_VERSION} ) +
+	     ( hbuf:4 | hbuf:3 | hbuf:2 | hbuf:1 ) +
+	     ( hooks:7 | hooks:6 | hooks:5 | hooks:4 ) +
+	     logprint:3 +
+             ( roster:7 | roster:6 | roster:5 | roster:4 | roster:3 | roster:2 | roster:1 ) +
+	     ( screen:13 | screen:12 | screen:11 | screen:10 | screen:9 | screen:8 | screen:7 | screen:6 | screen:5 | screen:4 ) +
+	     ( utils:4 | utils:3 | utils:2 ) +
+	     ( xmpp:8 | xmpp:7 | xmpp:6 | xmpp:5 | xmpp:4 | xmpp:3 | xmpp:2 | xmpp:1 )
 Provides:    disco:1
 Init:        disco_init
 Uninit:      disco_uninit
--- a/disco.c	Sun Feb 17 06:58:49 2013 +0200
+++ b/disco.c	Thu Nov 13 18:50:18 2014 +0200
@@ -22,17 +22,18 @@
 #include <loudmouth/loudmouth.h>
 #include <string.h>
 
-#include <mcabber/commands.h>
-#include <mcabber/logprint.h>
-#include <mcabber/utils.h>
-#include <mcabber/hooks.h>
-#include <mcabber/xmpp.h>
-#include <mcabber/compl.h>
-#include <mcabber/xmpp_defines.h>
-#include <mcabber/screen.h>
-#include <mcabber/hbuf.h>
-#include <mcabber/modules.h>
-#include <mcabber/caps.h>
+//#include <mcabber/caps.h>
+#include <mcabber/commands.h>      // cmd_add (), cmd_del ()
+#include <mcabber/compl.h>         // compl_new_category (), compl_del_category (), compl_add_category_word ()
+#include <mcabber/hbuf.h>          // HBB_PREFIX_INFO
+#include <mcabber/hooks.h>         // hk_add_handler (), hk_del_handler (), HOOK_PRE_DISCONNECT, HOOK_HANDLER_RESULT_*
+#include <mcabber/logprint.h>      // scr_log_print ()
+#include <mcabber/modules.h>       // module_info_t
+#include <mcabber/roster.h>        // buddy_getjid (), buddy_gettype (), current_buddy, BUDDATA ()
+#include <mcabber/screen.h>        // scr_write_incoming_message ()
+#include <mcabber/utils.h>         // to_utf8 (), free_arg_lst (), jidtodisp ()
+#include <mcabber/xmpp.h>          // xmpp_is_online (), lconnection
+#include <mcabber/xmpp_defines.h>  // NS_DISCO_INFO, NS_DISCO_ITEMS
 
 #include "disco.h"
 
@@ -87,7 +88,7 @@
 // globals
 //
 
-#ifdef MCABBER_API_HAVE_CMD_ID
+#ifdef HAVE_MCABBER_CMD_ID
 static gpointer disco_cmid     = NULL;
 #endif
 static guint    disco_cid      = 0;
@@ -550,7 +551,7 @@
 				if (bud) {
 					guint type = buddy_gettype (bud);
 					if (type != ROSTER_TYPE_GROUP && type != ROSTER_TYPE_SPECIAL)
-						to = g_strdup (buddy_getjid (bud)); // XXX memleak!
+						to = g_strdup (buddy_getjid (bud));
 				}
 			}
 		}
@@ -611,7 +612,7 @@
 void disco_init (void)
 {
 	// completion
-#ifdef MCABBER_API_HAVE_COMPL_FLAGS
+#ifdef HAVE_MCABBER_COMPLETION_FLAGS
 	disco_cid = compl_new_category (COMPL_FLAGS_SORT);
 #else
 	disco_cid = compl_new_category ();
@@ -625,7 +626,7 @@
 	disco_hid = hk_add_handler (disco_hh, HOOK_PRE_DISCONNECT, G_PRIORITY_DEFAULT, NULL);
 
 	// command
-#ifndef MCABBER_API_HAVE_CMD_ID
+#ifndef HAVE_MCABBER_CMD_ID
 	cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL);
 #else
 	disco_cmid = cmd_add ("disco", "", disco_cid, COMPL_JID, do_disco, NULL);
@@ -637,7 +638,7 @@
 void disco_uninit (void)
 {
 	// command
-#ifndef MCABBER_API_HAVE_CMD_ID
+#ifndef HAVE_MCABBER_CMD_ID
 	cmd_del ("disco");
 #else
 	if (disco_cmid)