diff src/plugins/plugin_xep_0234.py @ 1618:0de5f210fe56

plugin XEP-0300: implemented hashing: - parseHashElt do what it says - calculateHashElt can calculate a whole hash in a non-blocking way - or getHasher can be used for progressive hashing - getBestPeerAlgo return the best available hashing algorithm of an entity
author Goffi <goffi@goffi.org>
date Tue, 17 Nov 2015 19:48:19 +0100
parents b144babc2658
children 4dd07d026214
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0234.py	Tue Nov 17 19:41:30 2015 +0100
+++ b/src/plugins/plugin_xep_0234.py	Tue Nov 17 19:48:19 2015 +0100
@@ -58,6 +58,7 @@
         self._j.registerApplication(NS_JINGLE_FT, self)
         self._f = host.plugins["FILE"]
         self._f.register(NS_JINGLE_FT, self.fileJingleSend, priority = 10000, method_name=u"Jingle")
+        self._hash = self.host.plugins["XEP-0300"]
         host.bridge.addMethod("fileJingleSend", ".plugin", in_sign='sssss', out_sign='', method=self._fileJingleSend)
 
     def getHandler(self, profile):
@@ -116,7 +117,7 @@
         for name in ('date', 'desc', 'media-type', 'name', 'size'):
             file_elt.addElement(name, content=unicode(file_data[name]))
         file_elt.addElement("range") # TODO
-        file_elt.addChild(self.host.plugins["XEP-0300"].buidHash())
+        file_elt.addChild(self._hash.buildHashElt())
         return desc_elt
 
     def jingleRequestConfirmation(self, action, session, content_name, desc_elt, profile):