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
This commit is contained in:
Goffi 2015-11-17 19:48:19 +01:00
commit 8d9418b6ad

View file

@ -58,6 +58,7 @@ class XEP_0234(object):
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 @@ class XEP_0234(object):
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):