line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hoppy::Service::Logout; |
2
|
5
|
|
|
5
|
|
32
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
219
|
|
3
|
5
|
|
|
5
|
|
29
|
use warnings; |
|
5
|
|
|
|
|
636
|
|
|
5
|
|
|
|
|
171
|
|
4
|
5
|
|
|
5
|
|
27
|
use base qw( Hoppy::Service::Base ); |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
1825
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub work { |
7
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
8
|
0
|
|
|
|
|
|
my $args = shift; |
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
|
|
|
my $user_id = $args->{user_id}; |
11
|
0
|
|
|
|
|
|
my $in_data = $args->{in_data}; |
12
|
0
|
|
|
|
|
|
my $poe = $args->{poe}; |
13
|
0
|
|
|
|
|
|
my $session_id = $poe->session->ID; |
14
|
0
|
|
|
|
|
|
my $c = $self->context; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $result = $c->room->logout( $args, $poe ); |
17
|
0
|
|
|
|
|
|
my $out_data; |
18
|
0
|
0
|
|
|
|
|
if ($result) { |
19
|
0
|
|
|
|
|
|
$out_data = { result => $result, error => "" }; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
else { |
22
|
0
|
|
|
|
|
|
my $message = "logout failed"; |
23
|
0
|
|
|
|
|
|
$out_data = { result => "", error => $message }; |
24
|
|
|
|
|
|
|
} |
25
|
0
|
0
|
|
|
|
|
if ( $in_data->{id} ) { |
26
|
0
|
|
|
|
|
|
$out_data->{id} = $in_data->{id}; |
27
|
|
|
|
|
|
|
} |
28
|
0
|
|
|
|
|
|
my $serialized = $c->formatter->serialize($out_data); |
29
|
0
|
|
|
|
|
|
$c->unicast( |
30
|
|
|
|
|
|
|
{ |
31
|
|
|
|
|
|
|
session_id => $session_id, |
32
|
|
|
|
|
|
|
user_id => $args->{user_id}, |
33
|
|
|
|
|
|
|
message => $serialized |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
); |
36
|
0
|
0
|
|
|
|
|
if ( my $hook = $c->hook->{logout} ) { |
37
|
0
|
|
|
|
|
|
$hook->work($args); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
__END__ |