line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, .CO.ZA Contact EPP extension commands |
2
|
|
|
|
|
|
|
## From http://registry.coza.net.za/doku.php?id=eppcontactextension |
3
|
|
|
|
|
|
|
## |
4
|
|
|
|
|
|
|
## Copyright (c) 2011,2013 Patrick Mevzek . All rights reserved. |
5
|
|
|
|
|
|
|
## |
6
|
|
|
|
|
|
|
## This file is part of Net::DRI |
7
|
|
|
|
|
|
|
## |
8
|
|
|
|
|
|
|
## Net::DRI is free software; you can redistribute it and/or modify |
9
|
|
|
|
|
|
|
## it under the terms of the GNU General Public License as published by |
10
|
|
|
|
|
|
|
## the Free Software Foundation; either version 2 of the License, or |
11
|
|
|
|
|
|
|
## (at your option) any later version. |
12
|
|
|
|
|
|
|
## |
13
|
|
|
|
|
|
|
## See the LICENSE file that comes with this distribution for more details. |
14
|
|
|
|
|
|
|
#################################################################################################### |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
package Net::DRI::Protocol::EPP::Extensions::COZA::Contact; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
885
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
19
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
3
|
use Net::DRI::Util; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
12
|
|
22
|
1
|
|
|
1
|
|
3
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
388
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#################################################################################################### |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub register_commands |
27
|
|
|
|
|
|
|
{ |
28
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
29
|
0
|
|
|
|
|
|
my %tmp=( |
30
|
|
|
|
|
|
|
info => [ \&info, \&info_parse ], |
31
|
|
|
|
|
|
|
update => [ \&update, undef ], |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return { 'contact' => \%tmp }; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub setup |
38
|
|
|
|
|
|
|
{ |
39
|
0
|
|
|
0
|
0
|
|
my ($class,$po,$version)=@_; |
40
|
0
|
|
|
|
|
|
$po->ns({ 'cozacontact' => [ 'http://co.za/epp/extensions/cozacontact-1-0','coza-contact-1.0.xsd' ] }); |
41
|
0
|
|
|
|
|
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
#################################################################################################### |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub info |
47
|
|
|
|
|
|
|
{ |
48
|
0
|
|
|
0
|
0
|
|
my ($epp,$c,$rp)=@_; |
49
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
0
|
|
|
|
if (Net::DRI::Util::has_key($rp,'domain_listing') && $rp->{domain_listing}) |
52
|
|
|
|
|
|
|
{ |
53
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('cozacontact','info'); |
54
|
0
|
|
|
|
|
|
$mes->command_extension($eid,[['cozacontact:domainListing','true']]); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
0
|
0
|
0
|
|
|
|
if (Net::DRI::Util::has_key($rp,'balance') && $rp->{balance}) |
58
|
|
|
|
|
|
|
{ |
59
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('cozacontact','info'); |
60
|
0
|
|
|
|
|
|
$mes->command_extension($eid,[['cozacontact:balance','true']]); |
61
|
|
|
|
|
|
|
} |
62
|
0
|
|
|
|
|
|
return; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub info_parse |
66
|
|
|
|
|
|
|
{ |
67
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
68
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
69
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $infdata=$mes->get_extension('cozacontact','infData'); |
72
|
0
|
0
|
|
|
|
|
return unless defined $infdata; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
|
|
|
|
my %l; |
75
|
0
|
|
|
|
|
|
foreach my $el (Net::DRI::Util::xml_list_children($infdata)) |
76
|
|
|
|
|
|
|
{ |
77
|
0
|
|
|
|
|
|
my ($name,$node)=@$el; |
78
|
0
|
0
|
|
|
|
|
next unless $name eq 'domain'; |
79
|
0
|
|
|
|
|
|
push @{$l{lc $node->getAttribute('level')}},$node->textContent(); |
|
0
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
} |
81
|
0
|
|
|
|
|
|
$rinfo->{contact}->{$oname}->{domain_listing}=\%l; |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
my $ns=$mes->ns('cozacontact'); |
84
|
0
|
|
|
|
|
|
my $balance=Net::DRI::Util::xml_traverse($infdata,$ns,'balance'); |
85
|
0
|
0
|
|
|
|
|
$rinfo->{registrar}->{$oname}->{balance}=0+$balance->textContent() if defined $balance; |
86
|
0
|
|
|
|
|
|
return; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub update |
90
|
|
|
|
|
|
|
{ |
91
|
0
|
|
|
0
|
0
|
|
my ($epp,$c,$todo)=@_; |
92
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
my $cancel=$todo->set('cancel_action'); |
95
|
0
|
0
|
|
|
|
|
return unless defined $cancel; |
96
|
|
|
|
|
|
|
|
97
|
0
|
0
|
|
|
|
|
Net::DRI::Exception::usererr_invalid_parameters('cancel_action parameter must be PendingUpdate') unless $cancel=~m/^Pending(?:Update)$/; |
98
|
0
|
|
|
|
|
|
my $eid=$mes->command_extension_register('cozacontact','update',{cancelPendingAction=>$cancel}); |
99
|
0
|
|
|
|
|
|
return; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
#################################################################################################### |
103
|
|
|
|
|
|
|
1; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
__END__ |