summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2010-03-10 19:00:44 +0000
committerJonny Lamb <jonny.lamb@collabora.co.uk>2010-03-10 19:00:44 +0000
commit635f724a44231f05fa56ee53e55642c75dbffb6f (patch)
treefae2a32d8c314da68415003ef14174d3afc148a3
parent2c05b123a294a67d77f8f638fbb41c0cc6068a87 (diff)
channel: don't find the channel handle if TargetHandleType=NONE or TargetHandle is missing
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--src/server/channel.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/server/channel.py b/src/server/channel.py
index 7b1ac41..94e6026 100644
--- a/src/server/channel.py
+++ b/src/server/channel.py
@@ -21,7 +21,8 @@ import dbus
import dbus.service
from telepathy.constants import (CONNECTION_HANDLE_TYPE_NONE,
- CHANNEL_TEXT_MESSAGE_TYPE_NORMAL)
+ CHANNEL_TEXT_MESSAGE_TYPE_NORMAL,
+ HANDLE_TYPE_NONE)
from telepathy.errors import InvalidArgument
@@ -63,9 +64,17 @@ class Channel(_Channel, DBusProperties):
self._immutable_properties = dict()
- self._handle = self._conn.handle(
- props[CHANNEL_INTERFACE + '.TargetHandleType'],
- props[CHANNEL_INTERFACE + '.TargetHandle'])
+ if CHANNEL_INTERFACE + '.TargetHandleType' in props \
+ and CHANNEL_INTERFACE + '.TargetHandle' in props:
+ if props[CHANNEL_INTERFACE + '.TargetHandleType'] == HANDLE_TYPE_NONE:
+ self._handle = None
+ else:
+ self._handle = self._conn.handle(
+ props[CHANNEL_INTERFACE + '.TargetHandleType'],
+ props[CHANNEL_INTERFACE + '.TargetHandle'])
+ else:
+ self._handle = None
+
self._interfaces = set()
DBusProperties.__init__(self)