summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-09-09 16:46:53 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-09-09 16:46:53 +0300
commit26b746f2d8e99c18ccdfd3da1e318af8a890d2ef (patch)
tree4d8b9e29af4bd256683cee6af80aa4b72b73cce7 /protocols
parent6f681b3b1ddbe1937561c64c08943101082f5450 (diff)
code cleaning
Diffstat (limited to 'protocols')
-rw-r--r--protocols/SkypeWeb/src/request_queue.cpp4
-rw-r--r--protocols/SkypeWeb/src/requests/contacts.h25
-rw-r--r--protocols/SkypeWeb/src/requests/profile.h2
-rw-r--r--protocols/SkypeWeb/src/skype_contacts.cpp4
-rw-r--r--protocols/SkypeWeb/src/skype_proto.cpp4
5 files changed, 13 insertions, 26 deletions
diff --git a/protocols/SkypeWeb/src/request_queue.cpp b/protocols/SkypeWeb/src/request_queue.cpp
index cc112052bd..7012d9998f 100644
--- a/protocols/SkypeWeb/src/request_queue.cpp
+++ b/protocols/SkypeWeb/src/request_queue.cpp
@@ -23,7 +23,7 @@ AsyncHttpRequest::AsyncHttpRequest(int type, SkypeHost host, LPCSTR url, MTHttpR
switch (host) {
case HOST_API: m_szUrl = "api.skype.com"; break;
case HOST_PEOPLE: m_szUrl = "people.skype.com/v2"; break;
- case HOST_CONTACTS: m_szUrl = "contacts.skype.com/contacts/v2"; break;
+ case HOST_CONTACTS: m_szUrl = "edge.skype.com/pcs/contacts/v2"; break;
case HOST_GRAPH: m_szUrl = "skypegraph.skype.com"; break;
case HOST_LOGIN: m_szUrl = "login.skype.com"; break;
case HOST_DEFAULT:
@@ -112,7 +112,7 @@ MHttpResponse* CSkypeProto::DoSend(AsyncHttpRequest *pReq)
case HOST_PEOPLE:
case HOST_CONTACTS:
if (m_szApiToken)
- pReq->AddHeader((pReq->m_host == HOST_CONTACTS) ? "X-SkypeToken" : "X-Skypetoken", m_szApiToken);
+ pReq->AddHeader("X-Skypetoken", m_szApiToken);
pReq->AddHeader("Accept", "application/json");
pReq->AddHeader("Origin", "https://web.skype.com");
diff --git a/protocols/SkypeWeb/src/requests/contacts.h b/protocols/SkypeWeb/src/requests/contacts.h
index 23fa74614a..2fab52b21d 100644
--- a/protocols/SkypeWeb/src/requests/contacts.h
+++ b/protocols/SkypeWeb/src/requests/contacts.h
@@ -31,7 +31,6 @@ struct GetContactsAuthRequest : public AsyncHttpRequest
GetContactsAuthRequest() :
AsyncHttpRequest(REQUEST_GET, HOST_CONTACTS, "/users/SELF/invites", &CSkypeProto::LoadContactsAuth)
{
- AddHeader("Accept", "application/json");
}
};
@@ -40,8 +39,6 @@ struct AddContactRequest : public AsyncHttpRequest
AddContactRequest(const char *who, const char *greeting = "") :
AsyncHttpRequest(REQUEST_PUT, HOST_CONTACTS, "/users/SELF/contacts")
{
- AddHeader("Accept", "application/json");
-
JSONNode node;
node << CHAR_PARAM("mri", who) << CHAR_PARAM("greeting", greeting);
m_szParam = node.write().c_str();
@@ -50,34 +47,28 @@ struct AddContactRequest : public AsyncHttpRequest
struct DeleteContactRequest : public AsyncHttpRequest
{
- DeleteContactRequest(CSkypeProto *ppro, const char *who) :
+ DeleteContactRequest(const char *who) :
AsyncHttpRequest(REQUEST_DELETE, HOST_CONTACTS)
{
- m_szUrl.AppendFormat("/users/%s/contacts/%s", ppro->m_szSkypename.c_str(), who);
-
- AddHeader("Accept", "application/json");
+ m_szUrl.AppendFormat("/users/SELF/contacts/%s", mir_urlEncode(who).c_str());
}
};
struct AuthAcceptRequest : public AsyncHttpRequest
{
- AuthAcceptRequest(CSkypeProto *ppro, const char *who) :
+ AuthAcceptRequest(const char *who) :
AsyncHttpRequest(REQUEST_PUT, HOST_CONTACTS)
{
- m_szUrl.AppendFormat("/users/%s/invites/%s/accept", ppro->m_szSkypename.c_str(), who);
-
- AddHeader("Accept", "application/json");
+ m_szUrl.AppendFormat("/users/SELF/invites/%s/accept", mir_urlEncode(who).c_str());
}
};
struct AuthDeclineRequest : public AsyncHttpRequest
{
- AuthDeclineRequest(CSkypeProto *ppro, const char *who) :
+ AuthDeclineRequest(const char *who) :
AsyncHttpRequest(REQUEST_PUT, HOST_CONTACTS)
{
- m_szUrl.AppendFormat("/users/%s/invites/%s/decline", ppro->m_szSkypename.c_str(), who);
-
- AddHeader("Accept", "application/json");
+ m_szUrl.AppendFormat("/users/SELF/invites/%s/decline", mir_urlEncode(who).c_str());
}
};
@@ -88,8 +79,6 @@ struct BlockContactRequest : public AsyncHttpRequest
{
m_szParam = "{\"report_abuse\":\"false\",\"ui_version\":\"skype.com\"}";
pUserInfo = (void *)hContact;
-
- AddHeader("Accept", "application/json");
}
};
@@ -101,8 +90,6 @@ struct UnblockContactRequest : public AsyncHttpRequest
m_szUrl.AppendFormat("/users/SELF/contacts/blocklist/%s", ppro->getId(hContact).c_str());
pUserInfo = (void *)hContact;
- AddHeader("Accept", "application/json");
-
// TODO: user ip address
this << CHAR_PARAM("reporterIp", "123.123.123.123") << CHAR_PARAM("uiVersion", g_szMirVer);
}
diff --git a/protocols/SkypeWeb/src/requests/profile.h b/protocols/SkypeWeb/src/requests/profile.h
index e2afbac33a..24f6125382 100644
--- a/protocols/SkypeWeb/src/requests/profile.h
+++ b/protocols/SkypeWeb/src/requests/profile.h
@@ -23,7 +23,7 @@ struct GetProfileRequest : public AsyncHttpRequest
GetProfileRequest(CSkypeProto *ppro, MCONTACT hContact) :
AsyncHttpRequest(REQUEST_GET, HOST_API, 0, &CSkypeProto::LoadProfile)
{
- m_szUrl.AppendFormat("/users/%s/profile", (hContact == 0) ? "self" : ppro->getId(hContact).c_str());
+ m_szUrl.AppendFormat("/users/%s/profile", (hContact == 0) ? "self" : mir_urlEncode(ppro->getId(hContact)));
pUserInfo = (void *)hContact;
AddHeader("Accept", "application/json");
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp
index 0273ad0b23..bcf8e76a1f 100644
--- a/protocols/SkypeWeb/src/skype_contacts.cpp
+++ b/protocols/SkypeWeb/src/skype_contacts.cpp
@@ -230,7 +230,7 @@ INT_PTR CSkypeProto::OnGrantAuth(WPARAM hContact, LPARAM)
if (hContact == INVALID_CONTACT_ID)
return 1;
- PushRequest(new AuthAcceptRequest(this, getId(hContact)));
+ PushRequest(new AuthAcceptRequest(getId(hContact)));
return 0;
}
@@ -240,7 +240,7 @@ bool CSkypeProto::OnContactDeleted(MCONTACT hContact, uint32_t flags)
if (isChatRoom(hContact))
PushRequest(new DestroyChatroomRequest(getId(hContact)));
else
- PushRequest(new DeleteContactRequest(this, getId(hContact)));
+ PushRequest(new DeleteContactRequest(getId(hContact)));
}
return true;
}
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp
index 70ed909cc4..2bdde69b10 100644
--- a/protocols/SkypeWeb/src/skype_proto.cpp
+++ b/protocols/SkypeWeb/src/skype_proto.cpp
@@ -151,7 +151,7 @@ int CSkypeProto::Authorize(MEVENT hDbEvent)
if (hContact == INVALID_CONTACT_ID)
return 1;
- PushRequest(new AuthAcceptRequest(this, getId(hContact)));
+ PushRequest(new AuthAcceptRequest(getId(hContact)));
return 0;
}
@@ -161,7 +161,7 @@ int CSkypeProto::AuthDeny(MEVENT hDbEvent, const wchar_t*)
if (hContact == INVALID_CONTACT_ID)
return 1;
- PushRequest(new AuthDeclineRequest(this, getId(hContact)));
+ PushRequest(new AuthDeclineRequest(getId(hContact)));
return 0;
}