X-Git-Url: https://git.pterodactylus.net/?p=fms.git;a=blobdiff_plain;f=src%2Fhttp%2Fidentityexportxml.cpp;h=521c4ca896685ae74da0ffbe4b8106b1d4e741ef;hp=aff7623d9d2d0e7066ac17f40559338833a83616;hb=76805933f794915a72b7f0a21b12af6654759f4f;hpb=047cea32f848d605c549ec123c12c1c400dd7ec1 diff --git a/src/http/identityexportxml.cpp b/src/http/identityexportxml.cpp index aff7623..521c4ca 100644 --- a/src/http/identityexportxml.cpp +++ b/src/http/identityexportxml.cpp @@ -101,24 +101,15 @@ const bool IdentityExportXML::GetSingleUse(const long index) std::string IdentityExportXML::GetXML() { Poco::AutoPtr doc=new Poco::XML::Document; - Poco::XML::Element *root=doc->createElement("IdentityExport"); - Poco::XML::Element *el=NULL; - //TiXmlDocument td; - //TiXmlDeclaration *tdec=new TiXmlDeclaration("1.0","UTF-8",""); - //TiXmlElement *tid; - //TiXmlPrinter tp; + Poco::AutoPtr root=doc->createElement("IdentityExport"); + Poco::AutoPtr el=NULL; doc->appendChild(root); - //td.LinkEndChild(tdec); - //tid=new TiXmlElement("IdentityExport"); - //td.LinkEndChild(tid); for(std::vector::iterator i=m_identities.begin(); i!=m_identities.end(); i++) { el=doc->createElement("Identity"); - //TiXmlElement *tr=new TiXmlElement("Identity"); root->appendChild(el); - //tid->LinkEndChild(tr); el->appendChild(XMLCreateCDATAElement(doc,"Name",(*i).m_name)); el->appendChild(XMLCreateTextElement(doc,"PublicKey",(*i).m_publickey)); @@ -127,23 +118,9 @@ std::string IdentityExportXML::GetXML() el->appendChild(XMLCreateBooleanElement(doc,"PublishTrustList",(*i).m_publishtrustlist)); el->appendChild(XMLCreateBooleanElement(doc,"PublishBoardList",(*i).m_publishboardlist)); el->appendChild(XMLCreateBooleanElement(doc,"PublishFreesite",(*i).m_publishfreesite)); - - //tr->LinkEndChild(XMLCreateCDATAElement("Name",(*i).m_name)); - //tr->LinkEndChild(XMLCreateTextElement("PublicKey",(*i).m_publickey)); - //tr->LinkEndChild(XMLCreateTextElement("PrivateKey",(*i).m_privatekey)); - //tr->LinkEndChild(XMLCreateBooleanElement("SingleUse",(*i).m_singleuse)); - //tr->LinkEndChild(XMLCreateBooleanElement("PublishTrustList",(*i).m_publishtrustlist)); - //tr->LinkEndChild(XMLCreateBooleanElement("PublishBoardList",(*i).m_publishboardlist)); - //tr->LinkEndChild(XMLCreateBooleanElement("PublishFreesite",(*i).m_publishfreesite)); } - //td.Accept(&tp); - //return std::string(tp.CStr()); - - std::string xml; - xml=GenerateXML(doc); - - return xml; + return GenerateXML(doc); } void IdentityExportXML::Initialize() @@ -221,71 +198,4 @@ const bool IdentityExportXML::ParseXML(const std::string &xml) } return parsed; - - //TiXmlDocument td; - //td.Parse(xml.c_str()); -/* - if(!td.Error()) - { - std::string name; - std::string publickey; - std::string privatekey; - bool singleuse=false; - bool publishtrustlist=false; - bool publishboardlist=false; - bool publishfreesite=false; - TiXmlText *txt; - TiXmlHandle hnd(&td); - TiXmlNode *node; - - Initialize(); - - node=hnd.FirstChild("IdentityExport").FirstChild("Identity").ToElement(); - while(node) - { - name=""; - publickey=""; - privatekey=""; - singleuse=false; - publishtrustlist=false; - publishboardlist=false; - publishfreesite=false; - - TiXmlHandle hnd2(node); - txt=hnd2.FirstChild("Name").FirstChild().ToText(); - if(txt) - { - name=txt->ValueStr(); - } - txt=hnd2.FirstChild("PublicKey").FirstChild().ToText(); - if(txt) - { - publickey=txt->ValueStr(); - } - txt=hnd2.FirstChild("PrivateKey").FirstChild().ToText(); - if(txt) - { - privatekey=txt->ValueStr(); - } - - singleuse=XMLGetBooleanElement(node->ToElement(),"SingleUse"); - publishtrustlist=XMLGetBooleanElement(node->ToElement(),"PublishTrustList"); - publishboardlist=XMLGetBooleanElement(node->ToElement(),"PublishBoardList"); - publishfreesite=XMLGetBooleanElement(node->ToElement(),"PublishFreesite"); - - if(name!="" && publickey!="" && privatekey!="") - { - m_identities.push_back(identity(name,publickey,privatekey,singleuse,publishtrustlist,publishboardlist,publishfreesite)); - } - - node=node->NextSibling("Identity"); - } - return true; - - } - else - { - return false; - } -*/ }