Sample send IM script?
Parand Darugar
darugar at gmail.com
Mon Jul 2 19:51:54 EDT 2007
Hello,
I'm attempting to get a simple Python DBUS based example of a script
that starts a conversation working. I have one that responds to IMs,
but I can't seem to figure out the incantation to get it to initiate
the IMs.
Can anyone send a script in any language (C, Perl, Python, Tcl) that
starts a conversation, or point me to appropriate documentation? I've
tried a number of things based on the Perl howto
(http://developer.pidgin.im/doxygen/dev/html/perl-howto.html), but I
can't get it to go.
My particular scenario is:
- I'm logged in to account 'xxx' using nullclient
- I'd like to initiate a conversation with account 'someaccount'
- I'm using D-Bus with Python (but it could be any language)
I start nullclient and I'm able to interact with it using D-Bus.
Here's what I'm trying:
import dbus, dbus.glib, dbus.decorators, gobject
bus = dbus.SessionBus()
obj = bus.get_object("im.pidgin.purple.PurpleService",
"/im/pidgin/purple/PurpleObject")
purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")
name = 'someaccount'
protocol = 'prpl-yahoo'
ac = purple.PurpleAccountsFind(name, protocol) # returns a non-zero value
conversation = purple.PurpleConversationNew(1, ac, name) #
conversation returns 0
im = purple.PurpleConversationGetImData(conversation) # im is also 0
purple.PurpleConvImSend(im, "hello there")
Do I need some sort of connection or something after I find the
account to make this go?
Much thanks,
Parand
More information about the Devel
mailing list