1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00

- Compiling fixes

- GNOME version isn't anymore build here so you don't need all that GTK and
GNOME crap to compile irssi-text.
- Some fixes to compile with -ansi -pedantic


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@200 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2000-05-09 11:42:42 +00:00 committed by cras
parent 90ff30fcd0
commit 93d6032151
34 changed files with 524 additions and 535 deletions

View File

@ -11,21 +11,7 @@ if BUILD_SERVERTEST
SERVERTEST=servertest SERVERTEST=servertest
endif endif
SUBDIRS = po intl macros src $(PLUGINS) $(SERVERTEST) docs scripts SUBDIRS = po intl src $(SERVERTEST) docs scripts
## to automatically rebuild aclocal.m4 if any of the macros in
## `macros/' change
@MAINT@include macros/macros.dep
@MAINT@macros/macros.dep: $(srcdir)/macros/Makefile.am
@MAINT@ cd macros && $(MAKE) macros.dep
if HAVE_GNOME
desktopdir = $(datadir)/gnome/apps/Internet
desktop_DATA = irssi.desktop
corbadir = $(sysconfdir)/CORBA/servers
corba_DATA = irssi.gnorba
endif
confdir = $(sysconfdir)/irssi confdir = $(sysconfdir)/irssi
conf_DATA = config colorless.theme split.theme conf_DATA = config colorless.theme split.theme
@ -40,7 +26,8 @@ EXTRA_DIST = \
irssi.spec \ irssi.spec \
$(conf_DATA) \ $(conf_DATA) \
irssi.gnorba \ irssi.gnorba \
irssi.desktop irssi.desktop \
irssi-config.in
## make rpms ## make rpms
rpm: Makefile rpm: Makefile

View File

@ -2,17 +2,6 @@
#undef SYSCONFDIR #undef SYSCONFDIR
#undef HELPDIR #undef HELPDIR
#undef PLUGINSDIR #undef PLUGINSDIR
#undef LOCALEDIR
/* gtk / gnome */
#undef HAVE_GTK
#undef HAVE_IMLIB
#undef HAVE_GNOME
#undef HAVE_GNOME_PANEL
/* hebrew support for GtkText */
#undef GTK_HEBREW
#undef GTK_HEBREW_RC
/* misc.. */ /* misc.. */
#undef MEM_DEBUG #undef MEM_DEBUG
@ -29,7 +18,6 @@
#undef USE_NCURSES #undef USE_NCURSES
#undef NO_COLOR_CURSES #undef NO_COLOR_CURSES
#undef SCO_FLAVOR #undef SCO_FLAVOR
#undef NCURSES_970530
/* our own curses checks */ /* our own curses checks */
#undef HAVE_NCURSES_USE_DEFAULT_COLORS #undef HAVE_NCURSES_USE_DEFAULT_COLORS

View File

@ -23,4 +23,115 @@ echo "/* automatically created by autogen.sh */" > irssi-version.h
echo "#define IRSSI_VERSION \"$version\"" >> irssi-version.h echo "#define IRSSI_VERSION \"$version\"" >> irssi-version.h
echo "#define IRSSI_VERSION_DATE \"$version_date\"" >> irssi-version.h echo "#define IRSSI_VERSION_DATE \"$version_date\"" >> irssi-version.h
. $srcdir/macros/autogen.sh # *********** a bit modified GNOME's macros/autogen.sh **********
DIE=0
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`autoconf' installed to compile Gnome."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
(grep "^AM_PROG_LIBTOOL" $srcdir/configure.in >/dev/null) && {
(libtool --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`libtool' installed to compile Gnome."
echo "Get ftp://ftp.gnu.org/pub/gnu/libtool-1.2d.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
}
grep "^AM_GNU_GETTEXT" $srcdir/configure.in >/dev/null && {
grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
(gettext --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`gettext' installed to compile Gnome."
echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
}
grep "^AM_GNOME_GETTEXT" $srcdir/configure.in >/dev/null && {
grep "sed.*POTFILES" $srcdir/configure.in >/dev/null || \
(gettext --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`gettext' installed to compile Gnome."
echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
}
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: You must have \`automake' installed to compile Gnome."
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
NO_AUTOMAKE=yes
}
# if no automake, don't bother testing for aclocal
test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "**Error**: Missing \`aclocal'. The version of \`automake'"
echo "installed doesn't appear recent enough."
echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
if test -z "$*"; then
echo "**Warning**: I am going to run \`configure' with no arguments."
echo "If you wish to pass any to it, please specify them on the"
echo \`$0\'" command line."
echo
fi
case $CC in
xlc )
am_opt=--include-deps;;
esac
if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then
echo "Creating aclocal.m4 ..."
test -r aclocal.m4 || touch aclocal.m4
echo "Running gettextize... Ignore non-fatal messages."
echo "no" | gettextize --force --copy
echo "Making aclocal.m4 writable ..."
test -r aclocal.m4 && chmod u+w aclocal.m4
fi
if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then
echo "Running libtoolize..."
libtoolize --force --copy
fi
aclocalinclude="$ACLOCAL_FLAGS -I ."
echo "Running aclocal $aclocalinclude ..."
aclocal $aclocalinclude
if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then
echo "Running autoheader..."
autoheader
fi
echo "Running automake --gnu $am_opt ..."
automake --add-missing --gnu $am_opt
echo "Running autoconf ..."
autoconf
conf_flags="--enable-maintainer-mode --enable-compile-warnings" #--enable-iso-c
if test x$NOCONFIGURE = x; then
echo Running $srcdir/configure $conf_flags "$@" ...
$srcdir/configure $conf_flags "$@" \
&& echo Now type \`make\' to compile $PKG_NAME || exit 1
else
echo Skipping configure process.
fi

View File

@ -5,8 +5,6 @@ AM_INIT_AUTOMAKE(irssi, 0.7.90)
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
AM_ACLOCAL_INCLUDE(macros)
AC_ISC_POSIX AC_ISC_POSIX
AC_PROG_CC AC_PROG_CC
AC_PROG_CPP AC_PROG_CPP
@ -16,9 +14,6 @@ AM_PROG_LIBTOOL
AC_CHECK_HEADERS(string.h stdlib.h unistd.h dirent.h sys/ioctl.h libintl.h) AC_CHECK_HEADERS(string.h stdlib.h unistd.h dirent.h sys/ioctl.h libintl.h)
GNOME_INIT
GNOME_SUPPORT_CHECKS
AC_ARG_WITH(socks, AC_ARG_WITH(socks,
[ --with-socks Build with socks support], [ --with-socks Build with socks support],
if test x$withval = xyes; then if test x$withval = xyes; then
@ -47,45 +42,6 @@ AC_ARG_WITH(mysql,
fi, fi,
want_mysql=no) want_mysql=no)
AC_ARG_WITH(imlib,
[ --with-imlib Build with imlib support],
if test x$withval = xyes; then
want_imlib=yes
else
if test "x$withval" = xno; then
want_imlib=no
else
want_imlib=yes
fi
fi,
want_imlib=yes)
AC_ARG_WITH(gtk,
[ --with-gtk Build GTK frontend],
if test x$withval = xyes; then
want_gtk=yes
else
if test "x$withval" = xno; then
want_gtk=no
else
want_gtk=yes
fi
fi,
want_gtk=yes)
AC_ARG_WITH(gnome-panel,
[ --with-gnome-panel Build with gnome panel applet support],
if test x$withval = xyes; then
want_gnome_panel=yes
else
if test "x$withval" = xno; then
want_gnome_panel=no
else
want_gnome_panel=yes
fi
fi,
want_gnome_panel=yes)
AC_ARG_WITH(textui, AC_ARG_WITH(textui,
[ --with-textui Build text frontend], [ --with-textui Build text frontend],
if test x$withval = xyes; then if test x$withval = xyes; then
@ -177,19 +133,6 @@ AC_ARG_ENABLE(ipv6,
fi, fi,
want_ipv6=no) want_ipv6=no)
AC_ARG_ENABLE(gtk-hebrew,
[ --enable-gtk-hebrew Enable Hebrew support],
if test "x$enableval" = xno; then
want_gtk_hebrew=no
HEBREW_LIBS=""
else
AC_DEFINE(GTK_HEBREW)
AC_DEFINE_UNQUOTED(GTK_HEBREW_RC, "$enableval")
HEBREW_LIBS="-lfribidi"
want_gtk_hebrew=yes
fi,
want_gtk_hebrew=no)
dnl ** dnl **
dnl ** just some generic stuff... dnl ** just some generic stuff...
dnl ** dnl **
@ -242,82 +185,13 @@ if test "x$want_socks" = "xyes"; then
]) ])
fi fi
dnl **
dnl ** check for gnome
dnl **
if test "x$want_gnome" = "xyes"; then
if test "x$GNOME_LIBS" = "x"; then
want_gnome="no";
fi
if test "x$want_gtk" = "xno"; then
want_gnome="no";
fi
fi
if test "x$want_gnome" = "xyes"; then
AC_DEFINE(HAVE_GTK)
AC_DEFINE(HAVE_GNOME)
AC_DEFINE(HAVE_IMLIB)
GUI_CFLAGS="$GNOME_INCLUDEDIR"
dnl **
dnl ** check for gnome panel applet library
dnl **
if test "x$want_gnome_panel" = "xyes"; then
AC_CHECK_LIB(panel_applet, applet_widget_init, [
GUI_LIBS="$GNOME_LIBDIR $GNOMEGNORBA_LIBS -lpanel_applet"
AC_DEFINE(HAVE_GNOME_PANEL)
], [
GUI_LIBS="$GNOME_LIBDIR $GNOMEUI_LIBS"
want_gnome_panel="no"
], $GNOME_LIBDIR $GNOMEGNORBA_LIBS -lpanel_applet)
else
GUI_LIBS="$GNOME_LIBDIR $GNOMEUI_LIBS"
fi
else
want_gnome_panel="no"
if test "x$want_gtk" = "xyes"; then
AC_DEFINE(HAVE_GTK)
AM_PATH_GTK(1.2.0)
else
GTK_LIBS=
fi
if test "x$GTK_LIBS" != "x"; then
GUI_CFLAGS="$GTK_CFLAGS"
GUI_LIBS="$GTK_LIBS"
if test "x$want_imlib" = "xyes"; then
AM_PATH_GDK_IMLIB(, [define_imlib=true])
if test x$define_imlib = xtrue; then
AC_DEFINE(HAVE_IMLIB)
GUI_CFLAGS="$GUI_CFLAGS $GDK_IMLIB_CFLAGS"
GUI_LIBS="$GDK_IMLIB_LIBS"
fi
fi
GUI_LIBS="$GUI_LIBS ../lib-popt/libpopt.la"
fi
fi
if test "x$GUI_LIBS" != "x"; then
GUI_LIBS="$GUI_LIBS $HEBREW_LIBS $PROG_LIBS"
fi
AC_SUBST(GUI_LIBS)
AC_SUBST(GUI_CFLAGS)
dnl ** dnl **
dnl ** fe-text checks dnl ** fe-text checks
dnl ** dnl **
AM_PATH_GLIB(1.2.0,,, gmodule) AM_PATH_GLIB(1.2.0,,, gmodule)
PROG_LIBS="$PROG_LIBS $GLIB_LIBS ../lib-popt/libpopt.la" PROG_LIBS="$PROG_LIBS $GLIB_LIBS"
AC_SUBST(PROG_LIBS) AC_SUBST(PROG_LIBS)
dnl ** dnl **
@ -385,13 +259,10 @@ if test "$want_perl" = yes; then
fi fi
dnl ** check what we want to build dnl ** check what we want to build
AM_CONDITIONAL(BUILD_GNOMEUI, test "x$GUI_LIBS" != "x")
AM_CONDITIONAL(BUILD_TEXTUI, test "$want_textui" = "yes") AM_CONDITIONAL(BUILD_TEXTUI, test "$want_textui" = "yes")
AM_CONDITIONAL(BUILD_IRSSIBOT, test "$want_irssibot" = "yes") AM_CONDITIONAL(BUILD_IRSSIBOT, test "$want_irssibot" = "yes")
AM_CONDITIONAL(BUILD_PLUGINS, test "$want_plugins" = "yes") AM_CONDITIONAL(BUILD_PLUGINS, test "$want_plugins" = "yes")
AM_CONDITIONAL(BUILD_SERVERTEST, test "$want_servertest" = "yes") AM_CONDITIONAL(BUILD_SERVERTEST, test "$want_servertest" = "yes")
AM_CONDITIONAL(HAVE_GNOME, test "$want_gnome" = "yes")
AM_CONDITIONAL(HAVE_GNOME_PANEL, test "$want_gnome_panel" = "yes")
AM_CONDITIONAL(HAVE_MYSQL, test "$want_mysql" = "yes") AM_CONDITIONAL(HAVE_MYSQL, test "$want_mysql" = "yes")
AM_CONDITIONAL(HAVE_PERL, test "$want_perl" = "yes") AM_CONDITIONAL(HAVE_PERL, test "$want_perl" = "yes")
@ -401,17 +272,38 @@ dnl **
dnl ** Keep all the libraries here so each frontend doesn't need to dnl ** Keep all the libraries here so each frontend doesn't need to
dnl ** keep track of them all dnl ** keep track of them all
dnl ** dnl **
CORE_LIBS="../core/libcore.la ../lib-config/libirssi_config.la" dnl ** (these could be made configurable)
IRC_LIBS="../irc/libirc.la ../irc/core/libirc_core.la ../irc/dcc/libirc_dcc.la ../irc/flood/libirc_flood.la ../irc/notifylist/libirc_notifylist.la"
FE_COMMON_LIBS="../fe-common/core/libfe_common_core.la ../fe-common/irc/libfe_common_irc.la ../fe-common/irc/notifylist/libfe_common_irc_notifylist.la ../fe-common/irc/dcc/libfe_common_irc_dcc.la ../fe-common/irc/flood/libfe_common_irc_flood.la"
PERL_LIBS="../perl/libperl.la"
AC_SUBST(CORE_LIBS) CHAT_MODULES="irc"
AC_SUBST(IRC_LIBS) irc_MODULES="dcc flood notifylist"
AC_SUBST(FE_COMMON_LIBS)
dnl ****************************************
AC_SUBST(CHAT_MODULES)
AC_SUBST(irc_MODULES)
CORE_LIBS="../core/libcore.la ../lib-config/libirssi_config.la ../lib-popt/libpopt.la"
if test "$want_perl" = "yes"; then
PERL_LIBS="../perl/libperl.la"
else
PERL_LIBS=""
fi
FE_COMMON_LIBS="../fe-common/core/libfe_common_core.la"
CHAT_LIBS=""
for c in $CHAT_MODULES; do
CHAT_LIBS="$CHAT_LIBS ../$c/lib$c.la ../$c/core/lib${c}_core.la"
FE_COMMON_LIBS="$FE_COMMON_LIBS ../fe-common/$c/libfe_common_$c.la"
for s in `eval echo \\$${c}_MODULES`; do
CHAT_LIBS="$CHAT_LIBS ../$c/$s/lib${c}_$s.la"
FE_COMMON_LIBS="$FE_COMMON_LIBS ../fe-common/$c/$s/libfe_common_${c}_$s.la"
done
done
dnl ** common libraries needed by frontends dnl ** common libraries needed by frontends
COMMON_LIBS="$PERL_LIBS $FE_COMMON_LIBS $IRC_LIBS $CORE_LIBS" COMMON_NOUI_LIBS="$PERL_LIBS $CHAT_LIBS $CORE_LIBS $INTLLIBS"
COMMON_LIBS="$FE_COMMON_LIBS $COMMON_NOUI_LIBS"
AC_SUBST(COMMON_NOUI_LIBS)
AC_SUBST(COMMON_LIBS) AC_SUBST(COMMON_LIBS)
dnl ** dnl **
@ -443,7 +335,6 @@ AC_OUTPUT(
Makefile Makefile
po/Makefile.in po/Makefile.in
intl/Makefile intl/Makefile
macros/Makefile
src/Makefile src/Makefile
src/core/Makefile src/core/Makefile
src/irc/Makefile src/irc/Makefile
@ -459,10 +350,6 @@ src/fe-common/irc/flood/Makefile
src/fe-common/irc/notifylist/Makefile src/fe-common/irc/notifylist/Makefile
src/fe-none/Makefile src/fe-none/Makefile
src/fe-text/Makefile src/fe-text/Makefile
src/fe-gnome/Makefile
src/fe-gnome/help/Makefile
src/fe-gnome/help/C/Makefile
src/fe-gnome/pixmaps/Makefile
src/lib-config/Makefile src/lib-config/Makefile
src/lib-popt/Makefile src/lib-popt/Makefile
src/perl/Makefile src/perl/Makefile
@ -471,16 +358,9 @@ servertest/Makefile
scripts/Makefile scripts/Makefile
docs/Makefile docs/Makefile
docs/help/Makefile docs/help/Makefile
plugins/Makefile
plugins/sample/Makefile
plugins/speech/Makefile
plugins/sound/Makefile
plugins/proxy/Makefile
plugins/external/Makefile
plugins/bot/Makefile
plugins/sql/Makefile
stamp.h stamp.h
irssi.spec) irssi.spec
irssi-config)
dnl ** for building from objdir dnl ** for building from objdir
if test "x$want_perl" = "xyes"; then if test "x$want_perl" = "xyes"; then
@ -495,14 +375,6 @@ fi
echo echo
if test "x$GUI_LIBS" != "x"; then
echo Building GTK frontend ...... : yes
else
echo Building GTK frontend ...... : no
fi
echo Building with GNOME ........ : $want_gnome
echo Building with GNOME panel .. : $want_gnome_panel
echo Building text frontend ..... : $want_textui echo Building text frontend ..... : $want_textui
echo Building irssi-bot ......... : $want_irssibot echo Building irssi-bot ......... : $want_irssibot
echo Building with IPv6 support . : $want_ipv6 echo Building with IPv6 support . : $want_ipv6

278
curses.m4 Normal file
View File

@ -0,0 +1,278 @@
dnl Curses detection: Munged from Midnight Commander's configure.in
dnl
dnl What it does:
dnl =============
dnl
dnl - Determine which version of curses is installed on your system
dnl and set the -I/-L/-l compiler entries and add a few preprocessor
dnl symbols
dnl - Do an AC_SUBST on the CURSES_INCLUDEDIR and CURSES_LIBS so that
dnl @CURSES_INCLUDEDIR@ and @CURSES_LIBS@ will be available in
dnl Makefile.in's
dnl - Modify the following configure variables (these are the only
dnl curses.m4 variables you can access from within configure.in)
dnl CURSES_INCLUDEDIR - contains -I's and possibly -DRENAMED_CURSES if
dnl an ncurses.h that's been renamed to curses.h
dnl is found.
dnl CURSES_LIBS - sets -L and -l's appropriately
dnl CFLAGS - if --with-sco, add -D_SVID3
dnl has_curses - exports result of tests to rest of configure
dnl
dnl Usage:
dnl ======
dnl 1) Add lines indicated below to acconfig.h
dnl 2) call AC_CHECK_CURSES after AC_PROG_CC in your configure.in
dnl 3) Instead of #include <curses.h> you should use the following to
dnl properly locate ncurses or curses header file
dnl
dnl #if defined(USE_NCURSES) && !defined(RENAMED_NCURSES)
dnl #include <ncurses.h>
dnl #else
dnl #include <curses.h>
dnl #endif
dnl
dnl 4) Make sure to add @CURSES_INCLUDEDIR@ to your preprocessor flags
dnl 5) Make sure to add @CURSES_LIBS@ to your linker flags or LIBS
dnl
dnl Notes with automake:
dnl - call AM_CONDITIONAL(HAS_CURSES, test "$has_curses" = true) from
dnl configure.in
dnl - your Makefile.am can look something like this
dnl -----------------------------------------------
dnl INCLUDES= blah blah blah $(CURSES_INCLUDEDIR)
dnl if HAS_CURSES
dnl CURSES_TARGETS=name_of_curses_prog
dnl endif
dnl bin_PROGRAMS = other_programs $(CURSES_TARGETS)
dnl other_programs_SOURCES = blah blah blah
dnl name_of_curses_prog_SOURCES = blah blah blah
dnl other_programs_LDADD = blah
dnl name_of_curses_prog_LDADD = blah $(CURSES_LIBS)
dnl -----------------------------------------------
dnl
dnl
dnl The following lines should be added to acconfig.h:
dnl ==================================================
dnl
dnl /*=== Curses version detection defines ===*/
dnl /* Found some version of curses that we're going to use */
dnl #undef HAS_CURSES
dnl
dnl /* Use SunOS SysV curses? */
dnl #undef USE_SUNOS_CURSES
dnl
dnl /* Use old BSD curses - not used right now */
dnl #undef USE_BSD_CURSES
dnl
dnl /* Use SystemV curses? */
dnl #undef USE_SYSV_CURSES
dnl
dnl /* Use Ncurses? */
dnl #undef USE_NCURSES
dnl
dnl /* If you Curses does not have color define this one */
dnl #undef NO_COLOR_CURSES
dnl
dnl /* Define if you want to turn on SCO-specific code */
dnl #undef SCO_FLAVOR
dnl
dnl /* Set to reflect version of ncurses *
dnl * 0 = version 1.*
dnl * 1 = version 1.9.9g
dnl * 2 = version 4.0/4.1 */
dnl #undef NCURSES_970530
dnl
dnl /*=== End new stuff for acconfig.h ===*/
dnl
AC_DEFUN(AC_CHECK_CURSES,[
search_ncurses=true
screen_manager=""
has_curses=false
CFLAGS=${CFLAGS--O}
AC_SUBST(CURSES_LIBS)
AC_SUBST(CURSES_INCLUDEDIR)
AC_ARG_WITH(sco,
[ --with-sco Use this to turn on SCO-specific code],[
if test x$withval = xyes; then
AC_DEFINE(SCO_FLAVOR)
CFLAGS="$CFLAGS -D_SVID3"
fi
])
AC_ARG_WITH(sunos-curses,
[ --with-sunos-curses Used to force SunOS 4.x curses],[
if test x$withval = xyes; then
AC_USE_SUNOS_CURSES
fi
])
AC_ARG_WITH(osf1-curses,
[ --with-osf1-curses Used to force OSF/1 curses],[
if test x$withval = xyes; then
AC_USE_OSF1_CURSES
fi
])
AC_ARG_WITH(vcurses,
[ --with-vcurses[=incdir] Used to force SysV curses],
if test x$withval != xyes; then
CURSES_INCLUDEDIR="-I$withval"
fi
AC_USE_SYSV_CURSES
)
AC_ARG_WITH(ncurses,
[ --with-ncurses[=dir] Compile with ncurses/locate base dir],
if test x$withval = xno ; then
search_ncurses=false
elif test x$withval != xyes ; then
CURSES_LIBS="$LIBS -L$withval/lib -lncurses"
CURSES_INCLUDEDIR="-I$withval/include"
search_ncurses=false
screen_manager="ncurses"
AC_DEFINE(USE_NCURSES)
AC_DEFINE(HAS_CURSES)
has_curses=true
fi
)
if $search_ncurses
then
AC_SEARCH_NCURSES()
fi
])
AC_DEFUN(AC_USE_SUNOS_CURSES, [
search_ncurses=false
screen_manager="SunOS 4.x /usr/5include curses"
AC_MSG_RESULT(Using SunOS 4.x /usr/5include curses)
AC_DEFINE(USE_SUNOS_CURSES)
AC_DEFINE(HAS_CURSES)
has_curses=true
AC_DEFINE(NO_COLOR_CURSES)
AC_DEFINE(USE_SYSV_CURSES)
CURSES_INCLUDEDIR="-I/usr/5include"
CURSES_LIBS="/usr/5lib/libcurses.a /usr/5lib/libtermcap.a"
AC_MSG_RESULT(Please note that some screen refreshs may fail)
])
AC_DEFUN(AC_USE_OSF1_CURSES, [
AC_MSG_RESULT(Using OSF1 curses)
search_ncurses=false
screen_manager="OSF1 curses"
AC_DEFINE(HAS_CURSES)
has_curses=true
AC_DEFINE(NO_COLOR_CURSES)
AC_DEFINE(USE_SYSV_CURSES)
CURSES_LIBS="-lcurses"
])
AC_DEFUN(AC_USE_SYSV_CURSES, [
AC_MSG_RESULT(Using SysV curses)
AC_DEFINE(HAS_CURSES)
has_curses=true
AC_DEFINE(USE_SYSV_CURSES)
search_ncurses=false
screen_manager="SysV/curses"
CURSES_LIBS="-lcurses"
])
dnl AC_ARG_WITH(bsd-curses,
dnl [--with-bsd-curses Used to compile with bsd curses, not very fancy],
dnl search_ncurses=false
dnl screen_manager="Ultrix/cursesX"
dnl if test $system = ULTRIX
dnl then
dnl THIS_CURSES=cursesX
dnl else
dnl THIS_CURSES=curses
dnl fi
dnl
dnl CURSES_LIBS="-l$THIS_CURSES -ltermcap"
dnl AC_DEFINE(HAS_CURSES)
dnl has_curses=true
dnl AC_DEFINE(USE_BSD_CURSES)
dnl AC_MSG_RESULT(Please note that some screen refreshs may fail)
dnl AC_WARN(Use of the bsdcurses extension has some)
dnl AC_WARN(display/input problems.)
dnl AC_WARN(Reconsider using xcurses)
dnl)
dnl
dnl Parameters: directory filename cureses_LIBS curses_INCLUDEDIR nicename
dnl
AC_DEFUN(AC_NCURSES, [
if $search_ncurses
then
if test -f $1/$2
then
AC_MSG_RESULT(Found ncurses on $1/$2)
CURSES_LIBS="$3"
CURSES_INCLUDEDIR="$4"
search_ncurses=false
screen_manager=$5
AC_DEFINE(HAS_CURSES)
has_curses=true
AC_DEFINE(USE_NCURSES)
fi
fi
])
AC_DEFUN(AC_SEARCH_NCURSES, [
AC_CHECKING("location of ncurses.h file")
AC_NCURSES(/usr/include, ncurses.h, -lncurses,, "ncurses on /usr/include")
AC_NCURSES(/usr/include/ncurses, ncurses.h, -lncurses, -I/usr/include/ncurses, "ncurses on /usr/include/ncurses")
AC_NCURSES(/usr/local/include, ncurses.h, -L/usr/local/lib -lncurses, -I/usr/local/include, "ncurses on /usr/local")
AC_NCURSES(/usr/local/include/ncurses, ncurses.h, -L/usr/local/lib -L/usr/local/lib/ncurses -lncurses, -I/usr/local/include/ncurses, "ncurses on /usr/local/include/ncurses")
AC_NCURSES(/usr/local/include/ncurses, curses.h, -L/usr/local/lib -lncurses, -I/usr/local/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/local/.../ncurses")
AC_NCURSES(/usr/include/ncurses, curses.h, -lncurses, -I/usr/include/ncurses -DRENAMED_NCURSES, "renamed ncurses on /usr/include/ncurses")
dnl
dnl We couldn't find ncurses, try SysV curses
dnl
if $search_ncurses
then
AC_EGREP_HEADER(init_color, /usr/include/curses.h,
AC_USE_SYSV_CURSES)
AC_EGREP_CPP(USE_NCURSES,[
#include <curses.h>
#ifdef __NCURSES_H
#undef USE_NCURSES
USE_NCURSES
#endif
],[
CURSES_INCLUDEDIR="$CURSES_INCLUDEDIR -DRENAMED_NCURSES"
AC_DEFINE(HAS_CURSES)
has_curses=true
AC_DEFINE(USE_NCURSES)
search_ncurses=false
screen_manager="ncurses installed as curses"
])
fi
dnl
dnl Try SunOS 4.x /usr/5{lib,include} ncurses
dnl The flags USE_SUNOS_CURSES, USE_BSD_CURSES and BUGGY_CURSES
dnl should be replaced by a more fine grained selection routine
dnl
if $search_ncurses
then
if test -f /usr/5include/curses.h
then
AC_USE_SUNOS_CURSES
fi
fi
])

6
irssi-config.in Normal file
View File

@ -0,0 +1,6 @@
PROG_LIBS="@PROG_LIBS@"
PERL_LDFLAGS="@PERL_LDFLAGS@"
COMMON_LIBS="@COMMON_LIBS@"
CHAT_MODULES="@CHAT_MODULES@"
irc_MODULES="@irc_MODULES@"

View File

@ -1,8 +0,0 @@
[Desktop Entry]
Name=irssi
Comment=irssi IRC client
Comment[pl]=irssi - klient IRC
Icon=irssi-icon.png
Exec=irssi
Terminal=0
Type=Application

View File

@ -1,5 +0,0 @@
[irssi]
type=exe
repo_id=IDL:GNOME/Applet:1.0
description=irssi IRC client
location_info=irssi

View File

@ -3,11 +3,11 @@ bin_PROGRAMS = ircserver
INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir)/src INCLUDES = $(GLIB_CFLAGS) -I$(top_srcdir)/src
if BUILD_MEMDEBUG if BUILD_MEMDEBUG
memdebug_src=../src/irc-base/memdebug.o memdebug_src=../src/core/memdebug.o
else else
memdebug_src= memdebug_src=
endif endif
ircserver_LDADD = -lglib ../src/irc-base/network.o $(memdebug_src) ircserver_LDADD = -lglib ../src/core/network.o $(memdebug_src)
ircserver_SOURCES = server.c ircserver_SOURCES = server.c

View File

@ -1,8 +1,8 @@
#include <common.h> #include <common.h>
#include <irc-base/network.h> #include "core/network.h"
#define FLOOD_TIMEOUT 50000 #define FLOOD_TIMEOUT 1
typedef struct typedef struct
{ {
@ -12,20 +12,10 @@ typedef struct
CHANNEL_REC; CHANNEL_REC;
GList *channels; GList *channels;
gchar *clientnick, *clienthost; gchar *clientnick, clienthost[MAX_IP_LEN];
int clienth; int clienth;
gint gui_input_add(gint handle, GUIInputCondition condition,
GUIInputFunction function, gpointer data)
{
return -1;
}
void gui_input_remove(gint tag)
{
}
/* Read a line */ /* Read a line */
gint read_line(gboolean socket, gint handle, GString *output, GString *buffer) gint read_line(gboolean socket, gint handle, GString *output, GString *buffer)
{ {
@ -135,7 +125,6 @@ void send_cmd(void)
/* send msg to every channel */ /* send msg to every channel */
str[511] = '\0'; str[511] = '\0';
for (tmp = g_list_first(channels); tmp != NULL; tmp = tmp->next) for (tmp = g_list_first(channels); tmp != NULL; tmp = tmp->next)
{ {
CHANNEL_REC *rec = tmp->data; CHANNEL_REC *rec = tmp->data;
@ -246,12 +235,10 @@ void send_cmd(void)
client_send(str); client_send(str);
} }
makerand(str, 511); makerand(str, 511);
str[0] = ':'; str[0] = ':';
str[10] = '!'; str[10] = '!';
str[20] = '@'; str[20] = '@';
switch (rand() % 11) switch (rand() % 11)
{ {
case 0: case 0:
@ -330,7 +317,7 @@ void send_cmd(void)
break; break;
case 7: case 7:
/* invite */ /* invite */
pos = 30+sprintf(str+30, " INVITE %s", clientnick); pos = 30+sprintf(str+30, " INVITE %s ", clientnick);
str[pos] = 'X'; str[pos] = 'X';
break; break;
case 8: case 8:
@ -360,11 +347,6 @@ void handle_command(char *str)
} }
} }
guint gui_timeout_add(guint32 interval, GUITimeoutFunction function, gpointer data)
{
return -1;
}
int main(void) int main(void)
{ {
static fd_set fdset; static fd_set fdset;
@ -406,8 +388,8 @@ int main(void)
tv.tv_usec = FLOOD_TIMEOUT; tv.tv_usec = FLOOD_TIMEOUT;
if (select((serverh > clienth ? serverh : clienth)+1, &fdset, NULL, NULL, &tv) <= 0) if (select((serverh > clienth ? serverh : clienth)+1, &fdset, NULL, NULL, &tv) <= 0)
{ {
/* nothing happened, bug the client with some commands.. */ /* nothing happened, bug the client with some commands.. */
if (clienth != -1 && clientnick != NULL) send_cmd(); if (clienth != -1 && clientnick != NULL) send_cmd();
} }
else else
{ {
@ -434,7 +416,7 @@ int main(void)
clienth = net_accept(serverh, &clientip, &port); clienth = net_accept(serverh, &clientip, &port);
if (clienth != -1) if (clienth != -1)
{ {
clienthost = g_strdup(net_ip2host(&clientip)); net_ip2host(&clientip, clienthost);
client_send(":server 001 pla"); client_send(":server 001 pla");
client_send(":server 002 plapla"); client_send(":server 002 plapla");
client_send(":server 003 plaplapla"); client_send(":server 003 plaplapla");

View File

@ -2,11 +2,6 @@ if BUILD_TEXTUI
TEXTUI=fe-text TEXTUI=fe-text
endif endif
if BUILD_GNOMEUI
#GNOMEUI=fe-gnome
GNOMEUI=
endif
if BUILD_IRSSIBOT if BUILD_IRSSIBOT
BOTUI=fe-none BOTUI=fe-none
endif endif
@ -20,4 +15,4 @@ noinst_HEADERS = \
common.h \ common.h \
common-setup.h common-setup.h
SUBDIRS = lib-popt lib-config core irc fe-common $(PERLDIR) $(GNOMEUI) $(TEXTUI) $(BOTUI) SUBDIRS = lib-popt lib-config core irc fe-common $(PERLDIR) $(TEXTUI) $(BOTUI)

View File

@ -310,7 +310,7 @@ char *cmd_get_callfuncs(const char *data, int *count, va_list *args)
ret = g_strdup(data); ret = g_strdup(data);
for (tmp = cmdget_funcs; tmp != NULL; tmp = tmp->next) { for (tmp = cmdget_funcs; tmp != NULL; tmp = tmp->next) {
func = tmp->data; func = (CMD_GET_FUNC) tmp->data;
old = ret; old = ret;
ret = func(ret, count, args); ret = func(ret, count, args);
@ -361,12 +361,12 @@ char *cmd_get_params(const char *data, int count, ...)
void cmd_get_add_func(CMD_GET_FUNC func) void cmd_get_add_func(CMD_GET_FUNC func)
{ {
cmdget_funcs = g_slist_prepend(cmdget_funcs, func); cmdget_funcs = g_slist_prepend(cmdget_funcs, (void *) func);
} }
void cmd_get_remove_func(CMD_GET_FUNC func) void cmd_get_remove_func(CMD_GET_FUNC func)
{ {
cmdget_funcs = g_slist_prepend(cmdget_funcs, func); cmdget_funcs = g_slist_prepend(cmdget_funcs, (void *) func);
} }
static void parse_outgoing(const char *line, SERVER_REC *server, void *item) static void parse_outgoing(const char *line, SERVER_REC *server, void *item)

View File

@ -377,7 +377,7 @@ int match_wildcards(const char *cmask, const char *data)
char *mask, *newmask, *p1, *p2; char *mask, *newmask, *p1, *p2;
int ret; int ret;
newmask = mask = strdup(cmask); newmask = mask = g_strdup(cmask);
for (; *mask != '\0' && *data != '\0'; mask++) { for (; *mask != '\0' && *data != '\0'; mask++) {
if (*mask == '?' || toupper(*mask) == toupper(*data)) { if (*mask == '?' || toupper(*mask) == toupper(*data)) {
data++; data++;

View File

@ -8,7 +8,7 @@ typedef struct _config_rec CONFIG_REC;
enum { enum {
SETTING_TYPE_STRING, SETTING_TYPE_STRING,
SETTING_TYPE_INT, SETTING_TYPE_INT,
SETTING_TYPE_BOOLEAN, SETTING_TYPE_BOOLEAN
}; };
typedef struct { typedef struct {

View File

@ -108,7 +108,7 @@ static char *get_long_variable_value(const char *key, void *server, void *item,
*free_ret = FALSE; *free_ret = FALSE;
/* expando? */ /* expando? */
func = g_hash_table_lookup(expandos, key); func = (EXPANDO_FUNC) g_hash_table_lookup(expandos, key);
if (func != NULL) if (func != NULL)
return func(server, item, free_ret); return func(server, item, free_ret);
@ -502,7 +502,7 @@ void expando_create(const char *key, EXPANDO_FUNC func)
g_free(origkey); g_free(origkey);
g_hash_table_remove(expandos, key); g_hash_table_remove(expandos, key);
} }
g_hash_table_insert(expandos, g_strdup(key), func); g_hash_table_insert(expandos, g_strdup(key), (void *) func);
} }
/* Destroy expando */ /* Destroy expando */

View File

@ -66,3 +66,5 @@ enum {
extern FORMAT_REC fecommon_core_formats[]; extern FORMAT_REC fecommon_core_formats[];
#define MODULE_FORMATS fecommon_core_formats #define MODULE_FORMATS fecommon_core_formats
#include "printformat.h"

View File

@ -0,0 +1,25 @@
/* printformat(...) = printformat_format(module_formats, ...)
Could this be any harder? :) With GNU C compiler and C99 compilers,
use #define. With others use either inline functions if they are
supported or static functions if they are not..
*/
#if defined (__GNUC__) && !defined (__STRICT_ANSI__)
/* GCC */
# define printformat(server, channel, level, formatnum...) \
printformat_format(MODULE_FORMATS, server, channel, level, ##formatnum)
#elif defined (_ISOC99_SOURCE)
/* C99 */
# define printformat(server, channel, level, formatnum, ...) \
printformat_format(MODULE_FORMATS, server, channel, level, formatnum, __VA_ARGS__)
#else
/* inline/static */
static
#ifdef G_CAN_INLINE
inline
#endif
void printformat(void *server, const char *channel, int level, int formatnum, ...)
{
printformat_format(MODULE_FORMATS, server, channel, level, formatnum);
}
#endif

View File

@ -24,32 +24,6 @@ typedef struct {
#define PRINTFLAG_MIRC_COLOR 0x20 #define PRINTFLAG_MIRC_COLOR 0x20
#define PRINTFLAG_INDENT 0x40 #define PRINTFLAG_INDENT 0x40
/* printformat(...) = printformat_format(module_formats, ...)
Could this be any harder? :) With GNU C compiler and C99 compilers,
use #define. With others use either inline functions if they are
supported or static functions if they are not..
*/
#ifdef __GNUC__
/* GCC */
# define printformat(server, channel, level, formatnum...) \
printformat_format(MODULE_FORMATS, server, channel, level, ##formatnum)
#elif defined (_ISOC99_SOURCE)
/* C99 */
# define printformat(server, channel, level, formatnum, ...) \
printformat_format(MODULE_FORMATS, server, channel, level, formatnum, __VA_ARGS__)
#else
/* inline/static */
#ifdef G_CAN_INLINE
inline
#else
static
#endif
void printformat(void *server, const char *channel, int level, int formatnum, ...)
{
printformat_format(MODULE_FORMATS, server, channel, level, ##formatnum);
}
#endif
void printformat_format(FORMAT_REC *formats, void *server, const char *channel, int level, int formatnum, ...); void printformat_format(FORMAT_REC *formats, void *server, const char *channel, int level, int formatnum, ...);
void printtext(void *server, const char *channel, int level, const char *str, ...); void printtext(void *server, const char *channel, int level, const char *str, ...);

View File

@ -181,6 +181,17 @@ void window_set_level(WINDOW_REC *window, int level)
signal_emit("window level changed", 1, window); signal_emit("window level changed", 1, window);
} }
/* return active item's name, or if none is active, window's name */
char *window_get_active_name(WINDOW_REC *window)
{
g_return_val_if_fail(window != NULL, NULL);
if (window->active != NULL)
return window->active->name;
return window->name;
}
WINDOW_REC *window_find_level(void *server, int level) WINDOW_REC *window_find_level(void *server, int level)
{ {
WINDOW_REC *match; WINDOW_REC *match;

View File

@ -58,8 +58,11 @@ void window_change_server(WINDOW_REC *window, void *server);
void window_set_refnum(WINDOW_REC *window, int refnum); void window_set_refnum(WINDOW_REC *window, int refnum);
void window_set_name(WINDOW_REC *window, const char *name); void window_set_name(WINDOW_REC *window, const char *name);
void window_set_level(WINDOW_REC *window, int level); void window_set_level(WINDOW_REC *window, int level);
/* return active item's name, or if none is active, window's name */
char *window_get_active_name(WINDOW_REC *window);
WINDOW_REC *window_find_level(void *server, int level); WINDOW_REC *window_find_level(void *server, int level);
WINDOW_REC *window_find_closest(void *server, const char *name, int level); WINDOW_REC *window_find_closest(void *server, const char *name, int level);
WINDOW_REC *window_find_refnum(int refnum); WINDOW_REC *window_find_refnum(int refnum);

View File

@ -32,8 +32,10 @@ enum {
IRCTXT_DCC_CONNECT_ERROR, IRCTXT_DCC_CONNECT_ERROR,
IRCTXT_DCC_CANT_CREATE, IRCTXT_DCC_CANT_CREATE,
IRCTXT_DCC_REJECTED, IRCTXT_DCC_REJECTED,
IRCTXT_DCC_CLOSE, IRCTXT_DCC_CLOSE
}; };
extern FORMAT_REC fecommon_irc_dcc_formats[]; extern FORMAT_REC fecommon_irc_dcc_formats[];
#define MODULE_FORMATS fecommon_irc_dcc_formats #define MODULE_FORMATS fecommon_irc_dcc_formats
#include "printformat.h"

View File

@ -47,17 +47,17 @@ static void ctcp_print(const char *pre, const char *data, IRC_SERVER_REC *server
static void ctcp_default_msg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target) static void ctcp_default_msg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target)
{ {
return ctcp_print("unknown CTCP", data, server, nick, addr, target); ctcp_print("unknown CTCP", data, server, nick, addr, target);
} }
static void ctcp_ping_msg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target) static void ctcp_ping_msg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target)
{ {
return ctcp_print("CTCP PING", data, server, nick, addr, target); ctcp_print("CTCP PING", data, server, nick, addr, target);
} }
static void ctcp_version_msg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target) static void ctcp_version_msg(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target)
{ {
return ctcp_print("CTCP VERSION", data, server, nick, addr, target); ctcp_print("CTCP VERSION", data, server, nick, addr, target);
} }
static void ctcp_default_reply(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target) static void ctcp_default_reply(const char *data, IRC_SERVER_REC *server, const char *nick, const char *addr, const char *target)

View File

@ -11,3 +11,5 @@ enum {
extern FORMAT_REC fecommon_irc_flood_formats[]; extern FORMAT_REC fecommon_irc_flood_formats[];
#define MODULE_FORMATS fecommon_irc_flood_formats #define MODULE_FORMATS fecommon_irc_flood_formats
#include "printformat.h"

View File

@ -162,3 +162,5 @@ enum {
extern FORMAT_REC fecommon_irc_formats[]; extern FORMAT_REC fecommon_irc_formats[];
#define MODULE_FORMATS fecommon_irc_formats #define MODULE_FORMATS fecommon_irc_formats
#include "printformat.h"

View File

@ -17,3 +17,5 @@ enum {
extern FORMAT_REC fecommon_irc_notifylist_formats[]; extern FORMAT_REC fecommon_irc_notifylist_formats[];
#define MODULE_FORMATS fecommon_irc_notifylist_formats #define MODULE_FORMATS fecommon_irc_notifylist_formats
#include "printformat.h"

View File

@ -8,13 +8,11 @@ INCLUDES = \
-I$(top_srcdir)/src/core/ \ -I$(top_srcdir)/src/core/ \
-I$(top_srcdir)/src/irc/core/ -I$(top_srcdir)/src/irc/core/
irssi_bot_DEPENDENCIES = @IRC_LIBS@ @CORE_LIBS@ irssi_bot_DEPENDENCIES = @COMMON_NOUI_LIBS@
irssi_bot_LDADD = \ irssi_bot_LDADD = \
@IRC_LIBS@ \ @COMMON_NOUI_LIBS@ \
@CORE_LIBS@ \ $(PROG_LIBS) \
$(PROG_LIBS) \
$(INTLLIBS) \
$(PERL_LDFLAGS) $(PERL_LDFLAGS)
irssi_bot_SOURCES = \ irssi_bot_SOURCES = \

View File

@ -13,10 +13,9 @@ irssi_text_DEPENDENCIES = @COMMON_LIBS@
irssi_text_LDADD = \ irssi_text_LDADD = \
@COMMON_LIBS@ \ @COMMON_LIBS@ \
$(PROG_LIBS) \ $(PROG_LIBS) \
$(CURSES_LIBS) \ $(PERL_LDFLAGS) \
$(INTLLIBS) \ $(CURSES_LIBS)
$(PERL_LDFLAGS)
irssi_text_SOURCES = \ irssi_text_SOURCES = \
gui-entry.c \ gui-entry.c \

View File

@ -1,237 +0,0 @@
/*
gui-statusbar.c : irssi
Copyright (C) 1999 Timo Sirainen
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 "module.h"
#include "signals.h"
#include "server.h"
#include "windows.h"
#include "screen.h"
#include "gui-statusbar.h"
#include "gui-mainwindows.h"
#include "gui-windows.h"
typedef struct
{
gint tag;
gint xpos, ypos;
gint size;
gboolean right_justify, up;
STATUSBAR_FUNC func;
}
STATUSBAR_REC;
static GList *sbars;
static gint sbars_tag;
static void gui_statusbar_redraw_line(gboolean up, gint ypos)
{
GList *tmp;
gint xpos, rxpos;
xpos = 1;
for (tmp = sbars; tmp != NULL; tmp = tmp->next)
{
STATUSBAR_REC *rec = tmp->data;
if (!rec->right_justify)
{
if (rec->up == up && rec->ypos == ypos && xpos+rec->size < COLS)
{
rec->xpos = xpos;
rec->func(xpos, rec->ypos + (rec->up ? 0 : last_text_line), rec->size);
if (rec->size > 0) xpos += rec->size+1;
}
}
}
rxpos = COLS-1;
for (tmp = sbars; tmp != NULL; tmp = tmp->next)
{
STATUSBAR_REC *rec = tmp->data;
if (rec->right_justify)
{
if (rec->up == up && rec->ypos == ypos && rxpos-rec->size > xpos)
{
rec->xpos = rxpos-rec->size;
rec->func(rec->xpos, rec->ypos + (rec->up ? 0 : last_text_line), rec->size);
if (rec->size > 0) rxpos -= rec->size+1;
}
}
}
}
static void gui_statusbar_redraw_all(void)
{
gint n;
screen_refresh_freeze();
set_bg((1<<4)+15);
for (n = 0; n < first_text_line; n++)
{
move(n, 0); clrtoeol();
}
for (n = last_text_line; n < LINES-1; n++)
{
move(n, 0); clrtoeol();
}
set_bg(0);
for (n = 0; n < LINES-1; n++)
{
gui_statusbar_redraw_line(FALSE, n);
gui_statusbar_redraw_line(TRUE, n);
}
screen_refresh_thaw();
}
void gui_statusbar_redraw(gint tag)
{
GList *tmp;
if (tag == -1)
{
gui_statusbar_redraw_all();
return;
}
for (tmp = sbars; tmp != NULL; tmp = tmp->next)
{
STATUSBAR_REC *rec = tmp->data;
if (rec->tag == tag)
{
rec->func(rec->xpos, rec->ypos + (rec->up ? 0 : last_text_line), rec->size);
break;
}
}
}
/* create new statusbar, return position */
gint gui_statusbar_create(gboolean up)
{
gint pos;
pos = up ? first_text_line++ :
(LINES-2)-last_text_line--;
set_bg((1<<4)+15);
move(up ? pos : last_text_line+pos, 0); clrtoeol();
set_bg(0);
gui_windows_resize(-1, FALSE);
return pos;
}
void gui_statusbar_delete(gboolean up, gint ypos)
{
GList *tmp, *next;
if (up && first_text_line > 0)
first_text_line--;
else if (!up && last_text_line < LINES-1)
last_text_line++;
for (tmp = sbars; tmp != NULL; tmp = next)
{
STATUSBAR_REC *rec = tmp->data;
next = tmp->next;
if (rec->up == up && rec->ypos == ypos)
gui_statusbar_remove(rec->tag);
else if (rec->up == up && rec->ypos > ypos)
rec->ypos--;
}
gui_windows_resize(1, FALSE);
}
/* allocate area in statusbar, returns tag or -1 if failed */
gint gui_statusbar_allocate(gint size, gboolean right_justify, gboolean up, gint ypos, STATUSBAR_FUNC func)
{
STATUSBAR_REC *rec;
g_return_val_if_fail(func != NULL, -1);
rec = g_new0(STATUSBAR_REC, 1);
sbars = g_list_append(sbars, rec);
rec->tag = ++sbars_tag;
rec->xpos = -1;
rec->up = up;
rec->ypos = ypos;
rec->size = size;
rec->right_justify = right_justify;
rec->func = func;
gui_statusbar_redraw_all();
return rec->tag;
}
void gui_statusbar_resize(gint tag, gint size)
{
GList *tmp;
for (tmp = sbars; tmp != NULL; tmp = tmp->next)
{
STATUSBAR_REC *rec = tmp->data;
if (rec->tag == tag)
{
rec->size = size;
gui_statusbar_redraw_all();
break;
}
}
}
void gui_statusbar_remove(gint tag)
{
GList *tmp;
for (tmp = sbars; tmp != NULL; tmp = tmp->next)
{
STATUSBAR_REC *rec = tmp->data;
if (rec->tag == tag)
{
g_free(rec);
sbars = g_list_remove(sbars, rec);
if (!quitting) gui_statusbar_redraw_all();
break;
}
}
}
void gui_statusbar_init(void)
{
sbars = NULL;
sbars_tag = 0;
gui_statusbar_create(FALSE);
}
void gui_statusbar_deinit(void)
{
gui_statusbar_delete(FALSE, 0);
}

View File

@ -12,3 +12,5 @@ enum {
extern FORMAT_REC gui_text_formats[]; extern FORMAT_REC gui_text_formats[];
#define MODULE_FORMATS gui_text_formats #define MODULE_FORMATS gui_text_formats
#include "printformat.h"

View File

@ -11,18 +11,16 @@
#define ATTR_COLOR8 0x200 #define ATTR_COLOR8 0x200
#define ATTR_REVERSE 0x400 #define ATTR_REVERSE 0x400
extern gboolean use_colors; int init_screen(void); /* Initialize screen, detect screen length */
gint init_screen(void); /* Initialize screen, detect screen length */
void deinit_screen(void); /* Deinitialize screen */ void deinit_screen(void); /* Deinitialize screen */
void set_color(gint col); void set_color(int col);
void set_bg(gint col); void set_bg(int col);
void scroll_up(gint y1, gint y2); /* Scroll area up */ void scroll_up(int y1, int y2); /* Scroll area up */
void scroll_down(gint y1, gint y2); /* Scroll area down */ void scroll_down(int y1, int y2); /* Scroll area down */
void move_cursor(gint y, gint x); void move_cursor(int y, int x);
void screen_refresh_freeze(void); void screen_refresh_freeze(void);
void screen_refresh_thaw(void); void screen_refresh_thaw(void);

View File

@ -58,7 +58,7 @@ static void statusbar_redraw_line(STATUSBAR_REC *bar)
if (!rec->right_justify && xpos+rec->size < COLS) { if (!rec->right_justify && xpos+rec->size < COLS) {
rec->xpos = xpos; rec->xpos = xpos;
func = rec->func; func = (STATUSBAR_FUNC) rec->func;
func(rec, bar->ypos); func(rec, bar->ypos);
if (resized) break; if (resized) break;
@ -73,7 +73,7 @@ static void statusbar_redraw_line(STATUSBAR_REC *bar)
if (rec->right_justify && rxpos-rec->size > xpos) { if (rec->right_justify && rxpos-rec->size > xpos) {
rec->xpos = rxpos-rec->size; rec->xpos = rxpos-rec->size;
func = rec->func; func = (STATUSBAR_FUNC) rec->func;
func(rec, bar->ypos); func(rec, bar->ypos);
if (resized) break; if (resized) break;
@ -131,7 +131,7 @@ void statusbar_item_redraw(SBAR_ITEM_REC *item)
g_return_if_fail(item != NULL); g_return_if_fail(item != NULL);
func = item->func; func = (STATUSBAR_FUNC) item->func;
func(item, item->bar->ypos); func(item, item->bar->ypos);
} }
@ -215,7 +215,7 @@ SBAR_ITEM_REC *statusbar_item_create(STATUSBAR_REC *bar, int size, int right_jus
rec->xpos = -1; rec->xpos = -1;
rec->size = size; rec->size = size;
rec->right_justify = right_justify; rec->right_justify = right_justify;
rec->func = func; rec->func = (void *) func;
return rec; return rec;
} }

View File

@ -61,7 +61,7 @@ extern char *current_server_event; /* current server event being processed */
/* Send command to IRC server */ /* Send command to IRC server */
void irc_send_cmd(IRC_SERVER_REC *server, const char *cmd); void irc_send_cmd(IRC_SERVER_REC *server, const char *cmd);
void irc_send_cmdv(IRC_SERVER_REC *server, const char *cmd, ...) G_GNUC_PRINTF (2, 3);; void irc_send_cmdv(IRC_SERVER_REC *server, const char *cmd, ...) G_GNUC_PRINTF (2, 3);
/* Send command to IRC server, split to multiple commands if necessary so /* Send command to IRC server, split to multiple commands if necessary so
that command will never have more target nicks than `max_nicks'. Nicks that command will never have more target nicks than `max_nicks'. Nicks
are separated with commas. (works with /msg, /kick, ...) */ are separated with commas. (works with /msg, /kick, ...) */

View File

@ -6,7 +6,7 @@ enum {
NODE_TYPE_VALUE, NODE_TYPE_VALUE,
NODE_TYPE_BLOCK, NODE_TYPE_BLOCK,
NODE_TYPE_LIST, NODE_TYPE_LIST,
NODE_TYPE_COMMENT, NODE_TYPE_COMMENT
}; };
#define has_node_value(a) \ #define has_node_value(a) \

View File

@ -102,12 +102,12 @@ void config_node_set_int(CONFIG_NODE *parent, const char *key, int value)
char str[MAX_INT_STRLEN]; char str[MAX_INT_STRLEN];
g_snprintf(str, sizeof(str), "%d", value); g_snprintf(str, sizeof(str), "%d", value);
return config_node_set_str(parent, key, str); config_node_set_str(parent, key, str);
} }
void config_node_set_bool(CONFIG_NODE *parent, const char *key, int value) void config_node_set_bool(CONFIG_NODE *parent, const char *key, int value)
{ {
return config_node_set_str(parent, key, value ? "yes" : "no"); config_node_set_str(parent, key, value ? "yes" : "no");
} }
int config_set_str(CONFIG_REC *rec, const char *section, const char *key, const char *value) int config_set_str(CONFIG_REC *rec, const char *section, const char *key, const char *value)