summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/SkypeWeb/SkypeWeb.vcxproj1
-rw-r--r--protocols/SkypeWeb/SkypeWeb.vcxproj.filters3
-rw-r--r--protocols/SkypeWeb/src/skype_login.cpp19
-rw-r--r--protocols/SkypeWeb/src/skype_proto.cpp10
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h4
-rw-r--r--protocols/SkypeWeb/src/skype_utils.cpp6
-rw-r--r--protocols/SkypeWeb/src/stdafx.h1
7 files changed, 30 insertions, 14 deletions
diff --git a/protocols/SkypeWeb/SkypeWeb.vcxproj b/protocols/SkypeWeb/SkypeWeb.vcxproj
index 25cf16511d..ebb88292b7 100644
--- a/protocols/SkypeWeb/SkypeWeb.vcxproj
+++ b/protocols/SkypeWeb/SkypeWeb.vcxproj
@@ -46,5 +46,6 @@
<ClInclude Include="src\requests\status.h" />
<ClInclude Include="src\requests\subscriptions.h" />
<ClInclude Include="src\requests\trouter.h" />
+ <ClInclude Include="src\requests\mslogin.h" />
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/protocols/SkypeWeb/SkypeWeb.vcxproj.filters b/protocols/SkypeWeb/SkypeWeb.vcxproj.filters
index 0b41c204e3..3c54e2e212 100644
--- a/protocols/SkypeWeb/SkypeWeb.vcxproj.filters
+++ b/protocols/SkypeWeb/SkypeWeb.vcxproj.filters
@@ -53,5 +53,8 @@
<ClInclude Include="src\requests\trouter.h">
<Filter>Header Files\requests</Filter>
</ClInclude>
+ <ClInclude Include="src\requests\mslogin.h">
+ <Filter>Header Files\requests</Filter>
+ </ClInclude>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp
index 453ae85d0f..9196ef4f77 100644
--- a/protocols/SkypeWeb/src/skype_login.cpp
+++ b/protocols/SkypeWeb/src/skype_login.cpp
@@ -19,6 +19,25 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
UINT_PTR CSkypeProto::m_timer;
+void CSkypeProto::Login()
+{
+ // login
+ m_iStatus = ID_STATUS_CONNECTING;
+ requestQueue->Start();
+ int tokenExpires(getDword("TokenExpiresIn", 0));
+ ptrA login(getStringA(SKYPE_SETTINGS_ID));
+ HistorySynced = false;
+ if ((tokenExpires - 1800) > time(NULL))
+ OnLoginSuccess();
+ else
+ {
+ if (strstr(login, "@"))
+ SendRequest(new LoginMSRequest(), &CSkypeProto::OnMSLoginFirst);
+ else
+ SendRequest(new LoginOAuthRequest(login, ptrA(getStringA(SKYPE_SETTINGS_PASSWORD))), &CSkypeProto::OnLoginOAuth);
+ }
+}
+
void CSkypeProto::OnLoginOAuth(const NETLIBHTTPREQUEST *response)
{
if (response == NULL || response->pData == NULL)
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp
index 6d56dd99c7..c62a8e6db1 100644
--- a/protocols/SkypeWeb/src/skype_proto.cpp
+++ b/protocols/SkypeWeb/src/skype_proto.cpp
@@ -247,15 +247,7 @@ int CSkypeProto::SetStatus(int iNewStatus)
if (old_status == ID_STATUS_OFFLINE && m_iStatus == ID_STATUS_OFFLINE)
{
- // login
- m_iStatus = ID_STATUS_CONNECTING;
- requestQueue->Start();
- int tokenExpires(getDword("TokenExpiresIn", 0));
- HistorySynced = false;
- if ((tokenExpires - 1800) > time(NULL))
- OnLoginSuccess();
- else
- SendRequest(new LoginOAuthRequest(ptrA(getStringA(SKYPE_SETTINGS_ID)), ptrA(getStringA(SKYPE_SETTINGS_PASSWORD))), &CSkypeProto::OnLoginOAuth);
+ Login();
}
else
{
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index 1c60444312..df55850287 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -165,6 +165,10 @@ private:
int __cdecl OnOptionsInit(WPARAM wParam, LPARAM lParam);
// login
+ void Login();
+ void OnMSLoginFirst(const NETLIBHTTPREQUEST *response);
+ void OnMSLoginSecond(const NETLIBHTTPREQUEST *response);
+ void OnMSLoginEnd(const NETLIBHTTPREQUEST *response);
void OnLoginOAuth(const NETLIBHTTPREQUEST *response);
void OnLoginSuccess();
void OnEndpointCreated(const NETLIBHTTPREQUEST *response);
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp
index 4b3a2471da..bfc4cc3bdd 100644
--- a/protocols/SkypeWeb/src/skype_utils.cpp
+++ b/protocols/SkypeWeb/src/skype_utils.cpp
@@ -419,11 +419,7 @@ char *CSkypeProto::RemoveHtml(const char *text)
bool CSkypeProto::IsMe(const char *skypeName)
{
- ptrA mySkypeName(getStringA(SKYPE_SETTINGS_ID));
- ptrA SelfEndpointName(getStringA("SelfEndpointName"));
- if (!mir_strcmpi(skypeName, mySkypeName) || !mir_strcmp(skypeName, SelfEndpointName))
- return true;
- return false;
+ return (!mir_strcmpi(skypeName, m_szSelfSkypeName) || !mir_strcmp(skypeName, ptrA(getStringA("SelfEndpointName"))));
}
char *CSkypeProto::MirandaToSkypeStatus(int status)
diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h
index b627274e40..44f9f00b39 100644
--- a/protocols/SkypeWeb/src/stdafx.h
+++ b/protocols/SkypeWeb/src/stdafx.h
@@ -87,6 +87,7 @@ extern LIST<CSkypeProto> Accounts;
#include "requests\search.h"
#include "requests\chatrooms.h"
#include "requests\trouter.h"
+#include "requests\mslogin.h"
#include "request_queue.h"
#include "skype_proto.h"