| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/python-telepathy-0.15.11/examples/ |
Upload File : |
import dbus.glib
import gobject
import sys
from telepathy.constants import (
CONNECTION_STATUS_CONNECTED, CONNECTION_STATUS_DISCONNECTED)
from telepathy.interfaces import (
CONN_INTERFACE, CONN_INTERFACE_AVATARS)
from account import read_account, connect
registered = False
loop = None
def status_changed_cb(state, reason):
global registered
if state == CONNECTION_STATUS_CONNECTED:
print 'registered'
registered = True
conn[CONN_INTERFACE].Disconnect()
elif state == CONNECTION_STATUS_DISCONNECTED:
if not registered:
print 'failed (reason %d)' % reason
loop.quit()
if __name__ == '__main__':
manager, protocol, account = read_account(sys.argv[1])
account['register'] = True
conn = connect(manager, protocol, account)
conn[CONN_INTERFACE].connect_to_signal('StatusChanged', status_changed_cb)
print 'connecting'
conn[CONN_INTERFACE].Connect()
loop = gobject.MainLoop()
loop.run()
try:
conn[CONN_INTERFACE].Disconnect()
except:
pass