diff options
Diffstat (limited to 'protocols/SkypeWeb/src/requests')
-rw-r--r-- | protocols/SkypeWeb/src/requests/avatars.h | 22 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/capabilities.h | 16 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/chatrooms.h | 140 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/contacts.h | 122 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/endpoint.h | 27 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/files.h | 42 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/history.h | 62 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/login.h | 14 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/messages.h | 77 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/mslogin.h | 97 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/oauth.h | 45 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/poll.h | 20 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/profile.h | 15 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/search.h | 19 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/status.h | 43 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/subscriptions.h | 36 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/trouter.h | 126 |
17 files changed, 375 insertions, 548 deletions
diff --git a/protocols/SkypeWeb/src/requests/avatars.h b/protocols/SkypeWeb/src/requests/avatars.h index c0dd5061af..918bbf37c4 100644 --- a/protocols/SkypeWeb/src/requests/avatars.h +++ b/protocols/SkypeWeb/src/requests/avatars.h @@ -18,26 +18,27 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _SKYPE_REQUEST_AVATAR_H_
#define _SKYPE_REQUEST_AVATAR_H_
-class GetAvatarRequest : public HttpRequest
+struct GetAvatarRequest : public AsyncHttpRequest
{
-public:
- GetAvatarRequest(const char *url) : HttpRequest(REQUEST_GET, url)
+ GetAvatarRequest(const char *url, MCONTACT hContact) :
+ AsyncHttpRequest(REQUEST_GET, url, &CSkypeProto::OnReceiveAvatar)
{
flags |= NLHRF_REDIRECT;
+ pUserInfo = (void *)hContact;
}
};
-class SetAvatarRequest : public HttpRequest
+struct SetAvatarRequest : public AsyncHttpRequest
{
-public:
SetAvatarRequest(const PBYTE data, size_t dataSize, const char *szMime, CSkypeProto *ppro) :
- HttpRequest(REQUEST_PUT, FORMAT, "api.skype.com/users/%s/profile/avatar", ppro->m_szSkypename.MakeLower().c_str())
+ AsyncHttpRequest(REQUEST_PUT, 0, &CSkypeProto::OnSentAvatar)
{
- Headers
- << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken)
- << CHAR_VALUE("Content-Type", szMime);
+ m_szUrl.Format("api.skype.com/users/%s/profile/avatar", ppro->m_szSkypename.MakeLower().c_str());
- pData = (char*)mir_alloc(dataSize);
+ AddHeader("X-Skypetoken", ppro->m_szApiToken);
+ AddHeader("Content-Type", szMime);
+
+ pData = (char *)mir_alloc(dataSize);
memcpy(pData, data, dataSize);
dataLength = (int)dataSize;
}
@@ -48,5 +49,4 @@ public: }
};
-
#endif //_SKYPE_REQUEST_AVATAR_H_
diff --git a/protocols/SkypeWeb/src/requests/capabilities.h b/protocols/SkypeWeb/src/requests/capabilities.h index deab1354b1..ce53922869 100644 --- a/protocols/SkypeWeb/src/requests/capabilities.h +++ b/protocols/SkypeWeb/src/requests/capabilities.h @@ -18,16 +18,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _SKYPE_REQUEST_CAPS_H_
#define _SKYPE_REQUEST_CAPS_H_
-class SendCapabilitiesRequest : public HttpRequest
+struct SendCapabilitiesRequest : public AsyncHttpRequest
{
-public:
SendCapabilitiesRequest(const char *hostname, CSkypeProto *ppro) :
- HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/endpoints/%s/presenceDocs/messagingService", ppro->m_szServer, mir_urlEncode(ppro->m_szId).c_str())
+ AsyncHttpRequest(REQUEST_PUT, 0, &CSkypeProto::OnCapabilitiesSended)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get());
+ m_szUrl.Format("/users/ME/endpoints/%s/presenceDocs/messagingService", mir_urlEncode(ppro->m_szId).c_str());
+
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddRegistrationToken(ppro);
JSONNode privateInfo; privateInfo.set_name("privateInfo");
privateInfo << JSONNode("epname", hostname);
@@ -48,7 +48,7 @@ public: << privateInfo
<< publicInfo;
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
#endif //_SKYPE_REQUEST_CAPS_H_
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/requests/chatrooms.h b/protocols/SkypeWeb/src/requests/chatrooms.h index 66549c74f4..e0dd27c739 100644 --- a/protocols/SkypeWeb/src/requests/chatrooms.h +++ b/protocols/SkypeWeb/src/requests/chatrooms.h @@ -18,56 +18,51 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _SKYPE_REQUEST_CHATS_H_
#define _SKYPE_REQUEST_CHATS_H_
-class LoadChatsRequest : public HttpRequest
+struct LoadChatsRequest : public AsyncHttpRequest
{
-public:
LoadChatsRequest(CSkypeProto *ppro) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations", ppro->m_szServer)
+ AsyncHttpRequest(REQUEST_GET, "/users/ME/conversations", &CSkypeProto::OnLoadChats)
{
- Url
- << INT_VALUE("startTime", 0)
- << INT_VALUE("pageSize", 100)
- << CHAR_VALUE("view", "msnp24Equivalent")
- << CHAR_VALUE("targetType", "Thread");
-
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get())
- << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8");
+ this << INT_PARAM("startTime", 0) << INT_PARAM("pageSize", 100)
+ << CHAR_PARAM("view", "msnp24Equivalent") << CHAR_PARAM("targetType", "Thread");
+
+ AddHeader("Accept", "application/json, text/javascript");
+ AddRegistrationToken(ppro);
+ AddHeader("Content-Type", "application/json; charset = UTF-8");
}
};
-class SendChatMessageRequest : public HttpRequest
+struct SendChatMessageRequest : public AsyncHttpRequest
{
-public:
SendChatMessageRequest(const char *to, time_t timestamp, const char *message, CSkypeProto *ppro) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/19:%s/messages", ppro->m_szServer, to)
+ AsyncHttpRequest(REQUEST_POST)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get())
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
+ m_szUrl.Format("/users/ME/conversations/19:%s/messages", to);
+
+ AddHeader("Accept", "application/json, text/javascript");
+ AddRegistrationToken(ppro);
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+
JSONNode node;
node
<< JSONNode("clientmessageid", CMStringA(::FORMAT, "%llu000", (ULONGLONG)timestamp))
<< JSONNode("messagetype", "RichText")
<< JSONNode("contenttype", "text")
<< JSONNode("content", message);
-
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
-class SendChatActionRequest : public HttpRequest
+struct SendChatActionRequest : public AsyncHttpRequest
{
-public:
SendChatActionRequest(const char *to, time_t timestamp, const char *message, CSkypeProto *ppro) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/19:%s/messages", ppro->m_szServer, to)
+ AsyncHttpRequest(REQUEST_POST)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get())
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
+ m_szUrl.Format("/users/ME/conversations/19:%s/messages", to);
+
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddRegistrationToken(ppro);
JSONNode node(JSON_NODE);
node
@@ -76,23 +71,19 @@ public: << JSONNode("contenttype", "text")
<< JSONNode("content", message)
<< JSONNode("skypeemoteoffset", 4);
-
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
-class CreateChatroomRequest : public HttpRequest
+struct CreateChatroomRequest : public AsyncHttpRequest
{
-public:
CreateChatroomRequest(const LIST<char> &skypenames, CSkypeProto *ppro) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/threads", ppro->m_szServer)
+ AsyncHttpRequest(REQUEST_POST, "/threads")
{
//{"members":[{"id":"8:user3","role":"User"},{"id":"8:user2","role":"User"},{"id":"8:user1","role":"Admin"}]}
-
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get());
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddRegistrationToken(ppro);
JSONNode node;
JSONNode members(JSON_ARRAY); members.set_name("members");
@@ -106,73 +97,70 @@ public: members << member;
}
node << members;
-
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
-class GetChatInfoRequest : public HttpRequest
+struct GetChatInfoRequest : public AsyncHttpRequest
{
-public:
- GetChatInfoRequest(const char *chatId, CSkypeProto *ppro) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/v1/threads/%s%s", ppro->m_szServer, strstr(chatId, "19:") == chatId ? "" : "19:", chatId)
+ GetChatInfoRequest(const char *chatId, const CMStringW topic, CSkypeProto *ppro) :
+ AsyncHttpRequest(REQUEST_GET, 0, &CSkypeProto::OnGetChatInfo)
{
- Url << CHAR_VALUE("view", "msnp24Equivalent");
+ m_szUrl.Format("/threads/%s%s", ppro->m_szServer, strstr(chatId, "19:") == chatId ? "" : "19:", chatId);
+ pUserInfo = topic.Detach();
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get());
+ this << CHAR_PARAM("view", "msnp24Equivalent");
+
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddRegistrationToken(ppro);
}
};
-class InviteUserToChatRequest : public HttpRequest
+struct InviteUserToChatRequest : public AsyncHttpRequest
{
-public:
InviteUserToChatRequest(const char *chatId, const char *skypename, const char* role, CSkypeProto *ppro) :
- HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/threads/19:%s/members/8:%s", ppro->m_szServer, chatId, skypename)
+ AsyncHttpRequest(REQUEST_PUT)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get());
+ m_szUrl.Format("/threads/19:%s/members/8:%s", chatId, skypename);
- JSONNode node;
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddRegistrationToken(ppro);
+ JSONNode node;
node << JSONNode("role", role);
-
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
-class KickUserRequest : public HttpRequest
+struct KickUserRequest : public AsyncHttpRequest
{
-public:
KickUserRequest(const char *chatId, const char *skypename, CSkypeProto *ppro) :
- HttpRequest(REQUEST_DELETE, FORMAT, "%s/v1/threads/19:%s/members/8:%s", ppro->m_szServer, chatId, skypename)
+ AsyncHttpRequest(REQUEST_DELETE)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get());
+ m_szUrl.Format("/threads/19:%s/members/8:%s", chatId, skypename);
+
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddRegistrationToken(ppro);
}
};
-class SetChatPropertiesRequest : public HttpRequest
+struct SetChatPropertiesRequest : public AsyncHttpRequest
{
-public:
SetChatPropertiesRequest(const char *chatId, const char *propname, const char *value, CSkypeProto *ppro) :
- HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/threads/19:%s/properties?name=%s", ppro->m_szServer, chatId, propname)
+ AsyncHttpRequest(REQUEST_PUT)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get());
+ m_szUrl.Format("/threads/19:%s/properties?name=%s", chatId, propname);
+
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddRegistrationToken(ppro);
JSONNode node;
node << JSONNode(propname, value);
-
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
diff --git a/protocols/SkypeWeb/src/requests/contacts.h b/protocols/SkypeWeb/src/requests/contacts.h index 430b51aa2f..57866eb18c 100644 --- a/protocols/SkypeWeb/src/requests/contacts.h +++ b/protocols/SkypeWeb/src/requests/contacts.h @@ -18,121 +18,113 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _SKYPE_REQUEST_CONTACTS_H_
#define _SKYPE_REQUEST_CONTACTS_H_
-class GetContactListRequest : public HttpRequest
+struct GetContactListRequest : public AsyncHttpRequest
{
-public:
GetContactListRequest(CSkypeProto *ppro, const char *filter) :
- HttpRequest(REQUEST_GET, FORMAT, "contacts.skype.com/contacts/v1/users/%s/contacts", ppro->m_szSkypename.MakeLower().GetBuffer())
+ AsyncHttpRequest(REQUEST_GET, 0, &CSkypeProto::LoadContactList)
{
+ m_szUrl.Format("contacts.skype.com/contacts/v1/users/%s/contacts", ppro->m_szSkypename.MakeLower().GetBuffer());
+
+ // ?filter=contacts[?(@.type="skype" or @.type="msn")]
if (filter != NULL)
- {
- Url
- << CHAR_VALUE ("filter", filter); //?filter=contacts[?(@.type="skype" or @.type="msn")]
- }
+ this << CHAR_PARAM("filter", filter);
- Headers
- << CHAR_VALUE("X-SkypeToken", ppro->m_szApiToken);
+ AddHeader("X-SkypeToken", ppro->m_szApiToken);
}
};
-class GetContactsAuthRequest : public HttpRequest
+struct GetContactsAuthRequest : public AsyncHttpRequest
{
-public:
GetContactsAuthRequest(CSkypeProto *ppro) :
- HttpRequest(REQUEST_GET, FORMAT, "contacts.skype.com/contacts/v2/users/SELF/invites")
+ AsyncHttpRequest(REQUEST_GET, "contacts.skype.com/contacts/v2/users/SELF/invites", &CSkypeProto::LoadContactsAuth)
{
- Headers
- << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken)
- << CHAR_VALUE("Accept", "application/json");
+ AddHeader("X-Skypetoken", ppro->m_szApiToken);
+ AddHeader("Accept", "application/json");
}
};
-class AddContactRequest : public HttpRequest
+struct AddContactRequest : public AsyncHttpRequest
{
-public:
AddContactRequest(CSkypeProto *ppro, const char *who, const char *greeting = "") :
- HttpRequest(REQUEST_PUT, "contacts.skype.com/contacts/v2/users/SELF/contacts")
+ AsyncHttpRequest(REQUEST_PUT, "contacts.skype.com/contacts/v2/users/SELF/contacts")
{
- Headers
- << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken)
- << CHAR_VALUE("Accept", "application/json")
- << CHAR_VALUE("Content-type", "application/x-www-form-urlencoded");
+ AddHeader("X-Skypetoken", ppro->m_szApiToken);
+ AddHeader("Accept", "application/json");
+ AddHeader("Content-type", "application/x-www-form-urlencoded");
JSONNode node;
- node
- << JSONNode("mri", CMStringA(::FORMAT, "8:", who).GetString())
+ node << JSONNode("mri", CMStringA(::FORMAT, "8:", who).GetString())
<< JSONNode("greeting", greeting);
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
-class DeleteContactRequest : public HttpRequest
+struct DeleteContactRequest : public AsyncHttpRequest
{
-public:
DeleteContactRequest(CSkypeProto *ppro, const char *who) :
- HttpRequest(REQUEST_DELETE, FORMAT, "contacts.skype.com/contacts/v2/users/SELF/contacts/8:%s", who)
+ AsyncHttpRequest(REQUEST_DELETE)
{
- Headers
- << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken)
- << CHAR_VALUE("Accept", "application/json")
- << CHAR_VALUE("Content-type", "application/x-www-form-urlencoded");
+ m_szUrl.Format("contacts.skype.com/contacts/v2/users/SELF/contacts/8:%s", who);
+
+ AddHeader("X-Skypetoken", ppro->m_szApiToken);
+ AddHeader("Accept", "application/json");
}
};
-class AuthAcceptRequest : public HttpRequest
+struct AuthAcceptRequest : public AsyncHttpRequest
{
-public:
AuthAcceptRequest(CSkypeProto *ppro, const char *who) :
- HttpRequest(REQUEST_PUT, FORMAT, "contacts.skype.com/contacts/v2/users/SELF/invites/8:%s/accept", who)
+ AsyncHttpRequest(REQUEST_PUT)
{
- Headers
- << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken)
- << CHAR_VALUE("Accept", "application/json");
+ m_szUrl.Format("contacts.skype.com/contacts/v2/users/SELF/invites/8:%s/accept", who);
+
+ AddHeader("X-Skypetoken", ppro->m_szApiToken);
+ AddHeader("Accept", "application/json");
}
};
-class AuthDeclineRequest : public HttpRequest
+struct AuthDeclineRequest : public AsyncHttpRequest
{
-public:
AuthDeclineRequest(CSkypeProto *ppro, const char *who) :
- HttpRequest(REQUEST_PUT, FORMAT, "contacts.skype.com/contacts/v2/users/SELF/invites/8:%s/decline", who)
+ AsyncHttpRequest(REQUEST_PUT)
{
- Headers
- << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken)
- << CHAR_VALUE("Accept", "application/json");
+ m_szUrl.Format("contacts.skype.com/contacts/v2/users/SELF/invites/8:%s/decline", who);
+
+ AddHeader("X-Skypetoken", ppro->m_szApiToken);
+ AddHeader("Accept", "application/json");
}
};
-class BlockContactRequest : public HttpRequest
+struct BlockContactRequest : public AsyncHttpRequest
{
-public:
- BlockContactRequest(CSkypeProto *ppro, const char *who) :
- HttpRequest(REQUEST_PUT, FORMAT, "contacts.skype.com/contacts/v2/users/SELF/contacts/blocklist/8:%s", who)
+ BlockContactRequest(CSkypeProto *ppro, MCONTACT hContact) :
+ AsyncHttpRequest(REQUEST_PUT, 0, &CSkypeProto::OnBlockContact)
{
- Headers
- << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken)
- << CHAR_VALUE("Accept", "application/json")
- << CHAR_VALUE("Content-type", "application/x-www-form-urlencoded");
+ m_szUrl.Format("contacts.skype.com/contacts/v2/users/SELF/contacts/blocklist/8:%s", ppro->getId(hContact).c_str());
+ m_szParam = "{\"report_abuse\":\"false\",\"ui_version\":\"skype.com\"}";
+ pUserInfo = (void *)hContact;
- Body << VALUE("{\"report_abuse\":\"false\",\"ui_version\":\"skype.com\"}");
+ AddHeader("X-Skypetoken", ppro->m_szApiToken);
+ AddHeader("Accept", "application/json");
+ AddHeader("Content-type", "application/x-www-form-urlencoded");
}
};
-class UnblockContactRequest : public HttpRequest
+struct UnblockContactRequest : public AsyncHttpRequest
{
-public:
- UnblockContactRequest(CSkypeProto *ppro, const char *who) :
- HttpRequest(REQUEST_DELETE, FORMAT, "contacts.skype.com/contacts/v2/users/SELF/contacts/blocklist/8:%s", who)
+ UnblockContactRequest(CSkypeProto *ppro, MCONTACT hContact) :
+ AsyncHttpRequest(REQUEST_DELETE, 0, &CSkypeProto::OnUnblockContact)
{
- Headers
- << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken)
- << CHAR_VALUE("Accept", "application/json")
- << CHAR_VALUE("Content-type", "application/x-www-form-urlencoded");
-
- Body
- << CHAR_VALUE("reporterIp", "123.123.123.123") //TODO: user ip address
- << CHAR_VALUE("uiVersion", g_szMirVer);
+ m_szUrl.Format("contacts.skype.com/contacts/v2/users/SELF/contacts/blocklist/8:%s", ppro->getId(hContact).c_str());
+ pUserInfo = (void *)hContact;
+
+ AddHeader("X-Skypetoken", ppro->m_szApiToken);
+ AddHeader("Accept", "application/json");
+ AddHeader("Content-type", "application/x-www-form-urlencoded");
+
+ this << CHAR_PARAM("reporterIp", "123.123.123.123") // TODO: user ip address
+ << CHAR_PARAM("uiVersion", g_szMirVer);
}
};
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_
diff --git a/protocols/SkypeWeb/src/requests/files.h b/protocols/SkypeWeb/src/requests/files.h index f7404474a2..11123e3f03 100644 --- a/protocols/SkypeWeb/src/requests/files.h +++ b/protocols/SkypeWeb/src/requests/files.h @@ -1,43 +1,47 @@ #pragma once -class ASMObjectCreateRequest : public HttpRequest +struct ASMObjectCreateRequest : public AsyncHttpRequest { -public: - ASMObjectCreateRequest(CSkypeProto *ppro, const char *szContact, const char *szFileName) : - HttpRequest(REQUEST_POST, "api.asm.skype.com/v1/objects") + ASMObjectCreateRequest(CSkypeProto *ppro, CFileUploadParam *fup) : + AsyncHttpRequest(REQUEST_POST, "api.asm.skype.com/v1/objects", &CSkypeProto::OnASMObjectCreated) { flags &= (~NLHRF_DUMPASTEXT); - Headers - << FORMAT_VALUE("Authorization", "skype_token %s", ppro->m_szApiToken.get()) - << CHAR_VALUE("Content-Type", "text/json") - << CHAR_VALUE("X-Client-Version", "0/0.0.0.0"); + pUserInfo = fup; + + AddHeader("Authorization", CMStringA(FORMAT, "skype_token %s", ppro->m_szApiToken.get())); + AddHeader("Content-Type", "text/json"); + AddHeader("X-Client-Version", "0/0.0.0.0"); + + CMStringA szContact(FORMAT, "%d:%s", ppro->isChatRoom(fup->hContact) ? 19 : 8, ppro->getId(fup->hContact).c_str()); + T2Utf uszFileName(fup->tszFileName); + const char *szFileName = strrchr(uszFileName.get() + 1, '\\'); JSONNode node, jPermissions, jPermission(JSON_ARRAY); jPermissions.set_name("permissions"); - jPermission.set_name(szContact); + jPermission.set_name(szContact.c_str()); jPermission << JSONNode("", "read"); jPermissions << jPermission; node << JSONNode("type", "sharing/file") << JSONNode("filename", szFileName) << jPermissions; - - Body << VALUE(node.write().c_str()); + m_szParam = node.write().c_str(); } }; -class ASMObjectUploadRequest : public HttpRequest +struct ASMObjectUploadRequest : public AsyncHttpRequest { -public: - ASMObjectUploadRequest(CSkypeProto *ppro, const char *szObject, const PBYTE data, const size_t size) : - HttpRequest(REQUEST_PUT, FORMAT, "api.asm.skype.com/v1/objects/%s/content/original", szObject) + ASMObjectUploadRequest(CSkypeProto *ppro, const char *szObject, const PBYTE data, const size_t size, CFileUploadParam *fup) : + AsyncHttpRequest(REQUEST_PUT, 0, &CSkypeProto::OnASMObjectUploaded) { - Headers - << FORMAT_VALUE("Authorization", "skype_token %s", ppro->m_szApiToken.get()) - << CHAR_VALUE("Content-Type", "application/octet-stream"); + m_szUrl.Format("api.asm.skype.com/v1/objects/%s/content/original", szObject); + pUserInfo = fup; + + AddHeader("Authorization", CMStringA(FORMAT, "skype_token %s", ppro->m_szApiToken.get())); + AddHeader("Content-Type", "application/octet-stream"); pData = (char*)mir_alloc(size); memcpy(pData, data, size); dataLength = (int)size; - } + ~ASMObjectUploadRequest() { mir_free(pData); diff --git a/protocols/SkypeWeb/src/requests/history.h b/protocols/SkypeWeb/src/requests/history.h index fa6055b14b..ed65be8b2d 100644 --- a/protocols/SkypeWeb/src/requests/history.h +++ b/protocols/SkypeWeb/src/requests/history.h @@ -17,64 +17,52 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _SKYPE_REQUEST_HISTORY_H_
#define _SKYPE_REQUEST_HISTORY_H_
-class SyncHistoryFirstRequest : public HttpRequest
+struct SyncHistoryFirstRequest : public AsyncHttpRequest
{
-public:
SyncHistoryFirstRequest(int pageSize, CSkypeProto *ppro) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations", ppro->m_szServer)
+ AsyncHttpRequest(REQUEST_GET, "/users/ME/conversations", &CSkypeProto::OnSyncHistory)
{
- Url
- << INT_VALUE("startTime", 0)
- << INT_VALUE("pageSize", pageSize)
- << CHAR_VALUE("view", "msnp24Equivalent")
- << CHAR_VALUE("targetType", "Passport|Skype|Lync");
+ this << INT_PARAM("startTime", 0) << INT_PARAM("pageSize", pageSize)
+ << CHAR_PARAM("view", "msnp24Equivalent") << CHAR_PARAM("targetType", "Passport|Skype|Lync");
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get())
- << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8");
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset = UTF-8");
+ AddRegistrationToken(ppro);
}
SyncHistoryFirstRequest(const char *url, CSkypeProto *ppro) :
- HttpRequest(REQUEST_GET, url)
+ AsyncHttpRequest(REQUEST_GET, url, &CSkypeProto::OnSyncHistory)
{
-
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get())
- << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8");
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset = UTF-8");
+ AddRegistrationToken(ppro);
}
};
-class GetHistoryRequest : public HttpRequest
+struct GetHistoryRequest : public AsyncHttpRequest
{
-public:
GetHistoryRequest(const char *username, int pageSize, bool isChat, LONGLONG timestamp, CSkypeProto *ppro) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations/%d:%s/messages", ppro->m_szServer, isChat ? 19 : 8, mir_urlEncode(username).c_str())
+ AsyncHttpRequest(REQUEST_GET, 0, &CSkypeProto::OnGetServerHistory)
{
- Url
- << LONG_VALUE("startTime", timestamp)
- << INT_VALUE("pageSize", pageSize)
- << CHAR_VALUE("view", "msnp24Equivalent")
- << CHAR_VALUE("targetType", "Passport|Skype|Lync|Thread");
+ m_szUrl.Format("/users/ME/conversations/%d:%s/messages", isChat ? 19 : 8, mir_urlEncode(username).c_str());
+
+ this << INT_PARAM("startTime", timestamp) << INT_PARAM("pageSize", pageSize)
+ << CHAR_PARAM("view", "msnp24Equivalent") << CHAR_PARAM("targetType", "Passport|Skype|Lync|Thread");
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get())
- << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8");
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset = UTF-8");
+ AddRegistrationToken(ppro);
}
};
-class GetHistoryOnUrlRequest : public HttpRequest
+struct GetHistoryOnUrlRequest : public AsyncHttpRequest
{
-public:
GetHistoryOnUrlRequest(const char *url, CSkypeProto *ppro) :
- HttpRequest(REQUEST_GET, url)
+ AsyncHttpRequest(REQUEST_GET, url, &CSkypeProto::OnGetServerHistory)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get())
- << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8");
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset = UTF-8");
+ AddRegistrationToken(ppro);
}
};
diff --git a/protocols/SkypeWeb/src/requests/login.h b/protocols/SkypeWeb/src/requests/login.h index 18eec57aa6..bb5e5d00ad 100644 --- a/protocols/SkypeWeb/src/requests/login.h +++ b/protocols/SkypeWeb/src/requests/login.h @@ -18,11 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _SKYPE_REQUEST_LOGIN_H_
#define _SKYPE_REQUEST_LOGIN_H_
-class LoginOAuthRequest : public HttpRequest
+struct LoginOAuthRequest : public AsyncHttpRequest
{
-public:
LoginOAuthRequest(CMStringA username, const char *password) :
- HttpRequest(REQUEST_POST, "api.skype.com/login/skypetoken")
+ AsyncHttpRequest(REQUEST_POST, "api.skype.com/login/skypetoken", &CSkypeProto::OnLoginOAuth)
{
username.MakeLower();
CMStringA hashStr(::FORMAT, "%s\nskyper\n%s", username.c_str(), password);
@@ -30,11 +29,10 @@ public: BYTE digest[16];
mir_md5_hash((const BYTE*)hashStr.GetString(), hashStr.GetLength(), digest);
- Body
- << CHAR_VALUE("scopes", "client")
- << CHAR_VALUE("clientVersion", mir_urlEncode("0/7.4.85.102/259/").c_str())
- << CHAR_VALUE("username", mir_urlEncode(username).c_str())
- << CHAR_VALUE("passwordHash", mir_urlEncode(ptrA(mir_base64_encode(digest, sizeof(digest)))).c_str());
+ this << CHAR_PARAM("scopes", "client")
+ << CHAR_PARAM("clientVersion", mir_urlEncode("0/7.4.85.102/259/").c_str())
+ << CHAR_PARAM("username", mir_urlEncode(username).c_str())
+ << CHAR_PARAM("passwordHash", mir_urlEncode(ptrA(mir_base64_encode(digest, sizeof(digest)))).c_str());
}
};
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h index 04cd3226c6..fdcb8d8ae6 100644 --- a/protocols/SkypeWeb/src/requests/messages.h +++ b/protocols/SkypeWeb/src/requests/messages.h @@ -18,38 +18,42 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _SKYPE_REQUEST_MESSAGES_H_
#define _SKYPE_REQUEST_MESSAGES_H_
-class SendMessageRequest : public HttpRequest
+struct SendMessageParam
+{
+ MCONTACT hContact;
+ DWORD hMessage;
+};
+
+struct SendMessageRequest : public AsyncHttpRequest
{
-public:
SendMessageRequest(const char *username, time_t timestamp, const char *message, CSkypeProto *ppro, const char *MessageType = nullptr) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", ppro->m_szServer, username)
+ AsyncHttpRequest(REQUEST_POST, 0, &CSkypeProto::OnMessageSent)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get())
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
+ m_szUrl.Format("/users/ME/conversations/8:%s/messages", username);
+
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddRegistrationToken(ppro);
JSONNode node;
- node
- << JSONNode("clientmessageid", CMStringA(::FORMAT, "%llu", (ULONGLONG)timestamp))
+ node << JSONNode("clientmessageid", CMStringA(::FORMAT, "%llu", (ULONGLONG)timestamp))
<< JSONNode("messagetype", MessageType ? MessageType : "Text")
<< JSONNode("contenttype", "text")
<< JSONNode("content", message);
-
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
-class SendActionRequest : public HttpRequest
+struct SendActionRequest : public AsyncHttpRequest
{
-public:
SendActionRequest(const char *username, time_t timestamp, const char *message, CSkypeProto *ppro) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", ppro->m_szServer, username)
+ AsyncHttpRequest(REQUEST_POST, 0, &CSkypeProto::OnMessageSent)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get())
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
+ m_szUrl.Format("/users/ME/conversations/8:%s/messages", username);
+
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddRegistrationToken(ppro);
CMStringA content;
content.AppendFormat("%s %s", ppro->m_szSkypename.c_str(), message);
@@ -61,21 +65,20 @@ public: << JSONNode("contenttype", "text")
<< JSONNode("content", content)
<< JSONNode("skypeemoteoffset", ppro->m_szSkypename.GetLength() + 1);
-
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
-class SendTypingRequest : public HttpRequest
+struct SendTypingRequest : public AsyncHttpRequest
{
-public:
SendTypingRequest(const char *username, int iState, CSkypeProto *ppro) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", ppro->m_szServer, mir_urlEncode(username).c_str())
+ AsyncHttpRequest(REQUEST_POST)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get())
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
+ m_szUrl.Format("/users/ME/conversations/8:%s/messages", mir_urlEncode(username).c_str());
+
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddRegistrationToken(ppro);
const char *state = (iState == PROTOTYPE_SELFTYPING_ON) ? "Control/Typing" : "Control/ClearTyping";
@@ -85,28 +88,26 @@ public: << JSONNode("messagetype", state)
<< JSONNode("contenttype", "text")
<< JSONNode("content", "");
-
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
-class MarkMessageReadRequest : public HttpRequest
+struct MarkMessageReadRequest : public AsyncHttpRequest
{
-public:
MarkMessageReadRequest(const char *username, LONGLONG /*msgId*/, LONGLONG msgTimestamp, bool isChat, CSkypeProto *ppro) :
- HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/conversations/%d:%s/properties?name=consumptionhorizon", ppro->m_szServer, !isChat ? 8 : 19, username)
+ AsyncHttpRequest(REQUEST_PUT)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get())
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
+ m_szUrl.Format("/users/ME/conversations/%d:%s/properties?name=consumptionhorizon", !isChat ? 8 : 19, username);
+
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddRegistrationToken(ppro);
//"lastReadMessageTimestamp;modificationTime;lastReadMessageId"
JSONNode node(JSON_NODE);
node << JSONNode("consumptionhorizon", CMStringA(::FORMAT, "%lld000;%lld000;%lld000", msgTimestamp, time(NULL), msgTimestamp));
-
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
diff --git a/protocols/SkypeWeb/src/requests/mslogin.h b/protocols/SkypeWeb/src/requests/mslogin.h deleted file mode 100644 index 3f7930542b..0000000000 --- a/protocols/SkypeWeb/src/requests/mslogin.h +++ /dev/null @@ -1,97 +0,0 @@ -/*
-Copyright (c) 2015-20 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_REQUEST_LOGINMS_H_
-#define _SKYPE_REQUEST_LOGINMS_H_
-
-class LoginMSRequest : public HttpRequest
-{
-public:
- LoginMSRequest() :
- HttpRequest(REQUEST_GET, "login.skype.com/login/oauth/microsoft")
- {
- flags |= NLHRF_REDIRECT;
-
- Url
- << INT_VALUE ("client_id", 578134)
- << CHAR_VALUE ("redirect_uri", mir_urlEncode("https://web.skype.com"));
- }
- LoginMSRequest(const char *login, const char *password, const char *cookies_str, const char *ppft) :
- HttpRequest(REQUEST_POST, "login.live.com/ppsecure/post.srf")
- {
- Url
- << CHAR_VALUE ("wa", "wsignin1.0")
- << CHAR_VALUE ("wreply", "https%3A%2F%2Fsecure.skype.com%2Flogin%2Foauth%2Fproxy%3Fclient_id%3D578134%26redirect_uri%3Dhttps%253A%252F%252Fweb.skype.com");
-
- Headers
- << CHAR_VALUE ("Content-Type", "application/x-www-form-urlencoded")
- << CHAR_VALUE ("Cookie", cookies_str);
-
- Body
- << CHAR_VALUE ("login", mir_urlEncode(login))
- << CHAR_VALUE ("passwd", mir_urlEncode(password))
- << CHAR_VALUE ("PPFT", ppft);
- }
- LoginMSRequest(const char *t) :
- HttpRequest(REQUEST_POST, "login.skype.com/login/oauth")
- {
- Url
- << INT_VALUE ("client_id", 578134)
- << CHAR_VALUE ("redirect_uri", mir_urlEncode("https://web.skype.com"));
-
- Headers
- << CHAR_VALUE ("Content-Type", "application/x-www-form-urlencoded");
-
- Body
- << CHAR_VALUE ("t", mir_urlEncode(t))
- << INT_VALUE ("oauthPartner", 999)
- << INT_VALUE ("client_id", 578134)
- << CHAR_VALUE ("redirect_uri", mir_urlEncode("https://web.skype.com"));
- }
-
- LoginMSRequest(const char *t, int) :
- HttpRequest(REQUEST_POST, "secure.skype.com/login/oauth/proxy")
- {
- Url
- << INT_VALUE ("client_id", 578134)
- << CHAR_VALUE ("redirect_uri", mir_urlEncode("https://web.skype.com"));
-
- Headers
- << CHAR_VALUE ("Content-Type", "application/x-www-form-urlencoded");
-
- Body
- << CHAR_VALUE ("t", mir_urlEncode(t))
- << INT_VALUE ("oauthPartner", 999)
- << INT_VALUE ("client_id", 578134)
- << CHAR_VALUE ("redirect_uri", mir_urlEncode("https://web.skype.com"));
- }
-
- LoginMSRequest(const char *url, const char *login, const char *cookies_str, const char *ppft, const char *code) :
- HttpRequest(REQUEST_POST, url)
- {
- Headers
- << CHAR_VALUE ("Cookie", cookies_str);
- Body
- << CHAR_VALUE ("oct", code)
- << INT_VALUE ("AdTD", 1)
- << CHAR_VALUE ("login", mir_urlEncode(login))
- << INT_VALUE ("type", 19)
- << CHAR_VALUE ("PPFT", mir_urlEncode(ppft));
- }
-};
-
-#endif //_SKYPE_REQUEST_LOGINMS_H_
diff --git a/protocols/SkypeWeb/src/requests/oauth.h b/protocols/SkypeWeb/src/requests/oauth.h index aef2e150c1..3f23ea50e3 100644 --- a/protocols/SkypeWeb/src/requests/oauth.h +++ b/protocols/SkypeWeb/src/requests/oauth.h @@ -18,50 +18,39 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _SKYPE_REQUEST_OAUTH_H_ #define _SKYPE_REQUEST_OAUTH_H_ -class OAuthRequest : public HttpRequest +struct OAuthRequest : public AsyncHttpRequest { -public: OAuthRequest() : - HttpRequest(REQUEST_GET, "login.live.com/login.srf") + AsyncHttpRequest(REQUEST_GET, "login.live.com/login.srf", &CSkypeProto::OnOAuthStart) { flags |= NLHRF_REDIRECT; - Url - << CHAR_VALUE("wa", "wsignin1.0") - << CHAR_VALUE("wp", "MBI_SSL") - << CHAR_VALUE("wreply", "https%3A%2F%2Flw.skype.com%2Flogin%2Foauth%2Fproxy%3Fsite_name%3Dlw.skype.com") - << CHAR_VALUE("cobrandid", "90010"); + this << CHAR_PARAM("wa", "wsignin1.0") << CHAR_PARAM("wp", "MBI_SSL") + << CHAR_PARAM("wreply", "https://lw.skype.com/login/oauth/proxy?site_name=lw.skype.com") + << CHAR_PARAM("cobrandid", "90010"); } OAuthRequest(const char *login, const char *password, const char *cookies, const char *ppft) : - HttpRequest(REQUEST_POST, "login.live.com/ppsecure/post.srf") + AsyncHttpRequest(REQUEST_POST, "login.live.com/ppsecure/post.srf", &CSkypeProto::OnOAuthAuthorize) { - Url - << CHAR_VALUE("wa", "wsignin1.0") - << CHAR_VALUE("wp", "MBI_SSL") - << CHAR_VALUE("wreply", "https%3A%2F%2Flw.skype.com%2Flogin%2Foauth%2Fproxy%3Fsite_name%3Dlw.skype.com") - << CHAR_VALUE("cobrandid", "90010"); + this << CHAR_PARAM("wa", "wsignin1.0") << CHAR_PARAM("wp", "MBI_SSL") + << CHAR_PARAM("wreply", "https://lw.skype.com/login/oauth/proxy?site_name=lw.skype.com") + << CHAR_PARAM("cobrandid", "90010"); + m_szUrl.AppendFormat("?%s", m_szParam.c_str()); + m_szParam.Empty(); - Headers - << CHAR_VALUE("Content-Type", "application/x-www-form-urlencoded") - << CHAR_VALUE("Cookie", cookies); + AddHeader("Content-Type", "application/x-www-form-urlencoded"); + AddHeader("Cookie", cookies); - Body - << CHAR_VALUE("login", mir_urlEncode(login)) - << CHAR_VALUE("passwd", mir_urlEncode(password)) - << CHAR_VALUE("PPFT", ppft); + this << CHAR_PARAM("login", login) << CHAR_PARAM("passwd", password) << CHAR_PARAM("PPFT", ppft); } OAuthRequest(const char *t) : - HttpRequest(REQUEST_POST, "login.skype.com/login/microsoft") + AsyncHttpRequest(REQUEST_POST, "login.skype.com/login/microsoft", &CSkypeProto::OnOAuthEnd) { - Headers - << CHAR_VALUE ("Content-Type", "application/x-www-form-urlencoded"); + AddHeader("Content-Type", "application/x-www-form-urlencoded"); - Body - << CHAR_VALUE ("t", mir_urlEncode(t)) - << CHAR_VALUE("site_name", "lw.skype.com") - << INT_VALUE ("oauthPartner", 999); + this << CHAR_PARAM ("t", t) << CHAR_PARAM("site_name", "lw.skype.com") << INT_PARAM ("oauthPartner", 999); } }; diff --git a/protocols/SkypeWeb/src/requests/poll.h b/protocols/SkypeWeb/src/requests/poll.h index 7293c07067..d74030dbd4 100644 --- a/protocols/SkypeWeb/src/requests/poll.h +++ b/protocols/SkypeWeb/src/requests/poll.h @@ -18,24 +18,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _SKYPE_POLL_H_
#define _SKYPE_POLL_H_
-class PollRequest : public HttpRequest
+struct PollRequest : public AsyncHttpRequest
{
-public:
PollRequest(CSkypeProto *ppro) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions/0/poll", ppro->m_szServer)
+ AsyncHttpRequest(REQUEST_POST, "/users/ME/endpoints/SELF/subscriptions/0/poll")
{
timeout = 120000;
if (ppro->m_iPollingId != -1)
- Url << INT_VALUE("ackId", ppro->m_iPollingId);
+ this << INT_PARAM("ackId", ppro->m_iPollingId);
- Headers
- << CHAR_VALUE("Referer", "https://web.skype.com/main")
- << CHAR_VALUE("Content-Type", "application/x-www-form-urlencoded")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get())
- << CHAR_VALUE("ClientInfo", "os=Windows; osVer=8.1; proc=Win32; lcid=en-us; deviceType=1; country=n/a; clientName=swx-skype.com; clientVer=908/1.85.0.29")
- << CHAR_VALUE("Accept", "application/json; ver=1.0")
- << CHAR_VALUE("Accept-Language", "en, C");
+ AddHeader("Referer", "https://web.skype.com/main");
+ AddHeader("Content-Type", "application/x-www-form-urlencoded");
+ AddHeader("ClientInfo", "os=Windows; osVer=8.1; proc=Win32; lcid=en-us; deviceType=1; country=n/a; clientName=swx-skype.com; clientVer=908/1.85.0.29");
+ AddHeader("Accept", "application/json; ver=1.0");
+ AddHeader("Accept-Language", "en, C");
+ AddRegistrationToken(ppro);
}
};
#endif //_SKYPE_POLL_H_
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/requests/profile.h b/protocols/SkypeWeb/src/requests/profile.h index 13e5e50724..5f872b7fe8 100644 --- a/protocols/SkypeWeb/src/requests/profile.h +++ b/protocols/SkypeWeb/src/requests/profile.h @@ -18,15 +18,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _SKYPE_REQUEST_PROFILE_H_
#define _SKYPE_REQUEST_PROFILE_H_
-class GetProfileRequest : public HttpRequest
+struct GetProfileRequest : public AsyncHttpRequest
{
-public:
- GetProfileRequest(CSkypeProto *ppro, const char *skypename = "self") :
- HttpRequest(REQUEST_GET, FORMAT, "api.skype.com/users/%s/profile", skypename)
+ GetProfileRequest(CSkypeProto *ppro, MCONTACT hContact) :
+ AsyncHttpRequest(REQUEST_GET, 0, &CSkypeProto::LoadProfile)
{
- Headers
- << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken)
- << CHAR_VALUE("Accept", "application/json");
+ m_szUrl.Format("api.skype.com/users/%s/profile", (hContact == 0) ? "self" : ppro->getId(hContact).c_str());
+ pUserInfo = (void *)hContact;
+
+ AddHeader("X-Skypetoken", ppro->m_szApiToken);
+ AddHeader("Accept", "application/json");
}
};
diff --git a/protocols/SkypeWeb/src/requests/search.h b/protocols/SkypeWeb/src/requests/search.h index 275c5df80f..3df9f2fda2 100644 --- a/protocols/SkypeWeb/src/requests/search.h +++ b/protocols/SkypeWeb/src/requests/search.h @@ -18,23 +18,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _SKYPE_REQUEST_SEARCH_H_
#define _SKYPE_REQUEST_SEARCH_H_
-class GetSearchRequest : public HttpRequest
+struct GetSearchRequest : public AsyncHttpRequest
{
-public:
GetSearchRequest(const char *string, CSkypeProto *ppro) :
- HttpRequest(REQUEST_GET, "skypegraph.skype.com/search/v1.1/namesearch/swx/")
+ AsyncHttpRequest(REQUEST_GET, "skypegraph.skype.com/search/v1.1/namesearch/swx/", &CSkypeProto::OnSearch)
{
+ this << CHAR_PARAM("requestid", "skype.com-1.48.78-00000000-0000-0000-0000-000000000000")
+ << CHAR_PARAM("locale", "en-US") << CHAR_PARAM("searchstring", string);
- wchar_t locale[LOCALE_NAME_MAX_LENGTH] = L"en-US";
- //LCIDToLocaleName(Langpack_GetDefaultLocale(), locale, _countof(locale), 0); //FIXME: xp support
-
- Url
- << CHAR_VALUE("requestid", "skype.com-1.48.78-00000000-0000-0000-0000-000000000000")
- << CHAR_VALUE("locale", T2Utf(locale))
- << CHAR_VALUE("searchstring", string);
- Headers
- << CHAR_VALUE("Accept", "application/json")
- << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken);
+ AddHeader("Accept", "application/json");
+ AddHeader("X-Skypetoken", ppro->m_szApiToken);
}
};
diff --git a/protocols/SkypeWeb/src/requests/status.h b/protocols/SkypeWeb/src/requests/status.h index 459b30471f..5b68b46ddd 100644 --- a/protocols/SkypeWeb/src/requests/status.h +++ b/protocols/SkypeWeb/src/requests/status.h @@ -18,54 +18,45 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _SKYPE_REQUEST_STATUS_H_
#define _SKYPE_REQUEST_STATUS_H_
-class GetStatusRequest : public HttpRequest
+struct GetStatusRequest : public AsyncHttpRequest
{
-public:
GetStatusRequest(CSkypeProto *ppro) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/contacts/ALL/presenceDocs/messagingService", ppro->m_szServer)
+ AsyncHttpRequest(REQUEST_GET, "/users/ME/contacts/ALL/presenceDocs/messagingService", &CSkypeProto::OnReceiveStatus)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get())
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddRegistrationToken(ppro);
}
};
-class SetStatusRequest : public HttpRequest
+struct SetStatusRequest : public AsyncHttpRequest
{
-public:
SetStatusRequest(const char *status, CSkypeProto *ppro) :
- HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/presenceDocs/messagingService", ppro->m_szServer)
+ AsyncHttpRequest(REQUEST_PUT, "/users/ME/presenceDocs/messagingService", &CSkypeProto::OnStatusChanged)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get())
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddRegistrationToken(ppro);
JSONNode node(JSON_NODE);
node << JSONNode("status", status);
-
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
-class SetStatusMsgRequest : public HttpRequest
+struct SetStatusMsgRequest : public AsyncHttpRequest
{
-public:
SetStatusMsgRequest(const char *status, CSkypeProto *ppro) :
- HttpRequest(REQUEST_POST, "api.skype.com/users/self/profile/partial")
+ AsyncHttpRequest(REQUEST_POST, "api.skype.com/users/self/profile/partial")
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken)
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("X-Skypetoken", ppro->m_szApiToken);
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
JSONNode node, payload;
payload.set_name("payload");
node << (payload << JSONNode("mood", status));
-
-
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
diff --git a/protocols/SkypeWeb/src/requests/subscriptions.h b/protocols/SkypeWeb/src/requests/subscriptions.h index c10c572b38..610373f52b 100644 --- a/protocols/SkypeWeb/src/requests/subscriptions.h +++ b/protocols/SkypeWeb/src/requests/subscriptions.h @@ -18,58 +18,52 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _SKYPE_REQUEST_SUBSCIPTIONS_H_
#define _SKYPE_REQUEST_SUBSCIPTIONS_H_
-class CreateSubscriptionsRequest : public HttpRequest
+struct CreateSubscriptionsRequest : public AsyncHttpRequest
{
-public:
CreateSubscriptionsRequest(CSkypeProto *ppro) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions", ppro->m_szServer)
+ AsyncHttpRequest(REQUEST_POST, "/users/ME/endpoints/SELF/subscriptions", &CSkypeProto::OnSubscriptionsCreated)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get())
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddRegistrationToken(ppro);
JSONNode interestedResources(JSON_ARRAY); interestedResources.set_name("interestedResources");
- interestedResources
+ interestedResources
<< JSONNode("", "/v1/users/ME/conversations/ALL/properties")
<< JSONNode("", "/v1/users/ME/conversations/ALL/messages")
<< JSONNode("", "/v1/users/ME/contacts/ALL")
<< JSONNode("", "/v1/threads/ALL");
JSONNode node;
- node
+ node
<< JSONNode("channelType", "httpLongPoll")
<< JSONNode("template", "raw")
<< interestedResources;
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
-class CreateContactsSubscriptionRequest : public HttpRequest
+struct CreateContactsSubscriptionRequest : public AsyncHttpRequest
{
-public:
CreateContactsSubscriptionRequest(const LIST<char> &skypenames, CSkypeProto *ppro) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/contacts", ppro->m_szServer)
+ AsyncHttpRequest(REQUEST_POST, "/users/ME/contacts")
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken.get());
-
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddRegistrationToken(ppro);
JSONNode node;
JSONNode contacts(JSON_ARRAY); contacts.set_name("contacts");
- for (auto &it : skypenames)
- {
+ for (auto &it : skypenames) {
JSONNode contact;
contact << JSONNode("id", CMStringA(::FORMAT, "8:%s", it));
contacts << contact;
}
node << contacts;
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
diff --git a/protocols/SkypeWeb/src/requests/trouter.h b/protocols/SkypeWeb/src/requests/trouter.h index 85cfeea5f0..baeba2a861 100644 --- a/protocols/SkypeWeb/src/requests/trouter.h +++ b/protocols/SkypeWeb/src/requests/trouter.h @@ -17,53 +17,48 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #pragma once
-class CreateTrouterRequest : public HttpRequest
+struct CreateTrouterRequest : public AsyncHttpRequest
{
-public:
CreateTrouterRequest() :
- HttpRequest(REQUEST_POST, "go.trouter.io/v2/a")
+ AsyncHttpRequest(REQUEST_POST, "go.trouter.io/v2/a", &CSkypeProto::OnCreateTrouter)
{
- Headers << CHAR_VALUE("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml");
+ AddHeader("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml");
}
};
-class CreateTrouterPoliciesRequest : public HttpRequest
+struct CreateTrouterPoliciesRequest : public AsyncHttpRequest
{
-public:
CreateTrouterPoliciesRequest(CSkypeProto *ppro, const char *sr) :
- HttpRequest(REQUEST_POST, FORMAT, "prod.tpc.skype.com/v1/policies")
+ AsyncHttpRequest(REQUEST_POST, "prod.tpc.skype.com/v1/policies", &CSkypeProto::OnTrouterPoliciesCreated)
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken);
+ AddHeader("Accept", "application/json, text/javascript");
+ AddHeader("Content-Type", "application/json; charset=UTF-8");
+ AddHeader("X-Skypetoken", ppro->m_szApiToken);
JSONNode node;
node << JSONNode("sr", sr);
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
-class RegisterTrouterRequest : public HttpRequest
+struct RegisterTrouterRequest : public AsyncHttpRequest
{
-public:
RegisterTrouterRequest(CSkypeProto *ppro, const char *trouterUrl, const char *id) :
- HttpRequest(REQUEST_POST, "prod.registrar.skype.com/v2/registrations")
+ AsyncHttpRequest(REQUEST_POST, "prod.registrar.skype.com/v2/registrations")
{
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml")
- << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken);
+ AddHeader("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml");
+ AddHeader("X-Skypetoken", ppro->m_szApiToken);
JSONNode clientDescription; clientDescription.set_name("clientDescription");
- clientDescription
+ clientDescription
<< JSONNode("aesKey", "")
<< JSONNode("languageId", "en-US")
<< JSONNode("platform", "SWX")
<< JSONNode("templateKey", "SkypeWeb_1.0");
JSONNode TRouter;
- TRouter
+ TRouter
<< JSONNode("context", "")
<< JSONNode("path", trouterUrl)
<< JSONNode("ttl", 3600);
@@ -75,82 +70,77 @@ public: transports << TRouters;
JSONNode node;
- node
+ node
<< JSONNode("registrationId", id)
<< JSONNode("nodeId", "")
<< clientDescription
<< transports;
- Body << VALUE(node.write().c_str());
+ m_szParam = node.write().c_str();
}
};
-class HealthTrouterRequest : public HttpRequest
+struct HealthTrouterRequest : public AsyncHttpRequest
{
-public:
HealthTrouterRequest(const char *ccid) :
- HttpRequest(REQUEST_POST, "go.trouter.io/v2/h")
+ AsyncHttpRequest(REQUEST_POST, "go.trouter.io/v2/h", &CSkypeProto::OnHealth)
{
- Url
- << CHAR_VALUE("ccid", ccid);
+ this << CHAR_PARAM("ccid", ccid);
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml");
+ AddHeader("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml");
}
};
-class GetTrouterRequest : public HttpRequest
+struct GetTrouterRequest : public AsyncHttpRequest
{
-public:
GetTrouterRequest(const std::string &socketio, const std::string &sr, const std::string &st, const std::string &se, const std::string &sig,
const std::string &instance, const std::string &ccid) :
- HttpRequest(REQUEST_GET, FORMAT, "%ssocket.io/1/", socketio.c_str())
+ AsyncHttpRequest(REQUEST_GET, 0, &CSkypeProto::OnGetTrouter)
{
- Url
- << CHAR_VALUE("sr", sr.c_str())
- << CHAR_VALUE("issuer", "edf")
- << CHAR_VALUE("sp", "connect")
- << CHAR_VALUE("st", st.c_str())
- << CHAR_VALUE("se", se.c_str())
- << CHAR_VALUE("sig", sig.c_str())
- << CHAR_VALUE("r", instance.c_str())
- << CHAR_VALUE("v", "v2")
- << INT_VALUE("p", 443)
- << CHAR_VALUE("ccid", ccid.c_str())
- << CHAR_VALUE("tc", mir_urlEncode("{\"cv\":\"2014.8.26\",\"hr\":\"\",\"ua\":\"Miranda_NG\",\"v\":\"\"}"))
- << LONG_VALUE("t", time(NULL) * 1000);
-
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml");
+ m_szUrl.Format("%ssocket.io/1/", socketio.c_str());
+
+ this << CHAR_PARAM("sr", sr.c_str())
+ << CHAR_PARAM("issuer", "edf")
+ << CHAR_PARAM("sp", "connect")
+ << CHAR_PARAM("st", st.c_str())
+ << CHAR_PARAM("se", se.c_str())
+ << CHAR_PARAM("sig", sig.c_str())
+ << CHAR_PARAM("r", instance.c_str())
+ << CHAR_PARAM("v", "v2")
+ << INT_PARAM("p", 443)
+ << CHAR_PARAM("ccid", ccid.c_str())
+ << CHAR_PARAM("tc", mir_urlEncode("{\"cv\":\"2014.8.26\",\"hr\":\"\",\"ua\":\"Miranda_NG\",\"v\":\"\"}"))
+ << INT_PARAM("t", time(NULL) * 1000);
+
+ AddHeader("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml");
}
};
-class TrouterPollRequest : public HttpRequest
+struct TrouterPollRequest : public AsyncHttpRequest
{
-public:
TrouterPollRequest(const std::string &socketio, const std::string &sr, const std::string &st, const std::string &se, const std::string &sig,
const std::string &instance, const std::string &ccid, const std::string &sessId) :
- HttpRequest(REQUEST_GET, FORMAT, "%ssocket.io/1/xhr-polling/%s", socketio.c_str(), sessId.c_str())
+ AsyncHttpRequest(REQUEST_GET)
{
+ m_szUrl.Format("%ssocket.io/1/xhr-polling/%s", socketio.c_str(), sessId.c_str());
+
timeout = 60000;
flags |= NLHRF_PERSISTENT;
- Url
- << CHAR_VALUE("sr", sr.c_str())
- << CHAR_VALUE("issuer", "edf")
- << CHAR_VALUE("sp", "connect")
- << CHAR_VALUE("st", st.c_str())
- << CHAR_VALUE("se", se.c_str())
- << CHAR_VALUE("sig", sig.c_str())
- << CHAR_VALUE("r", instance.c_str())
- << CHAR_VALUE("v", "v2")
- << INT_VALUE("p", 443)
- << CHAR_VALUE("ccid", ccid.c_str())
- << CHAR_VALUE("tc", mir_urlEncode("{\"cv\":\"2014.8.26\",\"hr\":\"\",\"ua\":\"Miranda_NG\",\"v\":\"\"}"))
- << LONG_VALUE("t", time(NULL) * 1000);
-
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml");
+ this
+ << CHAR_PARAM("sr", sr.c_str())
+ << CHAR_PARAM("issuer", "edf")
+ << CHAR_PARAM("sp", "connect")
+ << CHAR_PARAM("st", st.c_str())
+ << CHAR_PARAM("se", se.c_str())
+ << CHAR_PARAM("sig", sig.c_str())
+ << CHAR_PARAM("r", instance.c_str())
+ << CHAR_PARAM("v", "v2")
+ << INT_PARAM("p", 443)
+ << CHAR_PARAM("ccid", ccid.c_str())
+ << CHAR_PARAM("tc", mir_urlEncode("{\"cv\":\"2014.8.26\",\"hr\":\"\",\"ua\":\"Miranda_NG\",\"v\":\"\"}"))
+ << INT_PARAM("t", time(NULL) * 1000);
+
+ AddHeader("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml");
}
};
-
|