summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_events.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/SkypeWeb/src/skype_events.cpp')
-rw-r--r--protocols/SkypeWeb/src/skype_events.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp
index 5139642270..309110b285 100644
--- a/protocols/SkypeWeb/src/skype_events.cpp
+++ b/protocols/SkypeWeb/src/skype_events.cpp
@@ -89,8 +89,40 @@ void CSkypeProto::OnLoginSecond(const NETLIBHTTPREQUEST *response)
cookies[match[1]] = match[2];
}
+ PushRequest(new GetRegInfoRequest(token.c_str()), &CSkypeProto::OnGetRegInfo);
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);
+}
+
+void CSkypeProto::OnGetRegInfo(const NETLIBHTTPREQUEST *response)
+{
+ std::regex regex;
+ std::smatch match;
+ std::string content = response->pData;
+ for (int i = 0; i < response->headersCount; i++)
+ {
+ if (mir_strcmpi(response->headers[i].szName, "Set-RegistrationToken"))
+ continue;
+
+ regex = "^(.+?)=(.+?);";
+ content = response->headers[i].szValue;
+
+ if (std::regex_search(content, match, regex))
+ RegInfo[match[1]] = match[2];
+ }
+ setString("RegistrationToken", RegInfo["registrationToken"].c_str());
+
+ for (int i = 0; i < response->headersCount; i++)
+ {
+ if (mir_strcmpi(response->headers[i].szName, "Location"))
+ continue;
+ content = response->headers[i].szValue;
+ }
+ setString("Endpoint", urlDecode(content.c_str()).c_str());
+ debugLogA(getStringA("RegistrationToken"));
+ debugLogA(getStringA("Endpoint"));
+ PushRequest(new GetEndpointRequest(ptrA(getStringA("RegistrationToken")), ptrA(getStringA("Endpoint"))));
+ PushRequest(new SetStatusRequest(ptrA(getStringA("RegistrationToken")), true));
} \ No newline at end of file