diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-03-31 21:33:48 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-03-31 21:33:48 +0000 |
commit | 0f73f1572a03e5bae2664c1b2bb2cd18a1e33fca (patch) | |
tree | a5307998d7efd2cc464cc41dbf7ee3d0a6240ad3 /protocols/SkypeWeb/src/skype_proto.cpp | |
parent | ff035d5933b88c564fdbf8ef5f899b6fa3ac63bb (diff) |
SkypeWeb:
- refactored status setting
- refactored HttpRequest 3
git-svn-id: http://svn.miranda-ng.org/main/trunk@12579 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_proto.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index e5ef4991d6..6f0905c785 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -1,7 +1,7 @@ #include "common.h"
CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) :
- PROTO<CSkypeProto>(protoName, userName), password(NULL)
+PROTO<CSkypeProto>(protoName, userName), password(NULL)
{
m_hProtoIcon = Icons[0].Handle;
SetAllContactsStatus(ID_STATUS_OFFLINE);
@@ -122,8 +122,60 @@ int CSkypeProto::SendUrl(MCONTACT, int, const char*) { return 0; } int CSkypeProto::SetApparentMode(MCONTACT, int) { return 0; }
+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;
+
+ if (iNewStatus == ID_STATUS_OFFLINE)
+ {
+ // logout
+ PushRequest(new LogoutRequest());
+ requestQueue->Stop();
+ if (!Miranda_Terminated())
+ {
+ SetAllContactsStatus(ID_STATUS_OFFLINE);
+ }
+ m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
+ }
+ else
+ {
+ if (old_status == ID_STATUS_CONNECTING)
+ {
+ return 0;
+ }
+ 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;
+ // it should be rewritten
+ //GetEndpointRequest *request = new GetEndpointRequest(getStringA("registrationToken"), getStringA("endpointId"));
+ //request->Send(m_hNetlibUser);
+ //delete request;
+ PushRequest(new SetStatusRequest(ptrA(getStringA("registrationToken")), MirandaToSkypeStatus(m_iStatus)), &CSkypeProto::OnSetStatus);
+ }
+ }
+
+ ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
+ return 0;
+}
HANDLE CSkypeProto::GetAwayMsg(MCONTACT) { return 0; }
|