[Telepathy] some question about telepathy

Yang, Jian jian.yang at intel.com
Tue Aug 7 17:49:59 PDT 2007


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 .yanwan1_cn at hotmail.com and
yanwan2_cn at hotmail.com  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"] = "yanwan1_cn at hotmail.com"
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),['yanwan2_cn at hotmail.com'])
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')

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/telepathy/attachments/20070808/08ac15fc/attachment.htm 


More information about the Telepathy mailing list