Drop publish_*, rework build system
* use foreach and lists in cmake
* put hook and option names in cmake configurable variables
* put module descriptions into cmake variables
* use cmake-provided options in .rc
* use cmake-provided module description in header and avv files
* rename headers to pep_*.h
* remove publish_*()
* api versions for pep_* bumped to 2 (incompatible)
* update documentation
* rework & optimize tune outgoing handler (ex-tune_publish)
* ignore backup files at installation
--- a/CMakeLists.txt Mon May 21 03:38:51 2012 +0300
+++ b/CMakeLists.txt Mon May 21 19:10:25 2012 +0300
@@ -18,8 +18,38 @@
project(pep C)
set(PROJECT_VERSION "0.0.3")
+set(HANDLER_LIST mood tune geoloc activity)
+set(MODULE_LIST pep)
+foreach(HANDLER IN LISTS HANDLER_LIST)
+ list(APPEND MODULE_LIST ${HANDLER} pep_${HANDLER})
+endforeach(HANDLER)
+
## User settable options
-
+option(DEBUG "Enable debugging symbols" OFF)
+foreach(HANDLER IN LISTS HANDLER_LIST)
+ string(TOUPPER ${HANDLER} UPHANDLER)
+ set(HOOK_${UPHANDLER}_IN "${HANDLER}-in" CACHE TEXT "${HANDLER} incoming event hook name")
+ set(HOOK_${UPHANDLER}_OUT "${HANDLER}-out" CACHE TEXT "${HANDLER} outgoing event hook name")
+endforeach(HANDLER)
+set(OPT_TUNE_PAUSE_IS_STOP "pep_tune_pause_is_stop" CACHE TEXT "Tune pause is stop option name")
+set(OPT_TUNE_INTERVAL "pep_tune_interval" CACHE TEXT "Tune intevral option name")
+set(OPT_GEOLOC_INTERVAL "pep_geoloc_interval" CACHE TEXT "Geoloc interval option name")
+
+set(PEP_DESCRIPTION "Common listener for PEP events")
+set(PEP_MOOD_DESCRIPTION "PEP mood event handler")
+set(PEP_TUNE_DESCRIPTION "PEP tune event handler\\n Options: ${OPT_TUNE_INTERVAL}, ${OPT_TUNE_PAUSE_IS_STOP}")
+set(PEP_GEOLOC_DESCRIPTION "PEP geoloc event handler\\n Options: ${OPT_GEOLOC_INTERVAL}")
+set(PEP_ACTIVITY_DESCRIPTION "PEP activity event handler")
+set(MOOD_DESCRIPTION "Mood event handler (ui)\\n Command: /mood")
+set(TUNE_DESCRIPTION "Tune event handler (ui)\\n Command: /tune")
+set(GEOLOC_DESCRIPTION "Geolocation event handler (ui)\\n Command: /geoloc")
+set(ACTIVITY_DESCRIPTION "User activity event handler (ui)\\n Command: /activity")
+
+foreach(AVMODULE IN LISTS MODULE_LIST)
+ string(TOUPPER ${AVMODULE} AVMODULE)
+ execute_PROCESS(COMMAND echo -n "${${AVMODULE}_DESCRIPTION}" COMMAND sed -e "s/\\\\n/\\n\\t/g" OUTPUT_VARIABLE ${AVMODULE}_DESCRIPTION_AVV)
+endforeach(AVMODULE)
+
## Check for build dependencies
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB REQUIRED glib-2.0)
@@ -35,44 +65,30 @@
${MCABBER_LIBRARY_DIRS})
## Target definitions
-add_library(pep MODULE pep.c pep.h)
-add_library(mood MODULE mood.c mood.h)
-add_library(pep_mood MODULE pep_mood.c mood.h pep.h)
-add_library(tune MODULE tune.c tune.h)
-add_library(pep_tune MODULE pep_tune.c tune.h pep.h)
-add_library(geoloc MODULE geoloc.c geoloc.h)
-add_library(pep_geoloc MODULE pep_geoloc.c geoloc.h pep.h)
-add_library(activity MODULE activity.c activity.h)
-add_library(pep_activity MODULE pep_activity.c activity.h pep.h)
+add_library(pep MODULE pep.c pep.h)
+foreach(HANDLER IN LISTS HANDLER_LIST)
+ add_library(${HANDLER} MODULE ${HANDLER}.c pep_${HANDLER}.h)
+ add_library(pep_${HANDLER} MODULE pep_${HANDLER}.c pep_${HANDLER}.h pep.h)
+endforeach(HANDLER)
## Compiler setup
if(DEBUG)
set(DEBUG_COMPILE_FLAGS "-g")
endif()
-configure_file(config.h.in config.h)
-include_directories(SYSTEM ${GLIB_INCLUDE_DIRS}
- ${LM_INCLUDE_DIRS}
- ${MCABBER_INCLUDE_DIRS})
-target_link_libraries(pep ${GLIB_LIBRARIES} ${LM_LIBRARIES} ${MCABBER_LIBRARIES})
-target_link_libraries(mood ${GLIB_LIBRARIES} ${MCABBER_LIBRARIES})
-target_link_libraries(pep_mood ${GLIB_LIBRARIES} ${LM_LIBRARIES} ${MCABBER_LIBRARIES})
-target_link_libraries(tune ${GLIB_LIBRARIES} ${MCABBER_LIBRARIES})
-target_link_libraries(pep_tune ${GLIB_LIBRARIES} ${LM_LIBRARIES} ${MCABBER_LIBRARIES})
-target_link_libraries(geoloc ${GLIB_LIBRARIES} ${MCABBER_LIBRARIES})
-target_link_libraries(pep_geoloc ${GLIB_LIBRARIES} ${LM_LIBRARIES} ${MCABBER_LIBRARIES})
-target_link_libraries(activity ${GLIB_LIBRARIES} ${MCABBER_LIBRARIES})
-target_link_libraries(pep_activity ${GLIB_LIBRARIES} ${LM_LIBRARIES} ${MCABBER_LIBRARIES})
-include_directories(${pep_SOURCE_DIR}
- ${pep_BINARY_DIR})
-set_target_properties(pep PROPERTIES COMPILE_FLAGS "-Wall ${DEBUG_COMPILE_FLAGS}")
-set_target_properties(mood PROPERTIES COMPILE_FLAGS "-Wall ${DEBUG_COMPILE_FLAGS}")
-set_target_properties(pep_mood PROPERTIES COMPILE_FLAGS "-Wall ${DEBUG_COMPILE_FLAGS}")
-set_target_properties(tune PROPERTIES COMPILE_FLAGS "-Wall ${DEBUG_COMPILE_FLAGS}")
-set_target_properties(pep_tune PROPERTIES COMPILE_FLAGS "-Wall ${DEBUG_COMPILE_FLAGS}")
-set_target_properties(geoloc PROPERTIES COMPILE_FLAGS "-Wall ${DEBUG_COMPILE_FLAGS}")
-set_target_properties(pep_geoloc PROPERTIES COMPILE_FLAGS "-Wall ${DEBUG_COMPILE_FLAGS}")
-set_target_properties(activity PROPERTIES COMPILE_FLAGS "-Wall ${DEBUG_COMPILE_FLAGS}")
-set_target_properties(pep_activity PROPERTIES COMPILE_FLAGS "-Wall ${DEBUG_COMPILE_FLAGS}")
+configure_file(config.h.in config.h)
+foreach(HANDLER IN LISTS HANDLER_LIST)
+ configure_file(pep_${HANDLER}.h.in pep_${HANDLER}.h)
+endforeach(HANDLER)
+include_directories(SYSTEM ${GLIB_INCLUDE_DIRS} ${LM_INCLUDE_DIRS} ${MCABBER_INCLUDE_DIRS})
+target_link_libraries(pep ${GLIB_LIBRARIES} ${LM_LIBRARIES} ${MCABBER_LIBRARIES})
+foreach(HANDLER IN LISTS HANDLER_LIST)
+ target_link_libraries(${HANDLER} ${GLIB_LIBRARIES} ${MCABBER_LIBRARIES})
+ target_link_libraries(pep_${HANDLER} ${GLIB_LIBRARIES} ${LM_LIBRARIES} ${MCABBER_LIBRARIES})
+endforeach(HANDLER)
+include_directories(${pep_SOURCE_DIR} ${pep_BINARY_DIR})
+foreach(AVMODULE IN LISTS MODULE_LIST)
+ set_target_properties(${AVMODULE} PROPERTIES COMPILE_FLAGS "-Wall ${DEBUG_COMPILE_FLAGS}")
+endforeach(AVMODULE)
## Packaging information
set(CPACK_PACKAGE_NAME libmcabber-pep)
@@ -94,22 +110,22 @@
set(CPACK_SOURCE_IGNORE_FILES "/\\\\..*;\\\\.swp;~$;/build/;\\\\.tar\\\\.;\\\\.deb;\\\\.so")
include(CPack)
-configure_file(avv/pep.in avv/pep)
-configure_file(avv/mood.in avv/mood)
-configure_file(avv/pep_mood.in avv/pep_mood)
-configure_file(avv/tune.in avv/tune)
-configure_file(avv/pep_tune.in avv/pep_tune)
-configure_file(avv/geoloc.in avv/geoloc)
-configure_file(avv/pep_geoloc.in avv/pep_geoloc)
-configure_file(avv/activity.in avv/activity)
-configure_file(avv/pep_activity.in avv/pep_activity)
+foreach(AVMODULE IN LISTS MODULE_LIST)
+ configure_file(avv/${AVMODULE}.in avv/${AVMODULE})
+endforeach(AVMODULE)
+
+configure_file(pep.rc.in pep.rc @ONLY)
## Installation
-install(TARGETS pep mood pep_mood tune pep_tune geoloc pep_geoloc activity pep_activity DESTINATION lib/mcabber)
-install(FILES pep.rc COPYING TODO README DESTINATION share/doc/${CPACK_PACKAGE_NAME})
-install(DIRECTORY doc/ DESTINATION share/doc/${CPACK_PACKAGE_NAME})
-install(FILES pep.h mood.h tune.h geoloc.h activity.h DESTINATION include/mcabber)
-install(DIRECTORY help DESTINATION share/mcabber)
-install(DIRECTORY ${PROJECT_BINARY_DIR}/avv/ DESTINATION share/mcabber/avv/modules)
+install(TARGETS ${MODULE_LIST} DESTINATION lib/mcabber)
+install(FILES ${PROJECT_BINARY_DIR}/pep.rc COPYING TODO README DESTINATION share/doc/${CPACK_PACKAGE_NAME})
+install(DIRECTORY doc/ DESTINATION share/doc/${CPACK_PACKAGE_NAME} PATTERN "*~" EXCLUDE)
+install(FILES pep.h
+ ${PROJECT_BINARY_DIR}/pep_mood.h
+ ${PROJECT_BINARY_DIR}/pep_tune.h
+ ${PROJECT_BINARY_DIR}/pep_geoloc.h
+ ${PROJECT_BINARY_DIR}/pep_activity.h DESTINATION include/mcabber)
+install(DIRECTORY help DESTINATION share/mcabber PATTERN "*~" EXCLUDE)
+install(DIRECTORY ${PROJECT_BINARY_DIR}/avv/ DESTINATION share/mcabber/avv/modules PATTERN "*~" EXCLUDE)
## The End ## vim: se ts=4: ##
--- a/activity.c Mon May 21 03:38:51 2012 +0300
+++ b/activity.c Mon May 21 19:10:25 2012 +0300
@@ -32,7 +32,7 @@
#include <mcabber/compl.h>
#include <mcabber/modules.h>
-#include "activity.h"
+#include "pep_activity.h"
#include "config.h"
@@ -43,7 +43,8 @@
void activity_init (void);
void activity_uninit (void);
-#define DESCRIPTION ( "PEP activity support\nProvides command /activity" )
+#define DESCRIPTION ( ACTIVITY_DESCRIPTION )
+
static const gchar *deps[] = { "pep_activity", NULL };
static module_info_t info_activity_dev = {
@@ -102,7 +103,7 @@
GError *error = NULL;
- activity_request ( CURRENT_JID, &error );
+ pep_activity_request ( CURRENT_JID, &error );
if ( error ) {
scr_log_print ( LPRINT_NORMAL, "Error sending request: %s.", error -> message );
g_error_free ( error );
--- a/activity.h Mon May 21 03:38:51 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-
-#ifndef MCABBER_ACTIVITY_H
-#define MCABBER_ACTIVITY_H
-
-/*
- * activity.h -- Pep activity events
- *
- * Copyright (C) 2012 Myhailo Danylenko <isbear@ukrpost.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <glib.h>
-
-#define NS_ACTIVITY ( "http:/" "/jabber.org/protocol/activity" )
-#define NS_ACTIVITY_NOTIFY ( "http:/" "/jabber.org/protocol/activity+notify" )
-
-#define HOOK_ACTIVITY_IN ( "activity-in" )
-#define HOOK_ACTIVITY_OUT ( "activity-out" )
-
-#define ACTIVITY_ERROR_NOTCONNECTED ( 0x01 )
-
-void activity_publish ( const gchar *major, const gchar *minor, const gchar *text );
-gboolean activity_request ( const gchar *to, GError **error );
-
-#endif
-
--- a/avv/activity.in Mon May 21 03:38:51 2012 +0300
+++ b/avv/activity.in Mon May 21 19:10:25 2012 +0300
@@ -2,12 +2,12 @@
Name: activity
Method: glib
Version: ${PROJECT_VERSION}
-Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
+Description: ${ACTIVITY_DESCRIPTION_AVV}
# commands depend on building environment - 4, 3 or 2+1
Requires: commands:4 + ( compl:3 | compl:2 ) + (hooks:5 | hooks:4 | hooks:3 | hooks:2 ) +
- pep_activity:1 + logprint:3 + ( hbuf:3 | hbuf:2 | hbuf:1 ) +
+ logprint:3 + ( hbuf:3 | hbuf:2 | hbuf:1 ) +
( screen:10 | screen:9 | screen:8 | screen:7 | screen:6 | screen:5 | screen:4 ) +
- ( roster:4 | roster:3 | roster:2 | roster:1 ) + utils:2
+ ( roster:4 | roster:3 | roster:2 | roster:1 ) + utils:2 + pep_activity:2
Init: activity_init
Uninit: activity_uninit
--- a/avv/geoloc.in Mon May 21 03:38:51 2012 +0300
+++ b/avv/geoloc.in Mon May 21 19:10:25 2012 +0300
@@ -2,13 +2,13 @@
Name: geoloc
Method: glib
Version: ${PROJECT_VERSION}
-Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
+Description: ${GEOLOC_DESCRIPTION_AVV}
# commands depend on compilaton environment
Requires: ( roster:4 | roster:3 | roster:2 | roster:1 ) + commands:4 + ( compl:3 | compl:2 ) +
( hooks:5 | hooks:4 | hooks:3 | hooks:2 | hooks:1 ) + utils:2 +
- pep_geoloc:1 + logprint:3 +
+ logprint:3 +
( screen:10 | screen:9 | screen:8 | screen:7 | screen:6 | screen:5 | screen:4 ) +
- ( hbuf:3 | hbuf:2 | hbuf:1 )
+ ( hbuf:3 | hbuf:2 | hbuf:1 ) + pep_geoloc:2
Init: geoloc_init
Uninit: geoloc_uninit
--- a/avv/mood.in Mon May 21 03:38:51 2012 +0300
+++ b/avv/mood.in Mon May 21 19:10:25 2012 +0300
@@ -2,14 +2,14 @@
Name: mood
Method: glib
Version: ${PROJECT_VERSION}
-Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
+Description: ${MOOD_DESCRIPTION_AVV}
# commands depend on building environment: 4, 3, 2+1
Requires: ( roster:4 | roster:3 | roster:2 | roster:1 ) + commands:4 +
( compl:3 | compl:2 | compl:1 ) + utils:2 +
( hooks:5 | hooks:4 | hooks:3 | hooks:2 ) +
- logprint:3 + pep_mood:1 +
+ logprint:3 +
( screen:10 | screen:9 | screen:8 | screen:7 | screen:6 | screen:5 | screen:4 ) +
- ( hbuf:3 | hbuf:2 | hbuf:1 )
+ ( hbuf:3 | hbuf:2 | hbuf:1 ) + pep_mood:2
Init: mood_init
Uninit: mood_uninit
--- a/avv/pep.in Mon May 21 03:38:51 2012 +0300
+++ b/avv/pep.in Mon May 21 19:10:25 2012 +0300
@@ -2,9 +2,7 @@
Name: pep
Method: glib
Version: ${PROJECT_VERSION}
-Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
- Provides common listener infrastructure for various other
- modules, eg avatar, geoloc, mood, tune.
+Description: ${PEP_DESCRIPTION_AVV}
Requires: ( xmpp:4 | xmpp:3 | xmpp:2 | xmpp:1 ) +
( hooks:5 | hooks:4 | hooks:3 | hooks:2 )
Provides: pep:1
--- a/avv/pep_activity.in Mon May 21 03:38:51 2012 +0300
+++ b/avv/pep_activity.in Mon May 21 19:10:25 2012 +0300
@@ -2,11 +2,11 @@
Name: pep_activity
Method: glib
Version: ${PROJECT_VERSION}
-Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
+Description: ${PEP_ACTIVITY_DESCRIPTION_AVV}
Requires: ( hooks:5 | hooks:4 | hooks:3 | hooks:2 ) +
( xmpp:4 | xmpp:3 | xmpp:2 | xmpp:1 ) + pep:1 + logprint:3 +
utils:2 + ( xmpp_helper:2 | xmpp_helper:1 )
-Provides: pep_activity:1 + activity:1
+Provides: pep_activity:2
Init: pep_activity_init
Uninit: pep_activity_uninit
--- a/avv/pep_geoloc.in Mon May 21 03:38:51 2012 +0300
+++ b/avv/pep_geoloc.in Mon May 21 19:10:25 2012 +0300
@@ -2,12 +2,12 @@
Name: pep_geoloc
Method: glib
Version: ${PROJECT_VERSION}
-Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
+Description: ${PEP_GEOLOC_DESCRIPTION_AVV}
Requires: ( hooks:5 | hooks:4 | hooks:3 | hooks:2 | hooks:1 ) + utils:2 +
( xmpp:4 | xmpp:3 | xmpp:2 | xmpp:1 ) + pep:1 + logprint:3 +
settings:1 + guards:2 +
( xmpp_helper:2 | xmpp_helper:1 )
-Provides: pep_geoloc:1 + geoloc:1
+Provides: pep_geoloc:2
Init: pep_geoloc_init
Uninit: pep_geoloc_uninit
--- a/avv/pep_mood.in Mon May 21 03:38:51 2012 +0300
+++ b/avv/pep_mood.in Mon May 21 19:10:25 2012 +0300
@@ -2,12 +2,12 @@
Name: pep_mood
Method: glib
Version: ${PROJECT_VERSION}
-Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
+Description: ${PEP_MOOD_DESCRIPTION_AVV}
# commands depend on building environment: 4, 3, 2+1
Requires: utils:2 + ( hooks:5 | hooks:4 | hooks:3 | hooks:2 ) +
( xmpp:4 | xmpp:3 | xmpp:2 | xmpp:1 ) + pep:1 + logprint:3 +
( xmpp_helper:2 | xmpp_helper:1 )
-Provides: pep_mood:1 + mood:1
+Provides: pep_mood:2
Init: pep_mood_init
Uninit: pep_mood_uninit
--- a/avv/pep_tune.in Mon May 21 03:38:51 2012 +0300
+++ b/avv/pep_tune.in Mon May 21 19:10:25 2012 +0300
@@ -2,12 +2,12 @@
Name: pep_tune
Method: glib
Version: ${PROJECT_VERSION}
-Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
+Description: ${PEP_TUNE_DESCRIPTION_AVV}
Requires: ( hooks:5 | hooks:4 | hooks:3 | hooks:2 ) +
( xmpp:4 | xmpp:3 | xmpp:2 | xmpp:1 ) + pep:1 + logprint:3 +
settings:1 + guards:2 + utils:2 +
( xmpp_helper:2 | xmpp_helper:1 )
-Provides: pep_tune:1 + tune:1
+Provides: pep_tune:2
Init: pep_tune_init
Uninit: pep_tune_uninit
--- a/avv/tune.in Mon May 21 03:38:51 2012 +0300
+++ b/avv/tune.in Mon May 21 19:10:25 2012 +0300
@@ -2,11 +2,11 @@
Name: tune
Method: glib
Version: ${PROJECT_VERSION}
-Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
+Description: ${TUNE_DESCRIPTION_AVV}
Requires: commands:4 + ( compl:3 | compl:2 ) + ( hooks:5 | hooks:4 | hooks:3 | hooks:2 ) + logprint:3 +
( screen:10 | screen:9 | screen:8 | screen:7 | screen:6 | screen:5 | screen:4 ) +
( roster:4 | roster:3 | roster:2 | roster:1 ) + utils:2 +
- ( hbuf:3 | hbuf:2 | hbuf:1 ) + pep_tune:1
+ ( hbuf:3 | hbuf:2 | hbuf:1 ) + pep_tune:2
Init: tune_init
Uninit: tune_uninit
--- a/config.h.in Mon May 21 03:38:51 2012 +0300
+++ b/config.h.in Mon May 21 19:10:25 2012 +0300
@@ -6,5 +6,16 @@
#define PROJECT_VERSION ( "${PROJECT_VERSION}" )
+#define PEP_DESCRIPTION ( "${PEP_DESCRIPTION}" )
+#define PEP_TUNE_DESCRIPTION ( "${PEP_TUNE_DESCRIPTION}" )
+#define PEP_MOOD_DESCRIPTION ( "${PEP_MOOD_DESCRIPTION}" )
+#define PEP_GEOLOC_DESCRIPTION ( "${PEP_GEOLOC_DESCRIPTION}" )
+#define PEP_ACTIVITY_DESCRIPTION ( "${PEP_ACTIVITY_DESCRIPTION}" )
+#define MOOD_DESCRIPTION ( "${MOOD_DESCRIPTION}" )
+#define TUNE_DESCRIPTION ( "${TUNE_DESCRIPTION}" )
+#define GEOLOC_DESCRIPTION ( "${GEOLOC_DESCRIPTION}" )
+#define ACTIVITY_DESCRIPTION ( "${ACTIVITY_DESCRIPTION}" )
+
+
#endif
--- a/doc/api.mdwn Mon May 21 03:38:51 2012 +0300
+++ b/doc/api.mdwn Mon May 21 19:10:25 2012 +0300
@@ -72,7 +72,10 @@
Hook name constants. Usually are the same as actual hook name, but
uppercased, with 'HOOK_' added and with underscores instead of dashes.
-### *_request ( to, error )
+### OPT_*
+MCabber option names. Should not be enclosed in braces.
+
+### pep_*_request ( to, error )
Request corresponding data from the jid, specified in 'to'.
'error' may be used for error control. If no error occured,
and remote side have replied with notification stanza, call
@@ -80,13 +83,6 @@
event '*-in'. Currently there's no way to detect an
error on the remote side (eg, if it does not support PEP).
-### *_publish ( ... )
-Publish supplied data as corresponding user's update. Note,
-that this function bypasses event interface, thus, it can
-be used to publish *only* via PEP. In general, it is
-suggested to use event (hooks) interface, as it allows
-multiplexing and non-breaking extensibility.
-
## pep
### (*pep_xmlns_handler_t) ( from, node, n, id, userdata )
@@ -104,17 +100,4 @@
### pep_unregister_xmlns_handler ( xmlns )
Remove handler from given xmlns namespace.
-## tune
-'tune_publish' takes list of key-value pairs.
-
-## mood
-'mood_publish' takes two string arguments - mood and mood message.
-
-## activity
-'activity_publish' takes three string arguments - major activity, minor, and
-activity message.
-
-## geoloc
-'geoloc_publish' takes list of key-value pairs.
-
<!-- -->
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/avv_api.mdwn Mon May 21 19:10:25 2012 +0300
@@ -0,0 +1,17 @@
+
+# Api versions:
+
+mood:1 provide mood_publish()
+pep_mood:1 mood:1 + provide mood_request(), use events
+pep_mood:2 drop mood_publish, rename to pep_mood_request(), header name change
+tune:1 provide tune_publish()
+pep_tune:1 tune:1 + provide tune_request(), use events
+pep_tune:2 drop tune_publish, rename to pep_tune_request(), header name change
+geoloc:1 provide geoloc_publish()
+pep_geoloc:1 geoloc:1 + provide geoloc_request(), use events
+pep_geoloc:2 drop geoloc_publish, rename to pep_geoloc_request(), header name change
+activity:1 provide activity_publish()
+pep_activity:1 activity:1 + provide activity_request(), use events
+pep_activity:2 drop activity_publish, rename to pep_activity_request(), header name change
+
+<!-- vim: se ts=20: -->
--- a/geoloc.c Mon May 21 03:38:51 2012 +0300
+++ b/geoloc.c Mon May 21 19:10:25 2012 +0300
@@ -32,7 +32,7 @@
#include <mcabber/hooks.h>
#include <mcabber/modules.h>
-#include "geoloc.h"
+#include "pep_geoloc.h"
#include "config.h"
@@ -43,9 +43,7 @@
void geoloc_init (void);
void geoloc_uninit (void);
-#define DESCRIPTION ( \
- "PEP geoloc event handling\n" \
- "Provides command /geoloc" )
+#define DESCRIPTION ( GEOLOC_DESCRIPTION )
static const gchar *deps[] = { "pep_geoloc", NULL };
@@ -119,7 +117,7 @@
GError *error = NULL;
- geoloc_request ( CURRENT_JID, &error );
+ pep_geoloc_request ( CURRENT_JID, &error );
if ( error ) {
scr_log_print ( LPRINT_NORMAL, "Error sending request: %s.", error -> message );
g_error_free ( error );
--- a/geoloc.h Mon May 21 03:38:51 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
-
-#ifndef MCABBER_GEOLOC_H
-#define MCABBER_GEOLOC_H
-
-/*
- * geoloc.h -- Pep geographical location events
- *
- * Copyright (C) 2009-2012 Myhailo Danylenko <isbear@ukrpost.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <glib.h>
-
-#define NS_GEOLOC ( "http:/" "/jabber.org/protocol/geoloc" )
-#define NS_GEOLOC_NOTIFY ( "http:/" "/jabber.org/protocol/geoloc+notify" )
-
-#define HOOK_GEOLOC_IN ( "geoloc-in" )
-#define HOOK_GEOLOC_OUT ( "geoloc-out" )
-
-#define GEOLOC_ERROR_NOTCONNECTED ( 0x01 )
-
-typedef struct {
- const gchar *name;
- gchar *value;
-} geoloc_pair_t;
-
-void geoloc_publish ( const geoloc_pair_t *pairs );
-gboolean geoloc_request ( const gchar *to, GError **error );
-
-#endif
-
--- a/mood.c Mon May 21 03:38:51 2012 +0300
+++ b/mood.c Mon May 21 19:10:25 2012 +0300
@@ -32,7 +32,7 @@
#include <mcabber/hooks.h>
#include <mcabber/modules.h>
-#include "mood.h"
+#include "pep_mood.h"
#include "config.h"
@@ -43,7 +43,7 @@
void mood_init (void);
void mood_uninit (void);
-#define DESCRIPTION ( "PEP mood events handling\nProvides command /mood" )
+#define DESCRIPTION ( MOOD_DESCRIPTION )
static const gchar *deps[] = { "pep_mood", NULL };
@@ -91,7 +91,7 @@
GError *error = NULL;
- mood_request ( CURRENT_JID, &error );
+ pep_mood_request ( CURRENT_JID, &error );
if ( error ) {
scr_log_print ( LPRINT_NORMAL, "Error sending request: %s.", error -> message );
g_error_free ( error );
--- a/mood.h Mon May 21 03:38:51 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-
-#ifndef MCABBER_MOOD_H
-#define MCABBER_MOOD_H
-
-/*
- * mood.h -- Pep mood events
- *
- * Copyright (C) 2009-2012 Myhailo Danylenko <isbear@ukrpost.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <glib.h>
-
-#define NS_MOOD ( "http:/" "/jabber.org/protocol/mood" )
-#define NS_MOOD_NOTIFY ( "http:/" "/jabber.org/protocol/mood+notify" )
-
-#define HOOK_MOOD_IN ( "mood-in" )
-#define HOOK_MOOD_OUT ( "mood-out" )
-
-#define MOOD_ERROR_NOTCONNECTED ( 0x01 )
-
-void mood_publish ( const gchar *mood, const gchar *text );
-gboolean mood_request ( const gchar *to, GError **error );
-
-#endif
-
--- a/pep.c Mon May 21 03:38:51 2012 +0300
+++ b/pep.c Mon May 21 19:10:25 2012 +0300
@@ -33,7 +33,7 @@
void pep_init (void);
void pep_uninit (void);
-#define DESCRIPTION ( "Common PEP events listener" )
+#define DESCRIPTION ( PEP_DESCRIPTION )
static module_info_t info_pep_dev = {
.branch = "dev",
--- a/pep.rc Mon May 21 03:38:51 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-
-# Modules, that provide internal infrastructure, and will
-# be loaded automatically by dependencies:
-#module load pep
-#module load pep_mood
-#moudle load pep_tune
-#module load pep_activity
-#module load pep_geoloc
-#module load pep_avatar
-
-# Minimum interval betweet two publishes. Any too frequent
-# publish requests will be discarded. Set to 0 to disable.
-# (pep_tune option)
-set pep_tune_interval = 10
-
-# Set to non-zero, if paused state should be considered
-# stopped state (and thus publish empty data).
-# (pep_tune option)
-set pep_tune_pause_is_stop = 1
-
-# Minimum interval between two publishes. Any too frequent
-# publish requests will be discarded. Set to 0 to disable.
-# (pep_geoloc option)
-set geoloc_interval = 5
-
-module load mood
-
-module load tune
-
-module load activity
-
-module load geoloc
-
-# Directory, where avatars will be saved. Avatars are saved by
-# their id (sha1sum of png data), and symlinked by jids.
-# I.e. '12345...679.png' contains png data and 'foo@bar.org' is a
-# symlink to '12345...679.png'
-set avatar_directory = ~/.mcabber/avatars
-
-module load avatar
-
-# the end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pep.rc.in Mon May 21 19:10:25 2012 +0300
@@ -0,0 +1,33 @@
+
+# Modules, that provide internal infrastructure, and will
+# be loaded automatically by dependencies:
+#module load pep
+#module load pep_mood
+#moudle load pep_tune
+#module load pep_activity
+#module load pep_geoloc
+
+# Minimum interval betweet two publishes. Any too frequent
+# publish requests will be discarded. Set to 0 to disable.
+# (pep_tune option)
+set @OPT_TUNE_INTERVAL@ = 10
+
+# Set to non-zero, if paused state should be considered
+# stopped state (and thus publish empty data).
+# (pep_tune option)
+set @OPT_TUNE_PAUSE_IS_STOP@ = 1
+
+# Minimum interval between two publishes. Any too frequent
+# publish requests will be discarded. Set to 0 to disable.
+# (pep_geoloc option)
+set @OPT_GEOLOC_INTERVAL@ = 5
+
+module load mood
+
+module load tune
+
+module load activity
+
+module load geoloc
+
+# the end
--- a/pep_activity.c Mon May 21 03:38:51 2012 +0300
+++ b/pep_activity.c Mon May 21 19:10:25 2012 +0300
@@ -31,7 +31,7 @@
#include <mcabber/xmpp_helper.h>
#include "pep.h"
-#include "activity.h"
+#include "pep_activity.h"
#include "config.h"
@@ -42,7 +42,8 @@
void pep_activity_init (void);
void pep_activity_uninit (void);
-#define DESCRIPTION ( "PEP activity support" )
+#define DESCRIPTION ( PEP_ACTIVITY_DESCRIPTION )
+
static const gchar *deps[] = { "pep", NULL };
static module_info_t info_activity_dev = {
@@ -129,7 +130,7 @@
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
}
-void activity_publish (const gchar *major, const gchar *minor, const gchar *text)
+static void activity_publish (const gchar *major, const gchar *minor, const gchar *text)
{
if (!xmpp_is_online ()) {
g_free (activity_major);
@@ -183,7 +184,7 @@
lm_message_unref (request);
}
-gboolean activity_request ( const gchar *to, GError **err )
+gboolean pep_activity_request ( const gchar *to, GError **err )
{
LmMessage *request;
LmMessageNode *node;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pep_activity.h.in Mon May 21 19:10:25 2012 +0300
@@ -0,0 +1,39 @@
+
+#ifndef MCABBER_ACTIVITY_H
+#define MCABBER_ACTIVITY_H
+
+/*
+ * activity.h -- Pep activity events
+ *
+ * Copyright (C) 2012 Myhailo Danylenko <isbear@ukrpost.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include <glib.h>
+
+#define NS_ACTIVITY ( "http:/" "/jabber.org/protocol/activity" )
+#define NS_ACTIVITY_NOTIFY ( "http:/" "/jabber.org/protocol/activity+notify" )
+
+#define HOOK_ACTIVITY_IN ( "${HOOK_ACTIVITY_IN}" )
+#define HOOK_ACTIVITY_OUT ( "${HOOK_ACTIVITY_OUT}" )
+
+#define ACTIVITY_ERROR_NOTCONNECTED ( 0x01 )
+
+gboolean pep_activity_request ( const gchar *to, GError **error );
+
+#endif
+
--- a/pep_geoloc.c Mon May 21 03:38:51 2012 +0300
+++ b/pep_geoloc.c Mon May 21 19:10:25 2012 +0300
@@ -34,7 +34,7 @@
#include <mcabber/modules.h>
#include "pep.h"
-#include "geoloc.h"
+#include "pep_geoloc.h"
#include "config.h"
@@ -45,9 +45,7 @@
void pep_geoloc_init (void);
void pep_geoloc_uninit (void);
-#define DESCRIPTION ( \
- "PEP geoloc event handling\n" \
- "Recognizes option geoloc_interval" )
+#define DESCRIPTION ( PEP_GEOLOC_DESCRIPTION )
static const gchar *deps[] = { "pep", NULL };
@@ -421,11 +419,11 @@
{
geoloc_gerror_quark = g_quark_from_string ( "pep-geoloc-gerror-quark" );
- geoloc_interval = settings_opt_get_int ("geoloc_interval");
+ geoloc_interval = settings_opt_get_int ( OPT_GEOLOC_INTERVAL );
- geoloc_guard_installed = settings_set_guard ("geoloc_interval", geoloc_guard);
+ geoloc_guard_installed = settings_set_guard (OPT_GEOLOC_INTERVAL, geoloc_guard);
if (!geoloc_guard_installed)
- scr_log_print (LPRINT_LOGNORM, "geoloc: Warning: cannot install option guard for 'geoloc_interval'.");
+ scr_log_print (LPRINT_LOGNORM, "geoloc: Warning: cannot install option guard for '" OPT_GEOLOC_INTERVAL "'.");
pep_register_xmlns_handler (NS_GEOLOC, geoloc_handler, NULL, NULL);
@@ -468,7 +466,7 @@
}
if (geoloc_guard_installed)
- settings_del_guard ("geoloc_interval");
+ settings_del_guard ( OPT_GEOLOC_INTERVAL );
}
/* vim: se ts=4 sw=4: */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pep_geoloc.h.in Mon May 21 19:10:25 2012 +0300
@@ -0,0 +1,46 @@
+
+#ifndef MCABBER_GEOLOC_H
+#define MCABBER_GEOLOC_H
+
+/*
+ * geoloc.h -- Pep geographical location events
+ *
+ * Copyright (C) 2009-2012 Myhailo Danylenko <isbear@ukrpost.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include <glib.h>
+
+#define NS_GEOLOC ( "http:/" "/jabber.org/protocol/geoloc" )
+#define NS_GEOLOC_NOTIFY ( "http:/" "/jabber.org/protocol/geoloc+notify" )
+
+#define OPT_GEOLOC_INTERVAL "${OPT_GEOLOC_INTERVAL}"
+
+#define HOOK_GEOLOC_IN ( "${HOOK_GEOLOC_IN}" )
+#define HOOK_GEOLOC_OUT ( "${HOOK_GEOLOC_OUT}" )
+
+#define GEOLOC_ERROR_NOTCONNECTED ( 0x01 )
+
+typedef struct {
+ const gchar *name;
+ gchar *value;
+} geoloc_pair_t;
+
+gboolean pep_geoloc_request ( const gchar *to, GError **error );
+
+#endif
+
--- a/pep_mood.c Mon May 21 03:38:51 2012 +0300
+++ b/pep_mood.c Mon May 21 19:10:25 2012 +0300
@@ -31,7 +31,7 @@
#include <mcabber/modules.h>
#include "pep.h"
-#include "mood.h"
+#include "pep_mood.h"
#include "config.h"
@@ -42,7 +42,7 @@
void pep_mood_init (void);
void pep_mood_uninit (void);
-#define DESCRIPTION ( "PEP mood events handling" )
+#define DESCRIPTION ( PEP_MOOD_DESCRIPTION )
static const gchar *deps[] = { "pep", NULL };
@@ -118,7 +118,7 @@
return LM_HANDLER_RESULT_REMOVE_MESSAGE;
}
-void mood_publish (const gchar *mood, const gchar *text)
+static void mood_publish (const gchar *mood, const gchar *text)
{
if (!xmpp_is_online ()) {
scr_log_print (LPRINT_DEBUG, "mood: Delaying publish until online.");
@@ -167,7 +167,7 @@
lm_message_unref (request);
}
-gboolean mood_request ( const gchar *to, GError **err )
+gboolean pep_mood_request ( const gchar *to, GError **err )
{
LmMessage *request;
LmMessageNode *node;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pep_mood.h.in Mon May 21 19:10:25 2012 +0300
@@ -0,0 +1,39 @@
+
+#ifndef MCABBER_MOOD_H
+#define MCABBER_MOOD_H
+
+/*
+ * mood.h -- Pep mood events
+ *
+ * Copyright (C) 2009-2012 Myhailo Danylenko <isbear@ukrpost.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include <glib.h>
+
+#define NS_MOOD ( "http:/" "/jabber.org/protocol/mood" )
+#define NS_MOOD_NOTIFY ( "http:/" "/jabber.org/protocol/mood+notify" )
+
+#define HOOK_MOOD_IN ( "${HOOK_MOOD_IN}" )
+#define HOOK_MOOD_OUT ( "${HOOK_MOOD_OUT}" )
+
+#define MOOD_ERROR_NOTCONNECTED ( 0x01 )
+
+gboolean pep_mood_request ( const gchar *to, GError **error );
+
+#endif
+
--- a/pep_tune.c Mon May 21 03:38:51 2012 +0300
+++ b/pep_tune.c Mon May 21 19:10:25 2012 +0300
@@ -30,7 +30,7 @@
#include <mcabber/modules.h>
#include "pep.h"
-#include "tune.h"
+#include "pep_tune.h"
#include "config.h"
@@ -41,9 +41,7 @@
void pep_tune_init (void);
void pep_tune_uninit (void);
-#define DESCRIPTION ( \
- "PEP tune event handler\n" \
- "Optios: " OPT_TUNE_PAUSE_IS_STOP ", " OPT_TUNE_INTERVAL )
+#define DESCRIPTION ( PEP_TUNE_DESCRIPTION )
static const gchar *deps[] = { "pep", NULL };
@@ -219,64 +217,7 @@
lm_message_unref (request);
}
-void tune_publish (const tune_pair_t *pairs)
-{
- gboolean publish = FALSE;
- const tune_pair_t *tag;
- tune_pair_t new_info[] = {
- { "artist", NULL },
- { "length", NULL },
- { "rating", NULL },
- { "source", NULL },
- { "title", NULL },
- { "track", NULL },
- { "uri", NULL },
- { NULL, NULL },
- };
-
- // populate new_info with new values
- for ( tag = pairs; tag -> name; ++ tag )
- if ( ! g_strcmp0 ( tag -> name, "state" ) ) {
- if ( ( ! g_strcmp0 ( tag -> value, "stop" ) ) ||
- ( ( ! g_strcmp0 ( tag -> value, "pause" ) ) &&
- settings_opt_get_int ( OPT_TUNE_PAUSE_IS_STOP ) ) ) {
- int i;
- for ( i = 0; i <= MAX_NO; ++ i )
- new_info [ i ] .value = NULL;
- break;
- }
- } else {
- int i;
- for ( i = 0; i <= MAX_NO; ++ i )
- if ( ! g_strcmp0 ( tag -> name, new_info [ i ] .name ) )
- new_info [ i ] .value = tag -> value;
- }
-
- { // check, if it differ from info
- int i;
- for (i = 0; i <= MAX_NO; ++i)
- if (g_strcmp0 (new_info[i].value, info[i].value)) {
- publish = TRUE;
- break;
- }
- }
-
- if (publish) {
-
- { // copy new values to info
- int i;
- for (i = 0; i <= MAX_NO; ++i) {
- if (info[i].value)
- g_free (info[i].value);
- info[i].value = g_strdup (new_info[i].value);
- }
- }
-
- tune_publish_info ();
- }
-}
-
-gboolean tune_request ( const gchar *to, GError **err )
+gboolean pep_tune_request ( const gchar *to, GError **err )
{
LmMessage *request;
LmMessageNode *node;
@@ -367,7 +308,49 @@
static guint tune_htoh ( const gchar *htype, hk_arg_t *args, gpointer udata )
{
- tune_publish ( (const tune_pair_t *) args );
+ gboolean publish = FALSE;
+ gboolean stop = FALSE;
+
+ { // check state
+ const hk_arg_t *arg;
+ for ( arg = args; arg -> name != NULL; ++ arg ) {
+ if ( ! g_strcmp0 ( arg -> name, "state" ) ) {
+ stop = ( ! g_strcmp0 ( arg -> value, "stop" ) ) ||
+ ( ( ! g_strcmp0 ( arg -> value, "pause" ) ) && settings_opt_get_int ( OPT_TUNE_PAUSE_IS_STOP ) );
+ break;
+ }
+ }
+ }
+
+ if ( stop ) { // ignore info
+ int i;
+ for ( i = 0; i <= MAX_NO; ++ i )
+ if ( info [ i ] .value != NULL ) {
+ g_free ( info [ i ] .value );
+ info [ i ] .value = NULL;
+ publish = TRUE;
+ }
+ } else { // populate info with new values
+ int i;
+ for ( i = 0; i <= MAX_NO; ++ i ) {
+ const hk_arg_t *arg;
+ for ( arg = args; arg -> name != NULL; ++ arg ) {
+ if ( ! g_strcmp0 ( arg -> name, info [ i ] .name ) ) {
+ if ( g_strcmp0 ( arg -> value, info [ i ] .value ) ) {
+ if ( info [ i ] .value )
+ g_free ( info [ i ] .value );
+ info [ i ] .value = g_strdup ( arg -> value );
+ publish = TRUE;
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ if ( publish )
+ tune_publish_info ();
+
return HOOK_HANDLER_RESULT_ALLOW_MORE_HANDLERS;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pep_tune.h.in Mon May 21 19:10:25 2012 +0300
@@ -0,0 +1,47 @@
+
+#ifndef MCABBER_TUNE_H
+#define MCABBER_TUNE_H
+
+/*
+ * tune.h -- Pep tune events
+ *
+ * Copyright (C) 2009-2012 Myhailo Danylenko <isbear@ukrpost.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include <glib.h>
+
+#define NS_TUNE ( "http:/" "/jabber.org/protocol/tune" )
+#define NS_TUNE_NOTIFY ( "http:/" "/jabber.org/protocol/tune+notify" )
+
+#define TUNE_ERROR_NOTCONNECTED ( 0x01 )
+
+#define OPT_TUNE_PAUSE_IS_STOP "${OPT_TUNE_PAUSE_IS_STOP}"
+#define OPT_TUNE_INTERVAL "${OPT_TUNE_INTERVAL}"
+
+#define HOOK_TUNE_IN ( "${HOOK_TUNE_IN}" )
+#define HOOK_TUNE_OUT ( "${HOOK_TUNE_OUT}" )
+
+typedef struct {
+ const gchar *name;
+ gchar *value;
+} tune_pair_t;
+
+gboolean pep_tune_request ( const gchar *to, GError **err );
+
+#endif
+
--- a/tune.c Mon May 21 03:38:51 2012 +0300
+++ b/tune.c Mon May 21 19:10:25 2012 +0300
@@ -29,7 +29,7 @@
#include <mcabber/hooks.h>
#include <mcabber/modules.h>
-#include "tune.h"
+#include "pep_tune.h"
#include "config.h"
@@ -40,10 +40,7 @@
void tune_init (void);
void tune_uninit (void);
-#define DESCRIPTION ( \
- "User interface for PEP tune events\n" \
- "Prints incoming notifications into buddies buffers\n" \
- "Provides command /tune" )
+#define DESCRIPTION ( TUNE_DESCRIPTION )
static const gchar *deps[] = { "pep_tune", NULL };
@@ -113,7 +110,7 @@
GError *error = NULL;
- tune_request ( CURRENT_JID, &error );
+ pep_tune_request ( CURRENT_JID, &error );
if ( error ) {
scr_log_print ( LPRINT_NORMAL, "Error sending request: %s.", error -> message );
g_error_free ( error );
--- a/tune.h Mon May 21 03:38:51 2012 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-
-#ifndef MCABBER_TUNE_H
-#define MCABBER_TUNE_H
-
-/*
- * tune.h -- Pep tune events
- *
- * Copyright (C) 2009-2012 Myhailo Danylenko <isbear@ukrpost.net>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- */
-
-#include <glib.h>
-
-#define NS_TUNE ( "http:/" "/jabber.org/protocol/tune" )
-#define NS_TUNE_NOTIFY ( "http:/" "/jabber.org/protocol/tune+notify" )
-
-#define OPT_TUNE_PAUSE_IS_STOP "pep_tune_pause_is_stop"
-#define OPT_TUNE_INTERVAL "pep_tune_interval"
-
-#define HOOK_TUNE_IN ( "tune-in" )
-#define HOOK_TUNE_OUT ( "tune-out" )
-
-#define TUNE_ERROR_NOTCONNECTED ( 0x01 )
-
-typedef struct {
- const gchar *name;
- gchar *value;
-} tune_pair_t;
-
-void tune_publish ( const tune_pair_t *pairs );
-gboolean tune_request ( const gchar *to, GError **err );
-
-#endif
-