chat logging plugin

Martin Atkins mart at
Wed Nov 8 19:54:59 UTC 2006

Eugene Tumachoff wrote:
> Hello,
> I'm trying to write a plugin to store users chat log.
> Can you please give me an advise, how to do it in the right way?

You could probably do this with a Delivery plugin. Components are 
subclasses of Delivery, which is a more raw interface to handling 
incoming stanzas which thus has less overhead. For this application, I 
don't think you t really gain much by subclassing Component.

Something like this, perhaps:

package Something::Blah::DJabberd::Logger;

use base qw(DJabberd::Delivery);

sub deliver {
     my ($self, $vhost, $cb, $stanza) = @_;

     # Only log message stanzas
     if ($stanza->isa('DJabberd::Message')) {
         # TODO: Do some kind of logging

     # Tell DJabberd that we didn't deliver the message
     # so that it'll try remaining delivery plugins
     return $cb->declined;

Check out the methods of DJabberd::Stanza to see how to get at the 
source JID, destination JID and message body. You might also like to 
refer to how DJabberd::Bot extracts both the plain text and XHTML 
versions of a message.

More information about the Djabberd mailing list