Example #1
0
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;
}
Example #2
0
std::shared_ptr<StoragePoint> StorableObject::createStoragePoint()
{
    auto parent = storageParent();
    return m_storagePointFactory->createStoragePoint(storageNodeName(), parent ? parent->storage().get() : nullptr);
}