sub
register_commands
{
my
(
$class
,
$version
)=
@_
;
my
%tmp
=(
create
=> [ \
&create
, \
&create_parse
],
update
=> [ \
&update
,
undef
],
info
=> [
undef
, \
&info_parse
],
);
return
{
'domain'
=> \
%tmp
};
}
sub
create
{
my
(
$epp
,
$domain
,
$rd
)=
@_
;
my
$mes
=
$epp
->message();
my
@d
;
push
@d
,Net::DRI::Protocol::EPP::Extensions::Afilias::MaintainerUrl::create(
'asia'
,
$rd
);
if
(Net::DRI::Util::has_contact(
$rd
))
{
my
$cs
=
$rd
->{contact};
foreach
my
$type
(
grep
{ ! /^(?:registrant|admin|tech|billing|regAgent)$/ }
$cs
->types())
{
push
@d
,
map
{ [
'asia:contact'
,{
type
=>
$type
},
$_
->srid()] } (
$cs
->get(
$type
));
}
}
return
unless
@d
;
my
$eid
=
$mes
->command_extension_register(
'asia:create'
,
sprintf
(
'xmlns:asia="%s" xsi:schemaLocation="%s %s"'
,
$mes
->nsattrs(
'asia'
)));
$mes
->command_extension(
$eid
,\
@d
);
}
sub
create_parse
{
my
(
$po
,
$otype
,
$oaction
,
$oname
,
$rinfo
)=
@_
;
my
$mes
=
$po
->message();
my
$infdata
=
$mes
->get_extension(
'asia'
,
'creData'
);
return
unless
defined
$infdata
;
my
$c
=Net::DRI::Util::xml_child_content(
$infdata
,
$mes
->ns(
'asia'
),
'domainRoid'
);
$rinfo
->{
$otype
}->{
$oname
}->{roid}=
$c
if
defined
$c
;
}
sub
update
{
my
(
$epp
,
$domain
,
$todo
) =
@_
;
my
$mes
=
$epp
->message();
my
@d
;
push
@d
,Net::DRI::Protocol::EPP::Extensions::Afilias::MaintainerUrl::update(
'asia'
,
$todo
);
my
$cs
=
$todo
->set(
'contact'
);
if
(Net::DRI::Util::isa_contactset(
$cs
))
{
foreach
my
$type
(
grep
{ ! /^(?:registrant|admin|tech|billing)$/ }
$cs
->types())
{
push
@d
,
map
{ [
'asia:contact'
,{
type
=>
$type
},
$_
->srid()] } (
$cs
->get(
$type
));
}
}
return
unless
@d
;
my
$eid
=
$mes
->command_extension_register(
'asia:update'
,
sprintf
(
'xmlns:asia="%s" xsi:schemaLocation="%s %s"'
,
$mes
->nsattrs(
'asia'
)));
$mes
->command_extension(
$eid
,[
'asia:chg'
,
@d
]);
}
sub
info_parse
{
my
(
$po
,
$otype
,
$oaction
,
$oname
,
$rinfo
)=
@_
;
my
$mes
=
$po
->message();
my
$infdata
=
$mes
->get_extension(
'asia'
,
'infData'
);
return
unless
defined
$infdata
;
my
$c
=Net::DRI::Protocol::EPP::Extensions::Afilias::MaintainerUrl::info_parse(
$mes
->ns(
'asia'
),
$infdata
);
$rinfo
->{
$otype
}->{
$oname
}->{maintainer_url}=
$c
if
defined
$c
;
my
$cs
=
$rinfo
->{
$otype
}->{
$oname
}->{contact};
foreach
my
$ct
(
$infdata
->getElementsByTagNameNS(
$mes
->ns(
'asia'
),
'contact'
))
{
$cs
->add(
$po
->create_local_object(
'contact'
)->srid(
$ct
->textContent()),
$ct
->getAttribute(
'type'
));
}
}
1;