summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/requests
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-03-22 20:23:42 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-03-22 20:23:42 +0000
commita9edb12c2cc13a74f16c0a61deaeaa8780f13f4e (patch)
tree70e805ba7e7f7024d31d91971655a4405cb25f92 /protocols/SkypeWeb/src/requests
parent4ba63fe41c45077e90e24f77bcece6af9ddeafef (diff)
SkypeWeb: refactored HttpRequest
git-svn-id: http://svn.miranda-ng.org/main/trunk@12477 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/requests')
-rw-r--r--protocols/SkypeWeb/src/requests/contacts.h38
-rw-r--r--protocols/SkypeWeb/src/requests/login.h37
-rw-r--r--protocols/SkypeWeb/src/requests/profile.h9
3 files changed, 48 insertions, 36 deletions
diff --git a/protocols/SkypeWeb/src/requests/contacts.h b/protocols/SkypeWeb/src/requests/contacts.h
index 5e4ce2cffe..aff095df65 100644
--- a/protocols/SkypeWeb/src/requests/contacts.h
+++ b/protocols/SkypeWeb/src/requests/contacts.h
@@ -9,8 +9,12 @@ public:
{
flags |= NLHRF_SSL;
- AddHeader("X-Skypetoken", token);
- AddHeader("Accept", "application/json");
+ Url << CHAR_VALUE("hideDetails", "true");
+
+ Headers
+ << CHAR_VALUE("X-Skypetoken", "Accept")
+ << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("Accept", "application/json");
}
};
@@ -22,18 +26,15 @@ public:
{
flags |= NLHRF_SSL;
- CMStringA data;
+ Headers
+ << CHAR_VALUE("X-Skypetoken", "Accept")
+ << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("Accept", "application/json");
+
for (size_t i = 0; i < skypenames.getCount(); i++)
{
- data.AppendFormat("contacts[]=%s&", skypenames[i]);
+ Body << CHAR_VALUE("contacts[]", skypenames[i]);
}
- data.Delete(data.GetLength() - 1);
-
- SetData(data, data.GetLength());
-
- AddHeader("X-Skypetoken", token);
- AddHeader("Accept", "application/json");
- AddHeader("Content-Type", "application/x-www-form-urlencoded");
}
};
@@ -45,8 +46,9 @@ public:
{
flags |= NLHRF_SSL;
- AddHeader("X-Skypetoken", token);
- AddHeader("Accept", "application/json");
+ Headers
+ << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("Accept", "application/json");
}
};
@@ -58,8 +60,9 @@ public:
{
flags |= NLHRF_SSL;
- AddHeader("X-Skypetoken", token);
- AddHeader("Accept", "application/json");
+ Headers
+ << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("Accept", "application/json");
}
};
@@ -71,8 +74,9 @@ public:
{
flags |= NLHRF_SSL;
- AddHeader("X-Skypetoken", token);
- AddHeader("Accept", "application/json");
+ Headers
+ << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("Accept", "application/json");
}
};
diff --git a/protocols/SkypeWeb/src/requests/login.h b/protocols/SkypeWeb/src/requests/login.h
index 73003b5046..12f0e9e5cc 100644
--- a/protocols/SkypeWeb/src/requests/login.h
+++ b/protocols/SkypeWeb/src/requests/login.h
@@ -9,35 +9,38 @@ public:
{
flags |= NLHRF_SSL;
- url.Append("?client_id=578134&redirect_uri=https%3A%2F%2Fweb.skype.com");
+ Url
+ << INT_VALUE("client_id", 578134)
+ << CHAR_VALUE("redirect_uri", "https%3A%2F%2Fweb.skype.com");
+
+ Headers
+ << CHAR_VALUE("Host", "login.skype.com")
+ << CHAR_VALUE("Referer", "https://web.skype.com/");
}
LoginRequest(const char *skypename, const char *password, const char *pie, const char *etm) :
HttpRequest(REQUEST_POST, "login.skype.com/login")
{
- flags |= NLHRF_SSL;
+ this->LoginRequest::LoginRequest();
- url.Append("?client_id=578134&redirect_uri=https%3A%2F%2Fweb.skype.com");
+ Headers
+ << CHAR_VALUE("Content-Type", "application/x-www-form-urlencoded")
+ << CHAR_VALUE("Referer", "https://login.skype.com/login?method=skype&client_id=578134&redirect_uri=https%3A%2F%2Fweb.skype.com");
LPTIME_ZONE_INFORMATION tzi = tmi.getTziByContact(NULL);
-
char sign = tzi->Bias > 0 ? '-' : '+';
int hours = tzi->Bias / -60;
int minutes = tzi->Bias % -60;
- CMStringA data = "";
- data.AppendFormat("username=%s&", skypename);
- data.AppendFormat("password=%s&", password);
- data.AppendFormat("pie=%s&", ptrA(mir_urlEncode(pie)));
- data.AppendFormat("etm=%s&", ptrA(mir_urlEncode(etm)));
- data.AppendFormat("timezone_field=%c%02d|%02d&", sign, hours, minutes);
- data.AppendFormat("js_time=%d.00&", time(NULL));
- data.Append("client_id=578134&");
- data.Append("redirect_uri=https%3A%2F%2Fweb.skype.com");
-
- SetData(data, data.GetLength());
-
- AddHeader("Content-Type", "application/x-www-form-urlencoded");
+ Body
+ << CHAR_VALUE("username", skypename)
+ << CHAR_VALUE("password", password)
+ << CHAR_VALUE("pie", ptrA(mir_urlEncode(pie)))
+ << CHAR_VALUE("etm", ptrA(mir_urlEncode(etm)))
+ << FORMAT_VALUE("timezone_field", "%c%02d|%02d", sign, hours, minutes)
+ << FORMAT_VALUE("js_time", "%d.00", time(NULL))
+ << INT_VALUE("client_id", 578134)
+ << CHAR_VALUE("redirect_uri", "https%3A%2F%2Fweb.skype.com");
}
};
diff --git a/protocols/SkypeWeb/src/requests/profile.h b/protocols/SkypeWeb/src/requests/profile.h
index 8473d19875..2c0b4e8fb6 100644
--- a/protocols/SkypeWeb/src/requests/profile.h
+++ b/protocols/SkypeWeb/src/requests/profile.h
@@ -9,8 +9,13 @@ public:
{
flags |= NLHRF_SSL;
- AddHeader("X-Skypetoken", token);
- AddHeader("Accept", "application/json");
+ Headers
+ << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("Accept", "application/json");
+
+
+ //AddHeader("Origin", "https://web.skype.com");
+ //AddHeader("Referer", "https://web.skype.com/main");
}
};