diff options
author | George Hazan <ghazan@miranda.im> | 2016-12-29 18:53:03 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2016-12-29 18:53:03 +0300 |
commit | 50e87bcbf1b3a716f155e504a09df1c0ff1a66f5 (patch) | |
tree | 671924fd03f4f0a3a5da0af7cd4fe4cc841d54ad /protocols/Discord/src/utils.cpp | |
parent | 95ee503b0f0a4cb434de65f2d9d7375356e39d74 (diff) |
support for the SnowFlake type for Miranda
Diffstat (limited to 'protocols/Discord/src/utils.cpp')
-rw-r--r-- | protocols/Discord/src/utils.cpp | 32 |
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 ¶m) 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)); +} |