# HG changeset patch # User Yoshiki Yazawa # Date 1183027701 -32400 # Node ID 8d4d17a528efb3d53a9e8bd3690b409ccfdfd44e initial import diff -r 000000000000 -r 8d4d17a528ef Makefile.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile.in Thu Jun 28 19:48:21 2007 +0900 @@ -0,0 +1,31 @@ +PIDGIN_CFLAGS = @PIDGIN_CFLAGS@ +AUD_CFLAGS = @AUD_CFLAGS@ +DBUS_GLIB_CFLAGS = @DBUS_GLIB_CFLAGS@ +CFLAGS = -fPIC -shared -Wall $(PIDGIN_CFLAGS) $(AUD_CFLAGS) $(DBUS_GLIB_CFLAGS) + +AUD_LIBS = @AUD_LIBS@ +AUD_LIB_DIR = @AUD_LIB_DIR@ +DBUS_GLIB_LIBS = @DBUS_GLIB_LIBS@ +DBUS_GLIB_LIB_DIR = @DBUS_GLIB_LIB_DIR@ +LDFLAGS = $(AUD_LIBS) $(DBUS_GLIB_LIBS) + +PIDGIN_LIB_DIR = @PIDGIN_LIB_DIR@ + + +default: pidgin-audacious.so + +pidgin-audacious.so: pidgin-audacious.c + gcc -o $@ $< $(CFLAGS) $(LDFLAGS) -g -Wl,-rpath=$(AUD_LIB_DIR) + + +install: pidgin-audacious.so + install -m 755 pidgin-audacious.so $(PIDGIN_LIB_DIR)/pidgin + + +clean: + rm -f pidgin-audacious.so + + +distclean: clean + rm -f Makefile config.log config.status *~ + rm -rf autom4te.cache diff -r 000000000000 -r 8d4d17a528ef README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Thu Jun 28 19:48:21 2007 +0900 @@ -0,0 +1,48 @@ +pidgin-audacious-2.0.0d2 + +1. What's this? + +pidgin-audacious is a pidgin plugin which updates status and userinfo +message for your pidgin accounts, reflecting the current track name what +you are listening in Audacious. + +Moreover, after version 1.1.0, pidgin-audacious can alter your alias +(aka friendly name or nickname) in msn protocol using the current +track name. + +This plugin requires pidgin 2.0.0 or later and development version of +audacious. (capable of DBus connection expected to be released as +1.4.0.) + +2. How to build + +Building pidgin-audacious plugin is very simple. Please do + +./configure +make +make install + +If you would like to test new alias substitution feature, please apply +included patch against the pidgin source. Both 2.0.0b4 and svn around +October 15 2006 would work. + +3. Usage + +This plugin expands the token "%song" in your status/userinfo message +and alias with the name of the currently playing music. To show the +track name, you have to compose a message containing the token. The +text format used in audacious playlist will be applied for +substitution. + +You can enable or disable expansion in status message, userinfo or +alias respectively. The preferences dialog is available from plugins +window in pidgin. + +4. Acknowledgment + +This plugin has been built based on Jon Oberheide's +gaim-rhythmbox-2.0beta2. I greatly appreciate his work. + + +Yoshiki Yazawa +yaz@honeyplanet.jp diff -r 000000000000 -r 8d4d17a528ef aclocal.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/aclocal.m4 Thu Jun 28 19:48:21 2007 +0900 @@ -0,0 +1,171 @@ +# generated automatically by aclocal 1.10 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# +# 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. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$PKG_CONFIG"; then + if test -n "$$1"; then + pkg_cv_[]$1="$$1" + else + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES + diff -r 000000000000 -r 8d4d17a528ef configure.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/configure.in Thu Jun 28 19:48:21 2007 +0900 @@ -0,0 +1,63 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.59) +AC_INIT(pidgin-audacioius, 2.0.0, yaz@honeyplanet.jp) +AC_CONFIG_SRCDIR([pidgin-audacious.c]) + +# Checks for programs. +AC_PROG_CC +AC_PROG_INSTALL + +# Checks for libraries. +PKG_CHECK_MODULES(AUDACIOUS, [audacious >= 1.4.0], , [ + AC_MSG_RESULT(no) + AC_MSG_ERROR([ + +You must have audacious >= 1.4.0 development headers installed to build. +])]) +AUD_CFLAGS=`pkg-config --cflags audacious 2> /dev/null` +AUD_LIBS=`pkg-config --libs audacious 2> /dev/null` +AUD_LIB_DIR=`pkg-config --variable=lib_dir audacious 2> /dev/null` +AC_SUBST(AUD_CFLAGS) +AC_SUBST(AUD_LIBS) +AC_SUBST(AUD_LIB_DIR) + +PKG_CHECK_MODULES(PIDGIN, [pidgin >= 2.0.0], , [ + AC_MSG_RESULT(no) + AC_MSG_ERROR([ + +You must have pidgin >= 2.0.0 development headers installed to build. +])]) +PIDGIN_CFLAGS=`pkg-config --cflags pidgin 2> /dev/null` +PIDGIN_LIBS=`pkg-config --libs pidgin 2> /dev/null` +PIDGIN_LIB_DIR=`pkg-config --variable=libdir pidgin 2> /dev/null` +AC_SUBST(PIDGIN_CFLAGS) +AC_SUBST(PIDGIN_LIBS) +AC_SUBST(PIDGIN_LIB_DIR) + +PKG_CHECK_MODULES(DBUSGLIB, [dbus-glib-1 >= 0.72], , [ + AC_MSG_RESULT(no) + AC_MSG_ERROR([ + +You must have dbus-glib-1 >= 0.72 development headers installed to build. +])]) +DBUS_GLIB_CFLAGS=`pkg-config --cflags dbus-glib-1` +DBUS_GLIB_LIBS=`pkg-config --libs dbus-glib-1` +DBUS_GLIB_LIB_DIR=`pkg-config --variable=libdir dbus-glib-1` +AC_SUBST(DBUS_GLIB_CFLAGS) +AC_SUBST(DBUS_GLIB_LIBS) +AC_SUBST(DBUS_GLIB_LIB_DIR) + +# Checks for header files. +AC_HEADER_STDC +AC_CHECK_HEADERS([stdlib.h string.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST + +# Checks for library functions. +AC_CHECK_FUNCS([strstr]) + +#AC_CONFIG_FILES([Makefile]) +AC_OUTPUT(Makefile) diff -r 000000000000 -r 8d4d17a528ef install-sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install-sh Thu Jun 28 19:48:21 2007 +0900 @@ -0,0 +1,323 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2005-05-14.22 + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +chmodcmd="$chmodprog 0755" +chowncmd= +chgrpcmd= +stripcmd= +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src= +dst= +dir_arg= +dstarg= +no_target_directory= + +usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: +-c (ignored) +-d create directories instead of installing files. +-g GROUP $chgrpprog installed files to GROUP. +-m MODE $chmodprog installed files to MODE. +-o USER $chownprog installed files to USER. +-s $stripprog installed files. +-t DIRECTORY install into DIRECTORY. +-T report an error if DSTFILE is a directory. +--help display this help and exit. +--version display version info and exit. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG +" + +while test -n "$1"; do + case $1 in + -c) shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + --help) echo "$usage"; exit $?;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -s) stripcmd=$stripprog + shift + continue;; + + -t) dstarg=$2 + shift + shift + continue;; + + -T) no_target_directory=true + shift + continue;; + + --version) echo "$0 $scriptversion"; exit $?;; + + *) # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + test -n "$dir_arg$dstarg" && break + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dstarg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dstarg" + shift # fnord + fi + shift # arg + dstarg=$arg + done + break;; + esac +done + +if test -z "$1"; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src ;; + esac + + if test -n "$dir_arg"; then + dst=$src + src= + + if test -d "$dst"; then + mkdircmd=: + chmodcmd= + else + mkdircmd=$mkdirprog + fi + else + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dstarg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dstarg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst ;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dstarg: Is a directory" >&2 + exit 1 + fi + dst=$dst/`basename "$src"` + fi + fi + + # This sed command emulates the dirname command. + dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` + + # Make sure that the destination directory exists. + + # Skip lots of stat calls in the usual case. + if test ! -d "$dstdir"; then + defaultIFS=' + ' + IFS="${IFS-$defaultIFS}" + + oIFS=$IFS + # Some sh's can't handle IFS=/ for some reason. + IFS='%' + set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` + shift + IFS=$oIFS + + pathcomp= + + while test $# -ne 0 ; do + pathcomp=$pathcomp$1 + shift + if test ! -d "$pathcomp"; then + $mkdirprog "$pathcomp" + # mkdir can fail with a `File exist' error in case several + # install-sh are creating the directory concurrently. This + # is OK. + test -d "$pathcomp" || exit + fi + pathcomp=$pathcomp/ + done + fi + + if test -n "$dir_arg"; then + $doit $mkdircmd "$dst" \ + && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } + + else + dstfile=`basename "$dst"` + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + trap '(exit $?); exit' 1 2 13 15 + + # Copy the file name to the temp name. + $doit $cpprog "$src" "$dsttmp" && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ + && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ + && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ + && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && + + # Now rename the file to the real destination. + { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ + || { + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + if test -f "$dstdir/$dstfile"; then + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ + || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ + || { + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 + (exit 1); exit 1 + } + else + : + fi + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" + } + } + fi || { (exit 1); exit 1; } +done + +# The final little trick to "correctly" pass the exit status to the exit trap. +{ + (exit 0); exit 0 +} + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff -r 000000000000 -r 8d4d17a528ef missing --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/missing Thu Jun 28 19:48:21 2007 +0900 @@ -0,0 +1,360 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2005-06-08.21 + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# 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, 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 Street, Fifth Floor, Boston, MA +# 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). +case "$1" in + lex|yacc) + # Not GNU programs, they don't have --version. + ;; + + tar) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff -r 000000000000 -r 8d4d17a528ef pidgin-audacious.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pidgin-audacious.c Thu Jun 28 19:48:21 2007 +0900 @@ -0,0 +1,523 @@ +/* + * Pidgin-Audacious plugin. + * + * 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. + */ +#define PURPLE_PLUGINS 1 + +#include +#include +#include +#include + +#include "gtkplugin.h" +#include "util.h" +#include "debug.h" +#include "connection.h" +#include "version.h" +#include +#include + +extern guchar *botch_utf(const void *msg, size_t len, size_t *newlen) __attribute__ ((weak)); + +#define PIDGINAUD_PLUGIN_ID "pidgin_audacious" + +#define OPT_PIDGINAUD "/plugins/pidgin_audacious" +#define OPT_PROCESS_STATUS OPT_PIDGINAUD "/process_status" +#define OPT_PROCESS_USERINFO OPT_PIDGINAUD "/process_userinfo" +#define OPT_PROCESS_ALIAS OPT_PIDGINAUD "/process_alias" + +#define SONG_TOKEN "%song" +#define NO_SONG_MESSAGE "No song being played." + +#define BUDDY_ALIAS_MAXLEN 387 + +#define aud_debug(fmt, ...) purple_debug(PURPLE_DEBUG_INFO, "Pidgin-Audacious", \ + fmt, ## __VA_ARGS__); +#define aud_error(fmt, ...) purple_debug(PURPLE_DEBUG_ERROR, "Pidgin-Audacious", \ + fmt, ## __VA_ARGS__); + +static gint timeout_tag = 0; + +GHashTable *stored_status; +GHashTable *stored_userinfo; +GHashTable *stored_alias; + +GHashTable *pushed_status; +GHashTable *pushed_userinfo; +GHashTable *pushed_alias; + +DBusGProxy *session = NULL; + +static void aud_process(gchar *aud_info); + +static DBusGProxy *get_dbus_proxy(void) +{ + DBusGConnection *connection = NULL; + DBusGProxy *session = NULL; + GError *error = NULL; + connection = dbus_g_bus_get(DBUS_BUS_SESSION, &error); + g_clear_error(&error); + + session = dbus_g_proxy_new_for_name(connection, AUDACIOUS_DBUS_SERVICE, + AUDACIOUS_DBUS_PATH, + AUDACIOUS_DBUS_INTERFACE); + + g_clear_error(&error); + return session; +#if 0 + if (audacious_remote_is_running(session)) { + return session; + } + else { + return NULL; + } +#endif +} + +static gboolean +watchdog_func(void) +{ + gint playpos = 0; + gchar *song = NULL, *tmp = NULL; +// DBusGProxy *session = get_dbus_proxy(); + + gboolean rv = TRUE; + size_t dummy; + + aud_debug("session = %p\n", session); + + aud_debug("is_playing = %d\n", audacious_remote_is_playing(session)); + + if(!audacious_remote_is_playing(session)) { /* audacious isn't playing */ + aud_process(NULL); + return rv; + } + + playpos = audacious_remote_get_playlist_pos(session); + tmp = audacious_remote_get_playlist_title(session, playpos); + if(tmp) { + if(botch_utf) // function exists + song = (gchar *) botch_utf(tmp, strlen(tmp), &dummy); + else + song = g_strdup(tmp); + } + g_free(tmp); + tmp = NULL; + + aud_process(song); + g_free(song); + song = NULL; + return rv; +} + +static void +aud_process_status(PurpleConnection *gc, gchar *aud_info) +{ + gchar *new; + const gchar *old, *proto; + PurpleAccount *account; + PurplePresence *presence; + PurplePlugin *prpl; + PurplePluginProtocolInfo *prpl_info; + PurpleStatus *status; + + gpointer val; // for hash + gchar *key; + + account = purple_connection_get_account(gc); + presence = purple_account_get_presence(account); + + proto = purple_account_get_protocol_id(account); + prpl = purple_find_prpl(proto); + g_return_if_fail(prpl != NULL); + + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); + g_return_if_fail(prpl_info != NULL && prpl_info->set_status != NULL); + + status = purple_presence_get_active_status(presence); + g_return_if_fail(status != NULL); + + old = purple_status_get_attr_string(status, "message"); + aud_debug("status current = %s\n", old); + if(old == NULL || strlen(old) == 0) { // auto away etc. + /* invalidate pushded status */ + /* generate key for hash table */ + key = g_strdup_printf("%s %s", account->username, account->protocol_id); + g_hash_table_replace(pushed_status, g_strdup(key), g_strdup("")); + return; + } + + /* generate key for hash table */ + key = g_strdup_printf("%s %s", account->username, account->protocol_id); + + val = g_hash_table_lookup(pushed_status, key); + + /* if current alias differs from pushed_alias or contains token, replace seed with this. */ + if( (val && g_ascii_strcasecmp(old, val)) || strstr(old, SONG_TOKEN) ) { + g_hash_table_replace(stored_status, g_strdup(key), g_strdup(old)); + } + + /* construct new status message */ + val = g_hash_table_lookup(stored_status, key); + g_return_if_fail(val != NULL); + aud_debug("status stored = %s\n", (gchar *)val); + + if(aud_info){ + new = purple_strreplace(val, SONG_TOKEN, aud_info); + } + else { + new = g_strdup(NO_SONG_MESSAGE); + } + + g_return_if_fail(new != NULL); + + /* set status message only if text has been changed */ + val = g_hash_table_lookup(pushed_status, key); + aud_debug("status pushed = %s\n", (gchar *)val); + + if (!val || g_ascii_strcasecmp(val, new) != 0) { + g_hash_table_replace(pushed_status, g_strdup(key), g_strdup(new)); + purple_status_set_attr_string(status, "message", new); + prpl_info->set_status(account, status); + } + g_free(key); + g_free(new); +} + + +static void +aud_process_userinfo(PurpleConnection *gc, gchar *aud_info) +{ + gchar *new; + const gchar *old, *proto; + PurpleAccount *account; + PurplePlugin *prpl; + PurplePluginProtocolInfo *prpl_info; + + gpointer val; // for hash + gchar *key; + + account = purple_connection_get_account(gc); + + proto = purple_account_get_protocol_id(account); + prpl = purple_find_prpl(proto); + g_return_if_fail(prpl != NULL); + + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); + g_return_if_fail(prpl_info != NULL && prpl_info->set_info != NULL); + + /* retrieve the old user info */ + old = purple_account_get_user_info(account); /* it's always from account.xml! */ + if(old == NULL || strlen(old) == 0) + return; + + /* generate key for hash table*/ + key = g_strdup_printf("%s %s", account->username, account->protocol_id); + + val = g_hash_table_lookup(pushed_userinfo, key); + + /* if current alias differs from pushed_alias or contains token, replace seed with this. */ + if( (val && g_ascii_strcasecmp(old, val)) || strstr(old, SONG_TOKEN) ) { + g_hash_table_replace(stored_userinfo, g_strdup(key), g_strdup(old)); + } + + /* construct new status message */ + val = g_hash_table_lookup(stored_userinfo, key); + g_return_if_fail(val != NULL); + + aud_debug("userinfo stored = %s\n", (gchar *)val); + + if(aud_info){ + new = purple_strreplace(val, SONG_TOKEN, aud_info); + } + else { + new = g_strdup(NO_SONG_MESSAGE); + } + + g_return_if_fail(new != NULL); + + /* set user info only if text has been changed */ + val = g_hash_table_lookup(pushed_userinfo, key); + aud_debug("userinfo pushed = %s\n", (gchar *)val); + + if (!val || g_ascii_strcasecmp(val, new) != 0) { + g_hash_table_replace(pushed_userinfo, g_strdup(key), g_strdup(new)); + prpl_info->set_info(gc, new); + } + g_free(key); + g_free(new); +} + +static void +aud_process_alias(PurpleConnection *gc, gchar *aud_info) +{ + gchar *new; + const gchar *old, *proto; + PurpleAccount *account; + PurplePlugin *prpl; + PurplePluginProtocolInfo *prpl_info; + + gpointer val; // for hash + glong bytes; + gchar *key; + + account = purple_connection_get_account(gc); + + proto = purple_account_get_protocol_id(account); + prpl = purple_find_prpl(proto); + g_return_if_fail(prpl != NULL); + + prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); + g_return_if_fail(prpl_info != NULL); + + /* retrieve the old alias */ +// old = purple_url_decode(purple_account_get_alias(account)); + old = purple_account_get_alias(account); + if(old == NULL || strlen(old) == 0) { + aud_error("couldn't get old alias\n"); + return; + } + aud_debug("old alias = %s\n", old); + + /* generate key for hash table*/ + key = g_strdup_printf("%s %s", account->username, account->protocol_id); +// aud_debug("alias key = %s\n", key); + + val = g_hash_table_lookup(pushed_alias, key); + + /* if current alias differs from pushed_alias or contains token, replace seed with this. */ + if( (val && g_ascii_strcasecmp(old, val)) || strstr(old, SONG_TOKEN) ) { + g_hash_table_replace(stored_alias, g_strdup(key), g_strdup(old)); + } + + /* construct new status message */ + val = g_hash_table_lookup(stored_alias, key); + g_return_if_fail(val != NULL); + + bytes = strlen(val); + bytes -= strlen(SONG_TOKEN); + aud_debug("alias: bytes = %ld", bytes); + + aud_debug("alias: stored = %s\n", (gchar *)val); + + if(aud_info){ + gchar *tmp = g_malloc0(BUDDY_ALIAS_MAXLEN); + glong utflen = g_utf8_strlen(aud_info, BUDDY_ALIAS_MAXLEN/3 - bytes - 1); + g_utf8_strncpy(tmp, aud_info, utflen); +// aud_debug("alias: utflen = %ld tmp = %s\n", utflen, tmp); + new = purple_strreplace(val, SONG_TOKEN, tmp); +// aud_debug("alias: new bytes = %ld new = %s\n", strlen(new), new); + g_free(tmp); + } + else { + new = purple_strreplace(val, SONG_TOKEN, NO_SONG_MESSAGE); + } + + g_return_if_fail(new != NULL); + + /* set user info only if text has been changed */ + val = g_hash_table_lookup(pushed_alias, key); + aud_debug("alias pushed = %s\n", (gchar *)val); + + if (!val || g_ascii_strcasecmp(val, new) != 0) { + //gint result; + gboolean ok = FALSE; + PurplePlugin *msn_plugin = NULL; + msn_plugin = purple_plugins_find_with_id("prpl-msn"); + aud_debug("msn_plugin = %p\n", msn_plugin); + + g_hash_table_replace(pushed_alias, g_strdup(key), g_strdup(new)); + purple_plugin_ipc_call(msn_plugin, "msn_set_friendly_name", &ok, gc, new); + aud_debug("ipc %d\n", ok); + } + g_free(key); + g_free(new); +} + +static void +aud_process(gchar *aud_info) +{ + GList *l; + PurpleConnection *gc; + + for (l = purple_connections_get_all(); l != NULL; l = l->next) { + gc = (PurpleConnection *) l->data; + + /* make sure we're connected */ + if (purple_connection_get_state(gc) != PURPLE_CONNECTED) { + continue; + } + + if (purple_prefs_get_bool(OPT_PROCESS_USERINFO)) { + aud_process_userinfo(gc, aud_info); + } + + if (purple_prefs_get_bool(OPT_PROCESS_STATUS)) { + aud_process_status(gc, aud_info); + } + + if (purple_prefs_get_bool(OPT_PROCESS_ALIAS)) { + aud_process_alias(gc, aud_info); + } + + } +} +static void +removekey(gpointer data) +{ + g_free(data); +} + +static void +removeval(gpointer data) +{ + g_free(data); +} + +static gboolean +restore_alias(PurpleConnection *gc, gpointer data) +{ + PurpleAccount *account; + gpointer val = NULL; + gchar *key = NULL; + + aud_debug("********** restore_alias called **********\n"); + account = purple_connection_get_account(gc); + + key = g_strdup_printf("%s %s", account->username, account->protocol_id); + val = g_hash_table_lookup(stored_alias, key); + g_return_val_if_fail(val != NULL, FALSE); + + aud_debug("write back alias %s\n", val); + purple_account_set_alias(account, val); //oct16 + + g_free(key); + + return TRUE; +} + + +static gboolean +load_plugin(PurplePlugin *plugin) +{ + stored_status = g_hash_table_new_full(g_str_hash, g_str_equal, removekey, removeval); + stored_alias = g_hash_table_new_full(g_str_hash, g_str_equal, removekey, removeval); + stored_userinfo = g_hash_table_new_full(g_str_hash, g_str_equal, removekey, removeval); + + pushed_status = g_hash_table_new_full(g_str_hash, g_str_equal, removekey, removeval); + pushed_alias = g_hash_table_new_full(g_str_hash, g_str_equal, removekey, removeval); + pushed_userinfo = g_hash_table_new_full(g_str_hash, g_str_equal, removekey, removeval); + + timeout_tag = g_timeout_add(15*1000, (gpointer)watchdog_func, NULL); + + /* connect to signing-off signal */ + purple_signal_connect(purple_connections_get_handle(), "signing-off", plugin, + PURPLE_CALLBACK(restore_alias), NULL); + + + return TRUE; +} + +static gboolean +unload_plugin(PurplePlugin *plugin) +{ + aud_debug("pidgin-audacious unload called\n"); + + g_hash_table_destroy(stored_status); + g_hash_table_destroy(stored_alias); + g_hash_table_destroy(stored_userinfo); + + g_hash_table_destroy(pushed_status); + g_hash_table_destroy(pushed_alias); + g_hash_table_destroy(pushed_userinfo); + + return TRUE; +} + +static PurplePluginPrefFrame * +get_plugin_pref_frame(PurplePlugin *plugin) +{ + PurplePluginPref *pref; + PurplePluginPrefFrame *frame = purple_plugin_pref_frame_new(); + + /* create gtk elements for the plugin preferences */ + pref = purple_plugin_pref_new_with_label("Pidgin-Audacious Configuration"); + purple_plugin_pref_frame_add(frame, pref); + + pref = purple_plugin_pref_new_with_name_and_label(OPT_PROCESS_STATUS, + "Expand " SONG_TOKEN " to song info in the status message"); + purple_plugin_pref_frame_add(frame, pref); + + pref = purple_plugin_pref_new_with_name_and_label(OPT_PROCESS_USERINFO, + "Expand " SONG_TOKEN " to song info in the user info"); + purple_plugin_pref_frame_add(frame, pref); + + pref = purple_plugin_pref_new_with_name_and_label(OPT_PROCESS_ALIAS, + "Expand " SONG_TOKEN " to song info in the alias"); + purple_plugin_pref_frame_add(frame, pref); + + return frame; +} + +static PurplePluginUiInfo pref_info = +{ + get_plugin_pref_frame +}; + +static PurplePluginInfo info = +{ + PURPLE_PLUGIN_MAGIC, + PURPLE_MAJOR_VERSION, + PURPLE_MINOR_VERSION, + PURPLE_PLUGIN_STANDARD, /**< type */ + NULL, /**< ui_req */ + 0, /**< flags */ + NULL, /**< deps */ + PURPLE_PRIORITY_DEFAULT, /**< priority */ + PIDGINAUD_PLUGIN_ID, /**< id */ + "Pidgin-Audacious", /**< name */ + "2.0.0d4", /**< version */ + "Automatically updates your Pidgin status info with the currently " + "playing music in Audacious.", /** summary */ + "Automatically updates your Pidgin status info with the currently " + "playing music in Audacious.", /** desc */ + "Yoshiki Yazawa (yaz@honeyplanet.jp)", /**< author */ + "http://www.honeyplanet.jp", /**< homepage */ + load_plugin, /**< load */ + unload_plugin, /**< unload */ + NULL, /**< destroy */ + NULL, /**< ui_info */ + NULL, /**< extra_info */ + &pref_info, /**< pref info */ + NULL +}; + +static void +init_plugin(PurplePlugin *plugin) +{ + g_type_init(); + + /* add plugin preferences */ + purple_prefs_add_none(OPT_PIDGINAUD); + purple_prefs_add_bool(OPT_PROCESS_STATUS, TRUE); + purple_prefs_add_bool(OPT_PROCESS_USERINFO, TRUE); + purple_prefs_add_bool(OPT_PROCESS_ALIAS, TRUE); + + session = get_dbus_proxy(); +} + +PURPLE_INIT_PLUGIN(pidgin_audacious, init_plugin, info)