added "send" trigger point as the last one before sending, can be used for e2e encryption
This commit is contained in:
parent
6467bdb3c3
commit
13e2e50cb0
1 changed files with 16 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ from twisted.words.protocols.jabber.xmlstream import XMPPHandler
|
|||
from twisted.words.protocols.jabber import xmlstream
|
||||
from twisted.words.protocols.jabber import error
|
||||
from twisted.words.protocols.jabber import jid
|
||||
from twisted.words.xish import domish
|
||||
from twisted.python import failure
|
||||
from wokkel import client as wokkel_client, disco, xmppim, generic, iwokkel
|
||||
from wokkel import delay
|
||||
|
|
@ -93,6 +94,21 @@ class SatXMPPClient(wokkel_client.XMPPClient):
|
|||
iq_error_elt = error.StanzaError(condition).toResponse(iq_elt)
|
||||
self.xmlstream.send(iq_error_elt)
|
||||
|
||||
def send(self, obj):
|
||||
# original send method accept string
|
||||
# but we restrict to domish.Element to make trigger treatments easier
|
||||
assert isinstance(obj, domish.Element)
|
||||
# XXX: this trigger is the last one before sending stanza on wire
|
||||
# is it is intended for things like end 2 end encryption.
|
||||
# *DO NOT* cancel (i.e. return False) without very good reason
|
||||
# (out of band transmission for instance).
|
||||
# e2e should have a priority of 0 here, and out of band transmission
|
||||
# a lower priority
|
||||
if not self.host_app.trigger.point("send", self, obj):
|
||||
return
|
||||
return super(SatXMPPClient, self).send(obj)
|
||||
|
||||
|
||||
def _authd(self, xmlstream):
|
||||
if not self.host_app.trigger.point("XML Initialized", xmlstream, self.profile):
|
||||
return
|
||||
|
|
|
|||
Loading…
Reference in a new issue