# HG changeset patch # User Mikael Berthe # Date 1298824947 -3600 # Node ID 2256d0626730570d93a976c3f1441a6ed585d778 # Parent 7eadf86039e6f200c812dac77ae473bc96251a80 Modularize fifo system (Myhailo Danylenko) Merge patch from isbear's mcabber-experimental repository. diff -r 7eadf86039e6 -r 2256d0626730 mcabber/configure.ac --- a/mcabber/configure.ac Sun Feb 27 17:24:11 2011 +0100 +++ b/mcabber/configure.ac Sun Feb 27 17:42:27 2011 +0100 @@ -282,6 +282,7 @@ modules/Makefile modules/beep/Makefile modules/xttitle/Makefile + modules/fifo/Makefile doc/Makefile doc/guide/Makefile doc/help/Makefile diff -r 7eadf86039e6 -r 2256d0626730 mcabber/mcabber/Makefile.am --- a/mcabber/mcabber/Makefile.am Sun Feb 27 17:24:11 2011 +0100 +++ b/mcabber/mcabber/Makefile.am Sun Feb 27 17:42:27 2011 +0100 @@ -7,7 +7,7 @@ xmpp.c xmpp.h xmpp_helper.c xmpp_helper.h xmpp_defines.h \ xmpp_iq.c xmpp_iq.h xmpp_iqrequest.c xmpp_iqrequest.h \ xmpp_muc.c xmpp_muc.h xmpp_s10n.c xmpp_s10n.h \ - caps.c caps.h fifo.c fifo.h help.c help.h + caps.c caps.h help.c help.h if OTR mcabber_SOURCES += otr.c otr.h nohtml.c nohtml.h @@ -53,6 +53,8 @@ endif mcabberincludedir = $(includedir)/mcabber +else +mcabber_SOURCES += fifo.c fifo.h endif #SUBDIRS = diff -r 7eadf86039e6 -r 2256d0626730 mcabber/mcabber/main.c --- a/mcabber/mcabber/main.c Sun Feb 27 17:24:11 2011 +0100 +++ b/mcabber/mcabber/main.c Sun Feb 27 17:42:27 2011 +0100 @@ -41,11 +41,14 @@ #include "utils.h" #include "pgp.h" #include "otr.h" -#include "fifo.h" #include "xmpp.h" #include "help.h" #include "events.h" +#ifndef MODULES_ENABLE +# include "fifo.h" +#endif + #ifdef MODULES_ENABLE # include "compl.h" # include "modules.h" @@ -77,7 +80,9 @@ static void mcabber_terminate(const char *msg) { +#ifndef MODULES_ENABLE fifo_deinit(); +#endif xmpp_disconnect(); scr_terminate_curses(); @@ -449,8 +454,10 @@ chatstates_disabled = settings_opt_get_int("disable_chatstates"); +#ifndef MODULES_ENABLE /* Initialize FIFO named pipe */ fifo_init(); +#endif /* Load previous roster state */ hlog_load_state(); @@ -498,7 +505,9 @@ #ifdef MODULES_ENABLE modules_deinit(); #endif +#ifndef MODULES_ENABLE fifo_deinit(); +#endif #ifdef HAVE_LIBOTR otr_terminate(); #endif diff -r 7eadf86039e6 -r 2256d0626730 mcabber/modules/Makefile.am --- a/mcabber/modules/Makefile.am Sun Feb 27 17:24:11 2011 +0100 +++ b/mcabber/modules/Makefile.am Sun Feb 27 17:42:27 2011 +0100 @@ -1,1 +1,1 @@ -SUBDIRS = beep xttitle +SUBDIRS = beep xttitle fifo diff -r 7eadf86039e6 -r 2256d0626730 mcabber/modules/fifo/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mcabber/modules/fifo/Makefile.am Sun Feb 27 17:42:27 2011 +0100 @@ -0,0 +1,12 @@ + +if INSTALL_HEADERS +pkglib_LTLIBRARIES = libfifo.la +libfifo_la_SOURCES = fifo_module.c $(top_srcdir)/mcabber/fifo.c $(top_srcdir)/mcabber/fifo.h +libfifo_la_LDFLAGS = -module -avoid-version -shared + +LDADD = $(GLIB_LIBS) +AM_CPPFLAGS = -I$(top_srcdir) $(GLIB_CFLAGS) $(LOUDMOUTH_CFLAGS) \ + $(GPGME_CFLAGS) $(LIBOTR_CFLAGS) \ + $(ENCHANT_CFLAGS) +endif + diff -r 7eadf86039e6 -r 2256d0626730 mcabber/modules/fifo/fifo_module.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mcabber/modules/fifo/fifo_module.c Sun Feb 27 17:42:27 2011 +0100 @@ -0,0 +1,51 @@ + +/* Copyright 2009,2010 Myhailo Danylenko + * + * This file is part of mcabber + * + * mcabber 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, see . */ + +#include +#include + +#include +#include +#include + +module_info_t info_fifo = { + .branch = MCABBER_BRANCH, + .api = MCABBER_API_VERSION, + .version = MCABBER_VERSION, + .requires = NULL, + .init = NULL, + .uninit = NULL, + .description = "Reads and executes command from FIFO pipe\n" + "Recognizes options fifo_name (required), fifo_hide_commands and fifo_ignore.", + .next = NULL, +}; + +gchar *g_module_check_init(GModule *module) +{ + if (fifo_init() == -1) + return "FIFO initialization failed"; + else + return NULL; +} + +void g_module_unload(GModule *module) +{ + fifo_deinit(); +} + +/* vim: set expandtab cindent cinoptions=>2\:2(0: For Vim users... */