From 177dd6a5b040212beebd0129880241cb13b6ef08 Mon Sep 17 00:00:00 2001 From: Konstantinos Sideris Date: Sat, 26 Aug 2017 14:31:23 +0300 Subject: Remove cache data when the user logs out --- include/Cache.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include') diff --git a/include/Cache.h b/include/Cache.h index 46107062..1be56620 100644 --- a/include/Cache.h +++ b/include/Cache.h @@ -17,6 +17,7 @@ #pragma once +#include #include #include "RoomState.h" @@ -32,6 +33,7 @@ public: QString nextBatchToken() const; QMap states(); + inline void deleteData(); inline void unmount(); inline QString memberDbName(const QString &roomid); @@ -46,6 +48,7 @@ private: bool isMounted_; QString userId_; + QString cacheDirectory_; }; inline void @@ -59,3 +62,10 @@ Cache::memberDbName(const QString &roomid) { return QString("m.%1").arg(roomid); } + +inline void +Cache::deleteData() +{ + if (!cacheDirectory_.isEmpty()) + QDir(cacheDirectory_).removeRecursively(); +} -- cgit 1.5.1