diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-08-22 20:16:35 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-08-22 20:16:35 +0000 |
commit | 0cf817868e112373e8ca0620e312755fe5baa89b (patch) | |
tree | dc872defa96901779cbebfbf23b139df79b75799 | |
parent | 55fb27f8953f2b311abcc0efece88dd912ba4b1e (diff) |
Tox: fixed status changing
git-svn-id: http://svn.miranda-ng.org/main/trunk@10306 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/Tox/src/tox_events.cpp | 7 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.cpp | 9 |
2 files changed, 5 insertions, 11 deletions
diff --git a/protocols/Tox/src/tox_events.cpp b/protocols/Tox/src/tox_events.cpp index 374b2d3ef8..bf1274e812 100644 --- a/protocols/Tox/src/tox_events.cpp +++ b/protocols/Tox/src/tox_events.cpp @@ -197,12 +197,6 @@ void CToxProto::OnStatusMessageChanged(Tox *tox, const int friendnumber, const u void CToxProto::OnUserStatusChanged(Tox *tox, int32_t friendnumber, uint8_t usertatus, void *arg)
{
- TOX_USERSTATUS userstatus = (TOX_USERSTATUS)usertatus;
- if (userstatus == TOX_USERSTATUS_NONE)
- {
- return;
- }
-
CToxProto *proto = (CToxProto*)arg;
std::vector<uint8_t> clientId(TOX_CLIENT_ID_SIZE);
@@ -212,6 +206,7 @@ void CToxProto::OnUserStatusChanged(Tox *tox, int32_t friendnumber, uint8_t user MCONTACT hContact = proto->FindContact(toxId.c_str());
if (hContact)
{
+ TOX_USERSTATUS userstatus = (TOX_USERSTATUS)usertatus;
int status = proto->ToxToMirandaStatus(userstatus);
proto->SetContactStatus(hContact, status);
}
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 585ff4496b..69880a64b7 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -221,11 +221,11 @@ int __cdecl CToxProto::SetApparentMode(MCONTACT hContact, int mode) { return 0; int __cdecl CToxProto::SetStatus(int iNewStatus)
{
- if (iNewStatus == this->m_iDesiredStatus)
+ if (iNewStatus == m_iDesiredStatus)
return 0;
- int old_status = this->m_iStatus;
- this->m_iDesiredStatus = iNewStatus;
+ int old_status = m_iStatus;
+ m_iDesiredStatus = iNewStatus;
if (iNewStatus == ID_STATUS_OFFLINE)
{
@@ -239,7 +239,6 @@ int __cdecl CToxProto::SetStatus(int iNewStatus) }
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
- ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
}
else
{
@@ -253,6 +252,7 @@ int __cdecl CToxProto::SetStatus(int iNewStatus) else
{
// set tox status
+ m_iStatus = iNewStatus;
if (tox_set_user_status(tox, MirandaToToxStatus(iNewStatus)) == 0)
{
SaveToxData();
@@ -261,7 +261,6 @@ int __cdecl CToxProto::SetStatus(int iNewStatus) }
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
-
return 0;
}
|