File: z_09_owncontact.t

package info (click to toggle)
libanyevent-xmpp-perl 0.55-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 784 kB
  • ctags: 553
  • sloc: perl: 8,004; makefile: 13
file content (35 lines) | stat: -rw-r--r-- 804 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!perl

use strict;
no warnings;
use Test::More;
use AnyEvent::XMPP::TestClient;
use AnyEvent::XMPP::IM::Message;
use AnyEvent::XMPP::Util qw/bare_jid/;

my $cl =
   AnyEvent::XMPP::TestClient->new_or_exit (tests => 1, finish_count => 1);
my $C = $cl->client;

my ($src, $dest);
my $recv_message = "";

$C->reg_cb (
   presence_update => sub {
      my ($C, $acc, $roster, $contact) = @_;

      if ($contact->is_me) {
         my ($first) = $contact->get_presences ();

         if ($first->show eq '') {
            $acc->connection->send_presence (
               undef, undef, show => 'xa', status => 'testing');
         } elsif ($first->show eq 'xa') {
            is ($first->status, 'testing', "extended away status is 'testing'");
            $cl->finish;
         }
      }
   }
);

$cl->wait;