[PATCH] Re: Using DJabberd as a platform for external components
Pedro Melo
melo at simplicidade.org
Sat Jan 6 17:24:33 UTC 2007
Hi Martin,
On Dec 22, 2006, at 1:29 AM, Martin Atkins wrote:
> In the core trunk now is a module called
> DJabberd::Delivery::ComponentConnection. If you create your custom
> component as a subclass of DJabberd::Component, you should then be
> able to make use of it like this:
>
> <VHost component.example.com>
>
> <Plugin DJabberd::Delivery::ComponentConnection>
> RemoteAddr 123.213.132.121:21231
> Secret password
> </Plugin>
>
> <Plugin YourNamespace::Jabber::SomeComponent>
> # ... parameters ...
> </Plugin>
>
> </VHost>
This does not work. When the first </Plugin> is reached, the
DJ::D::ComponentConnection is added to the VHost using the add_plugin
() method.
This will call $plugin->register(), and this will trigger a new
connection.
The problem is that the DJ::Conn::ComponentOut requires the $vhost-
>server, but that is still undef at this time. Vhosts only get the
server object at the </Vhost> when we call $server->add_vhost().
So we get a croak at line 64 of Connection.pm.
The fix I came up with was changing the VHost.pm to accept the server
in the %opts, and pass it at the time we create the vhost object
(when we parse the <VHost> tag.
The patch is attached. It passes all the tests but I don't know if it
might break other stuff. I don't know if there is some code that
depends on ->server() not being initialized until </VHost>...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: djabberd-external-component.patch
Type: application/octet-stream
Size: 1189 bytes
Desc: not available
Url : http://lists.danga.com/pipermail/djabberd/attachments/20070106/b7197265/djabberd-external-component.obj
-------------- next part --------------
Best regards,
--
Pedro Melo
Blog: http://www.simplicidade.org/notes/
Jabber ID: melo at simplicidade.org
Use Jabber!
More information about the Djabberd
mailing list