[Telepathy-commits] [telepathy-salut/master] xmppstream.py: override OutgoingXmppiChatStream send method as iChat doesn't send from attribute in stanza

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Nov 7 03:26:48 PST 2008


---
 tests/twisted/xmppstream.py |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/tests/twisted/xmppstream.py b/tests/twisted/xmppstream.py
index 8e43f55..d037707 100644
--- a/tests/twisted/xmppstream.py
+++ b/tests/twisted/xmppstream.py
@@ -154,6 +154,15 @@ class OutgoingXmppiChatStream(OutgoingXmppStream):
         root = domish.Element((NS_STREAMS, 'stream'))
         self.send(root.toXml(closeElement = 0, prefixes=self.prefixes))
 
+    def send(self, obj):
+        if domish.IElement.providedBy(obj):
+            # iChat doesn't send 'from' attribute
+            if self.remote_name != None:
+                obj["to"] = self.remote_name
+            obj = obj.toXml(prefixes=self.prefixes)
+
+        xmlstream.XmlStream.send(self, obj)
+
 class OutgoingXmppFactory(ClientFactory):
     def __init__(self, event_function):
         self.event_func = event_function
-- 
1.5.6.5




More information about the Telepathy-commits mailing list