bool EncryptionChatData::importEncrypt() { bool result = EncryptionNgConfiguration::instance()->encryptByDefault(); StorableObject *chatStorage = storageParent(); ChatShared *chat = dynamic_cast<ChatShared *>(chatStorage); if (!chat) return result; ContactSet contacts = chat->contacts(); if (1 != contacts.size()) return result; Contact contact = *contacts.begin(); QString encryptionEnabled = contact.ownerBuddy().customData("encryption_enabled"); contact.ownerBuddy().removeCustomData("encryption_enabled"); if (!encryptionEnabled.isEmpty()) result = encryptionEnabled == "true"; return result; }
std::shared_ptr<StoragePoint> StorableObject::createStoragePoint() { auto parent = storageParent(); return m_storagePointFactory->createStoragePoint(storageNodeName(), parent ? parent->storage().get() : nullptr); }