AnyEvent-XMPP
view release on metacpan or search on metacpan
lib/AnyEvent/XMPP/Client.pm view on Meta::CPAN
=head2 update_connections ()
This method tries to connect all unconnected accounts.
=cut
sub update_connections {
my ($self) = @_;
Scalar::Util::weaken $self;
for (values %{$self->{accounts}}) {
my $acc = $_;
if (!$acc->is_connected && !$self->{prep_connections}->{$acc->bare_jid}) {
my %args = (initial_presence => 10);
if (defined $self->{presence}) {
if (defined $self->{presence}->{priority}) {
$args{initial_presence} = $self->{presence}->{priority};
lib/AnyEvent/XMPP/Ext/VCard.pm view on Meta::CPAN
my $vcard = AnyEvent::XMPP::Ext::VCard->new;
$con->reg_cb (
stream_ready => sub { $vcard->hook_on ($con) }
);
=cut
sub hook_on {
my ($self, $con, $dont_retrieve_vcard) = @_;
Scalar::Util::weaken $self;
my $rid =
$con->reg_cb (
ext_before_send_presence_hook => sub {
my ($con, $id, $type, $attrs, $create_cb) = @_;
my $chlds;
my $vc = $self->my_vcard ($con);
lib/AnyEvent/XMPP/Ext/VCard.pm view on Meta::CPAN
# the own vcard was already set by retrieve
# this will push out an updated presence
$self->_publish_avatar;
});
}
}
);
my $ar = [$con, $rid];
Scalar::Util::weaken $ar->[0];
push @{$self->{hooked}}, $ar;
}
sub _publish_avatar {
my ($self) = @_;
for (@{$self->{hooked}}) {
if ($_->[0]) { $_->[0]->send_presence () }
}
}
( run in 0.254 second using v1.01-cache-2.11-cpan-65fba6d93b7 )