AnyEvent-XMPP

 view release on metacpan or  search on metacpan

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

    set_xmpp_ns_alias(receipts => 'urn:xmpp:receipts');

    $self->reg_cb(
        ext_before_message_xml => sub {
            my ($self, $con, $node) = @_;

            # Figure out if this is a receive receipt (XEP-0184), such a message
            # looks like this:
            #  <message from="recipient@jabber.ccc.de/androidDc9226M8"
            #   id="CA597-36"
            #   to="me@jabber.ccc.de/18327446281349735808246801">
            #    <received id="foobar23" xmlns="urn:xmpp:receipts"/>
            #  </message>
            my ($receipt) = $node->find_all ([qw/receipts received/]);
            if (defined($receipt)) {
                my $id = $receipt->attr('id');
                print "(xep0184) message $id acknowledged\n" if $self->{debug};
                delete $timers{$id};
                # If the recipient acknowledged our message, he *obviously*
                # supports receipts.
                $supports_receipts{$node->attr('from')} = 1;



( run in 1.097 second using v1.01-cache-2.11-cpan-7add2cbd662 )