AnyEvent-XMPP

 view release on metacpan or  search on metacpan

lib/AnyEvent/XMPP/Ext/Receipts.pm  view on Meta::CPAN

# vim:ts=4:sw=4:et
package AnyEvent::XMPP::Ext::Receipts;
use AnyEvent;
use AnyEvent::XMPP::Ext;
use AnyEvent::XMPP::Util qw/is_bare_jid/;
use AnyEvent::XMPP::Namespaces qw/set_xmpp_ns_alias/;
use Data::Dumper;
use warnings;
use strict;

our @ISA = qw/AnyEvent::XMPP::Ext/;

=head1 NAME

AnyEvent::XMPP::Ext::Receipts - XEP-0184 message receipts

=head1 SYNOPSIS

    use AnyEvent::XMPP::Ext::Disco;
    use AnyEvent::XMPP::Ext::Receipts;

    my $disco = AnyEvent::XMPP::Ext::Disco->new();
    $xmpp->add_extension($disco);

    my $receipts = AnyEvent::XMPP::Ext::Receipts->new(disco => $disco);
    $xmpp->add_extension($receipts);

    $disco->enable_feature($receipts->disco_feature);

=head1 DESCRIPTION

This module adds support for XEP-0184 message receipts.

Message receipts provide a way to verify that messages were received by the
recipient, as long as the recipient's client supports it.

Note that you need to send messages with message receipts to full Jabber IDs
(e.g. jabber@example.com/android3948128), not bare Jabber IDs (e.g.
jabber@example.com).

=head1 METHODS

=over

=cut

# A hash which stores whether a certain presence supports XEP-0184 receipts.
# Entries are added after we actually send a message and entries are purged
# when the presence goes offline or is replaced (since the new presence might
# have a different feature set while keeping the same jid).
my %supports_receipts = ();

# A hash which stores timers by message id. When a message is acknowledged, the
# corresponding timer is deleted.
my %timers = ();

=item B<new (%args)>

Creates a new receipts handle.

The following keys can be specified:

=over

=item B<disco>

An C<AnyEvent::XMPP::Ext::Disco> object so that it can be figured out whether



( run in 2.479 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )