Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
refactor(history): remove deprecated historykeeper
Browse files Browse the repository at this point in the history
This commit removes historykeeper and code only used by it.

BREAKING CHANGE:
qTox can't open old historykeeper chatlogs after this commit. Use
previous versions to migrate to the new database.
  • Loading branch information
sudden6 committed Feb 5, 2017
1 parent fb43e30 commit 38cecdc
Show file tree
Hide file tree
Showing 16 changed files with 0 additions and 879 deletions.
8 changes: 0 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,10 @@ set(${PROJECT_NAME}_SOURCES
src/net/toxuri.h
src/nexus.cpp
src/nexus.h
src/persistence/db/encrypteddb.cpp
src/persistence/db/encrypteddb.h
src/persistence/db/genericddinterface.cpp
src/persistence/db/genericddinterface.h
src/persistence/db/plaindb.cpp
src/persistence/db/plaindb.h
src/persistence/db/rawdatabase.cpp
src/persistence/db/rawdatabase.h
src/persistence/history.cpp
src/persistence/history.h
src/persistence/historykeeper.cpp
src/persistence/historykeeper.h
src/persistence/offlinemsgengine.cpp
src/persistence/offlinemsgengine.h
src/persistence/profile.cpp
Expand Down
8 changes: 0 additions & 8 deletions qtox.pro
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,8 @@ HEADERS += \
src/net/toxme.h \
src/net/toxuri.h \
src/nexus.h \
src/persistence/db/encrypteddb.h \
src/persistence/db/genericddinterface.h \
src/persistence/db/plaindb.h \
src/persistence/db/rawdatabase.h \
src/persistence/history.h \
src/persistence/historykeeper.h \
src/persistence/offlinemsgengine.h \
src/persistence/profile.h \
src/persistence/profilelocker.h \
Expand Down Expand Up @@ -580,12 +576,8 @@ SOURCES += \
src/net/toxme.cpp \
src/net/toxuri.cpp \
src/nexus.cpp \
src/persistence/db/encrypteddb.cpp \
src/persistence/db/genericddinterface.cpp \
src/persistence/db/plaindb.cpp \
src/persistence/db/rawdatabase.cpp \
src/persistence/history.cpp \
src/persistence/historykeeper.cpp \
src/persistence/offlinemsgengine.cpp \
src/persistence/profile.cpp \
src/persistence/profilelocker.cpp \
Expand Down
5 changes: 0 additions & 5 deletions src/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,11 +280,6 @@ void Core::start()
if (id.isValid()) // TODO: probably useless check, comes basically directly from toxcore
emit idSet(id);

// TODO: This is a backwards compatibility check,
// once most people have been upgraded away from the old HistoryKeeper, remove this
if (Nexus::getProfile()->isEncrypted())
checkEncryptedHistory();

loadFriends();

tox_callback_friend_request(tox, onFriendRequest);
Expand Down
50 changes: 0 additions & 50 deletions src/core/coreencryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include "src/core/cstring.h"
#include "src/nexus.h"
#include "src/persistence/profile.h"
#include "src/persistence/historykeeper.h"
#include <tox/tox.h>
#include <tox/toxencryptsave.h>
#include <QApplication>
Expand Down Expand Up @@ -124,52 +123,3 @@ QByteArray Core::getSaltFromFile(QString filename)
QByteArray res(reinterpret_cast<const char*>(salt), TOX_PASS_SALT_LENGTH);
return res;
}

void Core::checkEncryptedHistory()
{
QString path = HistoryKeeper::getHistoryPath();
bool exists = QFile::exists(path) && QFile(path).size()>0;
if (!exists)
return;

QByteArray salt = getSaltFromFile(path);
if (exists && salt.size() == 0)
{ // maybe we should handle this better
GUI::showWarning(tr("Encrypted chat history"), tr("No encrypted chat history file found, or it was corrupted.\nHistory will be disabled!"));
HistoryKeeper::resetInstance();
return;
}

auto passkey = createPasskey(Nexus::getProfile()->getPassword(), reinterpret_cast<uint8_t*>(salt.data()));

QString a(tr("Please enter the password for the chat history for the profile \"%1\".", "used in load() when no hist pw set").arg(Nexus::getProfile()->getName()));
QString b(tr("The previous password is incorrect; please try again:", "used on retries in load()"));
QString c(tr("\nDisabling chat history now will leave the encrypted history intact (but not usable); if you later remember the password, you may re-enable encryption from the Privacy tab with the correct password to use the history.", "part of history password dialog"));
QString dialogtxt;


if (!exists || HistoryKeeper::checkPassword(passkey))
return;

dialogtxt = tr("The chat history password failed. Please try another?", "used only when pw set before load() doesn't work");
dialogtxt += "\n" + c;

bool error = true;
do
{
QString pw = GUI::passwordDialog(tr("Disable chat history"), dialogtxt);

if (pw.isEmpty())
{
Settings::getInstance().setEnableLogging(false);
return;
}
else
{
passkey = createPasskey(pw, reinterpret_cast<uint8_t*>(salt.data()));
}

error = exists && !HistoryKeeper::checkPassword(passkey);
dialogtxt = a + "\n" + c + "\n" + b;
} while (error);
}
200 changes: 0 additions & 200 deletions src/persistence/db/encrypteddb.cpp

This file was deleted.

57 changes: 0 additions & 57 deletions src/persistence/db/encrypteddb.h

This file was deleted.

Loading

0 comments on commit 38cecdc

Please sign in to comment.