Browse Source

cache release function

ENGINE-781
Volker Birk 2 years ago
parent
commit
f6092c8427
3 changed files with 16 additions and 2 deletions
  1. +9
    -1
      message_cache.cc
  2. +3
    -1
      message_cache.hh
  3. +4
    -0
      test/test_message_cache.cc

+ 9
- 1
message_cache.cc View File

@ -16,7 +16,7 @@ namespace pEp {
rating, flags);
}
PEP_STATUS MessageCache::cached_mime_encode_message(
PEP_STATUS MessageCache::cache_mime_encode_message(
which one,
const message * msg,
bool omit_fields,
@ -28,6 +28,14 @@ namespace pEp {
mimetext, has_pEp_msg_attachment);
}
void MessageCache::cache_release(std::string id)
{
try {
message_cache._cache.erase(id);
}
catch (...) { }
}
static char *dup(const char *src)
{
if (!src)


+ 3
- 1
message_cache.hh View File

@ -33,7 +33,7 @@ namespace pEp {
enum which { msg_src, msg_dst };;
static PEP_STATUS cached_mime_encode_message(
static PEP_STATUS cache_mime_encode_message(
which one,
const message * msg,
bool omit_fields,
@ -41,6 +41,8 @@ namespace pEp {
bool has_pEp_msg_attachment
);
static void cache_release(std::string id);
protected:
DYNAMIC_API PEP_STATUS decrypt_message(
PEP_SESSION session,


+ 4
- 0
test/test_message_cache.cc View File

@ -33,6 +33,8 @@ int main()
src->attachments = new_bloblist(strdup("blobdata"), 8, "application/octet-stream", "blob.data");
assert(src->attachments && src->attachments->value);
// add to cache
::message *dst = nullptr;
PEP_rating rating;
PEP_decrypt_flags_t flags = 0;
@ -49,6 +51,8 @@ int main()
assert(string(src->longmsg) == "pEp");
assert(src->attachments == nullptr);
// remove from cache
cout << status << endl;
::free_message(src);


Loading…
Cancel
Save