[djabberd] kane, r795: r6532@coke: josboum | 2008-08-05 16:30...
Brad Fitzpatrick
brad at danga.com
Tue Aug 5 23:24:03 UTC 2008
I don't think this is a good change... RosterStorage is not a singleton.
You can run multiple vhosts within a process, all with different
RosterStorage mechanisms.
On Tue, Aug 5, 2008 at 7:30 AM, <commits at code.sixapart.com> wrote:
> r6532 at coke: josboum | 2008-08-05 16:30:19 +0200
> * for several plugins it's not possible to access their object after the
> ->register()
> phase is over; the object is then only referenced in closures.
> This patch adds a method, ->singleton, to retrieve the object for later
> use. This is
> particularly useful for setting up applications a la
> DJabberd::Plugin::MyApp
>
>
> _U trunk/
> U trunk/DJabberd/lib/DJabberd/Bot.pm
> U trunk/DJabberd/lib/DJabberd/RosterStorage.pm
>
>
>
> Property changes on: trunk
> ___________________________________________________________________
> Name: svk:merge
> - 02e31fea-a713-0410-9bb5-81a53d0f95f7:/djabberd-trunk:4879
> 1b5ff1af-660f-0410-86e2-35bade70ffec:/trunk/djabberd:61
> 391f84f8-cfa2-4f6b-a47d-f52c5dc88d86:/local/sixapart/djabberd-trunk:6518
> 54bb65a0-b99f-4f2b-b22a-e47d41dc43c7:/groupchat:328
> 54bb65a0-b99f-4f2b-b22a-e47d41dc43c7:/local:667
> + 02e31fea-a713-0410-9bb5-81a53d0f95f7:/djabberd-trunk:4879
> 1b5ff1af-660f-0410-86e2-35bade70ffec:/trunk/djabberd:61
> 391f84f8-cfa2-4f6b-a47d-f52c5dc88d86:/local/sixapart/djabberd-trunk:6532
> 54bb65a0-b99f-4f2b-b22a-e47d41dc43c7:/groupchat:328
> 54bb65a0-b99f-4f2b-b22a-e47d41dc43c7:/local:667
>
> Modified: trunk/DJabberd/lib/DJabberd/Bot.pm
> ===================================================================
> --- trunk/DJabberd/lib/DJabberd/Bot.pm 2008-08-05 11:17:05 UTC (rev 794)
> +++ trunk/DJabberd/lib/DJabberd/Bot.pm 2008-08-05 14:30:33 UTC (rev 795)
> @@ -10,6 +10,16 @@
>
> our $logger = DJabberd::Log->get_logger();
>
> +### store the object in a closure, so we can retrieve it later
> +{ my $singleton;
> + sub singleton { $singleton };
> +
> + sub new {
> + my $self = shift;
> + $singleton = $self->SUPER::new( @_ );
> + }
> +}
> +
> sub set_config_nodename {
> my ($self, $nodename) = @_;
> $self->{nodename} = $nodename;
>
> Modified: trunk/DJabberd/lib/DJabberd/RosterStorage.pm
> ===================================================================
> --- trunk/DJabberd/lib/DJabberd/RosterStorage.pm 2008-08-05 11:17:05
> UTC (rev 794)
> +++ trunk/DJabberd/lib/DJabberd/RosterStorage.pm 2008-08-05 14:30:33
> UTC (rev 795)
> @@ -6,6 +6,18 @@
> use DJabberd::Roster;
> use DJabberd::RosterItem;
>
> +### store the object in a closure, so we can retrieve it later
> +### this allows us to manipulate the roster storage from other
> +### places, to for example pre-link users.
> +{ my $singleton;
> + sub singleton { $singleton };
> +
> + sub new {
> + my $self = shift;
> + $singleton = $self->SUPER::new( @_ );
> + }
> +}
> +
> # don't override, or at least call SUPER to this if you do.
> sub register {
> my ($self, $vhost) = @_;
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/djabberd/attachments/20080805/0b50ad68/attachment.html
More information about the Djabberd
mailing list