# HG changeset patch # User William Pitcock # Date 1182285369 18000 # Node ID 7b4b8e135cb92486859da15c8107023188829c6b # Parent ef9446cebfcba9d153b92aa5feedff088b97c7ee Add IRC+PP support. diff -r ef9446cebfcb -r 7b4b8e135cb9 contrib/xchat-audacious.py --- a/contrib/xchat-audacious.py Fri Jun 15 13:52:40 2007 -0500 +++ b/contrib/xchat-audacious.py Tue Jun 19 15:36:09 2007 -0500 @@ -64,4 +64,54 @@ xchat.hook_command("PLAY", makeVoidCommand('Play'), help="Begins playback.") xchat.hook_command("SENDTRACK", command_send, help="Syntax: /SENDTRACK \nSends the currently playing track to a user.") +# IRC+PP support section + +# XChat is lame and does not give us a server list. +def get_servers(): + chanlist = xchat.get_list("channels") + servlist = [] + + for i in chanlist: + if i.server not in servlist: + servlist.append(i.server) + + return servlist + +ignore_services = 0; +def ignore_service_errors_cb(word, word_eol, userdata): + global ignore_services + + if ignore_services == 1: + return xchat.EAT_ALL + + return xchat.EAT_NONE + +xchat.hook_print("Notice", ignore_service_errors_cb) + +def unset_ignore_services(userdata=None): + global ignore_services + + ignore_services = 0 + +def presence_notification_dispatch(userdata=None): + global ignore_services + + aud = get_aud() + + ignore_services = 1 + if aud: + pos = aud.Position() + + title = aud.SongTitle(pos).encode("utf8") + + slist = get_servers() + for i in slist: + ctx = xchat.find_context(i) + + ctx.command("nickserv set qproperty np %s" % (title)) + +presence_notification_dispatch() +xchat.hook_timer(60000, presence_notification_dispatch) +xchat.hook_timer(1000, unset_ignore_services) + print "xchat-audacious $Id: xchat-audacious.py 4574 2007-05-16 07:46:17Z deitarion $ loaded"