Add support for incoming/outgoing filters.

A filter accepts and returns a stanza, but potentially modified.

To prevent sending/receiving a stanza, a filter may return None.

Incoming:
    self.add_filter('in', in_filter)

Outgoing:
    self.add_filter('out', out_filter)

Filters are applied in the order thay are added. However, you may
add an order parameter, which is the place in the list to insert the
filter:

    self.add_filter('in', in_filter, order=0)
This commit is contained in:
Lance Stout
2011-12-12 22:17:07 -08:00
parent fc8a13df5a
commit eff3330e75
2 changed files with 29 additions and 2 deletions

View File

@@ -1251,7 +1251,7 @@ class StanzaBase(ElementBase):
stanza sent immediately. Useful for stream
initialization. Defaults to ``False``.
"""
self.stream.send_raw(self.__str__(), now=now)
self.stream.send(self, now=now)
def __copy__(self):
"""Return a copy of the stanza object that does not share the