@@ -0,0 +1,1064 @@
+%0Aimport dbus.glib%0Aimport gobject%0Aimport sys%0A%0Afrom telepathy.constants import (%0A    CONNECTION_STATUS_CONNECTED, CONNECTION_STATUS_DISCONNECTED%0Afrom telepathy.interfaces import (%0A    CONN_INTERFACE, CONN_INTERFACE_AVATARS)%0A%0Afrom account import read_account, connect%0A%0Aregistered = False%0Aloop = None%0A%0Adef status_changed_cb(state, reason):%0A    print 'status changed', state%0A%0A    if state == CONNECTION_STATUS_CONNECTED:%0A        print 'registered'%0A        registered = True%0A        conn.Disconnect()%0A    elif state == CONNECTION_STATUS_DISCONNECTED:%0A        if !registered:%0A            print 'failed'%0A%0A    loop.quit()%0A%0Aif __name__ == '__main__':%0A    manager, protocol, account = read_account(sys.argv%5B1%5D)%0A    account%5B'register'%5D = True%0A    conn = connect(manager, protocol, account)%0A%0A    # XXX: hack!%0A    conn._valid_interfaces = %5BCONN_INTERFACE%5D%0A    conn%5BCONN_INTERFACE%5D.connect_to_signal('StatusChanged', status_changed_cb)%0A%0A    print 'connecting'%0A    conn%5BCONN_INTERFACE%5D.Connect()%0A    loop = gobject.MainLoop()%0A    loop.run()%0A    conn%5BCONN_INTERFACE%5D.Disconnect()%0A%0A

add registration example