summaryrefslogtreecommitdiff
path: root/protocols/Tox/src/tox_contacts.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-04-24 13:24:33 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-04-24 13:24:33 +0000
commit6fb6adb873fdf453a9c712c5ec8cdfa3182d1973 (patch)
tree744d6c14da3f90cb03a2730b7de4e5f3ceba3e78 /protocols/Tox/src/tox_contacts.cpp
parent90fae1963c8236f5fb8c73f490286539a7e061a7 (diff)
Tox: work commit
- multimedia dialogs are reworked - some fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@13081 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_contacts.cpp')
-rw-r--r--protocols/Tox/src/tox_contacts.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp
index 3fa7c26580..838a9fde7e 100644
--- a/protocols/Tox/src/tox_contacts.cpp
+++ b/protocols/Tox/src/tox_contacts.cpp
@@ -69,7 +69,7 @@ MCONTACT CToxProto::GetContact(const char *pubKey)
return hContact;
}
-MCONTACT CToxProto::AddContact(const char *address, const std::tstring &dnsId, bool isTemporary)
+MCONTACT CToxProto::AddContact(const char *address, const TCHAR *dnsId, bool isTemporary)
{
MCONTACT hContact = GetContact(address);
if (!hContact)
@@ -79,9 +79,9 @@ MCONTACT CToxProto::AddContact(const char *address, const std::tstring &dnsId, b
setString(hContact, TOX_SETTINGS_ID, address);
- if (!dnsId.empty())
+ if (dnsId && mir_tstrlen(dnsId))
{
- setTString(hContact, TOX_SETTINGS_DNS, dnsId.c_str());
+ setTString(hContact, TOX_SETTINGS_DNS, dnsId);
}
DBVARIANT dbv;
@@ -196,10 +196,11 @@ INT_PTR CToxProto::OnGrantAuth(WPARAM hContact, LPARAM)
{
if (!IsOnline())
{
- return -1;
+ // TODO: warn
+ return 0;
}
- ToxBinAddress pubKey(ptrA(getStringA(hContact, TOX_SETTINGS_ID)), TOX_PUBLIC_KEY_SIZE * 2);
+ ToxBinAddress pubKey(ptrA(getStringA(hContact, TOX_SETTINGS_ID)));
TOX_ERR_FRIEND_ADD error;
tox_friend_add_norequest(tox, pubKey, &error);
if (error != TOX_ERR_FRIEND_ADD_OK)
@@ -209,10 +210,12 @@ INT_PTR CToxProto::OnGrantAuth(WPARAM hContact, LPARAM)
}
// trim address to public key
- setString(hContact, TOX_SETTINGS_ID, pubKey.ToHex());
+ // setString(hContact, TOX_SETTINGS_ID, pubKey.ToHex());
db_unset(hContact, "CList", "NotOnList");
delSetting(hContact, "Grant");
+ SaveToxProfile();
+
return 0;
}
@@ -220,7 +223,8 @@ int CToxProto::OnContactDeleted(MCONTACT hContact, LPARAM)
{
if (!IsOnline())
{
- return -1;
+ // TODO: warn
+ return 0;
}
if (!isChatRoom(hContact))