
import dbus
import dbus.glib

import gobject

def run():
    bus = dbus.SessionBus()
    gabble = bus.get_object(
        'org.freedesktop.Telepathy.ConnectionManager.gabble',
        '/org/freedesktop/Telepathy/ConnectionManager/gabble')
    gabble = dbus.Interface(
        gabble,
        'org.freedesktop.Telepathy.ConnectionManager')
    parameters = {
        'account': 'dgh@jabber.org',
        'password': 'pass'
    }
    connection_name, connection_path = gabble.Connect('jabber', parameters)
    connection = bus.get_object(connection_name, connection_path)
    connection = dbus.Interface(
        connection,
        'org.freedesktop.Telepathy.Connection')
    connection.Disconnect()
    loop.quit()

def connect_reply_cb(*stuff):
    print stuff

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

