diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-09 15:48:33 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-04-09 15:48:33 +0000 |
commit | cf3dcf6b3fb88e11cc28717c0020f6c11003a4af (patch) | |
tree | 2502804ec43a3eff6e1d0e0c3b1b91eeba57c961 /protocols/SkypeWeb/src | |
parent | 2db3743c2b49587f0d0505b71b99f21dc4dd6eb8 (diff) |
SkypeWeb: Auth request in context menu is already work.
git-svn-id: http://svn.miranda-ng.org/main/trunk@12701 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src')
-rw-r--r-- | protocols/SkypeWeb/src/requests/contacts.h | 15 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_contacts.cpp | 12 |
2 files changed, 27 insertions, 0 deletions
diff --git a/protocols/SkypeWeb/src/requests/contacts.h b/protocols/SkypeWeb/src/requests/contacts.h index 8debeba6ed..45758c441f 100644 --- a/protocols/SkypeWeb/src/requests/contacts.h +++ b/protocols/SkypeWeb/src/requests/contacts.h @@ -75,6 +75,21 @@ public: }
};
+class AddContactRequest : public HttpRequest
+{
+public:
+ AddContactRequest(const char *token, const char *who, const char *greeting = "", const char *skypename = "self") :
+ HttpRequest(REQUEST_PUT, FORMAT, "api.skype.com/users/%s/contacts/auth-request/%s", skypename, who)
+ {
+ Headers
+ << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("Accept", "application/json");
+ CMStringA data;
+ data.AppendFormat("greeting=%s", mir_urlEncode(greeting));
+ Body << VALUE(data);
+ }
+};
+
class AuthAcceptRequest : public HttpRequest
{
public:
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index 5e779d545a..c33e1c5dca 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -225,11 +225,23 @@ void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response) INT_PTR CSkypeProto::OnRequestAuth(WPARAM hContact, LPARAM lParam)
{
+ if (hContact == INVALID_CONTACT_ID)
+ return 1;
+
+ ptrA token(getStringA("TokenSecret"));
+ ptrA skypename(getStringA(hContact, SKYPE_SETTINGS_ID));
+ PushRequest(new AddContactRequest(token, skypename));
return 0;
}
INT_PTR CSkypeProto::OnGrantAuth(WPARAM hContact, LPARAM)
{
+ if (hContact == INVALID_CONTACT_ID)
+ return 1;
+
+ ptrA token(getStringA("TokenSecret"));
+ ptrA skypename(getStringA(hContact, SKYPE_SETTINGS_ID));
+ PushRequest(new AuthAcceptRequest(token, skypename));
return 0;
}
|