diff options
author | aunsane <aunsane@gmail.com> | 2017-12-20 22:15:46 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2017-12-20 22:17:00 +0300 |
commit | c8548c468436fc3a2fccc00be9f48e6b7f0a1df2 (patch) | |
tree | 0d6cd519060f7783a0820d66462b037fd2a5c182 /protocols/Tox/src/tox_proto.cpp | |
parent | be36bd4b6641ebe418724aad1d867236794ffaa1 (diff) |
Tox: added ability to encrypt profile
Diffstat (limited to 'protocols/Tox/src/tox_proto.cpp')
-rw-r--r-- | protocols/Tox/src/tox_proto.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 7e4036f92a..419ef2ff2a 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -143,15 +143,13 @@ int CToxProto::SetStatus(int iNewStatus) int old_status = m_iStatus;
m_iDesiredStatus = iNewStatus;
+ // logout
if (iNewStatus == ID_STATUS_OFFLINE) {
- // logout
isTerminated = true;
SetEvent(hTerminateEvent);
- if (!Miranda_IsTerminated()) {
+ if (!Miranda_IsTerminated())
SetAllContactsStatus(ID_STATUS_OFFLINE);
- //CloseAllChatChatSessions();
- }
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
@@ -161,19 +159,20 @@ int CToxProto::SetStatus(int iNewStatus) if (old_status >= ID_STATUS_CONNECTING && old_status < ID_STATUS_OFFLINE)
return 0;
+ // login
if (old_status == ID_STATUS_OFFLINE && !IsOnline()) {
- // login
isTerminated = false;
m_iStatus = ID_STATUS_CONNECTING;
hPollingThread = ForkThreadEx(&CToxProto::PollingThread, nullptr, nullptr);
+ ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
+ return 0;
}
- else {
- // set tox status
- m_iStatus = iNewStatus;
- tox_self_set_status(toxThread->Tox(), MirandaToToxStatus(iNewStatus));
- }
-
+
+ // change status
+ m_iStatus = iNewStatus;
+ tox_self_set_status(toxThread->Tox(), MirandaToToxStatus(iNewStatus));
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
+
return 0;
}
@@ -220,9 +219,7 @@ int CToxProto::OnEvent(PROTOEVENTTYPE iEventType, WPARAM wParam, LPARAM lParam) return OnInitStatusMenu();
case EV_PROTO_ONERASE:
- ptrW profilePath(GetToxProfilePath());
- _wunlink(profilePath);
- break;
+ return OnDeleteToxProfile();
}
return 1;
|