diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-09-10 05:09:13 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-09-10 05:09:13 +0000 |
commit | f0cdc6fa307ea9b3dcbe44a93f4a0955b2e34b98 (patch) | |
tree | c90827bd8e6aacd4c16f94eed966301d2b1fe9cd /protocols/Tox | |
parent | 36e7bf01f588a890a95bb7319b75c31bb6f243cc (diff) |
Tox: contact id conversion
git-svn-id: http://svn.miranda-ng.org/main/trunk@10417 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox')
-rw-r--r-- | protocols/Tox/src/tox_contacts.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index ac022896ab..a62c685021 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -54,9 +54,26 @@ MCONTACT CToxProto::FindContact(const std::vector<uint8_t> &id) {
if (!db_get(hContact, m_szModuleName, TOX_SETTINGS_ID, &dbv))
{
- if (dbv.type == DBVT_BLOB && memcmp(id.data(), dbv.pbVal, TOX_CLIENT_ID_SIZE) == 0)
+ // temporary code for contact id conversion
+ if (dbv.type == DBVT_ASCIIZ)
{
- break;
+ std::vector<uint8_t> contactId = HexStringToData(dbv.pszVal);
+ db_unset(hContact, m_szModuleName, TOX_SETTINGS_ID);
+ db_set_blob(hContact, m_szModuleName, TOX_SETTINGS_ID, (uint8_t*)contactId.data(), TOX_CLIENT_ID_SIZE);
+
+ if (memcmp(id.data(), contactId.data(), TOX_CLIENT_ID_SIZE) == 0)
+ {
+ db_free(&dbv);
+ break;
+ }
+ }
+ else if (dbv.type == DBVT_BLOB)
+ {
+ if (memcmp(id.data(), dbv.pbVal, TOX_CLIENT_ID_SIZE) == 0)
+ {
+ db_free(&dbv);
+ break;
+ }
}
db_free(&dbv);
}
|