diff options
author | aunsane <aunsane@gmail.com> | 2018-10-02 01:09:47 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2018-10-02 01:09:47 +0300 |
commit | e80d4e54be3f7e0dffc940e63f48f2ea0bb1d3ca (patch) | |
tree | 47d9c5ed47be4d044e74a68a0dc05dbb4682dd9a | |
parent | 51b3403c20e32cf954752c557a18c164ced90da4 (diff) |
Tox: problems with contact Info (fixed #1603)
-rw-r--r-- | protocols/Tox/src/tox_contacts.cpp | 23 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.cpp | 2 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.h | 2 |
3 files changed, 14 insertions, 13 deletions
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 7945b7eeb6..3e3bfdfade 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -72,7 +72,7 @@ ToxHexAddress CToxProto::GetContactPublicKey(const Tox *tox, const int friendNum return pubKey;
}
-MCONTACT CToxProto::AddContact(const char *address, const char *nick, const char *dnsId, bool isTemporary)
+MCONTACT CToxProto::AddContact(const char *address, const wchar_t *nick, const wchar_t *dnsId, bool isTemporary)
{
MCONTACT hContact = GetContact(address);
if (hContact)
@@ -83,21 +83,22 @@ MCONTACT CToxProto::AddContact(const char *address, const char *nick, const char setString(hContact, TOX_SETTINGS_ID, address);
- if (mir_strlen(nick))
- setWString(hContact, "Nick", ptrW(mir_utf8decodeW(nick)));
+ if (mir_wstrlen(nick))
+ setWString(hContact, "Nick", nick);
else
setWString(hContact, "Nick", _A2T(address));
- if (mir_strlen(dnsId))
- setWString(hContact, TOX_SETTINGS_DNS, ptrW(mir_utf8decodeW(dnsId)));
+ if (mir_wstrlen(dnsId))
+ setWString(hContact, TOX_SETTINGS_DNS, dnsId);
- if (m_defaultGroup)
- db_set_ws(hContact, "CList", "Group", m_defaultGroup);
+ if (!isTemporary) {
+ if (m_defaultGroup)
+ db_set_ws(hContact, "CList", "Group", m_defaultGroup);
- setByte(hContact, "Auth", 1);
- setByte(hContact, "Grant", 1);
-
- if (isTemporary)
+ setByte(hContact, "Auth", 1);
+ setByte(hContact, "Grant", 1);
+ }
+ else
db_set_b(hContact, "CList", "NotOnList", 1);
return hContact;
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 286e037345..40c34ff828 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -89,7 +89,7 @@ MCONTACT CToxProto::AddToList(int flags, PROTOSEARCHRESULT *psr) ShowNotification(TranslateT("Contact already in your contact list"), 0, hContact);
return NULL;
}
- return AddContact(psr->id.a, psr->nick.a, psr->email.a, flags & PALF_TEMPORARY);
+ return AddContact(psr->id.a, psr->nick.w, psr->email.w, 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 c7c41174c2..02f02eeae9 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -153,7 +153,7 @@ private: ToxHexAddress GetContactPublicKey(const Tox *tox, const int friendNumber);
- MCONTACT AddContact(const char *address, const char *nick = nullptr, const char *dnsId = nullptr, bool isTemporary = false);
+ MCONTACT AddContact(const char *address, const wchar_t *nick = nullptr, const wchar_t *dnsId = nullptr, bool isTemporary = false);
MCONTACT GetContactFromAuthEvent(MEVENT hEvent);
|