Added demo plugin

This commit is contained in:
Sebastien Helleu 2007-11-03 12:42:30 +01:00
parent f6ed0f2e5b
commit 2e18be982f
8 changed files with 167 additions and 4 deletions

View File

@ -45,6 +45,7 @@ OPTION(DISABLE_ASPELL "Disable Aspell plugin")
OPTION(DISABLE_CHARSET "Disable Charset plugin") OPTION(DISABLE_CHARSET "Disable Charset plugin")
OPTION(DISABLE_FIFO "Disable FIFO plugin") OPTION(DISABLE_FIFO "Disable FIFO plugin")
OPTION(DISABLE_TRIGGER "Disable Trigger plugin") OPTION(DISABLE_TRIGGER "Disable Trigger plugin")
OPTION(ENABLE_DEMO "Enable Demo plugin")
OPTION(DISABLE_DOC "Disable Doc") OPTION(DISABLE_DOC "Disable Doc")
ADD_SUBDIRECTORY( po ) ADD_SUBDIRECTORY( po )

View File

@ -100,6 +100,7 @@ AH_VERBATIM([PLUGIN_ASPELL], [#undef PLUGIN_ASPELL])
AH_VERBATIM([PLUGIN_CHARSET], [#undef PLUGIN_CHARSET]) AH_VERBATIM([PLUGIN_CHARSET], [#undef PLUGIN_CHARSET])
AH_VERBATIM([PLUGIN_FIFO], [#undef PLUGIN_FIFO]) AH_VERBATIM([PLUGIN_FIFO], [#undef PLUGIN_FIFO])
AH_VERBATIM([PLUGIN_TRIGGER], [#undef PLUGIN_TRIGGER]) AH_VERBATIM([PLUGIN_TRIGGER], [#undef PLUGIN_TRIGGER])
AH_VERBATIM([PLUGIN_DEMO], [#undef PLUGIN_DEMO])
AH_VERBATIM([HAVE_GNUTLS], [#undef HAVE_GNUTLS]) AH_VERBATIM([HAVE_GNUTLS], [#undef HAVE_GNUTLS])
AH_VERBATIM([HAVE_FLOCK], [#undef HAVE_FLOCK]) AH_VERBATIM([HAVE_FLOCK], [#undef HAVE_FLOCK])
AH_VERBATIM([DEBUG], [#undef DEBUG]) AH_VERBATIM([DEBUG], [#undef DEBUG])
@ -107,9 +108,9 @@ AH_VERBATIM([DEBUG], [#undef DEBUG])
# Arguments for ./configure # Arguments for ./configure
AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interface (default=compiled if found)],enable_ncurses=$enableval,enable_ncurses=yes) AC_ARG_ENABLE(ncurses, [ --disable-ncurses Turn off ncurses interface (default=compiled if found)],enable_ncurses=$enableval,enable_ncurses=yes)
AC_ARG_ENABLE(wxwidgets, [ --enable-wxwidgets Turn on WxWidgets interface (default=no wxwidgets)],enable_wxwidgets=$enableval,enable_wxwidgets=no) AC_ARG_ENABLE(wxwidgets, [ --enable-wxwidgets Turn on WxWidgets interface (default=off)],enable_wxwidgets=$enableval,enable_wxwidgets=no)
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk interface (default=no Gtk)],enable_gtk=$enableval,enable_gtk=no) AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk interface (default=off)],enable_gtk=$enableval,enable_gtk=no)
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no Qt)],enable_qt=$enableval,enable_qt=no) AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=off)],enable_qt=$enableval,enable_qt=no)
AC_ARG_ENABLE(gnutls, [ --disable-gnutls Turn off gnutls support (default=compiled if found)],enable_gnutls=$enableval,enable_gnutls=yes) AC_ARG_ENABLE(gnutls, [ --disable-gnutls Turn off gnutls support (default=compiled if found)],enable_gnutls=$enableval,enable_gnutls=yes)
AC_ARG_ENABLE(irc, [ --disable-irc Turn off IRC plugin (default=compiled)],enable_irc=$enableval,enable_irc=yes) AC_ARG_ENABLE(irc, [ --disable-irc Turn off IRC plugin (default=compiled)],enable_irc=$enableval,enable_irc=yes)
AC_ARG_ENABLE(scripts, [ --disable-scripts Turn off script plugins (default=compiled if found)],enable_scripts=$enableval,enable_scripts=yes) AC_ARG_ENABLE(scripts, [ --disable-scripts Turn off script plugins (default=compiled if found)],enable_scripts=$enableval,enable_scripts=yes)
@ -124,6 +125,7 @@ AC_ARG_ENABLE(aspell, [ --disable-aspell Turn off Aspell plugin (
AC_ARG_ENABLE(charset, [ --disable-charset Turn off Charset plugin (default=compiled if found)],enable_charset=$enableval,enable_charset=yes) AC_ARG_ENABLE(charset, [ --disable-charset Turn off Charset plugin (default=compiled if found)],enable_charset=$enableval,enable_charset=yes)
AC_ARG_ENABLE(fifo, [ --disable-fifo Turn off Fifo plugin (default=compiled if found)],enable_fifo=$enableval,enable_fifo=yes) AC_ARG_ENABLE(fifo, [ --disable-fifo Turn off Fifo plugin (default=compiled if found)],enable_fifo=$enableval,enable_fifo=yes)
AC_ARG_ENABLE(trigger, [ --disable-trigger Turn off Trigger plugin (default=compiled if found)],enable_trigger=$enableval,enable_trigger=yes) AC_ARG_ENABLE(trigger, [ --disable-trigger Turn off Trigger plugin (default=compiled if found)],enable_trigger=$enableval,enable_trigger=yes)
AC_ARG_ENABLE(demo, [ --enable-demo Turn on Demo plugin (default=off)],enable_demo=$enableval,enable_demo=no)
AC_ARG_WITH(doc_xsl_prefix, [ --with-doc-xsl-prefix=DIR Docbook html/chunk.xsl is in DIR (default=autodetect)],doc_xsl_prefix=$withval,doc_xsl_prefix='') AC_ARG_WITH(doc_xsl_prefix, [ --with-doc-xsl-prefix=DIR Docbook html/chunk.xsl is in DIR (default=autodetect)],doc_xsl_prefix=$withval,doc_xsl_prefix='')
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=1)],debug=$withval,debug=1) AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=1)],debug=$withval,debug=1)
@ -623,6 +625,18 @@ else
not_asked="$not_asked trigger" not_asked="$not_asked trigger"
fi fi
# ---------------------------------- demo --------------------------------------
if test "x$enable_demo" = "xyes" ; then
DEMO_CFLAGS=""
DEMO_LFLAGS=""
AC_SUBST(DEMO_CFLAGS)
AC_SUBST(DEMO_LFLAGS)
AC_DEFINE(PLUGIN_DEMO)
else
not_asked="$not_asked demo"
fi
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# gnutls # gnutls
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -814,6 +828,7 @@ AM_CONDITIONAL(PLUGIN_ASPELL, test "$enable_aspell" = "yes")
AM_CONDITIONAL(PLUGIN_CHARSET, test "$enable_charset" = "yes") AM_CONDITIONAL(PLUGIN_CHARSET, test "$enable_charset" = "yes")
AM_CONDITIONAL(PLUGIN_FIFO, test "$enable_fifo" = "yes") AM_CONDITIONAL(PLUGIN_FIFO, test "$enable_fifo" = "yes")
AM_CONDITIONAL(PLUGIN_TRIGGER, test "$enable_trigger" = "yes") AM_CONDITIONAL(PLUGIN_TRIGGER, test "$enable_trigger" = "yes")
AM_CONDITIONAL(PLUGIN_DEMO, test "$enable_demo" = "yes")
AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes") AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes")
AM_CONDITIONAL(HAVE_FLOCK, test "$enable_flock" = "yes") AM_CONDITIONAL(HAVE_FLOCK, test "$enable_flock" = "yes")
AM_CONDITIONAL(DBLATEX_FOUND, test "$DBLATEX_FOUND" = "yes") AM_CONDITIONAL(DBLATEX_FOUND, test "$DBLATEX_FOUND" = "yes")
@ -841,6 +856,7 @@ AC_OUTPUT([Makefile
src/plugins/charset/Makefile src/plugins/charset/Makefile
src/plugins/fifo/Makefile src/plugins/fifo/Makefile
src/plugins/trigger/Makefile src/plugins/trigger/Makefile
src/plugins/demo/Makefile
src/gui/Makefile src/gui/Makefile
src/gui/curses/Makefile src/gui/curses/Makefile
src/gui/wxwidgets/Makefile src/gui/wxwidgets/Makefile
@ -901,6 +917,9 @@ fi
if test "x$enable_trigger" = "xyes"; then if test "x$enable_trigger" = "xyes"; then
listplugins="$listplugins trigger" listplugins="$listplugins trigger"
fi fi
if test "x$enable_demo" = "xyes"; then
listplugins="$listplugins demo"
fi
listoptional="" listoptional=""
if test "x$enable_gnutls" = "xyes"; then if test "x$enable_gnutls" = "xyes"; then

View File

@ -54,3 +54,7 @@ ENDIF(NOT DISABLE_FIFO)
IF(NOT DISABLE_TRIGGER) IF(NOT DISABLE_TRIGGER)
ADD_SUBDIRECTORY( trigger ) ADD_SUBDIRECTORY( trigger )
ENDIF(NOT DISABLE_TRIGGER) ENDIF(NOT DISABLE_TRIGGER)
IF(ENABLE_DEMO)
ADD_SUBDIRECTORY( demo )
ENDIF(ENABLE_TRIGGER)

View File

@ -64,4 +64,8 @@ if PLUGIN_TRIGGER
trigger_dir = trigger trigger_dir = trigger
endif endif
SUBDIRS = . $(irc_dir) $(script_dir) $(aspell_dir) $(charset_dir) $(fifo_dir) $(trigger_dir) if PLUGIN_DEMO
demo_dir = demo
endif
SUBDIRS = . $(irc_dir) $(script_dir) $(aspell_dir) $(charset_dir) $(fifo_dir) $(trigger_dir) $(demo_dir)

View File

@ -0,0 +1,22 @@
# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
#
# 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 3 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 <http://www.gnu.org/licenses/>.
#
ADD_LIBRARY(demo MODULE demo.c demo.h)
SET_TARGET_PROPERTIES(demo PROPERTIES PREFIX "")
TARGET_LINK_LIBRARIES(demo)
INSTALL(TARGETS demo LIBRARY DESTINATION lib/${PROJECT_NAME}/plugins)

View File

@ -0,0 +1,25 @@
# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org>
#
# 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 3 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 <http://www.gnu.org/licenses/>.
#
INCLUDES = -DLOCALEDIR=\"$(datadir)/locale\" $(DEMO_CFLAGS)
libdir = ${weechat_libdir}/plugins
lib_LTLIBRARIES = demo.la
demo_la_SOURCES = demo.c demo.h
demo_la_LDFLAGS = -module
demo_la_LIBADD = $(DEMO_LFLAGS)

61
src/plugins/demo/demo.c Normal file
View File

@ -0,0 +1,61 @@
/*
* Copyright (c) 2003-2007 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* 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 3 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 <http://www.gnu.org/licenses/>.
*/
/* demo.c: demo plugin for WeeChat */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "../weechat-plugin.h"
#include "demo.h"
static struct t_weechat_plugin *weechat_plugin = NULL;
/*
* weechat_plugin_init: init demo plugin
*/
int
weechat_plugin_init (struct t_weechat_plugin *plugin)
{
weechat_plugin = plugin;
return PLUGIN_RC_SUCCESS;
}
/*
* weechat_plugin_end: end demo plugin
*/
int
weechat_plugin_end ()
{
return PLUGIN_RC_SUCCESS;
}

27
src/plugins/demo/demo.h Normal file
View File

@ -0,0 +1,27 @@
/*
* Copyright (c) 2003-2007 by FlashCode <flashcode@flashtux.org>
* See README for License detail, AUTHORS for developers list.
*
* 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 3 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 <http://www.gnu.org/licenses/>.
*/
#ifndef __WEECHAT_DEMO_H
#define __WEECHAT_DEMO_H 1
char plugin_name[] = "demo";
char plugin_version[] = "0.1";
char plugin_description[] = "Demo plugin for WeeChat";
#endif /* demo.h */