Perl plugin skeleton

This commit is contained in:
Sebastien Helleu 2003-11-09 00:08:01 +00:00
parent 176198fdc6
commit fd9512bbbc
18 changed files with 268 additions and 58 deletions

View File

@ -1,9 +1,12 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2003-11-03
ChangeLog - 2003-11-09
Version 0.0.4 (under dev!):
* debug messages can be enabled via ./configure --enbale-debug option
Version 0.0.3 (2003-11-03):
* ./configure script to build WeeChat
* nicks are now correctly sorted (op, halfop, voice, other)

26
TODO
View File

@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
TODO - 2003-11-03
TODO - 2003-11-09
Legend:
# done
@ -10,17 +10,11 @@ Legend:
? is this really necessary?
v0.0.3:
v0.0.4:
------
* General:
# use of ./configure script for building WeeChat
* IRC protocol:
# implement RFC 2812
+ "/mode" command: change the user/channels modes
# "/wallops" command: write the same string to all the
persons with the flag +w enable
* WeeChat commands:
+ "/set" command: allow the user to set the WeeChat variables
@ -28,15 +22,24 @@ v0.0.3:
format, etc)
* Interface:
+ Gtk GUI
+ internationalization (traduce WeeChat in many languages)
* Configuration:
# do not stop program if problem with options in config file
- add missing options for config file
* Plugins:
- add Perl plugin
- "/load" and "/unload" commands to (un)load extension scripts
(perl, python, ruby, ...)
Future versions:
---------------
* General
- Windows version
* IRC protocol:
- "/dcc" command (for chat and sending/receiving files)
- complete "/list" command: add regexp search, display only channels that
@ -60,7 +63,6 @@ Future versions:
channel/private
* Interface:
+ Gtk GUI
- display current channel modes (example : #weechat(+nt))
- interpret special chars in messages (color & bold for example)
- many channel windows in one window/term (window split)
@ -81,13 +83,9 @@ Future versions:
* Configuration:
- add key bindings to config file
- add missing options for config file
- load config file after GUI (so init values by default (colors, ...) before
loading config)
* Plugins:
- add Perl plugin
- add Python plugin
- add Ruby plugin
- "/load" and "/unload" commands to (un)load extension scripts
(perl, python, ruby, ...)

View File

@ -51,29 +51,32 @@ AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([gethostbyname gethostname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strncasecmp strpbrk strrchr strstr uname])
AH_VERBATIM([DEBUG], [#undef DEBUG])
AC_ARG_ENABLE(curses, [ --disable-curses Turn off Curses interface (default=auto)],,enable_curses=yes)
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no)],enable_gtk=yes,enable_gtk=no)
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no)],enable_qt=yes,enable_qt=no)
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl plugins (default=no)],enable_perl=yes,enable_perl=no)
AC_ARG_ENABLE(debug, [ --enable-debug Turn on debugging messages (default=no)],enable_debug=yes,enable_debug=no)
enable_plugins=no
enable_perl=no
PERL_CFLAGS=
enable_python=no
enable_plugins="no"
enable_python="no"
PYTHON_CFLAGS=
enable_ruby=no
enable_ruby="no"
RUBY_CFLAGS=
enable_debug=no
DEBUG_CFLAGS=
AM_CONDITIONAL(GUI_CURSES, test "$enable_curses" = "yes")
AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
AM_CONDITIONAL(GUI_CURSES, test "$enable_curses" = "yes")
AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
# AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
# AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
if test "x$enable_curses" = "xyes" ; then
if test "$LIBCURSES_FOUND" = "0" ; then
AC_MSG_ERROR([Curses library not found! Install Curses library or run ./configure with --disable-curses parameter.])
fi
CURSES_LIBS=-lcurses
CURSES_LIBS="-lcurses"
AC_SUBST(CURSES_LIBS)
fi
@ -87,12 +90,31 @@ if test "x$enable_gtk" = "xyes" ; then
AC_SUBST(GTK_LIBS)
fi
PLUGIN_LIBS=
if test "x$enable_perl" = "xyes" ; then
enable_plugins="yes"
PLUGIN_LIBS="$PLUGIN_LIBS ../../plugins/perl/lib_weechat_perl.a"
PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
PERL_LIBS=`perl -MExtUtils::Embed -e ldopts`
AC_SUBST(PERL_CFLAGS)
AC_SUBST(PERL_LIBS)
fi
AC_SUBST(PLUGIN_LIBS)
if test "x$enable_debug" = "xyes" ; then
AC_DEFINE(DEBUG)
fi
CFLAGS="-Wall -W -pipe -O2"
AC_OUTPUT([Makefile
src/Makefile
src/common/Makefile
src/irc/Makefile
src/plugins/Makefile
src/plugins/perl/Makefile
src/gui/Makefile
src/gui/curses/Makefile
src/gui/gtk/Makefile

View File

@ -15,4 +15,4 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
SUBDIRS = common irc gui
SUBDIRS = common irc plugins gui

View File

@ -19,7 +19,7 @@ bin_PROGRAMS = weechat-curses
weechat_curses_LDADD = ../../common/lib_weechat_main.a \
../../irc/lib_weechat_irc.a \
$(CURSES_LIBS)
$(CURSES_LIBS) $(PLUGIN_LIBS)
weechat_curses_SOURCES = ../gui.h \
../gui-common.c \

View File

@ -21,7 +21,7 @@ INCLUDES = $(GTK_CFLAGS)
weechat_gtk_LDADD = ../../common/lib_weechat_main.a \
../../irc/lib_weechat_irc.a \
$(GTK_LIBS)
$(GTK_LIBS) $(PLUGIN_LIBS)
weechat_gtk_SOURCES = ../gui.h \
../gui-common.c \

31
src/plugins/Makefile.am Normal file
View File

@ -0,0 +1,31 @@
# Copyright (c) 2003 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 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
#
if PLUGIN_PERL
perl_dir=perl
endif
# if PLUGIN_PYTHON
# python_dir=python
# endif
# if PLUGIN_RUBY
# ruby_dir=ruby
# endif
# SUBDIRS = $(perl_dir) $(python_dir) $(ruby_dir)
SUBDIRS = $(perl_dir)

View File

@ -0,0 +1,22 @@
# Copyright (c) 2003 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 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
#
INCLUDES = $(PERL_CFLAGS)
noinst_LIBRARIES = lib_weechat_perl.a
lib_weechat_perl_a_SOURCES = perl.c

29
src/plugins/perl/perl.c Normal file
View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
* Bounga <bounga@altern.org>
* Xahlexx <xahlexx@tuxisland.org>
* See README for License detail.
*
* 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
*/
/* perl.c: Perl plugin support for WeeChat */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>

View File

@ -1,9 +1,12 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2003-11-03
ChangeLog - 2003-11-09
Version 0.0.4 (under dev!):
* debug messages can be enabled via ./configure --enbale-debug option
Version 0.0.3 (2003-11-03):
* ./configure script to build WeeChat
* nicks are now correctly sorted (op, halfop, voice, other)

View File

@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
TODO - 2003-11-03
TODO - 2003-11-09
Legend:
# done
@ -10,17 +10,11 @@ Legend:
? is this really necessary?
v0.0.3:
v0.0.4:
------
* General:
# use of ./configure script for building WeeChat
* IRC protocol:
# implement RFC 2812
+ "/mode" command: change the user/channels modes
# "/wallops" command: write the same string to all the
persons with the flag +w enable
* WeeChat commands:
+ "/set" command: allow the user to set the WeeChat variables
@ -28,15 +22,24 @@ v0.0.3:
format, etc)
* Interface:
+ Gtk GUI
+ internationalization (traduce WeeChat in many languages)
* Configuration:
# do not stop program if problem with options in config file
- add missing options for config file
* Plugins:
- add Perl plugin
- "/load" and "/unload" commands to (un)load extension scripts
(perl, python, ruby, ...)
Future versions:
---------------
* General
- Windows version
* IRC protocol:
- "/dcc" command (for chat and sending/receiving files)
- complete "/list" command: add regexp search, display only channels that
@ -60,7 +63,6 @@ Future versions:
channel/private
* Interface:
+ Gtk GUI
- display current channel modes (example : #weechat(+nt))
- interpret special chars in messages (color & bold for example)
- many channel windows in one window/term (window split)
@ -81,13 +83,9 @@ Future versions:
* Configuration:
- add key bindings to config file
- add missing options for config file
- load config file after GUI (so init values by default (colors, ...) before
loading config)
* Plugins:
- add Perl plugin
- add Python plugin
- add Ruby plugin
- "/load" and "/unload" commands to (un)load extension scripts
(perl, python, ruby, ...)

View File

@ -51,29 +51,32 @@ AC_FUNC_SELECT_ARGTYPES
AC_TYPE_SIGNAL
AC_CHECK_FUNCS([gethostbyname gethostname gettimeofday inet_ntoa memset mkdir select setlocale socket strcasecmp strchr strdup strncasecmp strpbrk strrchr strstr uname])
AH_VERBATIM([DEBUG], [#undef DEBUG])
AC_ARG_ENABLE(curses, [ --disable-curses Turn off Curses interface (default=auto)],,enable_curses=yes)
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no)],enable_gtk=yes,enable_gtk=no)
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no)],enable_qt=yes,enable_qt=no)
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl plugins (default=no)],enable_perl=yes,enable_perl=no)
AC_ARG_ENABLE(debug, [ --enable-debug Turn on debugging messages (default=no)],enable_debug=yes,enable_debug=no)
enable_plugins=no
enable_perl=no
PERL_CFLAGS=
enable_python=no
enable_plugins="no"
enable_python="no"
PYTHON_CFLAGS=
enable_ruby=no
enable_ruby="no"
RUBY_CFLAGS=
enable_debug=no
DEBUG_CFLAGS=
AM_CONDITIONAL(GUI_CURSES, test "$enable_curses" = "yes")
AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
AM_CONDITIONAL(GUI_CURSES, test "$enable_curses" = "yes")
AM_CONDITIONAL(GUI_GTK, test "$enable_gtk" = "yes")
AM_CONDITIONAL(GUI_QT, test "$enable_qt" = "yes")
AM_CONDITIONAL(PLUGIN_PERL, test "$enable_perl" = "yes")
# AM_CONDITIONAL(PLUGIN_PYTHON, test "$enable_python" = "yes")
# AM_CONDITIONAL(PLUGIN_RUBY, test "$enable_ruby" = "yes")
if test "x$enable_curses" = "xyes" ; then
if test "$LIBCURSES_FOUND" = "0" ; then
AC_MSG_ERROR([Curses library not found! Install Curses library or run ./configure with --disable-curses parameter.])
fi
CURSES_LIBS=-lcurses
CURSES_LIBS="-lcurses"
AC_SUBST(CURSES_LIBS)
fi
@ -87,12 +90,31 @@ if test "x$enable_gtk" = "xyes" ; then
AC_SUBST(GTK_LIBS)
fi
PLUGIN_LIBS=
if test "x$enable_perl" = "xyes" ; then
enable_plugins="yes"
PLUGIN_LIBS="$PLUGIN_LIBS ../../plugins/perl/lib_weechat_perl.a"
PERL_CFLAGS=`perl -MExtUtils::Embed -e ccopts`
PERL_LIBS=`perl -MExtUtils::Embed -e ldopts`
AC_SUBST(PERL_CFLAGS)
AC_SUBST(PERL_LIBS)
fi
AC_SUBST(PLUGIN_LIBS)
if test "x$enable_debug" = "xyes" ; then
AC_DEFINE(DEBUG)
fi
CFLAGS="-Wall -W -pipe -O2"
AC_OUTPUT([Makefile
src/Makefile
src/common/Makefile
src/irc/Makefile
src/plugins/Makefile
src/plugins/perl/Makefile
src/gui/Makefile
src/gui/curses/Makefile
src/gui/gtk/Makefile

View File

@ -15,4 +15,4 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
SUBDIRS = common irc gui
SUBDIRS = common irc plugins gui

View File

@ -19,7 +19,7 @@ bin_PROGRAMS = weechat-curses
weechat_curses_LDADD = ../../common/lib_weechat_main.a \
../../irc/lib_weechat_irc.a \
$(CURSES_LIBS)
$(CURSES_LIBS) $(PLUGIN_LIBS)
weechat_curses_SOURCES = ../gui.h \
../gui-common.c \

View File

@ -21,7 +21,7 @@ INCLUDES = $(GTK_CFLAGS)
weechat_gtk_LDADD = ../../common/lib_weechat_main.a \
../../irc/lib_weechat_irc.a \
$(GTK_LIBS)
$(GTK_LIBS) $(PLUGIN_LIBS)
weechat_gtk_SOURCES = ../gui.h \
../gui-common.c \

View File

@ -0,0 +1,31 @@
# Copyright (c) 2003 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 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
#
if PLUGIN_PERL
perl_dir=perl
endif
# if PLUGIN_PYTHON
# python_dir=python
# endif
# if PLUGIN_RUBY
# ruby_dir=ruby
# endif
# SUBDIRS = $(perl_dir) $(python_dir) $(ruby_dir)
SUBDIRS = $(perl_dir)

View File

@ -0,0 +1,22 @@
# Copyright (c) 2003 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 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
#
INCLUDES = $(PERL_CFLAGS)
noinst_LIBRARIES = lib_weechat_perl.a
lib_weechat_perl_a_SOURCES = perl.c

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2003 by FlashCode <flashcode@flashtux.org>
* Bounga <bounga@altern.org>
* Xahlexx <xahlexx@tuxisland.org>
* See README for License detail.
*
* 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
*/
/* perl.c: Perl plugin support for WeeChat */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>