summaryrefslogtreecommitdiff
path: root/protocols/Discord/src/utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Discord/src/utils.cpp')
-rw-r--r--protocols/Discord/src/utils.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/protocols/Discord/src/utils.cpp b/protocols/Discord/src/utils.cpp
index 52eecea527..4d69a6f40f 100644
--- a/protocols/Discord/src/utils.cpp
+++ b/protocols/Discord/src/utils.cpp
@@ -43,3 +43,35 @@ JSONNode& operator<<(JSONNode &json, const WCHAR_PARAM &param)
json.push_back(JSONNode(param.szName, ptrA(mir_utf8encodeW(param.wszValue)).get()));
return json;
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+SnowFlake CDiscordProto::getId(const char *szSetting)
+{
+ SnowFlake result;
+ DBVARIANT dbv;
+ dbv.type = DBVT_BLOB;
+ dbv.pbVal = (BYTE*)&result;
+ dbv.cpbVal = sizeof(result);
+ return (db_get(NULL, m_szModuleName, szSetting, &dbv)) ? 0 : result;
+}
+
+SnowFlake CDiscordProto::getId(MCONTACT hContact, const char *szSetting)
+{
+ SnowFlake result;
+ DBVARIANT dbv;
+ dbv.type = DBVT_BLOB;
+ dbv.pbVal = (BYTE*)&result;
+ dbv.cpbVal = sizeof(result);
+ return (db_get(hContact, m_szModuleName, szSetting, &dbv)) ? 0 : result;
+}
+
+void CDiscordProto::setId(const char *szSetting, SnowFlake iValue)
+{
+ db_set_blob(NULL, m_szModuleName, szSetting, &iValue, sizeof(iValue));
+}
+
+void CDiscordProto::setId(MCONTACT hContact, const char *szSetting, SnowFlake iValue)
+{
+ db_set_blob(hContact, m_szModuleName, szSetting, &iValue, sizeof(iValue));
+}