def __init__(self, proto, account, manager=None, protocol=None): """ Parameters: proto - the name of the protcol this conection should be handling. account - a protocol-specific account name manager - the name of the connection manager """ if manager is None: import warnings warnings.warn( 'The manager parameter to Connection.__init__ ' 'should be supplied', DeprecationWarning) manager = 'python' clean_account = _escape_as_identifier(account) bus_name = u'org.freedesktop.Telepathy.Connection.%s.%s.%s' % \ (manager, proto, clean_account) bus_name = dbus.service.BusName(bus_name, bus=dbus.SessionBus()) object_path = '/org/freedesktop/Telepathy/Connection/%s/%s/%s' % \ (manager, proto, clean_account) _Connection.__init__(self, bus_name, object_path) # monitor clients dying so we can release handles dbus.SessionBus().add_signal_receiver(self.name_owner_changed_callback, 'NameOwnerChanged', 'org.freedesktop.DBus', 'org.freedesktop.DBus', '/org/freedesktop/DBus') self._interfaces = set() DBusProperties.__init__(self) self._implement_property_get( CONN_INTERFACE, { 'SelfHandle': lambda: dbus.UInt32(self.GetSelfHandle()), 'Interfaces': lambda: dbus.Array(self.GetInterfaces(), signature='s'), 'Status': lambda: dbus.UInt32(self.GetStatus()) }) self._proto = proto # Protocol name self._protocol = protocol # Protocol object self._status = CONNECTION_STATUS_DISCONNECTED self._self_handle = NoneHandle() self._handles = weakref.WeakValueDictionary() self._next_handle_id = 1 self._client_handles = {} self._channels = set() self._next_channel_id = 0
def __init__(self, proto, account, manager=None, protocol=None): """ Parameters: proto - the name of the protcol this conection should be handling. account - a protocol-specific account name manager - the name of the connection manager """ if manager is None: import warnings warnings.warn('The manager parameter to Connection.__init__ ' 'should be supplied', DeprecationWarning) manager = 'python' clean_account = _escape_as_identifier(account) bus_name = u'org.freedesktop.Telepathy.Connection.%s.%s.%s' % \ (manager, proto, clean_account) bus_name = dbus.service.BusName(bus_name, bus=dbus.SessionBus()) object_path = '/org/freedesktop/Telepathy/Connection/%s/%s/%s' % \ (manager, proto, clean_account) _Connection.__init__(self, bus_name, object_path) # monitor clients dying so we can release handles dbus.SessionBus().add_signal_receiver(self.name_owner_changed_callback, 'NameOwnerChanged', 'org.freedesktop.DBus', 'org.freedesktop.DBus', '/org/freedesktop/DBus') self._interfaces = set() DBusProperties.__init__(self) self._implement_property_get(CONN_INTERFACE, { 'SelfHandle': lambda: dbus.UInt32(self.GetSelfHandle()), 'Interfaces': lambda: dbus.Array(self.GetInterfaces(), signature='s'), 'Status': lambda: dbus.UInt32(self.GetStatus()), 'HasImmortalHandles': lambda: True, }) self._proto = proto # Protocol name self._protocol = protocol # Protocol object self._status = CONNECTION_STATUS_DISCONNECTED self._self_handle = NoneHandle() self._handles = {} self._next_handle_id = 1 self._client_handles = {} self._channels = set() self._next_channel_id = 0