From a71f6701c2c5c5185651d8bc7d81cc3bd5726ce6 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Wed, 29 Aug 2012 16:12:14 +0200
Subject: [PATCH] correctly send hash in session-accept

---
 src/common/jingle_content.py | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/common/jingle_content.py b/src/common/jingle_content.py
index b1351454cb..c5ca6395f9 100644
--- a/src/common/jingle_content.py
+++ b/src/common/jingle_content.py
@@ -180,14 +180,17 @@ class JingleContent(object):
             node = xmpp.simplexml.Node(tag='size')
             node.addData(self.file_props.size)
             file_tag.addChild(node=node)
-        if self.file_props.hash_:
-            # TODO: use xep-300 for this bit
-            pass
-        # if the file is less than 10 mb, then it is small
-        # lets calculate it right away
-        if int(self.file_props.size) < 10000000:
-            h  = self._calcHash()
-            file_tag.addChild(node=h)
+        if self.file_props.type_ == 'r':
+            if self.file_props.hash_:
+                h = file_tag.addChild('hash', attrs={
+                    'algo': self.file_props.algo}, namespace=xmpp.NS_HASHES,
+                    payload=self.file_props.hash_)
+        else:
+            # if the file is less than 10 mb, then it is small
+            # lets calculate it right away
+            if int(self.file_props.size) < 10000000:
+                h  = self._calcHash()
+                file_tag.addChild(node=h)
         desc = file_tag.setTag('desc')
         if self.file_props.desc:
             desc.setData(self.file_props.desc)
-- 
GitLab