changeset 2848:9373f9ec469d trunk

Automated merge from ssh://hg.atheme.org//hg/audacious.
author William Pitcock <nenolod@atheme.org>
date Tue, 19 Jun 2007 15:36:44 -0500
parents 7b4b8e135cb9 (diff) 89c3fef7ae1f (current diff)
children 97dc42683fc6
files src/audacious/widgets/audacious_pbutton.c src/audacious/widgets/audacious_pbutton.h
diffstat 1 files changed, 50 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/xchat-audacious.py	Mon Jun 18 12:45:04 2007 +0900
+++ b/contrib/xchat-audacious.py	Tue Jun 19 15:36:44 2007 -0500
@@ -64,4 +64,54 @@
 xchat.hook_command("PLAY",  makeVoidCommand('Play'),    help="Begins playback.")
 xchat.hook_command("SENDTRACK", command_send, help="Syntax: /SENDTRACK <nick>\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"