XEP-0065,XEP-0096,XEP-0166,XEP-0235,XEP-0300: file transfer improvments:
huge patch sorry :) many things are improved by this patch, notably: - updated to last protocol changes (urn:xmpp:jingle:apps:file-transfer:5 and urn:xmpp:hashes:2) - XEP-0234: file request implementation - XEP-0234: methods to parse and generate <file> element (can be used by other plugins easily) - XEP-0234: range data is now in a namedtuple - path and namespace can be specified when sending/requesting a file (not standard, but needed for file sharing) - better error/termination handling - trigger points to handle file requests by other plugins - preparation to use file plugins with components
This commit is contained in:
parent
db45d45be5
commit
2e5991575f
1 changed files with 423 additions and 94 deletions
|
|
@ -51,6 +51,7 @@ PLUGIN_INFO = {
|
|||
C.PI_NAME: "Jingle",
|
||||
C.PI_IMPORT_NAME: "XEP-0166",
|
||||
C.PI_TYPE: "XEP",
|
||||
C.PI_MODES: C.PLUG_MODE_BOTH,
|
||||
C.PI_PROTOCOLS: ["XEP-0166"],
|
||||
C.PI_MAIN: "XEP_0166",
|
||||
C.PI_HANDLER: "yes",
|
||||
|
|
@ -318,6 +319,8 @@ class XEP_0166(object):
|
|||
@return D(unicode): jingle session id
|
||||
"""
|
||||
assert contents # there must be at least one content
|
||||
if peer_jid == client.jid:
|
||||
raise ValueError(_(u"You can't do a jingle session with yourself"))
|
||||
initiator = client.jid
|
||||
sid = unicode(uuid.uuid4())
|
||||
# TODO: session cleaning after timeout ?
|
||||
|
|
@ -385,9 +388,12 @@ class XEP_0166(object):
|
|||
transport_elt = yield transport.handler.jingleSessionInit(client, session, content_name)
|
||||
content_elt.addChild(transport_elt)
|
||||
|
||||
d = iq_elt.send()
|
||||
d.addErrback(self._iqError, sid, client)
|
||||
yield d
|
||||
try:
|
||||
yield iq_elt.send()
|
||||
except Exception as e:
|
||||
failure_ = failure.Failure(e)
|
||||
self._iqError(failure_, sid, client)
|
||||
raise failure_
|
||||
|
||||
def delayedContentTerminate(self, *args, **kwargs):
|
||||
"""Put contentTerminate in queue but don't execute immediately
|
||||
|
|
@ -758,7 +764,7 @@ class XEP_0166(object):
|
|||
try:
|
||||
reason_elt = jingle_elt.elements(NS_JINGLE, 'reason').next()
|
||||
except StopIteration:
|
||||
log.warning(u"Not reason given for session termination")
|
||||
log.warning(u"No reason given for session termination")
|
||||
reason_elt = jingle_elt.addElement('reason')
|
||||
|
||||
terminate_defers = self._callPlugins(client, XEP_0166.A_SESSION_TERMINATE, session, 'jingleTerminate', 'jingleTerminate', self._ignore, self._ignore, elements=False, force_element=reason_elt)
|
||||
|
|
|
|||
Loading…
Reference in a new issue