# HG changeset patch # User Luke Schierer # Date 1043613805 0 # Node ID 801830dec40994f13be0e4414e6ccf3a3a13df1f # Parent bf770f11132b5b142d165f4e20e8954c6f207a72 [gaim-migrate @ 4705] robot101 gave me a bad patch committer: Tailor Script diff -r bf770f11132b -r 801830dec409 configure.ac --- a/configure.ac Sun Jan 26 20:41:49 2003 +0000 +++ b/configure.ac Sun Jan 26 20:43:25 2003 +0000 @@ -122,7 +122,10 @@ AC_DEFINE_UNQUOTED(STATIC_PROTO_INIT, $extern_init void static_proto_init() { $load_proto }, [Loads static protocol plugin module initialization functions.]) -AC_ARG_ENABLE(audio, [ --disable-audio compile without libao/libaudiofile for sound playing],,enable_audio=yes) +AC_ARG_ENABLE(esd, [ --disable-esd Turn off ESD (default=auto)],,enable_esd=yes) +AC_ARG_ENABLE(nas, [ --enable-nas Enable NAS (Network Audio System) support],,enable_nas=no) +AC_ARG_ENABLE(artsc, [ --disable-artsc Turn off ArtsC (default=auto)],,enable_artsc=yes) + AC_ARG_ENABLE(plugins, [ --disable-plugins compile without plugin support],,enable_plugins=yes) AC_ARG_ENABLE(perl, [ --disable-perl compile without perl scripting],,enable_perl=yes) AC_ARG_ENABLE(gtkspell, [ --disable-gtkspell compile without GtkSpell automatic spell checking],,enable_gtkspell=yes) @@ -271,28 +274,45 @@ fi fi -if test "$enable_audio" = yes ; then - AC_CHECK_HEADERS(ao/ao.h, found_ao_lib=true, found_ao_lib=false) - if test "$found_ao_lib" = "true"; then - AC_CHECK_LIB(ao, ao_initialize, found_ao_lib=true, found_ao_lib=false) - fi - - AC_CHECK_HEADERS(audiofile.h, found_af_lib=true, found_af_lib=false) - if test "$found_af_lib" = "true"; then - AC_CHECK_LIB(audiofile, afOpenFile, found_af_lib=true, found_af_lib=false) +if test "$enable_nas" = yes ; then + AC_DEFINE(NAS_SOUND, 1, [Define if we have NAS sound support.]) + SOUND_LIBS="-laudio -lXt" +fi +if test "$enable_esd" = yes ; then + AM_PATH_GESD + if test "$no_esd" != yes ; then + old_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $ESD_CFLAGS" + AC_TRY_COMPILE(,[#include ], + [ + AC_DEFINE(ESD_SOUND, 1, [Define if we have ESD sound support.]) + SOUND_LIBS="$SOUND_LIBS $ESD_LIBS" + ],[ + enable_esd=no + CFLAGS="$old_CFLAGS" + ]) + else + enable_esd=no + fi +fi +if test "x$enable_artsc" = "xyes"; then + AM_PATH_ARTSC + if test "x$no_artsc" != "xyes" ; then + old_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $ARTSC_CFLAGS" + AC_TRY_COMPILE(,[#include ], + [ + AC_DEFINE(ARTSC_SOUND, 1, [Define if we have artsc sound support.]) + SOUND_LIBS="$SOUND_LIBS $ARTSC_LIBS" + ],[ + enable_artsc=no + CFLAGS="$old_CFLAGS" + ]) + else + enable_artsc=no fi - - if test "$found_ao_lib" = "true" -a "$found_af_lib" = "true"; then - SOUND_LIBS="-lao -laudiofile" - AC_SUBST(SOUND_LIBS) - AC_DEFINE(USE_AO, 1, [Define if we're using libao and libaudiofile for sound playing]) - enable_audio=yes - else - enable_audio=no - fi -else - enable_audio=no fi +AC_SUBST(SOUND_LIBS) if test "$ac_cv_cygwin" = yes ; then LDADD="$LDADD -static" @@ -422,16 +442,20 @@ echo Build Protocol Plugins........ : $enable_prpls echo Protocols to link statically.. : $STATIC_PRPLS echo -echo UI Library.................... : GTK 2.x +echo UI Library.................... : GTK 2.0 echo echo Build with Plugin support..... : $enable_plugins echo Build with Perl support....... : $enable_perl -echo Build with Audio support...... : $enable_audio -echo Build with GtkSpell support... : $enable_gtkspell +echo +echo Build with GtkSpell............: $enable_gtkspell echo echo Use XScreenSaver Extension.... : $enable_xss echo Use X Session Management...... : $enable_sm echo +echo Build with ESD................ : $enable_esd +echo Build with NAS................ : $enable_nas +echo Build with ArtsC.............. : $enable_artsc +echo echo Print debugging messages...... : $enable_debug echo eval eval echo Gaim will be installed in $bindir. diff -r bf770f11132b -r 801830dec409 configure.in --- a/configure.in Sun Jan 26 20:41:49 2003 +0000 +++ b/configure.in Sun Jan 26 20:43:25 2003 +0000 @@ -112,13 +112,16 @@ AC_DEFINE_UNQUOTED(STATIC_PROTO_INIT, $extern_init void static_proto_init() { $load_proto }, [Loads static protocol plugin module initialization functions.]) -AC_ARG_ENABLE(audio, [ --disable-audio compile without libao/libaudiofile for sound playing],,enable_audio=yes) +AC_ARG_ENABLE(esd, [ --disable-esd Turn off ESD (default=auto)],,enable_esd=yes) +AC_ARG_ENABLE(nas, [ --enable-nas Enable NAS (Network Audio System) support],,enable_nas=no) +AC_ARG_ENABLE(artsc, [ --disable-artsc Turn off ArtsC (default=auto)],,enable_artsc=yes) + AC_ARG_ENABLE(plugins, [ --disable-plugins compile without plugin support],,enable_plugins=yes) AC_ARG_ENABLE(perl, [ --disable-perl compile without perl scripting],,enable_perl=yes) AC_ARG_ENABLE(gtkspell, [ --disable-gtkspell compile without GtkSpell automatic spell checking],,enable_gtkspell=yes) + AC_ARG_ENABLE(debug, [ --enable-debug compile with debugging support],,enable_debug=no) AC_ARG_ENABLE(screensaver, [ --disable-screensaver compile without X screensaver extension],,enable_xss=yes) -AC_ARG_ENABLE(sm, [ --disable-sm compile without X session management support],,enable_sm=yes) AC_ARG_WITH(krb4, [ --with-krb4=PREFIX Compile Zephyr plugin with Kerberos 4 support],kerberos="$withval",kerberos="no") if test "$enable_debug" = yes ; then @@ -245,28 +248,45 @@ fi fi -if test "$enable_audio" = yes ; then - AC_CHECK_HEADERS(ao/ao.h, found_ao_lib=true, found_ao_lib=false) - if test "$found_ao_lib" = "true"; then - AC_CHECK_LIB(ao, ao_initialize, found_ao_lib=true, found_ao_lib=false) - fi - - AC_CHECK_HEADERS(audiofile.h, found_af_lib=true, found_af_lib=false) - if test "$found_af_lib" = "true"; then - AC_CHECK_LIB(audiofile, afOpenFile, found_af_lib=true, found_af_lib=false) +if test "$enable_nas" = yes ; then + AC_DEFINE(NAS_SOUND, 1, [Define if we have NAS sound support.]) + SOUND_LIBS="-laudio -lXt" +fi +if test "$enable_esd" = yes ; then + AM_PATH_GESD + if test "$no_esd" != yes ; then + old_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $ESD_CFLAGS" + AC_TRY_COMPILE(,[#include ], + [ + AC_DEFINE(ESD_SOUND, 1, [Define if we have ESD sound support.]) + SOUND_LIBS="$SOUND_LIBS $ESD_LIBS" + ],[ + enable_esd=no + CFLAGS="$old_CFLAGS" + ]) + else + enable_esd=no + fi +fi +if test "x$enable_artsc" = "xyes"; then + AM_PATH_ARTSC + if test "x$no_artsc" != "xyes" ; then + old_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $ARTSC_CFLAGS" + AC_TRY_COMPILE(,[#include ], + [ + AC_DEFINE(ARTSC_SOUND, 1, [Define if we have artsc sound support.]) + SOUND_LIBS="$SOUND_LIBS $ARTSC_LIBS" + ],[ + enable_artsc=no + CFLAGS="$old_CFLAGS" + ]) + else + enable_artsc=no fi - - if test "$found_ao_lib" = "true" -a "$found_af_lib" = "true"; then - SOUND_LIBS="-lao -laudiofile" - AC_SUBST(SOUND_LIBS) - AC_DEFINE(USE_AO, 1, [Define if we're using libao and libaudiofile for sound playing]) - enable_audio=yes - else - enable_audio=no - fi -else - enable_audio=no fi +AC_SUBST(SOUND_LIBS) if test "$ac_cv_cygwin" = yes ; then LDADD="$LDADD -static" @@ -398,15 +418,18 @@ echo Build Protocol Plugins........ : $enable_prpls echo Protocols to link statically.. : $STATIC_PRPLS echo -echo UI Library.................... : GTK 2.x +echo UI Library.................... : GTK 2.0 echo echo Build with Plugin support..... : $enable_plugins echo Build with Perl support....... : $enable_perl -echo Build with Audio support...... : $enable_audio -echo Build with GtkSpell support... : $enable_gtkspell +echo +echo Build with GtkSpell............: $enable_gtkspell echo echo Use XScreenSaver Extension.... : $enable_xss -echo Use X Session Management...... : $enable_sm +echo +echo Build with ESD................ : $enable_esd +echo Build with NAS................ : $enable_nas +echo Build with ArtsC.............. : $enable_artsc echo echo Print debugging messages...... : $enable_debug echo diff -r bf770f11132b -r 801830dec409 src/aim.c --- a/src/aim.c Sun Jan 26 20:41:49 2003 +0000 +++ b/src/aim.c Sun Jan 26 20:43:25 2003 +0000 @@ -896,8 +896,6 @@ gtk_main(); core_quit(); /* don't need ui_quit here because ui doesn't create anything */ - /* maybe we do now? -Robot101 */ - sound_quit(); #ifdef _WIN32 wgaim_cleanup(); #endif diff -r bf770f11132b -r 801830dec409 src/browser.c --- a/src/browser.c Sun Jan 26 20:41:49 2003 +0000 +++ b/src/browser.c Sun Jan 26 20:43:25 2003 +0000 @@ -487,106 +487,263 @@ gdk_x11_xatom_to_atom (XA_STRING), 8, GDK_PROP_MODE_REPLACE, (unsigned char *)command, strlen(command)); - gdk_window_add_filter(window, (GdkFilterFunc) netscape_response_cb, window); + while (!done) { + GdkEvent *event; + + event = gdk_event_get(); + + if (!event) + continue; + + if (event->any.window != window) { + gtk_main_do_event(event); + continue; + } + + if (event->type == GDK_DESTROY && event->any.window == window) { + + /* Print to warn user... */ + debug_printf("%s: window 0x%x was destroyed.\n", progname, (unsigned int)window); + result = 6; + done = True; + } else if (event->type == GDK_PROPERTY_NOTIFY && + event->property.state == GDK_PROPERTY_NEW_VALUE && + event->property.window == window && + event->property.atom == GDKA_MOZILLA_RESPONSE) { + GdkAtom actual_type; + gint actual_format, nitems; + unsigned char *data = 0; + + result = gdk_property_get(window, GDKA_MOZILLA_RESPONSE, + gdk_x11_xatom_to_atom (XA_STRING), 0, + (65536 / sizeof(long)), + 1, &actual_type, &actual_format, &nitems, &data); + + + if (result == Success && data && *data) { + debug_printf("%s: (server sent " MOZILLA_RESPONSE_PROP + " \"%s\" to 0x%x.)\n", + progname, data, (unsigned int)window); + } + + if (result != Success) { + debug_printf("%s: failed reading " MOZILLA_RESPONSE_PROP + " from window 0x%0x.\n", progname, (unsigned int)window); + result = 6; + done = True; + } else if (!data || strlen((char *)data) < 5) { + debug_printf("%s: invalid data on " MOZILLA_RESPONSE_PROP + " property of window 0x%0x.\n", + progname, (unsigned int)window); + result = 6; + done = True; + } else if (*data == '1') { /* positive preliminary reply */ + debug_printf("%s: %s\n", progname, data + 4); + /* keep going */ + done = False; + } else if (!strncmp((char *)data, "200", 3)) { + result = 0; + done = True; + } else if (*data == '2') { + debug_printf("%s: %s\n", progname, data + 4); + result = 0; + done = True; + } else if (*data == '3') { + debug_printf("%s: internal error: " + "server wants more information? (%s)\n", progname, data); + result = 3; + done = True; + } else if (*data == '4' || *data == '5') { + debug_printf("%s: %s\n", progname, data + 4); + result = (*data - '0'); + done = True; + } else { + debug_printf("%s: unrecognised " MOZILLA_RESPONSE_PROP + " from window 0x%x: %s\n", + progname, (unsigned int)window, data); + result = 6; + done = True; + } + + if (data) + g_free(data); + } else if (event->type == GDK_PROPERTY_NOTIFY && + event->property.window == window && + event->property.state == GDK_PROPERTY_DELETE && + event->property.atom == GDKA_MOZILLA_COMMAND) { + debug_printf("%s: (server 0x%x has accepted " + MOZILLA_COMMAND_PROP ".)\n", progname, (unsigned int)window); + } + gdk_event_free(event); + } + + if (new_command) + g_free(new_command); + + return result; } -static gboolean netscape_command(const char *command) + +gboolean check_netscape(gpointer data) { - GdkWindow *window = NULL; - - if (netscape_lock) { - debug_printf("netscape_command() is currently in use.\n"); - return FALSE; - } - - netscape_lock = 1; + char *msg = data; + int status; + GdkWindow *window; mozilla_remote_init_atoms(); window = mozilla_remote_find_window(); - if (window == NULL || (GDK_WINDOW_OBJECT(window)->destroyed == TRUE)) { - debug_printf("Remote window absent or unsuitable.\n"); + if (window && (GDK_WINDOW_OBJECT(window)->destroyed == FALSE)) { + + XSelectInput(gdk_display, GDK_WINDOW_XWINDOW(window), + (PropertyChangeMask | StructureNotifyMask)); + + + mozilla_remote_obtain_lock(window); + + status = mozilla_remote_command(window, msg, False); + + if (status != 6) + mozilla_remote_free_lock(window); + netscape_lock = 0; + + g_free(msg); return FALSE; + } else + return TRUE; +} + + +static void netscape_command(char *command) +{ + int status; + pid_t pid; + GdkWindow *window; + + if (netscape_lock) + return; + + netscape_lock = 1; + + + + mozilla_remote_init_atoms(); + window = mozilla_remote_find_window(); + + if (window && (GDK_WINDOW_OBJECT(window)->destroyed == FALSE)) { + + XSelectInput(gdk_display, GDK_WINDOW_XWINDOW(window), + (PropertyChangeMask | StructureNotifyMask)); + + mozilla_remote_obtain_lock(window); + + status = mozilla_remote_command(window, command, False); + + if (status != 6) + mozilla_remote_free_lock(window); + + netscape_lock = 0; + + gdk_window_destroy(window); + } else { + pid = fork(); + if (pid == 0) { + char *args[2]; + int e; + + args[0] = g_strdup("netscape"); + args[1] = NULL; + e = execvp(args[0], args); + printf("Hello%d\n", getppid()); + + _exit(0); + } else { + char *tmp = g_strdup(command); + g_timeout_add(200, check_netscape, tmp); + } } - mozilla_remote_command(window, command, False); - - netscape_lock = 0; - return TRUE; } void open_url(GtkWidget *w, char *url) { - char *command = NULL; - GError *error = NULL; - - switch (web_browser) { - case BROWSER_NETSCAPE: { - char *args = NULL; - - if (misc_options & OPT_MISC_BROWSER_POPUP) - args = g_strdup_printf("OpenURL(%s, new-window)", url); - else - args = g_strdup_printf("OpenURL(%s)", url); - - if (netscape_command(args)) { - g_free(args); - return; + gchar *space_free_url; + + if (web_browser == BROWSER_NETSCAPE) { + char *command; + + if (misc_options & OPT_MISC_BROWSER_POPUP) + command = g_strdup_printf("OpenURL(%s, new-window)", url); + else + command = g_strdup_printf("OpenURL(%s)", url); + + netscape_command(command); + g_free(command); +/* fixme: GNOME helper * + * } else if (web_browser == BROWSER_GNOME) { * + * gnome_url_show(url); */ + } else { + pid_t pid; + + pid = fork(); + + if (pid == 0) { + /* args will be allocated below but we don't bother + * freeing it since we're just going to exec and + * exit */ + char **args=NULL; + char command[1024]; + + if (web_browser == BROWSER_OPERA) { + args = g_new(char *, 4); + args[0] = "opera"; + args[1] = "-newwindow"; + args[2] = url; + args[3] = NULL; + } else if (web_browser == BROWSER_KONQ) { + args = g_new(char *, 4); + args[0] = "kfmclient"; + args[1] = "openURL"; + args[2] = url; + args[3] = NULL; + } else if (web_browser == BROWSER_GALEON) { + args = g_new(char *, 4); + args[0] = "galeon"; + if (misc_options & OPT_MISC_BROWSER_POPUP) { + args[1] = "-w"; + args[2] = url; + args[3] = NULL; + } else { + args[1] = url; + args[2] = NULL; + } + } else if (web_browser == BROWSER_MOZILLA) { + args = g_new(char *, 4); + args[0] = "mozilla"; + args[1] = url; + args[2] = NULL; + } else if (web_browser == BROWSER_MANUAL) { + if(strcmp(web_command,"") == 0) + _exit(0); + space_free_url = g_strdelimit(url, " ", '+'); + g_snprintf(command, sizeof(command), web_command, space_free_url); + g_free(space_free_url); + args = g_strsplit(command, " ", 0); } - /* if netscape is running ... - command = g_strdup_printf("netscape -remote %s", args); */ - - command = g_strdup_printf("netscape %s", url); - g_free(args); - } break; - - case BROWSER_OPERA: - command = g_strdup_printf("opera -newwindow %s", url); - break; - - case BROWSER_KONQ: - command = g_strdup_printf("kfmclient openURL %s", url); - break; - - case BROWSER_GALEON: - command = g_strdup_printf("galeon -w %s", url); - command = g_strdup_printf("galeon %s", url); - break; - - case BROWSER_MOZILLA: - command = g_strdup_printf("mozilla %s", url); - break; - - case BROWSER_MANUAL: { - char *space_free_url = NULL; - - if (!web_command[0]) { - do_error_dialog(_("Unable to launch your browser because the 'Manual' browser command has been chosen, but no command has been set."), NULL, GAIM_ERROR); - return; - } - - space_free_url = g_strdelimit(url, " ", '+'); - command = g_strdup_printf("%s %s", web_command, space_free_url); - g_free(space_free_url); - } break; + execvp(args[0], args); + _exit(0); + } } - - if (g_spawn_command_line_async(command, &error) == FALSE) { - char *tmp = g_strdup_printf(_("There was an error launching your chosen browser: %s"), error->message); - do_error_dialog(tmp, NULL, GAIM_ERROR); - g_free(tmp); - g_error_free(error); - } - - g_free(command); } void add_bookmark(GtkWidget *w, char *url) { if (web_browser == BROWSER_NETSCAPE) { - char *command = g_strdup_printf("AddBookmark(%s)", url); + char *command = g_malloc(1024); + + g_snprintf(command, 1024, "AddBookmark(%s)", url); netscape_command(command); g_free(command); diff -r bf770f11132b -r 801830dec409 src/gaimrc.c --- a/src/gaimrc.c Sun Jan 26 20:41:49 2003 +0000 +++ b/src/gaimrc.c Sun Jan 26 20:43:25 2003 +0000 @@ -820,8 +820,8 @@ } /* this is where we do bugs and compatibility stuff */ - if (!(sound_options & (OPT_SOUND_BEEP | OPT_SOUND_NORMAL | OPT_SOUND_CMD))) - sound_options |= OPT_SOUND_NORMAL; + if (!(sound_options & (OPT_SOUND_BEEP | OPT_SOUND_ESD | OPT_SOUND_NORMAL | OPT_SOUND_NAS | OPT_SOUND_ARTSC | OPT_SOUND_CMD))) + sound_options |= OPT_SOUND_ESD | OPT_SOUND_NORMAL | OPT_SOUND_NAS | OPT_SOUND_ARTSC; if (conv_size.width == 0 && conv_size.height == 0 && @@ -1244,7 +1244,10 @@ OPT_SOUND_RECV | OPT_SOUND_SEND | OPT_SOUND_SILENT_SIGNON | - OPT_SOUND_NORMAL; + OPT_SOUND_NORMAL | + OPT_SOUND_NAS | + OPT_SOUND_ARTSC | + OPT_SOUND_ESD; #ifdef USE_SCREENSAVER report_idle = IDLE_SCREENSAVER; diff -r bf770f11132b -r 801830dec409 src/prefs.c --- a/src/prefs.c Sun Jan 26 20:41:49 2003 +0000 +++ b/src/prefs.c Sun Jan 26 20:43:25 2003 +0000 @@ -956,12 +956,19 @@ #ifndef _WIN32 vbox = make_frame (ret, _("Sound Method")); dd = gaim_dropdown(vbox, _("_Method"), &sound_options, OPT_SOUND_BEEP | - OPT_SOUND_NORMAL | + OPT_SOUND_ESD | OPT_SOUND_ARTSC | OPT_SOUND_NAS | OPT_SOUND_NORMAL | OPT_SOUND_CMD, _("Console beep"), OPT_SOUND_BEEP, -#ifdef USE_AO - _("Automatic"), OPT_SOUND_NORMAL, +#ifdef ESD_SOUND + "ESD", OPT_SOUND_ESD, #endif +#ifdef ARTSC_SOUND + "ArtsC", OPT_SOUND_ARTSC, +#endif +#ifdef NAS_SOUND + "NAS", OPT_SOUND_NAS, +#endif + _("Internal"), OPT_SOUND_NORMAL, _("Command"), OPT_SOUND_CMD, NULL); gtk_size_group_add_widget(sg, dd); gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); diff -r bf770f11132b -r 801830dec409 src/sound.c --- a/src/sound.c Sun Jan 26 20:41:49 2003 +0000 +++ b/src/sound.c Sun Jan 26 20:43:25 2003 +0000 @@ -40,10 +40,17 @@ #include #include -#ifdef USE_AO -#include -#include -#endif /* USE_AO */ +#ifdef ESD_SOUND +#include +#endif + +#ifdef ARTSC_SOUND +#include +#endif + +#ifdef NAS_SOUND +#include