summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/requests/endpoint.h
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-05-27 16:11:15 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-05-27 16:11:15 +0300
commit49e856bee9b637156e659dcf0e65180dd5a4e077 (patch)
tree7c753bc2bdeda08956101d1b4604ec063989c2a8 /protocols/SkypeWeb/src/requests/endpoint.h
parent59bcd6091e2332308e4aac5a05d3b719f15aa031 (diff)
SkypeWeb:
- massive code cleanup, old http junk wiped out & replaced with standard MHttpRequest class - old MS login code removed; - basic url replaced with modern one;
Diffstat (limited to 'protocols/SkypeWeb/src/requests/endpoint.h')
-rw-r--r--protocols/SkypeWeb/src/requests/endpoint.h27
1 files changed, 12 insertions, 15 deletions
diff --git a/protocols/SkypeWeb/src/requests/endpoint.h b/protocols/SkypeWeb/src/requests/endpoint.h
index bf4e724cd7..07baa3c409 100644
--- a/protocols/SkypeWeb/src/requests/endpoint.h
+++ b/protocols/SkypeWeb/src/requests/endpoint.h
@@ -18,32 +18,29 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef _SKYPE_REQUEST_ENDPOINT_H_
#define _SKYPE_REQUEST_ENDPOINT_H_
-class CreateEndpointRequest : public HttpRequest
+struct CreateEndpointRequest : public AsyncHttpRequest
{
-public:
CreateEndpointRequest(CSkypeProto *ppro) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints", ppro->m_szServer)
+ AsyncHttpRequest(REQUEST_POST, "/users/ME/endpoints", &CSkypeProto::OnEndpointCreated)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << FORMAT_VALUE("Authentication", "skypetoken=%s", ppro->m_szApiToken.get());
+ m_szParam = "{}";
- Body << VALUE("{}");
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddHeader("Authentication", CMStringA(FORMAT, "skypetoken=%s", ppro->m_szApiToken.get()));
}
};
-class DeleteEndpointRequest : public HttpRequest
+struct DeleteEndpointRequest : public AsyncHttpRequest
{
-public:
DeleteEndpointRequest(CSkypeProto *ppro) :
- HttpRequest(REQUEST_DELETE, FORMAT, "%s/v1/users/ME/endpoints/%s", ppro->m_szServer, mir_urlEncode(ppro->m_szId).c_str())
+ AsyncHttpRequest(REQUEST_DELETE)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get());
+ m_szUrl.Format("/users/ME/endpoints/%s", mir_urlEncode(ppro->m_szId).c_str());
+
+ AddHeader("Accept", "application/json, text/javascript");
+ AddRegistrationToken(ppro);
}
};
-
#endif //_SKYPE_REQUEST_ENDPOINT_H_