WebDAV: implemented removeItem()

Mapping removeItem() to DELETE is straight-forward. Except that CalDAV
will require additional support for removing individual VEVENTs from
a resource that contains more than one VEVENT...
This commit is contained in:
Patrick Ohly 2010-10-06 11:43:39 +02:00
parent 31eb20f704
commit 6f58a1f5f7
1 changed files with 18 additions and 2 deletions

View File

@ -327,10 +327,26 @@ std::string WebDAVSource::getLUID(Neon::Request &req)
void WebDAVSource::removeItem(const string &uid)
{
// TODO
std::string item, result;
Neon::Request req(*m_session, "DELETE", luid2path(uid),
item, result);
// TODO: match exactly the expected revision, aka ETag,
// or implement locking.
// req.addHeader("If-Match", etag);
req.run();
SE_LOG_DEBUG(NULL, NULL, "remove item status: %s",
Neon::Status2String(req.getStatus()).c_str());
switch (req.getStatusCode()) {
case 204:
// the expected outcome
break;
default:
SE_THROW(std::string("unexpected status for removal: ") +
Neon::Status2String(req.getStatus()));
break;
}
}
SE_END_CXX
#endif /* ENABLE_DAV */