summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_status.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-03-30 19:23:00 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-03-30 19:23:00 +0000
commit5c46a4ff3d889e7ef4b2c4a8e6c353f84207a7ab (patch)
tree30c196f189620d37aca012da4962b0ba16aed6b8 /protocols/SkypeWeb/src/skype_status.cpp
parent02ac3e7c9a90243ab30c7ea0f780e498262123e1 (diff)
SkypeWeb: massive improvements (patch from MikalaiR)
git-svn-id: http://svn.miranda-ng.org/main/trunk@12556 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_status.cpp')
-rw-r--r--protocols/SkypeWeb/src/skype_status.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/protocols/SkypeWeb/src/skype_status.cpp b/protocols/SkypeWeb/src/skype_status.cpp
new file mode 100644
index 0000000000..b40aa44198
--- /dev/null
+++ b/protocols/SkypeWeb/src/skype_status.cpp
@@ -0,0 +1,62 @@
+#include "common.h"
+int CSkypeProto::SetStatus(int iNewStatus)
+{
+ if (iNewStatus == m_iDesiredStatus)
+ {
+ return 0;
+ }
+
+ debugLogA(__FUNCTION__ ": changing status from %i to %i", m_iStatus, iNewStatus);
+
+ int old_status = m_iStatus;
+ m_iDesiredStatus = iNewStatus;
+ switch (iNewStatus)
+ {
+ case ID_STATUS_OFFLINE:
+ PushRequest(new LogoutRequest());
+ requestQueue->Stop();
+ if (!Miranda_Terminated())
+ {
+ SetAllContactsStatus(ID_STATUS_OFFLINE);
+ }
+
+ m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
+ break;
+
+ case ID_STATUS_INVISIBLE:
+ case ID_STATUS_AWAY:
+ case ID_STATUS_DND:
+ case ID_STATUS_IDLE:
+ PushRequest(new GetEndpointRequest(ptrA(getStringA("registrationToken")), getStringA("endpointId")));
+ PushRequest(new SetStatusRequest(ptrA(getStringA("registrationToken")), iNewStatus), &CSkypeProto::OnSetStatus);
+ break;
+ default:
+ if (old_status == ID_STATUS_CONNECTING)
+ return 0;
+
+ if (m_iStatus == ID_STATUS_INVISIBLE || m_iStatus == ID_STATUS_AWAY || m_iStatus == ID_STATUS_DND || m_iStatus == ID_STATUS_IDLE)
+ {
+ PushRequest(new GetEndpointRequest(ptrA(getStringA("registrationToken")), getStringA("endpointId")));
+ PushRequest(new SetStatusRequest(ptrA(getStringA("registrationToken")), ID_STATUS_ONLINE), &CSkypeProto::OnSetStatus);
+ }
+ else if (old_status == ID_STATUS_OFFLINE && m_iStatus == ID_STATUS_OFFLINE)
+ {
+ // login
+ m_iStatus = ID_STATUS_CONNECTING;
+
+ requestQueue->Start();
+ PushRequest(new LoginRequest(), &CSkypeProto::OnLoginFirst);
+ }
+ else
+ {
+ // set status
+ m_iStatus = iNewStatus;
+ }
+ break;
+
+ }
+ ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
+ return 0;
+}
+
+void CSkypeProto::SetServerStatus(int iNewStatus){ return; } \ No newline at end of file