version 0.2.18
[fms.git] / src / freenet / identityxml.cpp
index f4e8c54..4b0fa23 100644 (file)
@@ -28,6 +28,12 @@ std::string IdentityXML::GetXML()
 \r
        tid->LinkEndChild(XMLCreateBooleanElement("PublishBoardList",m_publishboardlist));\r
 \r
+       // freesite edition will be -1 if identity isn't publishing a freesite\r
+       if(m_freesiteedition>=0)\r
+       {\r
+               tid->LinkEndChild(XMLCreateTextElement("FreesiteEdition",m_freesiteedition));\r
+       }\r
+\r
        td.Accept(&tp);\r
        return std::string(tp.CStr());\r
 \r
@@ -39,6 +45,7 @@ void IdentityXML::Initialize()
        m_publishtrustlist=false;\r
        m_publishboardlist=false;\r
        m_singleuse=false;\r
+       m_freesiteedition=-1;\r
 }\r
 \r
 const bool IdentityXML::ParseXML(const std::string &xml)\r
@@ -59,12 +66,24 @@ const bool IdentityXML::ParseXML(const std::string &xml)
                        m_name=txt->ValueStr();\r
                }\r
 \r
+               if(m_name.size()>40)\r
+               {\r
+                       m_name.erase(40);\r
+               }\r
+\r
                m_singleuse=XMLGetBooleanElement(hnd.FirstChild("Identity").ToElement(),"SingleUse");\r
 \r
                m_publishtrustlist=XMLGetBooleanElement(hnd.FirstChild("Identity").ToElement(),"PublishTrustList");\r
 \r
                m_publishboardlist=XMLGetBooleanElement(hnd.FirstChild("Identity").ToElement(),"PublishBoardList");\r
 \r
+               txt=hnd.FirstChild("Identity").FirstChild("FreesiteEdition").FirstChild().ToText();\r
+               if(txt)\r
+               {\r
+                       std::string editionstr=SanitizeSingleString(txt->ValueStr());\r
+                       StringFunctions::Convert(editionstr,m_freesiteedition);\r
+               }\r
+\r
                return true;\r
 \r
        }\r