diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-02-01 18:12:17 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-02-01 18:12:17 +0000 |
commit | 5bd5d3dc1920e22d0632dd265593b6dacce227dd (patch) | |
tree | 54ef412a3b2ff9ef5c2d91efcdb2e6b22cb4d352 /protocols | |
parent | 0a377fe6d1ca13161fc6ced1375b7926476fe44a (diff) |
Tox: fixed message sending
git-svn-id: http://svn.miranda-ng.org/main/trunk@11977 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/Tox/src/tox_messages.cpp | 16 | ||||
-rw-r--r-- | protocols/Tox/src/tox_transfer.cpp | 2 |
2 files changed, 10 insertions, 8 deletions
diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index a050b7f962..c513780f3f 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -35,8 +35,9 @@ void CToxProto::OnFriendAction(Tox *tox, const int number, const uint8_t *action int __cdecl CToxProto::SendMsg(MCONTACT hContact, int flags, const char* msg)
{
- uint32_t number = 0;// getDword(hContact, TOX_SETTINGS_NUMBER, TOX_ERROR);
- if (number == TOX_ERROR)
+ ToxBinAddress pubKey = ptrA(getStringA(hContact, TOX_SETTINGS_ID));
+ int32_t friendNumber = tox_get_friend_number(tox, pubKey);
+ if (friendNumber == TOX_ERROR)
{
debugLogA("CToxProto::SendMsg: failed to get friend number");
return 0;
@@ -46,11 +47,11 @@ int __cdecl CToxProto::SendMsg(MCONTACT hContact, int flags, const char* msg) {
if (strncmp(msg, "/me ", 4) != 0)
{
- result = tox_send_message(tox, number, (uint8_t*)msg, mir_strlen(msg));
+ result = tox_send_message(tox, friendNumber, (uint8_t*)msg, mir_strlen(msg));
}
else
{
- result = tox_send_action(tox, number, (uint8_t*)&msg[4], mir_strlen(msg) - 4);
+ result = tox_send_action(tox, friendNumber, (uint8_t*)&msg[4], mir_strlen(msg) - 4);
}
}
@@ -115,10 +116,11 @@ int __cdecl CToxProto::UserIsTyping(MCONTACT hContact, int type) {
if (hContact && IsOnline())
{
- uint32_t number = 0;//getDword(hContact, TOX_SETTINGS_NUMBER, TOX_ERROR);
- if (number >= 0)
+ ToxBinAddress pubKey = ptrA(getStringA(hContact, TOX_SETTINGS_ID));
+ int32_t friendNumber = tox_get_friend_number(tox, pubKey);
+ if (friendNumber >= 0)
{
- tox_set_user_is_typing(tox, number, type);
+ tox_set_user_is_typing(tox, friendNumber, type);
return 0;
}
}
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp index fd244f5136..43656ce349 100644 --- a/protocols/Tox/src/tox_transfer.cpp +++ b/protocols/Tox/src/tox_transfer.cpp @@ -146,7 +146,7 @@ HANDLE __cdecl CToxProto::SendFile(MCONTACT hContact, const PROTOCHAR*, PROTOCHA int32_t friendNumber = tox_get_friend_number(tox, pubKey);
if (friendNumber == TOX_ERROR)
{
- debugLogA("CToxProto::SendFilesAsync: cannot get friend number by public key");
+ debugLogA("CToxProto::SendMsg: failed to get friend number");
return NULL;
}
|