[PyXMPP] Want to implement component - logger
Jacek Konieczny
jajcus at jajcus.net
Wed Mar 17 19:13:58 CET 2010
On Wed, Mar 17, 2010 at 03:25:46PM +0200, Serg Truf wrote:
> i want to implement component for ejabberd server, but can't get route
> messages, so see only Unknown stanzas
>
> how can i handle those 'Unknown' stanzas?
There is direct interface for that.
> i read that should reimplement route_stanza,
That is not quite true. route_stanza is supposed to be used for stanzas
not addressed to your component.
> please advice me or give me an vector in this.
Override the process_stanza() method of the stream object.
Not to bother with subclassing you can just use some Python magic and
replace the attribute:
class Something(...):
...
orig_process_stanza = None
def some_stream_setup(self):
self.orig_process_stanza = stream.process_stanza
stream.process_stanza = self.my_process_stanza
def my_process_stanza(self, stanza):
if stanza.stanza_type == "route":
stanza = do_something_like_stripping_route()
return self.orig_process_stanza(stanza)
I hope that helps (haven't tried it myself).
Greets,
Jacek
More information about the PyXMPP
mailing list