PDA

View Full Version : [SOLVED] pidgin, dbus and python help please.



Glich
March 25th, 2008, 12:45 AM
'''
hello, using pidgin instant messenger I can get the value of 'message' when one is being sent but,
I dont know how to chage the value of message.

from the documentation (http://developer.pidgin.im/doxygen/dev/html/conversation-signals.html#sending-im-msg):
_____________________________
sending-im-msg:

Emitted before sending an IM to a user. message is a pointer to the message string, so the plugin can replace the message before being sent.
_____________________________

I think python get's a copy of the message (this is just a guess). How can I change the message before it is sent?

Thanks.
The code is taken from http://developer.pidgin.im/wiki/DbusHowto#Furtherreading and changed only a small amount.
'''

#!/usr/bin/env python

def cb_func(account, rec, message):
#change message here somehow?
print message

import dbus, gobject
from dbus.mainloop.glib import DBusGMainLoop
dbus.mainloop.glib.DBusGMainLoop(set_as_default=Tr ue)
bus = dbus.SessionBus()

bus.add_signal_receiver(cb_func,
dbus_interface="im.pidgin.purple.PurpleInterface",
signal_name="SendingImMsg")

loop = gobject.MainLoop()
loop.run()

Roptaty
March 25th, 2008, 01:40 PM
Using dbus you can only get information from Pidgin, you cant modify the information. To do this, you need to write a plugin loaded in Pidgin. (See http://developer.pidgin.im/wiki/DbusHowto )

Glich
March 25th, 2008, 11:53 PM
Yes, I need to read that better. Thanks for pointing it out. I'm thinking of making a plugin that will allow python to have more control.