I have met some problems in the telepathy-APIs . Below is a code about
telepathy by using python . Its function just is sending some
information , But it can not run [EMAIL PROTECTED] and
[EMAIL PROTECTED]  are  the test MSN id .Thanks for your help. 

Best regards!!!

Code:

 

#!/usr/bin/python
import dbus 
import time 
# connect to the bus 
bus = dbus.SessionBus() 
# get a connection manager object 
butt = bus.get_object(
'org.freedesktop.Telepathy.ConnectionManager.butterfly',
'/org/freedesktop/Telepathy/ConnectionManager/butterfly' ) 
# request a connection from it
params = {}

params["account"] = "[EMAIL PROTECTED]"
params["server"] = "messenger.hotmail.com"

params["port"] = dbus.UInt32(1863)
params["password"] = "haha123456"

(bus_name, object_path) = butt.RequestConnection("msn", params) 
# get the connection object 
conn = bus.get_object(bus_name, object_path) 
# tell it to connect and wait a bit
print 'object created......' 
conn.Connect(dbus_interface='org.freedesktop.Telepathy.Connection')
print 'connected......'
print conn 
time.sleep(3) 
# request a handle for our contact 
handles = conn.RequestHandles(dbus.UInt32(1),['[EMAIL PROTECTED]'])
print 'handls created......' 
# request a text channel with that handle 
object_path = conn.RequestChannel( 
'org.freedesktop.Telepathy.Channel.Type.Text', 
dbus.UInt32(1), handles[0], True)
print 'channel created....' 
# get a channel object 
channel = bus.get_object(bus_name, object_path) 
# send a message 
channel.Send(0, 'Hello, i am XXXX.This is just a software-testing!Thanks
for your help!')
print 'message had been sent...' 
# disconnect 
#conn.Disconnect( 
#dbus_interface='org.freedesktop.Telepathy.Connection')

_______________________________________________
Telepathy mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/telepathy

Reply via email to