summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
Diffstat (limited to 'protocols')
-rw-r--r--protocols/SkypeWeb/src/http_request.h6
-rw-r--r--protocols/SkypeWeb/src/requests/avatars.h13
-rw-r--r--protocols/SkypeWeb/src/skype_avatars.cpp2
3 files changed, 14 insertions, 7 deletions
diff --git a/protocols/SkypeWeb/src/http_request.h b/protocols/SkypeWeb/src/http_request.h
index 50e9528dfd..b281a8846f 100644
--- a/protocols/SkypeWeb/src/http_request.h
+++ b/protocols/SkypeWeb/src/http_request.h
@@ -230,8 +230,10 @@ public:
url.Insert(0, flags & NLHRF_SSL ? "https://" : "http://");
szUrl = url.GetBuffer();
- pData = Body.ToString();
- dataLength = mir_strlen(pData);
+ if (!pData) {
+ pData = Body.ToString();
+ dataLength = mir_strlen(pData);
+ }
char message[1024];
mir_snprintf(message, SIZEOF(message), "Send request to %s", szUrl);
diff --git a/protocols/SkypeWeb/src/requests/avatars.h b/protocols/SkypeWeb/src/requests/avatars.h
index c45c94c1ed..6b71a0732d 100644
--- a/protocols/SkypeWeb/src/requests/avatars.h
+++ b/protocols/SkypeWeb/src/requests/avatars.h
@@ -13,14 +13,19 @@ public:
class SetAvatarRequest : public HttpRequest
{
public:
- SetAvatarRequest(const char *token, const char *skypename, const char *data) :
+ SetAvatarRequest(const char *token, const char *skypename, const char *data, size_t dataSize) :
HttpRequest(REQUEST_PUT, FORMAT, "api.skype.com/users/%s/profile/avatar", skypename)
{
+ pData = (char*)mir_alloc(dataSize);
+ memcpy(pData, data, dataSize);
+ dataLength = dataSize;
Headers
<< CHAR_VALUE("X-Skypetoken", token)
- << CHAR_VALUE("Content-Type", "image/jpg");
-
- Body << VALUE(data);
+ << CHAR_VALUE("Content-Type", "image/jpeg");
+ }
+ ~SetAvatarRequest()
+ {
+ mir_free(pData);
}
};
diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp
index caa9ac88e0..b6b486c2ab 100644
--- a/protocols/SkypeWeb/src/skype_avatars.cpp
+++ b/protocols/SkypeWeb/src/skype_avatars.cpp
@@ -187,7 +187,7 @@ INT_PTR CSkypeProto::SvcSetMyAvatar(WPARAM wParam, LPARAM lParam)
ptrA token(getStringA("TokenSecret"));
ptrA skypename(getStringA("Skypename"));
- PushRequest(new SetAvatarRequest(token, skypename, data), &CSkypeProto::OnSentAvatar);
+ PushRequest(new SetAvatarRequest(token, skypename, data, length), &CSkypeProto::OnSentAvatar);
}
else
{