update xchat to r1494

This commit is contained in:
berkeviktor@aol.com 2011-04-16 19:18:20 +02:00
parent 798fa386aa
commit ca434e0e7a
3 changed files with 65 additions and 115 deletions

View File

@ -35,10 +35,12 @@ AH_VERBATIM([XCHATLIBDIR],[#undef XCHATLIBDIR])
AH_VERBATIM([XCHATSHAREDIR],[#undef XCHATSHAREDIR]) AH_VERBATIM([XCHATSHAREDIR],[#undef XCHATSHAREDIR])
AH_VERBATIM([SOCKS],[#undef SOCKS]) AH_VERBATIM([SOCKS],[#undef SOCKS])
AH_VERBATIM([USE_MSPROXY],[#undef USE_MSPROXY]) AH_VERBATIM([USE_MSPROXY],[#undef USE_MSPROXY])
AH_VERBATIM([USE_LIBPROXY],[#undef USE_LIBPROXY])
dnl AH_VERBATIM([USE_GNOME],[#undef USE_GNOME]) dnl AH_VERBATIM([USE_GNOME],[#undef USE_GNOME])
AH_VERBATIM([USE_SHM],[#undef USE_SHM]) AH_VERBATIM([USE_SHM],[#undef USE_SHM])
AH_VERBATIM([USE_GTKSPELL],[#undef USE_GTKSPELL]) AH_VERBATIM([USE_GTKSPELL],[#undef USE_GTKSPELL])
AH_VERBATIM([USE_LIBSEXY],[#undef USE_LIBSEXY]) AH_VERBATIM([USE_LIBSEXY],[#undef USE_LIBSEXY])
AH_VERBATIM([USE_LIBNOTIFY],[#undef USE_LIBNOTIFY])
AH_VERBATIM([USE_IPV6],[#undef USE_IPV6]) AH_VERBATIM([USE_IPV6],[#undef USE_IPV6])
AH_VERBATIM([USE_MMX],[#undef USE_MMX]) AH_VERBATIM([USE_MMX],[#undef USE_MMX])
AH_VERBATIM([USE_OPENSSL],[#undef USE_OPENSSL]) AH_VERBATIM([USE_OPENSSL],[#undef USE_OPENSSL])
@ -131,6 +133,10 @@ AC_ARG_ENABLE(dbus,
[ --disable-dbus disable DBUS support], [ --disable-dbus disable DBUS support],
dbus=$enableval, dbus=yes) dbus=$enableval, dbus=yes)
AC_ARG_ENABLE(libnotify,
[ --disable-libnotify disable libnotify support],
libnotify=$enableval, libnotify=yes)
AC_ARG_ENABLE(mmx, AC_ARG_ENABLE(mmx,
[ --disable-mmx disable MMX assembly routines], [ --disable-mmx disable MMX assembly routines],
mmx=$enableval, mmx=yes) mmx=$enableval, mmx=yes)
@ -434,8 +440,13 @@ dnl *********************************************************************
dnl ** LIBPROXY ********************************************************* dnl ** LIBPROXY *********************************************************
dnl ********************************************************************* dnl *********************************************************************
PKG_CHECK_MODULES([LIBPROXY], [libproxy-1.0], [libproxy=1], [libproxy=0]) PKG_CHECK_MODULES([LIBPROXY], [libproxy-1.0], [libproxy=yes], [
AC_DEFINE_UNQUOTED([USE_LIBPROXY], [$libproxy], [Use libproxy]) AC_MSG_RESULT(no)
libproxy=no
])
if test "x$libproxy" = "xyes" ; then
AC_DEFINE(USE_LIBPROXY)
fi
dnl ********************************************************************* dnl *********************************************************************
dnl ** PLUGIN *********************************************************** dnl ** PLUGIN ***********************************************************
@ -493,6 +504,22 @@ if test "x$dbus" = "xyes" ; then
fi fi
fi fi
dnl *********************************************************************
dnl ** LIBNOTIFY ********************************************************
dnl *********************************************************************
if test "x$libnotify" = "xyes" ; then
PKG_CHECK_MODULES(LIBNOTIFY, libnotify >= 0.4, [], [
AC_MSG_RESULT(no)
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 *********************************************************************
dnl ** SPELL ************************************************************ dnl ** SPELL ************************************************************
dnl ********************************************************************* dnl *********************************************************************
@ -531,6 +558,7 @@ dnl *********************************************************************
AM_CONDITIONAL(USE_OPENSSL, test "x$openssl" = "xyes") AM_CONDITIONAL(USE_OPENSSL, test "x$openssl" = "xyes")
AM_CONDITIONAL(USE_LIBSEXY, test "x$spell" = "xstatic") 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_TEXT, test "x$textfe" = "xyes")
AM_CONDITIONAL(DO_GTK, test "x$gtkfe" = "xyes") AM_CONDITIONAL(DO_GTK, test "x$gtkfe" = "xyes")
AM_CONDITIONAL(DO_PERL, test "x$perl" = "xyes") AM_CONDITIONAL(DO_PERL, test "x$perl" = "xyes")
@ -819,6 +847,7 @@ else
fi fi
echo openssl support ..... : $openssl\ ipv6 support .......... : $ipv6 echo openssl support ..... : $openssl\ ipv6 support .......... : $ipv6
echo dbus support ........ : $dbus\ msproxy ntlm \(ISA\) .... : $have_ntlm echo dbus support ........ : $dbus\ msproxy ntlm \(ISA\) .... : $have_ntlm
echo libnotify support ... : $libnotify
echo echo
echo The binary will be installed in $prefix/bin echo The binary will be installed in $prefix/bin
echo echo

View File

@ -1558,8 +1558,9 @@ server_child (server * serv)
g_strfreev (proxy_list); g_strfreev (proxy_list);
g_free (url); g_free (url);
}
#endif #endif
} else if (prefs.proxy_host[0] && else if (prefs.proxy_host[0] &&
prefs.proxy_type > 0 && prefs.proxy_type > 0 &&
prefs.proxy_use != 2) /* proxy is NOT dcc-only */ prefs.proxy_use != 2) /* proxy is NOT dcc-only */
{ {

View File

@ -15,7 +15,17 @@
#include "menu.h" #include "menu.h"
#include <gtk/gtk.h> #include <gtk/gtk.h>
#define LIBNOTIFY #ifdef USE_LIBNOTIFY
#include <libnotify/notify.h>
#ifndef NOTIFY_CHECK_VERSION
#define NOTIFY_CHECK_VERSION(x,y,z) 0
#endif
#if NOTIFY_CHECK_VERSION(0,7,0)
#define XC_NOTIFY_NEW(a,b,c,d) notify_notification_new(a,b,c)
#else
#define XC_NOTIFY_NEW(a,b,c,d) notify_notification_new(a,b,c,d)
#endif
#endif
typedef enum /* current icon status */ typedef enum /* current icon status */
{ {
@ -117,80 +127,6 @@ fe_tray_set_tooltip (const char *text)
gtk_status_icon_set_tooltip (sticon, text); gtk_status_icon_set_tooltip (sticon, text);
} }
#ifdef LIBNOTIFY
/* dynamic access to libnotify.so */
static void *nn_mod = NULL;
/* prototypes */
static gboolean (*nn_init) (char *);
static void (*nn_uninit) (void);
/* recent versions of libnotify don't take the fourth GtkWidget argument, but passing an
* extra NULL argument will be fine */
static void *(*nn_new) (const gchar *summary, const gchar *message, const gchar *icon, gpointer dummy);
static gboolean (*nn_show) (void *noti, GError **error);
static void (*nn_set_timeout) (void *noti, gint timeout);
static void
libnotify_cleanup (void)
{
if (nn_mod)
{
nn_uninit ();
g_module_close (nn_mod);
nn_mod = NULL;
}
}
static gboolean
libnotify_notify_new (const char *title, const char *text, GtkStatusIcon *icon)
{
void *noti;
if (!nn_mod)
{
nn_mod = g_module_open ("libnotify", G_MODULE_BIND_LAZY);
if (!nn_mod)
{
nn_mod = g_module_open ("libnotify.so.1", G_MODULE_BIND_LAZY);
if (!nn_mod)
return FALSE;
}
if (!g_module_symbol (nn_mod, "notify_init", (gpointer)&nn_init))
goto bad;
if (!g_module_symbol (nn_mod, "notify_uninit", (gpointer)&nn_uninit))
goto bad;
if (!g_module_symbol (nn_mod, "notify_notification_new", (gpointer)&nn_new))
goto bad;
if (!g_module_symbol (nn_mod, "notify_notification_show", (gpointer)&nn_show))
goto bad;
if (!g_module_symbol (nn_mod, "notify_notification_set_timeout", (gpointer)&nn_set_timeout))
goto bad;
if (!nn_init (PACKAGE_NAME))
goto bad;
}
text = strip_color (text, -1, STRIP_ALL|STRIP_ESCMARKUP);
title = strip_color (title, -1, STRIP_ALL);
noti = nn_new (title, text, XCHATSHAREDIR"/pixmaps/xchat.png", NULL);
g_free ((char *)title);
g_free ((char *)text);
nn_set_timeout (noti, prefs.input_balloon_time*1000);
nn_show (noti, NULL);
g_object_unref (G_OBJECT (noti));
return TRUE;
bad:
g_module_close (nn_mod);
nn_mod = NULL;
return FALSE;
}
#endif
void void
fe_tray_set_balloon (const char *title, const char *text) fe_tray_set_balloon (const char *title, const char *text)
{ {
@ -213,42 +149,26 @@ fe_tray_set_balloon (const char *title, const char *text)
if (!text) if (!text)
return; return;
#ifdef LIBNOTIFY #ifdef USE_LIBNOTIFY
/* try it via libnotify.so */ NotifyNotification *notification;
if (libnotify_notify_new (title, text, sticon)) char *notify_text, *notify_title;
return; /* success */
#endif
/* try it the crude way */ if (!notify_is_initted())
path = g_find_program_in_path ("notify-send"); notify_init(PACKAGE_NAME);
if (path)
{ notify_text = strip_color (text, -1, STRIP_ALL|STRIP_ESCMARKUP);
sprintf(time, "%d000",prefs.input_balloon_time); notify_title = strip_color (title, -1, STRIP_ALL);
argv[0] = path;
argv[1] = "-i"; notification = XC_NOTIFY_NEW (notify_title, notify_text, XCHATSHAREDIR"/pixmaps/xchat.png", NULL);
argv[2] = "gtk-dialog-info";
if (access (XCHATSHAREDIR"/pixmaps/xchat.png", R_OK) == 0) g_free ((char *)notify_title);
argv[2] = XCHATSHAREDIR"/pixmaps/xchat.png"; g_free ((char *)notify_text);
argv[3] = "-t";
argv[4] = time; notify_notification_set_timeout (notification, prefs.input_balloon_time*1000);
argv[5] = title; notify_notification_show (notification, NULL);
text = strip_color (text, -1, STRIP_ALL|STRIP_ESCMARKUP);
argv[6] = text; g_object_unref (notification);
argv[7] = NULL; #endif
xchat_execv (argv);
g_free ((char *)path);
g_free ((char *)text);
}
else
{
/* show this error only once */
static unsigned char said_it = FALSE;
if (!said_it)
{
said_it = TRUE;
fe_message (_("Cannot find 'notify-send' to open balloon alerts.\nPlease install libnotify."), FE_MSG_ERROR);
}
}
#endif #endif
} }
@ -845,8 +765,8 @@ tray_plugin_deinit (xchat_plugin *plugin_handle)
{ {
#ifdef WIN32 #ifdef WIN32
tray_cleanup (); tray_cleanup ();
#elif defined(LIBNOTIFY) #elif defined(USE_LIBNOTIFY)
libnotify_cleanup (); notify_uninit ();
#endif #endif
return 1; return 1;
} }