[telepathy-ashes/master] Got it working with butterfly and haze too.
David Laban
david.laban at collabora.co.uk
Sat Oct 10 18:19:40 PDT 2009
Note that this found a bug in butterfly where it got confused by multiple
calls to Connect(). There is still debugging to do, but it will mostly
happen within butterfly.
---
ashes/tools/dispatchers.py | 19 ++++++++++++++++---
ashes/tools/groups.py | 3 ++-
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/ashes/tools/dispatchers.py b/ashes/tools/dispatchers.py
index 8b6ed21..0e2055a 100644
--- a/ashes/tools/dispatchers.py
+++ b/ashes/tools/dispatchers.py
@@ -47,7 +47,7 @@ class ChannelDispatcher(ConnectionListener):
if isinstance(classes, dict):
for key, handler_class in classes.items():
if issubclass(handler_class, ChannelListener):
- handler_classes[key] = value
+ handler_classes[key] = handler_class
elif isinstance(classes, (tuple, list)):
for handler_class in classes:
if issubclass(handler_class, ChannelListener):
@@ -65,6 +65,16 @@ class ChannelDispatcher(ConnectionListener):
FIXME: do caps based on _handler_classes rather than hardcoded.
"""
super(ChannelDispatcher, self).finish_setup()
+
+ def StatusChanged(self, status, reason=0):
+ print "StatusChanged", status, reason
+ if status == 0: #Connected
+ self.dispatch_initial_channels()
+ # We know that ConnectionListener listens to this signal to detect
+ # disconnects. Other mixin classes MAY also override this.
+ super(ChannelDispatcher, self).StatusChanged(status, reason)
+
+ def dispatch_initial_channels(self):
handler_classes = self._collect_handler_classes()
caps = []
for (chantype, handletype), handler_class in handler_classes.items():
@@ -78,8 +88,11 @@ class ChannelDispatcher(ConnectionListener):
else:
print "WARNING: %s needs to override channel_type handle_type "\
"and capability_flags. It doesn't." % handler_class
-
- self.connection[self.CAPS].AdvertiseCapabilities(caps, [])
+ try:
+ caps_iface = self.connection[self.CAPS]
+ caps_iface.AdvertiseCapabilities(caps, [])
+ except KeyError:
+ print "CM doesn't implement the capabilities interface"
get_property(self.connection, telepathy.CONNECTION_INTERFACE_REQUESTS,
'Channels', reply_handler=self.NewChannels, error_handler=printer)
diff --git a/ashes/tools/groups.py b/ashes/tools/groups.py
index 16225ac..7fc2c9e 100644
--- a/ashes/tools/groups.py
+++ b/ashes/tools/groups.py
@@ -24,7 +24,8 @@ class MemberAcceptor(ChannelListener):
self.group_properties_callback)
def group_properties_callback(self, properties):
- self.local_pending(properties["LocalPendingMembers"])
+ handles = properties.get("LocalPendingMembers", [])
+ self.local_pending(handles)
def local_pending(self, pending):
"""
--
1.5.6.5
More information about the telepathy-commits
mailing list