+class EnsureChannel(Action):
+
+ def __init__(self, connAction, channelType, handleType, handleId):
+ super(EnsureChannel, self).__init__()
+ self._connAction = connAction
+ self._channel = None
+ self._channelType = channelType
+ self._handleType = handleType
+ self._handleId = handleId
+ self._handle = None
+
+ @property
+ def channel(self):
+ return self._channel
+
+ @property
+ def handle(self):
+ return self._handle
+
+ @property
+ def handles(self):
+ return [self._handle]
+
+ def queue_action(self):
+ properties = {
+ telepathy.server.CHANNEL_INTERFACE+".ChannelType": self._channelType,
+ telepathy.server.CHANNEL_INTERFACE+".TargetHandleType": self._handleType,
+ telepathy.server.CHANNEL_INTERFACE+".TargetID": self._handleId,
+ }
+ self._connAction.conn[telepathy.server.CONNECTION_INTERFACE_REQUESTS].EnsureChannel(
+ properties,
+ reply_handler = self._on_done,
+ error_handler = self._on_error,
+ )
+
+ def _on_done(self, yours, channelObjectPath, properties):
+ print "Create?", not not yours
+ print "Path:", channelObjectPath
+ print "Properties:", properties
+ self._channel = telepathy.client.Channel(self._connAction.serviceName, channelObjectPath)
+ self._handle = properties[telepathy.server.CHANNEL_INTERFACE+".TargetHandle"]
+ super(EnsureChannel, self)._on_done()
+
+