File Coverage

blib/lib/Protocol/XMPP/Message.pm
Criterion Covered Total %
statement 9 23 39.1
branch 0 10 0.0
condition 0 3 0.0
subroutine 3 11 27.2
pod 2 8 25.0
total 14 55 25.4


line stmt bran cond sub pod time code
1             package Protocol::XMPP::Message;
2              
3 4     4   185489 use strict;
  4         9  
  4         120  
4 4     4   15 use warnings;
  4         5  
  4         177  
5 4     4   40 use parent qw(Protocol::XMPP::Base);
  4         8  
  4         26  
6              
7             our $VERSION = '0.007'; ## VERSION
8              
9             =head1 NAME
10              
11             Protocol::XMPP::Feature - register ability to deal with a specific feature
12              
13             =head1 SYNOPSIS
14              
15             =head1 DESCRIPTION
16              
17             =head1 METHODS
18              
19             =cut
20              
21 0   0 0 1   sub from { my $self = shift; $self->{from} // $self->stream->jid }
  0            
22 0 0   0 1   sub to { shift->{to} || '' }
23 0 0   0 0   sub subject { shift->{subject} || '' }
24 0 0   0 0   sub body { shift->{body} || '' }
25 0 0   0 0   sub type { shift->{type} || 'chat' }
26 0 0   0 0   sub nick { my $self = shift; $self->{nick} || $self->{from} }
  0            
27              
28             sub reply {
29 0     0 0   my $self = shift;
30 0           my %args = @_;
31 0           $self->write_xml(['message', 'from' => $self->stream->jid, 'to' => $self->from, type => $self->type, _content => [[ 'body', _content => $args{body} ]]]);
32             }
33              
34             sub send {
35 0     0 0   my $self = shift;
36 0           my %args = @_;
37 0           $self->write_xml([
38             'message',
39             'to' => $self->to,
40             type => $self->type,
41             _content => [[
42             'body',
43             _content => $self->body
44             ]]
45             ]);
46             }
47              
48             1;
49              
50             __END__