1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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; }
|