--- a/CMakeLists.txt Mon Mar 16 04:06:02 2009 +0200
+++ b/CMakeLists.txt Mon Mar 16 04:43:24 2009 +0200
@@ -6,6 +6,8 @@
option(DEBUG "Enable debugging output" ON)
option(LLM_LOG_HANDLER "Enable registration of log messages handler for lua-loudmouth library's messages" ON)
set(MCABBER_INCLUDE_DIR "/home/isbear/src/mcabber/hglm/mcabber/src" CACHE FILEPATH "Path to mcabber headers")
+set(ML_SOURCE_PRIORITY G_PRIORITY_HIGH_IDLE CACHE STRING "Glib event source priority for timeout and bgread")
+set(ML_BGREAD_BUFFER 4096 CACHE STRING "Background pipe reading buffer size")
## Define targets
add_library(mcabber-lua MODULE main.c util.c)
--- a/TODO Mon Mar 16 04:06:02 2009 +0200
+++ b/TODO Mon Mar 16 04:43:24 2009 +0200
@@ -13,5 +13,4 @@
think about how tune notification should act on start/quit
clarify situation with disco, maybe it is due to this we are unable to receive pep events
lm debug should be more flexible
-make bgread buffer size and timers priority either CMake definitions or mcabber options
--- a/config.h.in Mon Mar 16 04:06:02 2009 +0200
+++ b/config.h.in Mon Mar 16 04:43:24 2009 +0200
@@ -8,6 +8,12 @@
// define this to enable lua-loudmouth log messages handler
#cmakedefine LLM_LOG_HANDLER
+// size of background pipe reading buffer
+#define MLUA_BGREAD_BUFFER ( ${ML_BGREAD_BUFFER} )
+
+// priority of glib event sources for timeout and bgread
+#define MLUA_SOURCE_PRIORITY ( ${ML_SOURCE_PRIORITY} )
+
// hack for mcabber headers
#define MODULES_ENABLE
--- a/main.c Mon Mar 16 04:06:02 2009 +0200
+++ b/main.c Mon Mar 16 04:43:24 2009 +0200
@@ -778,8 +778,6 @@
// TIMER
-#define LUA_TIMER_PRIORITY ( G_PRIORITY_HIGH_IDLE )
-
typedef struct {
int reference;
guint source;
@@ -826,7 +824,7 @@
cb->reference = luaL_ref (L, LUA_REGISTRYINDEX);
cb->L = L;
- source = g_timeout_add_seconds_full (LUA_TIMER_PRIORITY, interval, (GSourceFunc) lua_timer_callback, cb, (GDestroyNotify) lua_timer_callback_destroy);
+ source = g_timeout_add_seconds_full (MLUA_SOURCE_PRIORITY, interval, (GSourceFunc) lua_timer_callback, cb, (GDestroyNotify) lua_timer_callback_destroy);
cb->source = source;
lua_timers = g_slist_prepend (lua_timers, (gpointer) source);
@@ -835,15 +833,13 @@
// BACKGROUND PIPE READING
-#define LUA_BGREAD_BUFFER ( 4096 )
-
typedef struct {
lua_State *L;
FILE *fd;
int reference;
} lua_bgread_callback_t;
-static gchar lua_bgread_buffer[LUA_BGREAD_BUFFER];
+static gchar lua_bgread_buffer[MLUA_BGREAD_BUFFER];
static void lua_bgread_callback_destroy (lua_bgread_callback_t *cb)
{
@@ -863,7 +859,7 @@
if (condition | G_IO_IN) { // data
while (TRUE) {
gsize read = 0;
- g_io_channel_read_chars (source, lua_bgread_buffer, LUA_BGREAD_BUFFER, &read, NULL);
+ g_io_channel_read_chars (source, lua_bgread_buffer, MLUA_BGREAD_BUFFER, &read, NULL);
if (!read) // exausted
break;
@@ -929,7 +925,7 @@
cb->L = L;
cb->fd = fd;
- g_io_add_watch_full (channel, G_PRIORITY_HIGH_IDLE, G_IO_IN|G_IO_HUP|G_IO_ERR, (GIOFunc) lua_bgread_callback, cb, (GDestroyNotify) lua_bgread_callback_destroy);
+ g_io_add_watch_full (channel, MLUA_SOURCE_PRIORITY, G_IO_IN|G_IO_HUP|G_IO_ERR, (GIOFunc) lua_bgread_callback, cb, (GDestroyNotify) lua_bgread_callback_destroy);
return 0;
}