From 7767995400e9acd163e872b8bad35b776fe340b9 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann Date: Wed, 9 Jun 2021 11:40:27 -0500 Subject: [PATCH] Use account-based rather than protocol-based cache paths --- application/CayaUtils.cpp | 10 ++-------- application/CayaUtils.h | 2 +- application/Conversation.cpp | 5 +---- protocols/xmpp/JabberHandler.cpp | 2 +- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/application/CayaUtils.cpp b/application/CayaUtils.cpp index f83a2fa..b20a74e 100644 --- a/application/CayaUtils.cpp +++ b/application/CayaUtils.cpp @@ -126,20 +126,14 @@ CayaCachePath() const char* -CayaLogPath(const char* signature, const char* subsignature) +CayaLogPath(const char* accountName) { BPath path; if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) return NULL; path.Append("Caya/Logs"); - path.Append(signature); - - if (BString(signature) != BString(subsignature) - || BString(subsignature).IsEmpty() == false) - { - path.Append(subsignature); - } + path.Append(accountName); if (create_directory(path.Path(), 0755) != B_OK) return NULL; diff --git a/application/CayaUtils.h b/application/CayaUtils.h index a14ef69..e631659 100644 --- a/application/CayaUtils.h +++ b/application/CayaUtils.h @@ -22,7 +22,7 @@ const char* CayaAccountPath(const char* signature); const char* CayaAccountPath(const char* signature, const char* subsignature); const char* CayaCachePath(); -const char* CayaLogPath(const char* signature, const char* subsignature); +const char* CayaLogPath(const char* accountName); rgb_color CayaTintColor(rgb_color color, int severity); rgb_color CayaForegroundColor(rgb_color background); diff --git a/application/Conversation.cpp b/application/Conversation.cpp index 2853245..cb1cef2 100644 --- a/application/Conversation.cpp +++ b/application/Conversation.cpp @@ -360,10 +360,7 @@ Conversation::_EnsureLogPath() if (fLogPath.InitCheck() == B_OK) return; - const char* sig = fLooper->Protocol()->Signature(); - CayaProtocolAddOn* protoAdd = ProtocolManager::Get()->ProtocolAddOn(sig); - - fLogPath.SetTo(CayaLogPath(protoAdd->Signature(), protoAdd->ProtoSignature())); + fLogPath.SetTo(CayaLogPath(fLooper->Protocol()->GetName())); fLogPath.Append(fID); } diff --git a/protocols/xmpp/JabberHandler.cpp b/protocols/xmpp/JabberHandler.cpp index b738406..e571c44 100644 --- a/protocols/xmpp/JabberHandler.cpp +++ b/protocols/xmpp/JabberHandler.cpp @@ -808,7 +808,7 @@ JabberHandler::_SetupAvatarCache() path.Append("Caya"); path.Append("Cache"); - path.Append(Signature()); + path.Append(GetName()); if (create_directory(path.Path(), 0755) != B_OK) return B_ERROR;