diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-02-01 09:23:58 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-02-01 09:23:58 +0000 |
commit | 09fa77d73829e76123ac7a9b73bc90def12e9d9c (patch) | |
tree | 20c5e5a4fc83c672e0505db662e88c16635c5d9d /protocols/Tox/src/tox_messages.cpp | |
parent | a76b0175b2cb203f4a0cc68c99588f23ef945eb6 (diff) |
Tox:
- refactoring
- updated tox core
git-svn-id: http://svn.miranda-ng.org/main/trunk@11970 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_messages.cpp')
-rw-r--r-- | protocols/Tox/src/tox_messages.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp index 51f255b546..a050b7f962 100644 --- a/protocols/Tox/src/tox_messages.cpp +++ b/protocols/Tox/src/tox_messages.cpp @@ -4,7 +4,7 @@ void CToxProto::OnFriendMessage(Tox *tox, const int number, const uint8_t *messa {
CToxProto *proto = (CToxProto*)arg;
- MCONTACT hContact = proto->FindContact(number);
+ MCONTACT hContact = proto->GetContact(number);
if (hContact)
{
PROTORECVEVENT recv = { 0 };
@@ -20,7 +20,7 @@ void CToxProto::OnFriendAction(Tox *tox, const int number, const uint8_t *action {
CToxProto *proto = (CToxProto*)arg;
- MCONTACT hContact = proto->FindContact(number);
+ MCONTACT hContact = proto->GetContact(number);
if (hContact)
{
proto->AddDbEvent(
@@ -35,9 +35,7 @@ void CToxProto::OnFriendAction(Tox *tox, const int number, const uint8_t *action int __cdecl CToxProto::SendMsg(MCONTACT hContact, int flags, const char* msg)
{
- std::string id = getStringA(hContact, TOX_SETTINGS_ID);
- std::vector<uint8_t> clientId = HexStringToData(id);
- uint32_t number = tox_get_friend_number(tox, clientId.data());
+ uint32_t number = 0;// getDword(hContact, TOX_SETTINGS_NUMBER, TOX_ERROR);
if (number == TOX_ERROR)
{
debugLogA("CToxProto::SendMsg: failed to get friend number");
@@ -48,11 +46,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, (uint16_t)strlen(msg));
+ result = tox_send_message(tox, number, (uint8_t*)msg, mir_strlen(msg));
}
else
{
- result = tox_send_action(tox, number, (uint8_t*)&msg[4], (uint16_t)(strlen(msg) - 4));
+ result = tox_send_action(tox, number, (uint8_t*)&msg[4], mir_strlen(msg) - 4);
}
}
@@ -68,7 +66,7 @@ void CToxProto::OnReadReceipt(Tox *tox, int32_t number, uint32_t receipt, void * {
CToxProto *proto = (CToxProto*)arg;
- MCONTACT hContact = proto->FindContact(number);
+ MCONTACT hContact = proto->GetContact(number);
if (hContact)
{
proto->ProtoBroadcastAck(
@@ -106,7 +104,7 @@ void CToxProto::OnTypingChanged(Tox *tox, const int number, uint8_t isTyping, vo {
CToxProto *proto = (CToxProto*)arg;
- MCONTACT hContact = proto->FindContact(number);
+ MCONTACT hContact = proto->GetContact(number);
if (hContact)
{
CallService(MS_PROTO_CONTACTISTYPING, hContact, (LPARAM)isTyping);
@@ -117,9 +115,7 @@ int __cdecl CToxProto::UserIsTyping(MCONTACT hContact, int type) {
if (hContact && IsOnline())
{
- std::string id = getStringA(hContact, TOX_SETTINGS_ID);
- std::vector<uint8_t> clientId = HexStringToData(id);
- uint32_t number = tox_get_friend_number(tox, clientId.data());
+ uint32_t number = 0;//getDword(hContact, TOX_SETTINGS_NUMBER, TOX_ERROR);
if (number >= 0)
{
tox_set_user_is_typing(tox, number, type);
|