diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-03-24 19:38:19 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-03-24 19:38:19 +0000 |
commit | 2902d463ea9a35f7dd9b7ee5c887e10ed11f8542 (patch) | |
tree | cc526321622b2f397f1521a75195fd46b1fb2fd3 /protocols | |
parent | 2f1b8c756066316c59be907bcd94a73cae5e3a7b (diff) |
SkypeWeb: status improvements
git-svn-id: http://svn.miranda-ng.org/main/trunk@12493 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/SkypeWeb/src/requests/contacts.h | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/status.h | 14 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_events.cpp | 17 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 15 |
4 files changed, 30 insertions, 22 deletions
diff --git a/protocols/SkypeWeb/src/requests/contacts.h b/protocols/SkypeWeb/src/requests/contacts.h index 9a41c1d8fe..21bf1d56a5 100644 --- a/protocols/SkypeWeb/src/requests/contacts.h +++ b/protocols/SkypeWeb/src/requests/contacts.h @@ -18,8 +18,8 @@ public: class GetContactsInfoRequest : public HttpsPostRequest
{
public:
- GetContactsInfoRequest(const char *token, const LIST<char> &skypenames, const char *skypename = "self") :
- HttpsPostRequest("api.skype.com/users/%s/contacts/profiles", skypename)
+ GetContactsInfoRequest(const char *token, const LIST<char> &skypenames/*, const char *skypename = "self"*/) :
+ HttpsPostRequest("api.skype.com/users/self/contacts/profiles"/*, skypename*/)
{
Headers
<< CHAR_VALUE("X-Skypetoken", token)
@@ -68,4 +68,4 @@ public: }
};
-#endif //_SKYPE_REQUEST_CONTACTS_H_
+#endif //_SKYPE_REQUEST_CONTACTS_H_
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/requests/status.h b/protocols/SkypeWeb/src/requests/status.h index a8c40a492b..f37c936ec4 100644 --- a/protocols/SkypeWeb/src/requests/status.h +++ b/protocols/SkypeWeb/src/requests/status.h @@ -4,7 +4,7 @@ class SetStatusRequest : public HttpsRequest
{
public:
- SetStatusRequest(const char *regToken, bool status) :
+ SetStatusRequest(const char *regToken, int status) :
HttpsRequest(REQUEST_PUT, "client-s.gateway.messenger.live.com/v1/users/ME/presenceDocs/messagingService")
{
CMStringA auth = "registrationToken=";
@@ -18,9 +18,15 @@ public: << CHAR_VALUE("Origin", "https://web.skype.com")
<< CHAR_VALUE("Connection", "keep-alive");
- const char *data = status
- ? "{\"status\":\"Online\"}"
- : "{\"status\":\"Hidden\"}";
+ const char *data;
+ if (status == ID_STATUS_ONLINE)
+ data = "{\"status\":\"Online\"}";
+ else if (status == ID_STATUS_INVISIBLE)
+ data = "{\"status\":\"Hidden\"}";
+ else if (status == ID_STATUS_AWAY)
+ data = "{\"status\":\"Away\"}";
+ else
+ data = "{\"status\":\"Online\"}";
Body << VALUE(data);
}
};
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index d7e661bff4..b64618e6cb 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -93,7 +93,7 @@ void CSkypeProto::OnLoginSecond(const NETLIBHTTPREQUEST *response) PushRequest(new GetProfileRequest(token.c_str()), &CSkypeProto::LoadProfile);
PushRequest(new GetContactListRequest(token.c_str()), &CSkypeProto::LoadContactList);
- ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, m_iStatus = m_iDesiredStatus);
+ //ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, m_iStatus = m_iDesiredStatus);
}
void CSkypeProto::OnGetRegInfo(const NETLIBHTTPREQUEST *response)
@@ -129,7 +129,8 @@ void CSkypeProto::OnGetRegInfo(const NETLIBHTTPREQUEST *response) CMStringA endpointURL = getStringA("Endpoint");
endpointURL += "/presenceDocs/messagingService";
PushRequest(new GetEndpointRequest(ptrA(getStringA("RegistrationToken")), endpointURL));
- PushRequest(new SetStatusRequest(ptrA(getStringA("RegistrationToken")), true));
+ PushRequest(new SetStatusRequest(ptrA(getStringA("RegistrationToken")), ID_STATUS_ONLINE), &CSkypeProto::OnSetStatus);
+ //SetStatus(ID_STATUS_ONLINE);
}
void CSkypeProto::OnSetStatus(const NETLIBHTTPREQUEST *response)
@@ -149,17 +150,13 @@ void CSkypeProto::OnSetStatus(const NETLIBHTTPREQUEST *response) int old_status = m_iStatus;
int iNewStatus;
if (mir_strcmp(status, "O")==0)
- {
- iNewStatus = ID_STATUS_ONLINE;
- }
- else if (mir_strcmp(status,"H")==0)
- {
+ iNewStatus = ID_STATUS_ONLINE;
+ else if (mir_strcmp(status, "H") == 0)
iNewStatus = ID_STATUS_INVISIBLE;
- }
+ else if (mir_strcmp(status, "A") == 0)
+ iNewStatus = ID_STATUS_AWAY;
else
- {
iNewStatus = ID_STATUS_ONLINE;
- }
m_iStatus = iNewStatus;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 4f3adf6462..14e520c239 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -33,9 +33,9 @@ DWORD_PTR CSkypeProto::GetCaps(int type, MCONTACT) case PFLAGNUM_1:
return PF1_AUTHREQ;
case PFLAGNUM_2:
- return PF2_ONLINE | PF2_INVISIBLE;
+ return PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY;
case PFLAGNUM_3:
- return PF2_ONLINE | PF2_INVISIBLE;
+ return PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY;
case PFLAGNUM_4:
return PF4_FORCEADDED | PF4_NOAUTHDENYREASON;
case PFLAG_UNIQUEIDTEXT:
@@ -152,7 +152,12 @@ int CSkypeProto::SetStatus(int iNewStatus) else if (iNewStatus == ID_STATUS_INVISIBLE)
{
PushRequest(new GetEndpointRequest(ptrA(getStringA("RegistrationToken")), endpointURL));
- PushRequest(new SetStatusRequest(ptrA(getStringA("RegistrationToken")), false), &CSkypeProto::OnSetStatus);
+ PushRequest(new SetStatusRequest(ptrA(getStringA("RegistrationToken")), ID_STATUS_INVISIBLE), &CSkypeProto::OnSetStatus);
+ }
+ else if (iNewStatus == ID_STATUS_AWAY)
+ {
+ PushRequest(new GetEndpointRequest(ptrA(getStringA("RegistrationToken")), endpointURL));
+ PushRequest(new SetStatusRequest(ptrA(getStringA("RegistrationToken")), ID_STATUS_AWAY), &CSkypeProto::OnSetStatus);
}
else
{
@@ -161,10 +166,10 @@ int CSkypeProto::SetStatus(int iNewStatus) return 0;
}
- if (m_iStatus == ID_STATUS_INVISIBLE)
+ if (m_iStatus == ID_STATUS_INVISIBLE || m_iStatus == ID_STATUS_AWAY)
{
PushRequest(new GetEndpointRequest(ptrA(getStringA("RegistrationToken")), endpointURL));
- PushRequest(new SetStatusRequest(ptrA(getStringA("RegistrationToken")), true), &CSkypeProto::OnSetStatus);
+ PushRequest(new SetStatusRequest(ptrA(getStringA("RegistrationToken")), ID_STATUS_ONLINE), &CSkypeProto::OnSetStatus);
}
else if (old_status == ID_STATUS_OFFLINE && m_iStatus == ID_STATUS_OFFLINE)
{
|