AnyEvent-XMPP
view release on metacpan or search on metacpan
lib/AnyEvent/XMPP/Client.pm view on Meta::CPAN
$self->{started} = 1;
$self->update_connections;
}
=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);
lib/AnyEvent/XMPP/Ext/MUC/User.pm view on Meta::CPAN
=cut
sub new {
my $this = shift;
my $class = ref($this) || $this;
my $self = $class->SUPER::new (@_);
$self->init;
$self
}
sub update {
my ($self, $node) = @_;
$self->SUPER::update ($node);
my ($xuser) = $node->find_all ([qw/muc_user x/]);
my $from = $node->attr ('from');
my ($room, $srv, $nick) = split_jid ($from);
my ($aff, $role, $stati, $jid, $new_nick);
$self->{stati} ||= {};
$stati = $self->{stati};
lib/AnyEvent/XMPP/IM/Contact.pm view on Meta::CPAN
=item B<update ($item)>
This method wants a L<AnyEvent::XMPP::Node> in C<$item> which
should be a roster item received from the server. The method will
update the contact accordingly and return it self.
=cut
sub update {
my ($self, $item) = @_;
my ($jid, $name, $subscription, $ask) =
(
$item->attr ('jid'),
$item->attr ('name'),
$item->attr ('subscription'),
$item->attr ('ask')
);
lib/AnyEvent/XMPP/IM/Contact.pm view on Meta::CPAN
}
=item B<update_presence ($presence)>
This method updates the presence of contacts on the roster.
C<$presence> must be a L<AnyEvent::XMPP::Node> object and should be
a presence packet.
=cut
sub update_presence {
my ($self, $node) = @_;
my $type = $node->attr ('type');
my $jid = $node->attr ('from');
# XXX: should check whether C<$jid> is nice JID.
$self->touch_presence ($jid);
my $old;
my $new;
lib/AnyEvent/XMPP/IM/Presence.pm view on Meta::CPAN
bless { @_ }, $class;
}
sub clone {
my ($self) = @_;
my $p = $self->new (connection => $self->{connection});
$p->{$_} = $self->{$_} for qw/show jid priority status/;
$p
}
sub update {
my ($self, $node) = @_;
$self->fetch_delay_from_node ($node);
my $type = $node->attr ('type');
my ($show) = $node->find_all ([qw/client show/]);
my ($priority) = $node->find_all ([qw/client priority/]);
my %stati;
$stati{$_->attr ('lang') || ''} = $_->text
lib/AnyEvent/XMPP/IM/Roster.pm view on Meta::CPAN
object. There is no other way.
=cut
sub new {
my $this = shift;
my $class = ref($this) || $this;
bless { @_ }, $class;
}
sub update {
my ($self, $node) = @_;
my ($query) = $node->find_all ([qw/roster query/]);
return unless $query;
my @upd;
for my $item ($query->find_all ([qw/roster item/])) {
my $jid = $item->attr ('jid');
lib/AnyEvent/XMPP/IM/Roster.pm view on Meta::CPAN
my $c = $self->remove_contact ($jid);
$c->update ($item);
} else {
push @upd, $self->get_contact ($jid)->update ($item);
}
}
@upd
}
sub update_presence {
my ($self, $node) = @_;
my $jid = $node->attr ('from');
# XXX: should check whether C<$jid> is nice JID.
my $type = $node->attr ('type');
my $contact = $self->touch_jid ($jid);
my %stati;
$stati{$_->attr ('lang') || ''} = $_->text
for $node->find_all ([qw/client status/]);
( run in 0.351 second using v1.01-cache-2.11-cpan-2b0bae70ee8 )