/* X-Chat
* Copyright (C) 1998-2006 Peter Zelezny.
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <time.h>
#ifdef WIN32
#include <io.h>
#else
#include <unistd.h>
#endif
#include "fe-gtk.h"
#include <gdk/gdkkeysyms.h>
#include "../common/hexchat.h"
#include "../common/hexchatc.h"
#include "../common/cfgfiles.h"
#include "../common/outbound.h"
#include "../common/util.h"
#include "../common/fe.h"
#include "../common/server.h"
#include "gtkutil.h"
#include "maingui.h"
#include "menu.h"
#include "custom-list.h"
enum
{
COL_CHANNEL,
COL_USERS,
COL_TOPIC,
N_COLUMNS
};
#ifndef CUSTOM_LIST
typedef struct /* this is now in custom-list.h */
{
char *topic;
char *collation_key;
guint32 pos;
guint32 users;
/* channel string lives beyond "users" */
#define GET_CHAN(row) (((char *)row)+sizeof(chanlistrow))
}
chanlistrow;
#endif
#define GET_MODEL(xserv) (gtk_tree_view_get_model(GTK_TREE_VIEW(xserv->gui->chanlist_list)))
static gboolean
chanlist_match (server *serv, const char *str)
{
switch (serv->gui->chanlist_search_type)
{
case 1:
return match (GTK_ENTRY (serv->gui->chanlist_wild)->text, str);
#ifndef WIN32
case 2:
if (!serv->gui->have_regex)
return 0;
/* regex returns 0 if it's a match: */
return !regexec (&serv->gui->chanlist_match_regex, str, 1, NULL, REG_NOTBOL);
#endif
default: /* case 0: */
return nocasestrstr (str, GTK_ENTRY (serv->gui->chanlist_wild)->text) ? 1 : 0;
}
}
/**
* Updates the caption to reflect the number of users and channels
*/
static void
chanlist_update_caption (server *serv)
{
gchar tbuf[256];
snprintf (tbuf, sizeof tbuf,
_("Displaying %d/%d users on %d/%d channels."),
serv->gui->chanlist_users_shown_count,
serv->gui->chanlist_users_found_count,
serv->gui->chanlist_channels_shown_count,
serv->gui->chanlist_channels_found_count);
gtk_label_set_text (GTK_LABEL (serv->gui->chanlist_label), tbuf);
serv->gui->chanlist_caption_is_stale = FALSE;
}
static void
chanlist_update_buttons (server *serv)
{
if (serv->gui->chanlist_channels_shown_count)
{
gtk_widget_set_sensitive (serv->gui->chanlist_join, TRUE);
gtk_widget_set_sensitive (serv->gui->chanlist_savelist, TRUE);
}
else
{
gtk_widget_set_sensitive (serv->gui->chanlist_join, FALSE);
gtk_widget_set_sensitive (serv->gui->chanlist_savelist, FALSE);
}
}
static void
chanlist_reset_counters (server *serv)
{
serv->gui->chanlist_users_found_count = 0;
serv->gui->chanlist_users_shown_count = 0;
serv->gui->chanlist_channels_found_count = 0;
serv->gui->chanlist_channels_shown_count = 0;
chanlist_update_caption (serv);
chanlist_update_buttons (serv);
}
/* free up our entire linked list and all the nodes */
static void
chanlist_data_free (server *serv)
{
GSList *rows;
chanlistrow *data;
if (serv->gui->chanlist_data_stored_rows)
{
for (rows = serv->gui->chanlist_data_stored_rows; rows != NULL;
rows = rows->next)
{
data = rows->data;
g_free (data->topic);
g_free (data->collation_key);
free (data);
}
g_slist_free (serv->gui->chanlist_data_stored_rows);
serv->gui->chanlist_data_stored_rows = NULL;
}
g_slist_free (serv->gui->chanlist_pending_rows);
serv->gui->chanlist_pending_rows = NULL;
}
/* add any rows we received from the server in the last 0.25s to the GUI */
static void
chanlist_flush_pending (server *serv)
{
GSList *list = serv->gui->chanlist_pending_rows;
GtkTreeModel *model;
chanlistrow *row;
if (!list)
{
if (serv->gui->chanlist_caption_is_stale)
chanlist_update_caption (serv);
return;
}
model = GET_MODEL (serv);
while (list)
{
row = list->data;
custom_list_append (CUSTOM_LIST (model), row);
list = list->next;
}
g_slist_free (serv->gui->chanlist_pending_rows);
serv->gui->chanlist_pending_rows = NULL;
chanlist_update_caption (serv);
}
static gboolean
chanlist_timeout (server *serv)
{
chanlist_flush_pending (serv);
return TRUE;
}
/**
* Places a data row into the gui GtkTreeView, if and only if the row matches
* the user and regex/search requirements.
*/
static void
chanlist_place_row_in_gui (server *serv, chanlistrow *next_row, gboolean force)
{
GtkTreeModel *model;
/* First, update the 'found' counter values */
serv->gui->chanlist_users_found_count += next_row->users;
serv->gui->chanlist_channels_found_count++;
if (serv->gui->chanlist_channels_shown_count == 1)
/* join & save buttons become live */
chanlist_update_buttons (serv);
if (next_row->users < serv->gui->chanlist_minusers)
{
serv->gui->chanlist_caption_is_stale = TRUE;
return;
}
if (next_row->users > serv->gui->chanlist_maxusers
&& serv->gui->chanlist_maxusers > 0)
{
serv->gui->chanlist_caption_is_stale = TRUE;
return;
}
if (GTK_ENTRY (serv->gui->chanlist_wild)->text[0])
{
/* Check what the user wants to match. If both buttons or _neither_
* button is checked, look for match in both by default.
*/
if (serv->gui->chanlist_match_wants_channel ==
serv->gui->chanlist_match_wants_topic)
{
if (!chanlist_match (serv, GET_CHAN (next_row))
&& !chanlist_match (serv, next_row->topic))
{
serv->gui->chanlist_caption_is_stale = TRUE;
return;
}
}
else if (serv->gui->chanlist_match_wants_channel)
{
if (!chanlist_match (serv, GET_CHAN (next_row)))
{
serv->gui->chanlist_caption_is_stale = TRUE;
return;
}
}
else if (serv->gui->chanlist_match_wants_topic)
{
if (!chanlist_match (serv, next_row->topic))
{
serv->gui->chanlist_caption_is_stale = TRUE;
return;
}
}
}
if (force || serv->gui->chanlist_channels_shown_count < 20)
{
model = GET_MODEL (serv);
/* makes it appear fast :) */
custom_list_append (CUSTOM_LIST (model), next_row);
chanlist_update_caption (serv);
}
else
/* add it to GUI at the next update interval */
serv->gui->chanlist_pending_rows = g_slist_prepend (serv->gui->chanlist_pending_rows, next_row);
/* Update the 'shown' counter values */
serv->gui->chanlist_users_shown_count += next_row->userspre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555 } /* Name.Decorator */
.highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */
.highlight .nl { color: #336699; font-style: italic } /* Name.Label */
.highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */
.highlight .py { color: #336699; font-weight: bold } /* Name.Property */
.highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #336699 } /* Name.Variable */
.highlight .ow { color: #008800 } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */
.highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */
.highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */
.highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */
.highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */
.highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */
.highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */
.highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */
.highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */
.highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */dnl Process this file with autoconf to produce a configure script.
AC_INIT([HexChat],[2.9.1],[http://www.hexchat.org/],[hexchat])
AC_PREREQ([2.60])
AC_COPYRIGHT([Copyright (C) 1998-2010 Peter Zelezny])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([configure.in])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.9 dist-bzip2 subdir-objects no-define])
AC_USE_SYSTEM_EXTENSIONS
AM_MAINTAINER_MODE
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
AM_PROG_AS
AM_DISABLE_STATIC
AC_PROG_LIBTOOL
dnl -----------------------------------------------------------
dnl Language Support
dnl -----------------------------------------------------------
GETTEXT_PACKAGE=hexchat
AC_SUBST(GETTEXT_PACKAGE)
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE",[Gettext package name])
ALL_LINGUAS="am az be bg ca cs de el en_GB es et fi fr gl hi hu it ja kn ko lt lv mk ms nb nl no pa pl pt pt_BR ru sk sl sq sr sv th uk vi wa zh_CN zh_TW"
AM_GNU_GETTEXT
dnl displaced from acconfig.h
AH_VERBATIM([OLD_PERL],[#undef OLD_PERL])
AH_VERBATIM([PREFIX],[#undef PREFIX])
AH_VERBATIM([HEXCHATLIBDIR],[#undef HEXCHATLIBDIR])
AH_VERBATIM([HEXCHATSHAREDIR],[#undef HEXCHATSHAREDIR])
AH_VERBATIM([SOCKS],[#undef SOCKS])
AH_VERBATIM([USE_MSPROXY],[#undef USE_MSPROXY])
AH_VERBATIM([USE_LIBPROXY],[#undef USE_LIBPROXY])
dnl AH_VERBATIM([USE_GNOME],[#undef USE_GNOME])
AH_VERBATIM([USE_SHM],[#undef USE_SHM])
AH_VERBATIM([USE_GTKSPELL],[#undef USE_GTKSPELL])
AH_VERBATIM([USE_LIBSEXY],[#undef USE_LIBSEXY])
AH_VERBATIM([HAVE_ISO_CODES],[#undef HAVE_ISO_CODES])
AH_VERBATIM([USE_LIBNOTIFY],[#undef USE_LIBNOTIFY])
AH_VERBATIM([USE_IPV6],[#undef USE_IPV6])
AH_VERBATIM([USE_MMX],[#undef USE_MMX])
AH_VERBATIM([USE_OPENSSL],[#undef USE_OPENSSL])
AH_VERBATIM([USE_PLUGIN],[#undef USE_PLUGIN])
AH_VERBATIM([USE_XFT],[#undef USE_XFT])
AH_VERBATIM([USE_XLIB],[#undef USE_XLIB])
AH_VERBATIM([USE_SIGACTION],[#undef USE_SIGACTION])
AH_VERBATIM([USING_FREEBSD],[#undef USING_FREEBSD])
AH_VERBATIM([USING_LINUX],[#undef USING_LINUX])
AH_VERBATIM([socklen_t],[#undef socklen_t])
AH_VERBATIM([USE_DBUS],[#undef USE_DBUS])
AC_DEFINE([XCHAT_REVISION],["1521"],[XChat SVN Revision])
AC_PATH_PROG(sedpath, sed)
if test "_$sedpath" = _; then
AC_MSG_ERROR("Cannot find sed: I need it\!")
fi
AC_PATH_PROG(unamepath, uname)
if test "_$unamepath" = _; then
system="unknown"
else
AC_MSG_CHECKING(system type)
system=`$unamepath -s`
AC_MSG_RESULT($system)
if test "$system" = "Linux"; then
AC_DEFINE(USING_LINUX)
fi
if test "$system" = "FreeBSD"; then
AC_DEFINE(USING_FREEBSD)
fi
fi
dnl *********************************************************************
dnl ** configure switches ***********************************************
dnl *********************************************************************
AC_ARG_ENABLE(socks,
[ --enable-socks link with SOCKS5 library (default: no)],
socks=$enableval, socks=no)
AC_ARG_ENABLE(ipv6,
[ --enable-ipv6 enable IPv6 (default: no)],
ipv6=$enableval, ipv6=no)
AC_ARG_ENABLE(xft,
[ --enable-xft enable use of Xft directly (default: no)],
xft=$enableval, xft=no)
AC_ARG_ENABLE(openssl,
[ --enable-openssl[=PATH] enable use of openSSL],
openssl=$enableval, openssl=yes)
AC_ARG_ENABLE(gtkfe,
[ --disable-gtkfe disable building gtk frontend],
gtkfe=$enableval, gtkfe=yes)
AC_ARG_ENABLE(textfe,
[ --enable-textfe build the text frontend (default: no)],
textfe=$enableval, textfe=no)
dnl AC_ARG_ENABLE(gnome,
dnl [ --disable-gnome disable use of gnome],
dnl gnome=$enableval, gnome=yes)
AC_ARG_ENABLE(xlib,
[ --disable-xlib disable use of xlib (for non X11 systems)],
xlib=$enableval, xlib=yes)
AC_ARG_ENABLE(python,
[ --disable-python don't build the python plugin],
python=$enableval, python=yes)
AC_ARG_ENABLE(perl,
[ --disable-perl don't build the perl plugin],
perl=$enableval, perl=yes)
AC_ARG_ENABLE(perl_old,
[ --disable-perl_old no backwards compatibility for perl plugin],
perl_old=$enableval, perl_old=yes)
AC_ARG_ENABLE(tcl,
[ --enable-tcl[=PATH] directory with Tcl config file: tclConfig.sh],
tcl=$enableval, tcl=yes)
AC_ARG_ENABLE(plugin,
[ --disable-plugin disable plugin support],
plugin=$enableval, plugin=yes)
AC_ARG_ENABLE(checksum,
[ --disable-checksum disable the Checksum plugin],
checksum=$enableval, checksum=yes)
AC_ARG_ENABLE(doat,
[ --disable-doat disable the Do At plugin],
doat=$enableval, doat=yes)
AC_ARG_ENABLE(fishlim,
[ --disable-fishlim disable the FiSHLiM plugin],
fishlim=$enableval, fishlim=yes)
AC_ARG_ENABLE(sasl,
[ --disable-sasl disable the SASL plugin],
sasl=$enableval, sasl=yes)
AC_ARG_ENABLE(dbus,
[ --disable-dbus disable DBUS support],
dbus=$enableval, dbus=yes)
AC_ARG_ENABLE(libnotify,
[ --disable-libnotify disable libnotify support],
libnotify=$enableval, libnotify=yes)
AC_ARG_ENABLE(mmx,
[ --disable-mmx disable MMX assembly routines],
mmx=$enableval, mmx=yes)
AC_ARG_ENABLE(shm,
[ --enable-shm enable use of XShm for fast tinting (default: no)],
shm=$enableval, shm=no)
AC_ARG_ENABLE(spell,
[ --enable-spell=type enable spelling type: none static libsexy gtkspell],
spell=$enableval, spell=static)
AC_ARG_ENABLE(ntlm,
[ --enable-ntlm enable Microsoft's NTLM auth (libntlm) library support (default: no)],
ntlm=$enableval, ntlm=no)
dnl *********************************************************************
dnl ** GLIB *************************************************************
dnl *********************************************************************
AM_PATH_GLIB_2_0(2.12.0, glib=yes, glib=no)
if test "$glib" = no; then
AC_MSG_ERROR("Cannot find glib")
fi
COMMON_CFLAGS="$GLIB_CFLAGS"
COMMON_LIBS="$GLIB_LIBS"
COMMON_LIBS="$COMMON_LIBS -lgmodule-2.0"
dnl *********************************************************************
dnl ** GTK **************************************************************
dnl *********************************************************************
AM_PATH_GTK_2_0(2.10.0, havegtk=yes, havegtk=no)
if test "$havegtk" = no; then
gtkfe=no
echo
echo Cannot find GTK\! Not building GTK FrontEnd.
echo
fi
if test "$gtkfe" != yes; then
gnome=no
COMMON_LIBS="$GLIB_LIBS"
COMMON_CFLAGS="$GLIB_CFLAGS"
fi
dnl *********************************************************************
dnl ** GNOME ************************************************************
dnl *********************************************************************
GUI_LIBS="$GUI_LIBS $GTK_LIBS"
GUI_CFLAGS="$GUI_CFLAGS $GTK_CFLAGS"
gnome=no
#if test "$gnome" = yes; then
# AC_PATH_PROG(pkgconfigpath, pkg-config)
# AC_MSG_CHECKING(Gnome2 compile flags)
# GNOME_CFLAGS="`$pkgconfigpath libgnome-2.0 --cflags 2>/dev/null`"
# if test "_$GNOME_CFLAGS" = _ ; then
# gnome=no
# AC_MSG_RESULT([Gnome not found, building without it.])
# else
# GNOME_VER="`$pkgconfigpath libgnome-2.0 --modversion`"
# GUI_LIBS="$GUI_LIBS `$pkgconfigpath libgnome-2.0 --libs`"
# GUI_CFLAGS="$GUI_CFLAGS $GNOME_CFLAGS"
# AC_DEFINE(USE_GNOME)
# AC_MSG_RESULT(ok)
# fi
#fi
# GConf
AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
dnl *********************************************************************
dnl ** XFT **************************************************************
dnl *********************************************************************
if test "$xft" = yes; then
AC_PATH_PROG(pkgconfigpath, pkg-config)
if $pkgconfigpath xft --exists; then
GUI_CFLAGS="$GUI_CFLAGS `$pkgconfigpath xft --cflags`"
GUI_LIBS="$GUI_LIBS `$pkgconfigpath xft --libs`"
else
xft=no
oldCPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $GTK_CFLAGS"
AC_CHECK_HEADERS(X11/Xft/Xft.h, xft=yes)
CPPFLAGS=$oldCPPFLAGS
fi
if test "$xft" = yes; then
AC_DEFINE(USE_XFT)
fi
fi
dnl *********************************************************************
dnl ** XLIB *************************************************************
dnl *********************************************************************
if test "$xlib" = yes; then
AC_DEFINE(USE_XLIB)
if test "$system" = "SunOS"; then
LIBS="$LIBS -L/usr/openwin/lib -lX11"
else
AC_CHECK_LIB(X11, XSetWMHints)
fi
else
shm=no
fi
dnl *********************************************************************
dnl ** PERL *************************************************************
dnl *********************************************************************
if test "$perl" = yes; then
AC_PATH_PROG(perlpath, perl)
AC_MSG_CHECKING(for Perl compile flags)
PERL_CFLAGS=`$perlpath -MExtUtils::Embed -e ccopts 2>/dev/null`
if test "_$PERL_CFLAGS" = _ ; then
AC_MSG_RESULT([not found, building without perl.])
perl=no
else
PERL_LDFLAGS=`$perlpath -MExtUtils::Embed -e ldopts |$sedpath 's/-lgdbm //'`
PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-ldb //'`
PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-lndbm //'`
if test "$system" = "Linux"; then
PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-lnsl //'`
PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-lposix //'`
fi
PERL_LDFLAGS=`echo $PERL_LDFLAGS |$sedpath 's/-lc //'`
AC_MSG_RESULT(ok)
# oldLIBS=$LIBS
# LIBS="$LIBS $PERL_LDFLAGS"
# AC_CHECK_FUNC(eval_pv)
# AC_CHECK_FUNC(call_pv)
# LIBS=$oldLIBS
AC_MSG_CHECKING(for perl >= 5.8.0)
PERL_VER=`$perlpath -e 'print $]>= 5.008?"yes":"no"'`
if test "$PERL_VER" = "yes"; then
AC_MSG_RESULT(yes)
AC_MSG_CHECKING(if perl plugin will be backward compatible)
if test "$perl_old" = "yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(OLD_PERL)
else
AC_MSG_RESULT(no)
fi
else
AC_MSG_RESULT(no)
echo "perl version too old, building without perl."
perl=no
fi
fi
fi
dnl *********************************************************************
dnl ** PYTHON ***********************************************************
dnl *********************************************************************
if test "$python" = yes; then
AC_PATH_PROG(pythonpath, python2)
if test "_$pythonpath" = _ ; then
AC_PATH_PROG(pythonpath, python)
fi
if test "_$pythonpath" = _ ; then
python=no
else
AC_MSG_CHECKING(Python version)
changequote(<<, >>)dnl
PY_VER=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_config_vars("VERSION")[0];'`
PY_LIB=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(standard_lib=1);'`
PY_INC=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_config_vars("INCLUDEPY")[0];'`
$pythonpath -c "import sys; map(int,sys.version[:3].split('.')) >= [2,2] or sys.exit(1)"
changequote([, ])dnl
AC_MSG_RESULT($PY_VER)
if test "$?" != "1"; then
AC_MSG_CHECKING(Python compile flags)
PY_PREFIX=`$pythonpath -c 'import sys; print sys.prefix'`
PY_EXEC_PREFIX=`$pythonpath -c 'import sys; print sys.exec_prefix'`
if test -f $PY_INC/Python.h; then
PY_LIBS="-L$PY_LIB/config -lpython$PY_VER -lpthread -lutil"
PY_CFLAGS="-I$PY_INC"
AC_MSG_RESULT(ok)
else
python=no
AC_MSG_RESULT([Can't find Python.h])
fi
else
echo "Python too old. Only 2.2 or above is supported."
python=no
fi
fi
fi
dnl *********************************************************************
dnl ** TCL **************************************************************
dnl *********************************************************************
AC_MSG_CHECKING(for location of tclConfig.sh)
dirs="$tcl /lib /usr/lib /usr/tcl/lib /usr/lib/tcl8.4 /usr/local/lib /usr/local/tcl-8.4/lib /usr/local/tcl/lib /opt/lib /usr/lib/tcl8.3"
found=0
if test "$tcl" != "no"; then
tcl=no
for try in $dirs; do
if test -f $try/tclConfig.sh; then
found=1
. $try/tclConfig.sh
TCL_LIBS="$TCL_LIB_SPEC $TCL_LIBS"
TCL_CFLAGS="-I${TCL_PREFIX}/include $TCL_INCLUDE_SPEC"
tcl=yes
AC_MSG_RESULT($try/tclConfig.sh)
break
fi
done
if test "$found" -eq 0 ; then
AC_MSG_RESULT([tclConfig.sh not found - use the --enable-tcl option])
fi
fi
dnl *********************************************************************
dnl ** IPv6 *************************************************************
dnl *********************************************************************
dnl purely for Solaris
AC_CHECK_FUNC(select, ,
AC_CHECK_LIB(socket, select, ,
AC_CHECK_LIB(nsl, select, ,
AC_CHECK_LIB(inet, select, ,
AC_CHECK_LIB(cposix, select, ,
AC_CHECK_LIB(net, select, ,
AC_MSG_WARN(i can not find select. you might need to help me)))))))
AC_CHECK_LIB(socket, select)
if test "$ipv6" = yes; then
AC_CHECK_FUNCS(getaddrinfo, have_getaddrinfo=yes)
AC_MSG_CHECKING(whether to enable IPv6 support)
if test "$have_getaddrinfo" = yes; then
AC_MSG_RESULT(yes)
AC_DEFINE(USE_IPV6)
else
ipv6=no
AC_MSG_RESULT(no)
fi
fi
dnl *********************************************************************
dnl ** OPENSSL **********************************************************
dnl *********************************************************************
retry=no
if test "$openssl" != no; then
AC_PATH_PROG(pkgconfigpath, pkg-config)
AC_MSG_CHECKING(for openssl through pkg-config)
if $pkgconfigpath openssl --exists; then
CPPFLAGS="$CPPFLAGS `$pkgconfigpath openssl --cflags`"
LIBS="$LIBS `$pkgconfigpath openssl --libs`"
AC_DEFINE(USE_OPENSSL)
AC_MSG_RESULT(yes)
openssl=yes
else
AC_MSG_RESULT(no)
retry=yes
fi
fi
if test "$retry" = "yes"; then
unset openssl_path ac_cv_lib_ssl_SSL_new ac_cv_header_openssl_ssl_h
if test "$openssl" != yes; then
openssl_path=$openssl
fi
openssl=no
SAVED_LIBS=$LIBS
LIBS="$LIBS -lcrypto"
if test -n "$openssl_path"; then
LIBS="-L$openssl_path/lib $LIBS"
fi
AC_CHECK_LIB(ssl, SSL_new, have_openssl=yes)
LIBS=$SAVED_LIBS
if test "$have_openssl" = yes; then
SAVED_CPPFLAGS=$CPPFLAGS
if test -n "$openssl_path"; then
CPPFLAGS="-I$openssl_path/include $CPPFLAGS"
fi
AC_CHECK_HEADERS(openssl/ssl.h, have_openssl_h=yes)
if test "$have_openssl_h" = yes; then
openssl=yes
AC_DEFINE(USE_OPENSSL)
LIBS="$LIBS -lssl -lcrypto"
if test -n "$openssl_path"; then
LIBS="-L$openssl_path/lib $LIBS"
fi
else
CPPFLAGS=$SAVED_CPPFLAGS
fi
fi
fi
dnl *********************************************************************
dnl ** LIBPROXY *********************************************************
dnl *********************************************************************
PKG_CHECK_MODULES([LIBPROXY], [libproxy-1.0], [libproxy=yes], [
libproxy=no
])
if test "x$libproxy" = "xyes" ; then
COMMON_LIBS="$COMMON_LIBS $LIBPROXY_LIBS"
COMMON_CFLAGS="$COMMON_CFLAGS $LIBPROXY_CFLAGS"
AC_DEFINE(USE_LIBPROXY)
fi
dnl *********************************************************************
dnl ** PLUGIN ***********************************************************
dnl *********************************************************************
if test "$plugin" = yes; then
AC_CHECK_FUNCS(dlopen, have_dl=yes)
if test "$have_dl" != yes; then
AC_CHECK_LIB(dl, dlopen, have_dl=yes)
if test "$have_dl" = yes; then
LIBS="$LIBS -ldl"
fi
fi
if test "$have_dl" = yes; then
AC_DEFINE(USE_PLUGIN)
AC_PATH_PROG(pkgconfigpath, pkg-config)
dnl we just need the -Wl,--export-dynamic, but not -lgmodule-2.0
RDYNAMIC_FLAGS="`$pkgconfigpath gmodule-2.0 --libs | $sedpath 's/ -lgmodule-2.0//'`"
LIBS="$LIBS $RDYNAMIC_FLAGS"
if test "$LD" = ""; then
VS="`ld --help | grep version-script 2> /dev/null`"
else
VS="`$LD --help | grep version-script 2> /dev/null`"
fi
if test "$VS" != ""; then
GUI_LIBS="$GUI_LIBS -Wl,--version-script,\$(srcdir)/../version-script"
fi
else
plugin=no
fi
fi
dnl *********************************************************************
dnl ** Checksum *********************************************************
dnl *********************************************************************
if test "$checksum" != "no"; then
checksum=no
AC_MSG_CHECKING(for plugin interface used by Checksum)
if test "$plugin" = yes; then
AC_MSG_RESULT([yes])
AC_MSG_CHECKING(for OpenSSL used by Checksum)
if test "$openssl" = yes; then
checksum=yes
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([OpenSSL cannot be found, use the --enable-openssl option])
fi
else
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option])
fi
fi
dnl *********************************************************************
dnl ** DO AT ************************************************************
dnl *********************************************************************
if test "$doat" != "no"; then
AC_MSG_CHECKING(for plugin interface used by Do At)
doat=no
if test "$plugin" = yes; then
doat=yes
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option for Do At])
fi
fi
dnl *********************************************************************
dnl ** FiSHLiM **********************************************************
dnl *********************************************************************
if test "$fishlim" != "no"; then
fishlim=no
AC_MSG_CHECKING(for plugin interface used by FiSHLiM)
if test "$plugin" = yes; then
AC_MSG_RESULT([yes])
AC_MSG_CHECKING(for OpenSSL used by FiSHLiM)
if test "$openssl" = yes; then
fishlim=yes
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([OpenSSL cannot be found, use the --enable-openssl option])
fi
else
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option])
fi
fi
dnl *********************************************************************
dnl ** SASL *************************************************************
dnl *********************************************************************
if test "$sasl" != "no"; then
AC_MSG_CHECKING(for plugin interface used by SASL)
sasl=no
if test "$plugin" = yes; then
sasl=yes
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([plugins are disabled, use the --enable-plugin option for SASL])
fi
fi
dnl #######################################################################
dnl # Check for DBUS libraries
dnl #######################################################################
if test "x$dbus" = "xyes" ; then
PKG_CHECK_MODULES(DBUS, [dbus-1 >= 0.60 dbus-glib-1 >= 0.60 gthread-2.0], dbus=yes, [
dbus=no
])
AC_PATH_PROG(DBUS_BINDING_TOOL, dbus-binding-tool, no)
AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal, no)
if test "x$DBUS_BINDING_TOOL" = "xno" || test "x$GLIB_GENMARSHAL" = "xno" || test "x$dbus" = "xno" ; then
dbus="no"
else
COMMON_LIBS="$COMMON_LIBS $DBUS_LIBS"
COMMON_CFLAGS="$COMMON_CFLAGS $DBUS_CFLAGS"
AC_DEFINE(USE_DBUS)
AS_AC_EXPAND(DBUS_SERVICES_DIR, "$datadir/dbus-1/services")
AC_SUBST(DBUS_SERVICES_DIR)
AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [Where services dir for DBUS is])
fi
fi
dnl *********************************************************************
dnl ** LIBNOTIFY ********************************************************
dnl *********************************************************************
if test "x$libnotify" = "xyes" ; then
PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= 0.4, [], [
libnotify=no
])
if test "$libnotify" != "no" ; then
GUI_LIBS="$GUI_LIBS $LIBNOTIFY_LIBS"
GUI_CFLAGS="$GUI_CFLAGS $LIBNOTIFY_CFLAGS"
AC_DEFINE(USE_LIBNOTIFY)
fi
fi
dnl *********************************************************************
dnl ** SPELL ************************************************************
dnl *********************************************************************
if test "$spell" = "gtkspell" ; then
PKG_CHECK_MODULES(GTKSPELL, gtkspell-2.0 >= 2.0.2, [], [
spell=no
])
if test "$spell" != "no" ; then
GUI_LIBS="$GUI_LIBS $GTKSPELL_LIBS"
GUI_CFLAGS="$GUI_CFLAGS $GTKSPELL_CFLAGS"
AC_DEFINE(USE_GTKSPELL)
fi
fi
if test "$spell" = "libsexy" ; then
PKG_CHECK_MODULES([LIBSEXY], [libsexy >= 0.1.8], [
libsexy=yes
GUI_LIBS="$GUI_LIBS $LIBSEXY_LIBS"
GUI_CFLAGS="$GUI_CFLAGS $LIBSEXY_CFLAGS"
AC_DEFINE(USE_LIBSEXY)
], [
dnl use builtin static one
spell="static"
])
fi
if test "$spell" = "static" ; then
PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= 2.0.0, [
AC_DEFINE(HAVE_ISO_CODES)
AC_DEFINE(USE_LIBSEXY)
GUI_CFLAGS="$GUI_CFLAGS -I/usr/include/libxml2"
LIBS="$LIBS -lxml2"
], [
AC_MSG_ERROR("Cannot find libxml2")
])
fi
dnl *********************************************************************
dnl ** CONDITIONALS *****************************************************
dnl *********************************************************************
AM_CONDITIONAL(USE_OPENSSL, test "x$openssl" = "xyes")
AM_CONDITIONAL(USE_LIBSEXY, test "x$spell" = "xstatic")
AM_CONDITIONAL(USE_LIBNOTIFY, test "x$libnotify" = "xyes")
AM_CONDITIONAL(DO_TEXT, test "x$textfe" = "xyes")
AM_CONDITIONAL(DO_GTK, test "x$gtkfe" = "xyes")
AM_CONDITIONAL(DO_PERL, test "x$perl" = "xyes")
AM_CONDITIONAL(DO_PYTHON, test "x$python" = "xyes")
AM_CONDITIONAL(DO_TCL, test "x$tcl" = "xyes")
AM_CONDITIONAL(DO_PLUGIN, test "x$plugin" = "xyes")
AM_CONDITIONAL(DO_CHECKSUM, test "x$checksum" = "xyes")
AM_CONDITIONAL(DO_DOAT, test "x$doat" = "xyes")
AM_CONDITIONAL(DO_FISHLIM, test "x$fishlim" = "xyes")
AM_CONDITIONAL(DO_SASL, test "x$sasl" = "xyes")
AM_CONDITIONAL(USE_DBUS, test "x$dbus" = "xyes")
AM_CONDITIONAL(DO_GCONF, test "x$GCONFTOOL" != "xno")
dnl *********************************************************************
dnl ** SOCKS5 ***********************************************************
dnl *********************************************************************
if test "$socks" = yes; then
socks=no
AC_CHECK_LIB(socks5, SOCKSconnect, have_socks=yes)
if test "$have_socks" = yes; then
AC_CHECK_HEADERS(socks.h, have_socks_h=yes)
if test "$have_socks_h" = yes; then
socks=yes
AC_DEFINE(SOCKS)
LIBS="$LIBS -lsocks5"
fi
fi
fi
dnl *********************************************************************
dnl ** MS PROXY *********************************************************
dnl *********************************************************************
have_ntlm="no"
if test "x$ntlm" = "xyes" ; then
have_ntlm="no"
AC_CHECK_LIB(ntlm, ntlm_smb_encrypt, have_ntlm=yes)
if test "$have_ntlm" = yes; then
LIBS="$LIBS -lntlm"
AC_DEFINE(USE_MSPROXY)
fi
fi
dnl *********************************************************************
dnl ** XShm *************************************************************
dnl *********************************************************************
if test "$shm" = yes; then
oldl=$LIBS
oldc=$CPPFLAGS
LIBS="$LIBS `$pkgconfigpath --libs-only-L xft`"
CPPFLAGS="$CPPFLAGS `$pkgconfigpath --cflags-only-I xft`"
shm=no
AC_CHECK_LIB(Xext, XShmAttach, shm=yes)
if test "$shm" = yes; then
shm=no
AC_CHECK_HEADERS(sys/ipc.h, shm=yes)
if test "$shm" = yes; then
shm=no
AC_CHECK_HEADERS(sys/shm.h, shm=yes)
fi
fi
LIBS=$oldl
if test "$shm" = yes; then
GUI_LIBS="$GUI_LIBS `$pkgconfigpath --libs-only-L xft` -lX11 -lXext"
AC_DEFINE(USE_SHM)
else
CPPFLAGS=$oldc
fi
fi
dnl *********************************************************************
dnl ** MMX **************************************************************
dnl *********************************************************************
dnl we don't need mmx on *this* machine, just i386, because
dnl it's checked at runtime.
if test "$mmx" = "yes"; then
case $host_cpu in
i386|i486|i586|i686|i786|k6|k7)
mmx=yes
;;
*)
mmx=no
esac
if test "$system" = "OpenBSD"; then
dnl openbsd fails because mmx_cmod doesn't prefix its symbols with underscore.
dnl xtext.o: Undefined symbol `_shade_ximage_15_mmx' referenced from text segment
mmx=no
fi
if test "$mmx" = "yes"; then
AC_DEFINE(USE_MMX)
fi
fi
AM_CONDITIONAL(USE_MMX, test "$mmx" = "yes")
dnl *********************************************************************
dnl ** GCC FLAGS ********************************************************
dnl *********************************************************************
dnl Only use -Wall and -pipe if we have gcc
if test "x$GCC" = "xyes"; then
if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
CFLAGS="$CFLAGS -Wall"
fi
if test "$system" = "Linux" -o "$system" = "FreeBSD"; then
if test -z "`echo "$CFLAGS" | grep "\-pipe" 2> /dev/null`" ; then
CFLAGS="$CFLAGS -pipe"
fi
fi
if test -z "`echo "$CFLAGS" | grep "\-g " 2> /dev/null`" ; then
CFLAGS="$CFLAGS -g"
fi
fi
dnl does this compiler support -Wno-pointer-sign ?
AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign ])
safe_CFLAGS=$CFLAGS
CFLAGS="-Wno-pointer-sign"
AC_TRY_COMPILE(, [
int main () { return 0 ; }
],
[
no_pointer_sign=yes
AC_MSG_RESULT([yes])
], [
no_pointer_sign=no
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
if test x$no_pointer_sign = xyes; then
CFLAGS="$CFLAGS -Wno-pointer-sign"
fi
dnl does this compiler support -funsigned-char ?
AC_MSG_CHECKING([if gcc accepts -funsigned-char ])
safe_CFLAGS=$CFLAGS
CFLAGS="-funsigned-char"
AC_TRY_COMPILE(, [
int main () { return 0 ; }
],
[
unsigned_char=yes
AC_MSG_RESULT([yes])
], [
unsigned_char=no
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
if test x$unsigned_char = xyes; then
CFLAGS="$CFLAGS -funsigned-char"
fi
dnl *********************************************************************
dnl ** FUNCTIONS/LIBS/CFLAGS ********************************************
dnl *********************************************************************
AC_MSG_CHECKING(for modern sigaction)
dnl libc5 on linux and FreeBSD 3.x doesn't have siginfo_t
dnl and the sa_sigation field.
AC_TRY_COMPILE(
[#include <signal.h>],
[struct sigaction act;
siginfo_t *si;
act.sa_sigaction = 0;],
[
AC_MSG_RESULT(yes)
AC_DEFINE(USE_SIGACTION)
],
AC_MSG_RESULT(no))
AC_PATH_PROG(gdkpixbufcsourcepath, gdk-pixbuf-csource)
AC_SUBST(gdkpixbufcsourcepath)
if test "$gtkfe" != no -a "_$gdkpixbufcsourcepath" = _; then
AC_MSG_ERROR("Cannot find gdk-pixbuf-csource: Install GTK+ 2.0\!")
fi
dnl if we don't have this, use g_snprintf instead
AC_CHECK_FUNCS(snprintf vsnprintf memrchr strtoull)
AC_CHECK_FUNC(gethostbyname, ,
AC_CHECK_LIB(resolv, gethostbyname, ,
AC_CHECK_LIB(nsl, gethostbyname)))
AC_CHECK_FUNC(gethostname, , AC_CHECK_LIB(nsl, gethostname))
dnl necessary for IRIX
AC_CHECK_HEADERS(strings.h)
dnl Check for type in sys/socket.h - from Squid source (GPL)
AC_CACHE_CHECK(for socklen_t, ac_cv_type_socklen_t, [
AC_EGREP_CPP([socklen_t[^a-zA-Z_0-9]], [#include <sys/types.h>
#include <sys/socket.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif],
ac_cv_type_socklen_t=yes,
ac_cv_type_socklen_t=no)
])
if test $ac_cv_type_socklen_t = no; then
AC_DEFINE(socklen_t, int)
fi
dnl Mac OS X and Darwin use lookupd, which caches DNS queries by default
AC_EGREP_CPP(lookupd, dnl
[#if (defined(__APPLE__) && defined(__MACH__))
lookupd
#endif], AC_DEFINE([LOOKUPD],1,[Define to 1 if the system uses lookupd]))
dnl freebsd needs this
LIBS="$LIBS $INTLLIBS"
CFLAGS="$CFLAGS $CPPFLAGS"
GUI_LIBS="$GUI_LIBS $COMMON_LIBS"
dnl make these visible to all Makefiles
AC_SUBST(GUI_LIBS)
AC_SUBST(GUI_CFLAGS)
AC_SUBST(COMMON_LIBS)
AC_SUBST(COMMON_CFLAGS)
AC_SUBST(PERL_CFLAGS)
AC_SUBST(PERL_LDFLAGS)
AC_SUBST(PY_CFLAGS)
AC_SUBST(PY_LIBS)
AC_SUBST(TCL_LIBS)
AC_SUBST(TCL_CFLAGS)
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)
PLUGIN_INCLUDES='-I$(top_srcdir)/plugins'
AC_SUBST(PLUGIN_INCLUDES)
dnl for plugin.c and pixmaps.c
test "x$prefix" = xNONE && prefix="$ac_default_prefix"
test "x$exec_prefix" = xNONE && exec_prefix="$prefix"
AC_DEFINE_UNQUOTED(PREFIX, "${prefix}")
AS_AC_EXPAND(HEXCHATLIBDIR, "${libdir}/hexchat")
AC_DEFINE_UNQUOTED(HEXCHATLIBDIR, "$HEXCHATLIBDIR")
AS_AC_EXPAND(HEXCHATSHAREDIR, "$datadir")
AC_DEFINE_UNQUOTED(HEXCHATSHAREDIR, "$HEXCHATSHAREDIR")
dnl for plugins/xxx/Makefile.am
hexchatlibdir=${libdir}/hexchat
AC_SUBST(hexchatlibdir)
AC_OUTPUT([
Makefile
src/Makefile
src/common/Makefile
src/common/dbus/Makefile
src/fe-text/Makefile
src/fe-gtk/Makefile
src/pixmaps/Makefile
plugins/Makefile
plugins/python/Makefile
plugins/perl/Makefile
plugins/tcl/Makefile
plugins/checksum/Makefile
plugins/doat/Makefile
plugins/fishlim/Makefile
plugins/sasl/Makefile
intl/Makefile
po/Makefile.in
])
echo
echo HexChat $VERSION
echo
echo GTK+ interface ........ : $gtkfe
echo Text interface ........ : $textfe
echo
echo MMX tinting ........... : $mmx
echo XShm tinting .......... : $shm
if test "$xft" = no; then
echo Text backend .......... : Pango
else
echo Text backend .......... : Xft
fi
echo OpenSSL support ....... : $openssl
echo D-Bus support ......... : $dbus
echo libnotify support ..... : $libnotify
echo Spelling .............. : $spell
echo Plugin interface ...... : $plugin
echo NLS/gettext ........... : $USE_NLS
echo IPv6 support .......... : $ipv6
echo MS Proxy NTLM \(ISA\) ... : $have_ntlm
echo
echo Perl .................. : $perl
echo Python ................ : $python
echo Tcl ................... : $tcl
echo
echo Checksum .............. : $checksum
echo Do At ................. : $doat
echo FiSHLiM ............... : $fishlim
echo SASL .................. : $sasl
echo
echo The binary will be installed in $prefix/bin
echo
if test "$gtkfe" = no; then
echo Warning: The GTK \(GUI\) frontend will not be built.
echo
fi
if test "$spell" = "gtkspell"; then
echo Warning: GTK SPELL is not the recommended spelling library.
echo
fi
echo configure complete, now type \'make\' and pray.
echo
static void
chanlist_save (GtkWidget * wid, server *serv)
{
GtkTreeIter iter;
GtkTreeModel *model = GET_MODEL (serv);
if (gtk_tree_model_get_iter_first (model, &iter))
gtkutil_file_req (_("Select an output filename"), chanlist_filereq_done,
serv, NULL, NULL, FRF_WRITE);
}
static gboolean
chanlist_flash (server *serv)
{
if (serv->gui->chanlist_refresh->state != GTK_STATE_ACTIVE)
gtk_widget_set_state (serv->gui->chanlist_refresh, GTK_STATE_ACTIVE);
else
gtk_widget_set_state (serv->gui->chanlist_refresh, GTK_STATE_PRELIGHT);
return TRUE;
}
static void
chanlist_minusers (GtkSpinButton *wid, server *serv)
{
serv->gui->chanlist_minusers = gtk_spin_button_get_value_as_int (wid);
prefs.hex_gui_chanlist_minusers = serv->gui->chanlist_minusers;
save_config();
if (serv->gui->chanlist_minusers < serv->gui->chanlist_minusers_downloaded)
{
if (serv->gui->chanlist_flash_tag == 0)
serv->gui->chanlist_flash_tag = g_timeout_add (500, (GSourceFunc)chanlist_flash, serv);
}
else
{
if (serv->gui->chanlist_flash_tag)
{
g_source_remove (serv->gui->chanlist_flash_tag);
serv->gui->chanlist_flash_tag = 0;
}
}
}
static void
chanlist_maxusers (GtkSpinButton *wid, server *serv)
{
serv->gui->chanlist_maxusers = gtk_spin_button_get_value_as_int (wid);
prefs.hex_gui_chanlist_maxusers = serv->gui->chanlist_maxusers;
save_config();
}
static void
chanlist_dclick_cb (GtkTreeView *view, GtkTreePath *path,
GtkTreeViewColumn *column, gpointer data)
{
chanlist_join (0, (server *) data); /* double clicked a row */
}
static void
chanlist_menu_destroy (GtkWidget *menu, gpointer userdata)
{
gtk_widget_destroy (menu);
g_object_unref (menu);
}
static void
chanlist_copychannel (GtkWidget *item, server *serv)
{
char *chan = chanlist_get_selected (serv, FALSE);
if (chan)
{
gtkutil_copy_to_clipboard (item, NULL, chan);
g_free (chan);
}
}
static void
chanlist_copytopic (GtkWidget *item, server *serv)
{
char *topic = chanlist_get_selected (serv, TRUE);
if (topic)
{
gtkutil_copy_to_clipboard (item, NULL, topic);
g_free (topic);
}
}
static gboolean
chanlist_button_cb (GtkTreeView *tree, GdkEventButton *event, server *serv)
{
GtkWidget *menu;
GtkTreeSelection *sel;
GtkTreePath *path;
char *chan;
if (event->button != 3)
return FALSE;
if (!gtk_tree_view_get_path_at_pos (tree, event->x, event->y, &path, 0, 0, 0))
return FALSE;
/* select what they right-clicked on */
sel = gtk_tree_view_get_selection (tree);
gtk_tree_selection_unselect_all (sel);
gtk_tree_selection_select_path (sel, path);
gtk_tree_path_free (path);
menu = gtk_menu_new ();
if (event->window)
gtk_menu_set_screen (GTK_MENU (menu), gdk_drawable_get_screen (event->window));
g_object_ref (menu);
g_object_ref_sink (menu);
g_object_unref (menu);
g_signal_connect (G_OBJECT (menu), "selection-done",
G_CALLBACK (chanlist_menu_destroy), NULL);
mg_create_icon_item (_("_Join Channel"), GTK_STOCK_JUMP_TO, menu,
chanlist_join, serv);
mg_create_icon_item (_("_Copy Channel Name"), GTK_STOCK_COPY, menu,
chanlist_copychannel, serv);
mg_create_icon_item (_("Copy _Topic Text"), GTK_STOCK_COPY, menu,
chanlist_copytopic, serv);
chan = chanlist_get_selected (serv, FALSE);
menu_addfavoritemenu (serv, menu, chan, FALSE);
g_free (chan);
gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 0, event->time);
return TRUE;
}
static void
chanlist_destroy_widget (GtkWidget *wid, server *serv)
{
custom_list_clear ((CustomList *)GET_MODEL (serv));
chanlist_data_free (serv);
if (serv->gui->chanlist_flash_tag)
{
g_source_remove (serv->gui->chanlist_flash_tag);
serv->gui->chanlist_flash_tag = 0;
}
if (serv->gui->chanlist_tag)
{
g_source_remove (serv->gui->chanlist_tag);
serv->gui->chanlist_tag = 0;
}
#ifndef WIN32
if (serv->gui->have_regex)
{
regfree (&serv->gui->chanlist_match_regex);
serv->gui->have_regex = 0;
}
#endif
}
static void
chanlist_closegui (GtkWidget *wid, server *serv)
{
if (is_server (serv))
serv->gui->chanlist_window = NULL;
}
static void
chanlist_add_column (GtkWidget *tree, int textcol, int size, char *title, gboolean right_justified)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *col;
renderer = gtk_cell_renderer_text_new ();
if (right_justified)
g_object_set (G_OBJECT (renderer), "xalign", (gfloat) 1.0, NULL);
g_object_set (G_OBJECT (renderer), "ypad", (gint) 0, NULL);
gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (tree), -1, title,
renderer, "text", textcol, NULL);
gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (renderer), 1);
col = gtk_tree_view_get_column (GTK_TREE_VIEW (tree), textcol);
gtk_tree_view_column_set_sort_column_id (col, textcol);
gtk_tree_view_column_set_resizable (col, TRUE);
if (textcol != COL_TOPIC)
{
gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_FIXED);
gtk_tree_view_column_set_fixed_width (col, size);
}
}
static void
chanlist_combo_cb (GtkWidget *combo, server *serv)
{
serv->gui->chanlist_search_type = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
}
void
chanlist_opengui (server *serv, int do_refresh)
{
GtkWidget *vbox, *hbox, *table, *wid, *view;
char tbuf[256];
GtkListStore *store;
if (serv->gui->chanlist_window)
{
mg_bring_tofront (serv->gui->chanlist_window);
return;
}
snprintf (tbuf, sizeof tbuf, _(DISPLAY_NAME": Channel List (%s)"),
server_get_network (serv, TRUE));
serv->gui->chanlist_pending_rows = NULL;
serv->gui->chanlist_tag = 0;
serv->gui->chanlist_flash_tag = 0;
serv->gui->chanlist_data_stored_rows = NULL;
if (!serv->gui->chanlist_minusers)
{
if (prefs.hex_gui_chanlist_minusers < 1 || prefs.hex_gui_chanlist_minusers > 999999)
{
prefs.hex_gui_chanlist_minusers = 5;
save_config();
}
serv->gui->chanlist_minusers = prefs.hex_gui_chanlist_minusers;
}
if (!serv->gui->chanlist_maxusers)
{
if (prefs.hex_gui_chanlist_maxusers < 1 || prefs.hex_gui_chanlist_maxusers > 999999)
{
prefs.hex_gui_chanlist_maxusers = 9999;
save_config();
}
serv->gui->chanlist_maxusers = prefs.hex_gui_chanlist_maxusers;
}
serv->gui->chanlist_window =
mg_create_generic_tab ("ChanList", tbuf, FALSE, TRUE, chanlist_closegui,
serv, 640, 480, &vbox, serv);
gtkutil_destroy_on_esc (serv->gui->chanlist_window);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
gtk_box_set_spacing (GTK_BOX (vbox), 12);
/* make a label to store the user/channel info */
wid = gtk_label_new (NULL);
gtk_box_pack_start (GTK_BOX (vbox), wid, 0, 0, 0);
gtk_widget_show (wid);
serv->gui->chanlist_label = wid;
/* ============================================================= */
store = (GtkListStore *) custom_list_new();
view = gtkutil_treeview_new (vbox, GTK_TREE_MODEL (store), NULL, -1);
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (view->parent),
GTK_SHADOW_IN);
serv->gui->chanlist_list = view;
g_signal_connect (G_OBJECT (view), "row_activated",
G_CALLBACK (chanlist_dclick_cb), serv);
g_signal_connect (G_OBJECT (view), "button-press-event",
G_CALLBACK (chanlist_button_cb), serv);
chanlist_add_column (view, COL_CHANNEL, 96, _("Channel"), FALSE);
chanlist_add_column (view, COL_USERS, 50, _("Users"), TRUE);
chanlist_add_column (view, COL_TOPIC, 50, _("Topic"), FALSE);
gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (view), TRUE);
/* this is a speed up, but no horizontal scrollbar :( */
/*gtk_tree_view_set_fixed_height_mode (GTK_TREE_VIEW (view), TRUE);*/
gtk_widget_show (view);
/* ============================================================= */
table = gtk_table_new (4, 4, FALSE);
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
gtk_table_set_row_spacings (GTK_TABLE (table), 3);
gtk_box_pack_start (GTK_BOX (vbox), table, 0, 1, 0);
gtk_widget_show (table);
wid = gtkutil_button (NULL, GTK_STOCK_FIND, 0, chanlist_search_pressed, serv,
_("_Search"));
serv->gui->chanlist_search = wid;
gtk_table_attach (GTK_TABLE (table), wid, 3, 4, 3, 4,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
wid = gtkutil_button (NULL, GTK_STOCK_REFRESH, 0, chanlist_refresh, serv,
_("_Download List"));
serv->gui->chanlist_refresh = wid;
gtk_table_attach (GTK_TABLE (table), wid, 3, 4, 2, 3,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
wid = gtkutil_button (NULL, GTK_STOCK_SAVE_AS, 0, chanlist_save, serv,
_("Save _List..."));
serv->gui->chanlist_savelist = wid;
gtk_table_attach (GTK_TABLE (table), wid, 3, 4, 1, 2,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
wid = gtkutil_button (NULL, GTK_STOCK_JUMP_TO, 0, chanlist_join, serv,
_("_Join Channel"));
serv->gui->chanlist_join = wid;
gtk_table_attach (GTK_TABLE (table), wid, 3, 4, 0, 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
/* ============================================================= */
wid = gtk_label_new (_("Show only:"));
gtk_misc_set_alignment (GTK_MISC (wid), 0, 0.5);
gtk_table_attach (GTK_TABLE (table), wid, 0, 1, 3, 4,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (wid);
hbox = gtk_hbox_new (0, 0);
gtk_box_set_spacing (GTK_BOX (hbox), 9);
gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, 3, 4,
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (hbox);
wid = gtk_label_new (_("channels with"));
gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0);
gtk_widget_show (wid);
wid = gtk_spin_button_new_with_range (1, 999999, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (wid),
serv->gui->chanlist_minusers);
g_signal_connect (G_OBJECT (wid), "value_changed",
G_CALLBACK (chanlist_minusers), serv);
gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0);
gtk_widget_show (wid);
serv->gui->chanlist_min_spin = wid;
wid = gtk_label_new (_("to"));
gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0);
gtk_widget_show (wid);
wid = gtk_spin_button_new_with_range (1, 999999, 1);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (wid),
serv->gui->chanlist_maxusers);
g_signal_connect (G_OBJECT (wid), "value_changed",
G_CALLBACK (chanlist_maxusers), serv);
gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0);
gtk_widget_show (wid);
wid = gtk_label_new (_("users."));
gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0);
gtk_widget_show (wid);
/* ============================================================= */
wid = gtk_label_new (_("Look in:"));
gtk_misc_set_alignment (GTK_MISC (wid), 0, 0.5);
gtk_table_attach (GTK_TABLE (table), wid, 0, 1, 2, 3,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (wid);
hbox = gtk_hbox_new (0, 0);
gtk_box_set_spacing (GTK_BOX (hbox), 12);
gtk_table_attach (GTK_TABLE (table), hbox, 1, 2, 2, 3,
GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (hbox);
wid = gtk_check_button_new_with_label (_("Channel name"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (wid), TRUE);
gtk_signal_connect (GTK_OBJECT (wid), "toggled",
GTK_SIGNAL_FUNC
(chanlist_match_channel_button_toggled), serv);
gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0);
gtk_widget_show (wid);
wid = gtk_check_button_new_with_label (_("Topic"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (wid), TRUE);
gtk_signal_connect (GTK_OBJECT (wid), "toggled",
GTK_SIGNAL_FUNC (chanlist_match_topic_button_toggled),
serv);
gtk_box_pack_start (GTK_BOX (hbox), wid, 0, 0, 0);
gtk_widget_show (wid);
serv->gui->chanlist_match_wants_channel = 1;
serv->gui->chanlist_match_wants_topic = 1;
/* ============================================================= */
wid = gtk_label_new (_("Search type:"));
gtk_misc_set_alignment (GTK_MISC (wid), 0, 0.5);
gtk_table_attach (GTK_TABLE (table), wid, 0, 1, 1, 2,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (wid);
wid = gtk_combo_box_new_text ();
gtk_combo_box_append_text (GTK_COMBO_BOX (wid), _("Simple Search"));
gtk_combo_box_append_text (GTK_COMBO_BOX (wid), _("Pattern Match (Wildcards)"));
#ifndef WIN32
gtk_combo_box_append_text (GTK_COMBO_BOX (wid), _("Regular Expression"));
#endif
gtk_combo_box_set_active (GTK_COMBO_BOX (wid), serv->gui->chanlist_search_type);
gtk_table_attach (GTK_TABLE (table), wid, 1, 2, 1, 2,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
g_signal_connect (G_OBJECT (wid), "changed",
G_CALLBACK (chanlist_combo_cb), serv);
gtk_widget_show (wid);
/* ============================================================= */
wid = gtk_label_new (_("Find:"));
gtk_misc_set_alignment (GTK_MISC (wid), 0, 0.5);
gtk_table_attach (GTK_TABLE (table), wid, 0, 1, 0, 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (wid);
wid = gtk_entry_new_with_max_length (255);
gtk_signal_connect (GTK_OBJECT (wid), "changed",
GTK_SIGNAL_FUNC (chanlist_find_cb), serv);
gtk_signal_connect (GTK_OBJECT (wid), "activate",
GTK_SIGNAL_FUNC (chanlist_search_pressed),
(gpointer) serv);
gtk_table_attach (GTK_TABLE (table), wid, 1, 2, 0, 1,
GTK_EXPAND | GTK_FILL, 0, 0, 0);
gtk_widget_show (wid);
serv->gui->chanlist_wild = wid;
chanlist_find_cb (wid, serv);
/* ============================================================= */
wid = gtk_vseparator_new ();
gtk_table_attach (GTK_TABLE (table), wid, 2, 3, 0, 5,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (wid);
g_signal_connect (G_OBJECT (serv->gui->chanlist_window), "destroy",
G_CALLBACK (chanlist_destroy_widget), serv);
/* reset the counters. */
chanlist_reset_counters (serv);
serv->gui->chanlist_tag = g_timeout_add (250, (GSourceFunc)chanlist_timeout, serv);
if (do_refresh)
chanlist_do_refresh (serv);
chanlist_update_buttons (serv);
gtk_widget_show (serv->gui->chanlist_window);
gtk_widget_grab_focus (serv->gui->chanlist_refresh);
}