Status pluginDataRemove(const Account &account, const std::string &plugin, const std::string &key) { std::string filename = keyFilename(account, plugin, key); if (fileExists(filename)) ABC_CHECK(fileDelete(filename)); return Status(); }
Status pluginDataRemove(const Account &account, const std::string &plugin, const std::string &key) { std::string filename = keyFilename(account, plugin, key); if (fileExists(filename)) ABC_CHECK_OLD(ABC_FileIODeleteFile(filename.c_str(), &error)); return Status(); }
Status pluginDataSet(const Account &account, const std::string &plugin, const std::string &key, const std::string &data) { ABC_CHECK(fileEnsureDir(pluginsDirectory(account))); ABC_CHECK(fileEnsureDir(pluginDirectory(account, plugin))); PluginDataFile json; json.keySet(key); json.dataSet(data); ABC_CHECK(json.save(keyFilename(account, plugin, key), account.login.dataKey())); return Status(); }
Status pluginDataGet(const Account &account, const std::string &plugin, const std::string &key, std::string &data) { PluginDataFile json; ABC_CHECK(json.load(keyFilename(account, plugin, key), account.login.dataKey())); ABC_CHECK(json.keyOk()); ABC_CHECK(json.dataOk()); if (json.key() != key) return ABC_ERROR(ABC_CC_JSONError, "Plugin filename does not match contents"); data = json.data(); return Status(); }
Status pluginDataSet(const Account &account, const std::string &plugin, const std::string &key, const std::string &data) { ABC_CHECK(fileEnsureDir(pluginsDirectory(account))); ABC_CHECK(fileEnsureDir(pluginDirectory(account, plugin))); const auto namePath = pluginDirectory(account, plugin) + "Name.json"; if (!fileExists(namePath)) { PluginNameJson json; ABC_CHECK(json.nameSet(plugin)); json.save(namePath, account.login.dataKey()); } PluginDataFile json; json.keySet(key); json.dataSet(data); ABC_CHECK(json.save(keyFilename(account, plugin, key), account.login.dataKey())); return Status(); }