/* * Copyright (C) 2006 Registro.br. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * 1. Redistribution of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY REGISTRO.BR ``AS IS AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIE OF FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO * EVENT SHALL REGISTRO.BR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. */ /* $Id: DomainCreate.cpp 896 2007-03-08 20:27:28Z eduardo $ */ #include "config.h" #include "DomainCreate.H" #include "StrUtil.H" LIBEPP_NICBR_NS_BEGIN void DomainCreate::set_xml_template(const string &xml_template) { StrUtil su; Action::set_xml_template_common(xml_template); map < string, string, less > to_parse; //name to_parse["name"] = su.esc_xml_markup(get_command()->get_name()); //period DomainCreateCmd::Period period = get_command()->get_period(); to_parse["period"] = ""; if (period.time > 0) { to_parse["period"] = "" + StrUtil::to_string("%d", period.time) + ""; } //nameservers vector nss = get_command()->get_nameservers(); vector::const_iterator ns_it; set::const_iterator ip_it; to_parse["nameservers"] = ""; if (!nss.empty()) { to_parse["nameservers"] = ""; for (ns_it = nss.begin(); ns_it != nss.end(); ns_it++) { to_parse["nameservers"] += ""; to_parse["nameservers"] += "" + su.esc_xml_markup(ns_it->name) + ""; for (ip_it = ns_it->ips.begin(); ip_it != ns_it->ips.end(); ip_it++) { to_parse["nameservers"] += ""; } to_parse["nameservers"] += ""; } to_parse["nameservers"] += ""; } //registrant to_parse["registrant"] = ""; if (get_command()->get_registrant() != "") { to_parse["registrant"] = "" + su.esc_xml_markup(get_command()->get_registrant()) + ""; } //other contacts map< string, string, less > contacts = get_command()->get_contacts(); map< string, string, less >::const_iterator it_contacts; to_parse["other_contacts"] = ""; for (it_contacts = contacts.begin(); it_contacts != contacts.end(); it_contacts++) { to_parse["other_contacts"] += "" + su.esc_xml_markup((*it_contacts).second) + ""; } //auth info AuthInfo authInfo; authInfo = get_command()->get_authInfo(); string auth_info_str; auth_info_str = ""; if (authInfo.get_roid() == "") { auth_info_str += "" + su.esc_xml_markup(authInfo.get_pw()) + ""; } else { auth_info_str += "" + su.esc_xml_markup(authInfo.get_pw()) + ""; } auth_info_str += ""; to_parse["auth_info"] = auth_info_str; to_parse["ext_begin"] = ""; to_parse["ext_end"] = ""; to_parse["ds_ext"] = ""; ///////////////////////////////////////////////////////////////////////////// // DS Extension Mapping - RFC4310 if (get_command()->has_extension()) { to_parse["ext_begin"] = ""; to_parse["ext_end"] = ""; if (get_command()->has_ds_extension()) { to_parse["ds_ext"] += ""; list ds_info_list = get_command()->get_dsInfo(); list::iterator it; for (it = ds_info_list.begin(); it != ds_info_list.end(); it++) { to_parse["ds_ext"] += it->get_xml_format(); } to_parse["ds_ext"] += ""; } } _xml = StrUtil::parse(_xml, to_parse, "$(", ")$"); } LIBEPP_NICBR_NS_END