message: implement update-after-move

Allow for in-place updating of a moved document; i.e., without re-parsing
This commit is contained in:
Dirk-Jan C. Binnema
2022-04-22 08:13:09 +03:00
parent a548cac2d0
commit a8a3a0c3bf
2 changed files with 29 additions and 3 deletions

View File

@ -687,3 +687,20 @@ Message::mtime() const
}
Result<void>
Message::update_after_move(const std::string& new_path,
const std::string& new_maildir,
Flags new_flags)
{
const auto statbuf{get_statbuf(new_path)};
if (!statbuf)
return Err(statbuf.error());
priv_->doc.add(Field::Id::Path, new_path);
priv_->doc.add(Field::Id::Maildir, new_maildir);
priv_->doc.add(new_flags);
return Ok();
}