diff options
Diffstat (limited to 'ucb/source/ucp/webdav-curl/webdavresponseparser.cxx')
-rw-r--r-- | ucb/source/ucp/webdav-curl/webdavresponseparser.cxx | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx b/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx index a236957c096e..83daa33b112d 100644 --- a/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx +++ b/ucb/source/ucp/webdav-curl/webdavresponseparser.cxx @@ -22,11 +22,13 @@ #include "DAVProperties.hxx" #include "UCBDeadPropertyValue.hxx" -#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +#include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> + #include <cppuhelper/implbase.hxx> #include <com/sun/star/xml/sax/Parser.hpp> #include <com/sun/star/xml/sax/InputSource.hpp> -#include <comphelper/processfactory.hxx> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> #include <com/sun/star/ucb/LockEntry.hpp> #include <com/sun/star/ucb/LockScope.hpp> #include <com/sun/star/ucb/LockType.hpp> @@ -75,6 +77,7 @@ namespace { WebDAVName_unknown = 0, WebDAVName_activelock, + WebDAVName_lockdiscovery, WebDAVName_multistatus, WebDAVName_response, WebDAVName_href, @@ -114,6 +117,7 @@ namespace if(aWebDAVNameMapperList.empty()) { aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("activelock"), WebDAVName_activelock)); + aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("lockdiscovery"), WebDAVName_lockdiscovery)); aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("multistatus"), WebDAVName_multistatus)); aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("response"), WebDAVName_response)); aWebDAVNameMapperList.insert(WebDAVNameValueType(OUString("href"), WebDAVName_href)); @@ -518,6 +522,15 @@ namespace } } + OUString MakePropertyName(WebDAVContext const& rContext) + { + OUString ret; + OString const name(OUStringToOString(rContext.getName(), RTL_TEXTENCODING_UTF8)); + OString const nameSpace(OUStringToOString(rContext.getNamespace(), RTL_TEXTENCODING_UTF8)); + DAVProperties::createUCBPropName(nameSpace.getStr(), name.getStr(), ret); + return ret; + } + void SAL_CALL WebDAVResponseParser::endElement( const OUString& aName ) { const sal_Int32 nLen(aName.getLength()); @@ -527,9 +540,9 @@ namespace { if(collectThisPropertyAsName()) { - // When collecting property names and parent is prop, just append the prop name - // to the collection, no need to parse deeper - maPropStatNames.push_back(mpContext->getNamespace() + mpContext->getName()); + // name must be encoded as expected by createSerfPropName() + OUString const name(MakePropertyName(*mpContext)); + maPropStatNames.emplace_back(name); } else { @@ -751,6 +764,20 @@ namespace maResult_Lock.push_back(maLock); break; } + case WebDAVName_lockdiscovery: + { + // lockdiscovery may be requested via PROPFIND, + // in addition to LOCK! so return it 2 ways + if (isCollectingProperties()) + { + http_dav_ucp::DAVPropertyValue aDAVPropertyValue; + + aDAVPropertyValue.Name = "DAV:lockdiscovery"; + aDAVPropertyValue.Value <<= ::comphelper::containerToSequence(maResult_Lock); + maPropStatProperties.push_back(aDAVPropertyValue); + } + break; + } case WebDAVName_propstat: { // propstat end, check status @@ -832,9 +859,7 @@ namespace && isCollectingProperties()) { http_dav_ucp::DAVPropertyValue aDAVPropertyValue; - OString const name(OUStringToOString(mpContext->getParent()->getName(), RTL_TEXTENCODING_UTF8)); - OString const nameSpace(OUStringToOString(mpContext->getParent()->getNamespace(), RTL_TEXTENCODING_UTF8)); - DAVProperties::createUCBPropName(nameSpace.getStr(), name.getStr(), aDAVPropertyValue.Name); + aDAVPropertyValue.Name = MakePropertyName(*mpContext->getParent()); if (UCBDeadPropertyValue::createFromXML(m_UCBType, m_UCBValue, aDAVPropertyValue.Value)) { maPropStatProperties.push_back(aDAVPropertyValue); |