summaryrefslogtreecommitdiff
path: root/protocols/Tox/src
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-05-31 19:00:56 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-05-31 19:00:56 +0000
commite5d977a8e28a301ea56e2786756537d03b84540a (patch)
tree1a225e4ce7dcb3bfbb6a2aebd6c1b01ff5e73a45 /protocols/Tox/src
parent6a08d8f762284e3ad8ddc2307287bef8a261989d (diff)
Tox: fixed contact adding
git-svn-id: http://svn.miranda-ng.org/main/trunk@13948 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src')
-rw-r--r--protocols/Tox/src/tox_contacts.cpp10
-rw-r--r--protocols/Tox/src/tox_proto.cpp9
-rw-r--r--protocols/Tox/src/tox_proto.h2
3 files changed, 9 insertions, 12 deletions
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp
index 8441573384..abf80745de 100644
--- a/protocols/Tox/src/tox_contacts.cpp
+++ b/protocols/Tox/src/tox_contacts.cpp
@@ -63,7 +63,7 @@ MCONTACT CToxProto::GetContact(const char *pubKey)
return hContact;
}
-MCONTACT CToxProto::AddContact(const char *address, const TCHAR *nick, const TCHAR *dnsId, bool isTemporary)
+MCONTACT CToxProto::AddContact(const char *address, const char *nick, const char *dnsId, bool isTemporary)
{
MCONTACT hContact = GetContact(address);
if (!hContact)
@@ -73,11 +73,11 @@ MCONTACT CToxProto::AddContact(const char *address, const TCHAR *nick, const TCH
setString(hContact, TOX_SETTINGS_ID, address);
- if (mir_tstrlen(nick))
- setTString(hContact, "Nick", dnsId);
+ if (mir_strlen(nick))
+ setTString(hContact, "Nick", ptrT(mir_utf8decodeT(nick)));
- if (mir_tstrlen(dnsId))
- setTString(hContact, TOX_SETTINGS_DNS, dnsId);
+ if (mir_strlen(dnsId))
+ setTString(hContact, TOX_SETTINGS_DNS, ptrT(mir_utf8decodeT(dnsId)));
DBVARIANT dbv;
if (!getTString(TOX_SETTINGS_GROUP, &dbv))
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp
index 7ec780634d..da29ff9e02 100644
--- a/protocols/Tox/src/tox_proto.cpp
+++ b/protocols/Tox/src/tox_proto.cpp
@@ -63,21 +63,18 @@ DWORD_PTR CToxProto::GetCaps(int type, MCONTACT)
MCONTACT CToxProto::AddToList(int flags, PROTOSEARCHRESULT *psr)
{
- ptrA address(mir_t2a(psr->id.t));
ptrA myAddress(getStringA(NULL, TOX_SETTINGS_ID));
- if (strnicmp(address, myAddress, TOX_PUBLIC_KEY_SIZE) == 0)
+ if (strnicmp(psr->id.a, myAddress, TOX_PUBLIC_KEY_SIZE) == 0)
{
ShowNotification(TranslateT("You cannot add yourself to your contact list"), 0);
return NULL;
}
- if (MCONTACT hContact = GetContact((char*)address))
+ if (MCONTACT hContact = GetContact(psr->id.a))
{
ShowNotification(TranslateT("Contact already in your contact list"), 0, hContact);
return NULL;
}
- ptrT nick(mir_tstrdup(psr->nick.t));
- ptrT dnsId(mir_tstrdup(psr->email.t));
- return AddContact(address, nick, dnsId, flags & PALF_TEMPORARY);
+ return AddContact(psr->id.a, psr->nick.a, psr->email.a, flags & PALF_TEMPORARY);
}
int CToxProto::Authorize(MEVENT hDbEvent)
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h
index 4d1e08cf6b..c92424f11e 100644
--- a/protocols/Tox/src/tox_proto.h
+++ b/protocols/Tox/src/tox_proto.h
@@ -154,7 +154,7 @@ private:
MCONTACT GetContact(const int friendNumber);
MCONTACT GetContact(const char *pubKey);
- MCONTACT AddContact(const char *address, const TCHAR *nick = NULL, const TCHAR *dnsId = NULL, bool isTemporary = false);
+ MCONTACT AddContact(const char *address, const char *nick = NULL, const char *dnsId = NULL, bool isTemporary = false);
MCONTACT GetContactFromAuthEvent(MEVENT hEvent);