Use account-based rather than protocol-based cache paths

This commit is contained in:
Jaidyn Ann 2021-06-09 11:40:27 -05:00
parent 5723f55433
commit 7767995400
4 changed files with 5 additions and 14 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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);
}

View File

@ -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;