summaryrefslogtreecommitdiff
path: root/examples/connections.py
blob: 6b86d35e1cb8b18ee2d1baddfb0b8fbd10a420d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

"""
Print out a list of existing Telepathy connections.
"""

import dbus.glib

import telepathy

prefix = 'org.freedesktop.Telepathy.Connection.'

if __name__ == '__main__':
    for conn in telepathy.client.Connection.get_connections():
        conn_iface = conn[telepathy.CONN_INTERFACE]
        handle = conn_iface.GetSelfHandle()
        print conn_iface.InspectHandles(
            telepathy.CONNECTION_HANDLE_TYPE_CONTACT, [handle])[0]
        print ' Protocol:', conn_iface.GetProtocol()
        print ' Name:', conn.service_name[len(prefix):]
        print