line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
## Domain Registry Interface, FCCN (.PT) Contact EPP extension commands |
2
|
|
|
|
|
|
|
## |
3
|
|
|
|
|
|
|
## Copyright (c) 2008,2009,2013 Patrick Mevzek . All rights reserved. |
4
|
|
|
|
|
|
|
## |
5
|
|
|
|
|
|
|
## This file is part of Net::DRI |
6
|
|
|
|
|
|
|
## |
7
|
|
|
|
|
|
|
## Net::DRI is free software; you can redistribute it and/or modify |
8
|
|
|
|
|
|
|
## it under the terms of the GNU General Public License as published by |
9
|
|
|
|
|
|
|
## the Free Software Foundation; either version 2 of the License, or |
10
|
|
|
|
|
|
|
## (at your option) any later version. |
11
|
|
|
|
|
|
|
## |
12
|
|
|
|
|
|
|
## See the LICENSE file that comes with this distribution for more details. |
13
|
|
|
|
|
|
|
#################################################################################################### |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
package Net::DRI::Protocol::EPP::Extensions::FCCN::Contact; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
893
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
33
|
|
18
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
5
|
use Net::DRI::Exception; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
673
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=pod |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 NAME |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Net::DRI::Protocol::EPP::Extensions::FCCN::Contact - FCCN (.PT) EPP Contact extensions for Net::DRI |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Please see the README file for details. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SUPPORT |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
For now, support questions should be sent to: |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Enetdri@dotandco.comE |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Please also see the SUPPORT file in the distribution. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 SEE ALSO |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Ehttp://www.dotandco.com/services/software/Net-DRI/E |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 AUTHOR |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Patrick Mevzek, Enetdri@dotandco.comE |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 COPYRIGHT |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Copyright (c) 2008,2009,2013 Patrick Mevzek . |
51
|
|
|
|
|
|
|
All rights reserved. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify |
54
|
|
|
|
|
|
|
it under the terms of the GNU General Public License as published by |
55
|
|
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or |
56
|
|
|
|
|
|
|
(at your option) any later version. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
See the LICENSE file that comes with this distribution for more details. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
#################################################################################################### |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub register_commands |
65
|
|
|
|
|
|
|
{ |
66
|
0
|
|
|
0
|
0
|
|
my ($class,$version)=@_; |
67
|
0
|
|
|
|
|
|
my %tmp=( |
68
|
|
|
|
|
|
|
create => [ \&create, undef ], |
69
|
|
|
|
|
|
|
update => [ \&update, undef ], |
70
|
|
|
|
|
|
|
info => [ undef, \&info_parse ], |
71
|
|
|
|
|
|
|
); |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
return { 'contact' => \%tmp }; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#################################################################################################### |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub build_command_extension |
79
|
|
|
|
|
|
|
{ |
80
|
0
|
|
|
0
|
0
|
|
my ($mes,$epp,$tag)=@_; |
81
|
0
|
|
|
|
|
|
return $mes->command_extension_register($tag,sprintf('xmlns:ptcontact="%s" xsi:schemaLocation="%s %s"',$mes->nsattrs('ptcontact'))); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub create |
85
|
|
|
|
|
|
|
{ |
86
|
0
|
|
|
0
|
0
|
|
my ($epp,$contact)=@_; |
87
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# validate() has been called |
90
|
0
|
|
|
|
|
|
my @n; |
91
|
0
|
|
|
|
|
|
push @n,['ptcontact:identification',$contact->identification()->{value}]; |
92
|
0
|
0
|
|
|
|
|
push @n,['ptcontact:mobile',$contact->mobile()] if $contact->mobile(); |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
my $eid=build_command_extension($mes,$epp,'ptcontact:create'); |
95
|
0
|
|
|
|
|
|
$mes->command_extension($eid,\@n); |
96
|
0
|
|
|
|
|
|
return; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub update |
100
|
|
|
|
|
|
|
{ |
101
|
0
|
|
|
0
|
0
|
|
my ($epp,$contact,$todo)=@_; |
102
|
0
|
|
|
|
|
|
my $mes=$epp->message(); |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
my @n; |
105
|
0
|
|
|
|
|
|
my $auth=$contact->auth(); |
106
|
0
|
0
|
0
|
|
|
|
Net::DRI::Exception::usererr_insufficient_parameters('Contact password is mandatory for .PT contact update') unless (defined($auth) && (ref($auth) eq 'HASH') && exists($auth->{pw}) && Net::DRI::Util::xml_is_normalizedstring($auth->{pw})); |
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
107
|
0
|
|
|
|
|
|
push @n,['ptcontact:pw',$auth->{pw}]; |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
my $newc=$todo->set('info'); |
110
|
0
|
0
|
|
|
|
|
if ($newc) |
111
|
|
|
|
|
|
|
{ |
112
|
0
|
0
|
|
|
|
|
Net::DRI::Exception->die(1,'protocol/EPP',10,'Invalid contact '.$newc) unless Net::DRI::Util::isa_contact($newc,'Net::DRI::Data::Contact::FCCN'); |
113
|
0
|
0
|
|
|
|
|
push @n,['ptcontact:mobile',$newc->mobile()] if $newc->mobile(); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
|
my $eid=build_command_extension($mes,$epp,'ptcontact:update'); |
117
|
0
|
|
|
|
|
|
$mes->command_extension($eid,\@n); |
118
|
0
|
|
|
|
|
|
return; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub info_parse |
122
|
|
|
|
|
|
|
{ |
123
|
0
|
|
|
0
|
0
|
|
my ($po,$otype,$oaction,$oname,$rinfo)=@_; |
124
|
0
|
|
|
|
|
|
my $mes=$po->message(); |
125
|
0
|
0
|
|
|
|
|
return unless $mes->is_success(); |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
my $infdata=$mes->get_extension('ptcontact','infData'); |
128
|
0
|
0
|
|
|
|
|
return unless $infdata; |
129
|
0
|
|
|
|
|
|
my $ns=$mes->ns('ptcontact'); |
130
|
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
my $co=$rinfo->{contact}->{$oname}->{self}; |
132
|
0
|
|
|
|
|
|
my $c=$infdata->getFirstChild(); |
133
|
0
|
|
|
|
|
|
while($c) |
134
|
|
|
|
|
|
|
{ |
135
|
0
|
0
|
|
|
|
|
next unless ($c->nodeType() == 1); ## only for element nodes |
136
|
0
|
|
0
|
|
|
|
my $name=$c->localname() || $c->nodeName(); |
137
|
0
|
0
|
|
|
|
|
next unless $name; |
138
|
|
|
|
|
|
|
|
139
|
0
|
0
|
|
|
|
|
if ($name eq 'type') |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
140
|
|
|
|
|
|
|
{ |
141
|
0
|
|
|
|
|
|
$co->type($c->getFirstChild()->getData()); |
142
|
|
|
|
|
|
|
} elsif ($name eq 'identification') |
143
|
|
|
|
|
|
|
{ |
144
|
0
|
|
|
|
|
|
$co->identification({type=>$c->getAttribute('type'),value=>$c->getFirstChild()->getData()}); |
145
|
|
|
|
|
|
|
} elsif ($name eq 'mobile') |
146
|
|
|
|
|
|
|
{ |
147
|
0
|
|
|
|
|
|
$co->mobile($c->getFirstChild()->getData()); |
148
|
|
|
|
|
|
|
} |
149
|
0
|
|
|
|
|
|
} continue { $c=$c->getNextSibling(); } |
150
|
0
|
|
|
|
|
|
return; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
#################################################################################################### |
154
|
|
|
|
|
|
|
1; |