diff options
Diffstat (limited to 'protocols/SkypeWeb/src/requests')
-rw-r--r-- | protocols/SkypeWeb/src/requests/avatars.h | 7 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/capabilities.h | 29 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/chatrooms.h | 104 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/contacts.h | 56 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/endpoint.h | 11 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/files.h | 10 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/history.h | 33 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/login.h | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/messages.h | 63 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/oauth.h | 9 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/poll.h | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/profile.h | 5 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/search.h | 5 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/status.h | 30 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/subscriptions.h | 38 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/trouter.h | 146 |
16 files changed, 133 insertions, 421 deletions
diff --git a/protocols/SkypeWeb/src/requests/avatars.h b/protocols/SkypeWeb/src/requests/avatars.h index 918bbf37c4..4f35f226ee 100644 --- a/protocols/SkypeWeb/src/requests/avatars.h +++ b/protocols/SkypeWeb/src/requests/avatars.h @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct GetAvatarRequest : public AsyncHttpRequest
{
GetAvatarRequest(const char *url, MCONTACT hContact) :
- AsyncHttpRequest(REQUEST_GET, url, &CSkypeProto::OnReceiveAvatar)
+ AsyncHttpRequest(REQUEST_GET, HOST_OTHER, url, &CSkypeProto::OnReceiveAvatar)
{
flags |= NLHRF_REDIRECT;
pUserInfo = (void *)hContact;
@@ -31,11 +31,10 @@ struct GetAvatarRequest : public AsyncHttpRequest struct SetAvatarRequest : public AsyncHttpRequest
{
SetAvatarRequest(const PBYTE data, size_t dataSize, const char *szMime, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_PUT, 0, &CSkypeProto::OnSentAvatar)
+ AsyncHttpRequest(REQUEST_PUT, HOST_API, 0, &CSkypeProto::OnSentAvatar)
{
- m_szUrl.Format("api.skype.com/users/%s/profile/avatar", ppro->m_szSkypename.MakeLower().c_str());
+ m_szUrl.AppendFormat("/users/%s/profile/avatar", ppro->m_szSkypename.MakeLower().c_str());
- AddHeader("X-Skypetoken", ppro->m_szApiToken);
AddHeader("Content-Type", szMime);
pData = (char *)mir_alloc(dataSize);
diff --git a/protocols/SkypeWeb/src/requests/capabilities.h b/protocols/SkypeWeb/src/requests/capabilities.h index ce53922869..c733bf633f 100644 --- a/protocols/SkypeWeb/src/requests/capabilities.h +++ b/protocols/SkypeWeb/src/requests/capabilities.h @@ -21,34 +21,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct SendCapabilitiesRequest : public AsyncHttpRequest
{
SendCapabilitiesRequest(const char *hostname, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_PUT, 0, &CSkypeProto::OnCapabilitiesSended)
+ AsyncHttpRequest(REQUEST_PUT, HOST_DEFAULT, 0, &CSkypeProto::OnCapabilitiesSended)
{
- 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);
+ m_szUrl.AppendFormat("/users/ME/endpoints/%s/presenceDocs/messagingService", mir_urlEncode(ppro->m_szId).c_str());
JSONNode privateInfo; privateInfo.set_name("privateInfo");
- privateInfo << JSONNode("epname", hostname);
+ privateInfo << CHAR_PARAM("epname", hostname);
JSONNode publicInfo; publicInfo.set_name("publicInfo");
- publicInfo
- << JSONNode("capabilities", "Audio|Video")
- << JSONNode("typ", 125)
- << JSONNode("skypeNameVersion", "Miranda NG Skype")
- << JSONNode("nodeInfo", "xx")
- << JSONNode("version", g_szMirVer);
+ publicInfo << CHAR_PARAM("capabilities", "Audio|Video") << INT_PARAM("typ", 125)
+ << CHAR_PARAM("skypeNameVersion", "Miranda NG Skype") << CHAR_PARAM("nodeInfo", "xx") << CHAR_PARAM("version", g_szMirVer);
JSONNode node;
- node
- << JSONNode("id", "messagingService")
- << JSONNode("type", "EndpointPresenceDoc")
- << JSONNode("selfLink", "uri")
- << privateInfo
- << publicInfo;
+ node << CHAR_PARAM("id", "messagingService") << CHAR_PARAM("type", "EndpointPresenceDoc")
+ << CHAR_PARAM("selfLink", "uri") << privateInfo << publicInfo;
m_szParam = node.write().c_str();
}
};
-#endif //_SKYPE_REQUEST_CAPS_H_
\ No newline at end of file +
+#endif //_SKYPE_REQUEST_CAPS_H_
diff --git a/protocols/SkypeWeb/src/requests/chatrooms.h b/protocols/SkypeWeb/src/requests/chatrooms.h index e0dd27c739..aa39995f01 100644 --- a/protocols/SkypeWeb/src/requests/chatrooms.h +++ b/protocols/SkypeWeb/src/requests/chatrooms.h @@ -20,57 +20,39 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct LoadChatsRequest : public AsyncHttpRequest
{
- LoadChatsRequest(CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_GET, "/users/ME/conversations", &CSkypeProto::OnLoadChats)
+ LoadChatsRequest() :
+ AsyncHttpRequest(REQUEST_GET, HOST_DEFAULT, "/users/ME/conversations", &CSkypeProto::OnLoadChats)
{
- this << INT_PARAM("startTime", 0) << INT_PARAM("pageSize", 100)
+ 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");
}
};
struct SendChatMessageRequest : public AsyncHttpRequest
{
- SendChatMessageRequest(const char *to, time_t timestamp, const char *message, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_POST)
+ SendChatMessageRequest(const char *to, time_t timestamp, const char *message) :
+ AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT)
{
- 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");
+ m_szUrl.AppendFormat("/users/ME/conversations/19:%s/messages", to);
JSONNode node;
- node
- << JSONNode("clientmessageid", CMStringA(::FORMAT, "%llu000", (ULONGLONG)timestamp))
- << JSONNode("messagetype", "RichText")
- << JSONNode("contenttype", "text")
- << JSONNode("content", message);
+ node << CHAR_PARAM("clientmessageid", CMStringA(::FORMAT, "%llu000", (ULONGLONG)timestamp))
+ << CHAR_PARAM("messagetype", "RichText") << CHAR_PARAM("contenttype", "text") << CHAR_PARAM("content", message);
m_szParam = node.write().c_str();
}
};
struct SendChatActionRequest : public AsyncHttpRequest
{
- SendChatActionRequest(const char *to, time_t timestamp, const char *message, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_POST)
+ SendChatActionRequest(const char *to, time_t timestamp, const char *message) :
+ AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT)
{
- 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);
+ m_szUrl.AppendFormat("/users/ME/conversations/19:%s/messages", to);
JSONNode node(JSON_NODE);
- node
- << JSONNode("clientmessageid", CMStringA(::FORMAT, "%llu000", (ULONGLONG)timestamp))
- << JSONNode("messagetype", "RichText")
- << JSONNode("contenttype", "text")
- << JSONNode("content", message)
- << JSONNode("skypeemoteoffset", 4);
+ node << CHAR_PARAM("clientmessageid", CMStringA(::FORMAT, "%llu000", (ULONGLONG)timestamp))
+ << CHAR_PARAM("messagetype", "RichText") << CHAR_PARAM("contenttype", "text")
+ << CHAR_PARAM("content", message) << INT_PARAM("skypeemoteoffset", 4);
m_szParam = node.write().c_str();
}
};
@@ -78,22 +60,16 @@ struct SendChatActionRequest : public AsyncHttpRequest struct CreateChatroomRequest : public AsyncHttpRequest
{
CreateChatroomRequest(const LIST<char> &skypenames, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_POST, "/threads")
+ AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/threads")
{
//{"members":[{"id":"8:user3","role":"User"},{"id":"8:user2","role":"User"},{"id":"8:user1","role":"Admin"}]}
- 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");
- for (auto &it : skypenames)
- {
+ for (auto &it : skypenames) {
JSONNode member;
- member
- << JSONNode("id", CMStringA(::FORMAT, "8:%s", it).GetBuffer())
- << JSONNode("role", !mir_strcmpi(it, ppro->m_szSkypename) ? "Admin" : "User");
+ member << CHAR_PARAM("id", CMStringA(::FORMAT, "8:%s", it).GetBuffer())
+ << CHAR_PARAM("role", !mir_strcmpi(it, ppro->m_szSkypename) ? "Admin" : "User");
members << member;
}
node << members;
@@ -103,63 +79,47 @@ struct CreateChatroomRequest : public AsyncHttpRequest struct GetChatInfoRequest : public AsyncHttpRequest
{
- GetChatInfoRequest(const char *chatId, const CMStringW topic, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_GET, 0, &CSkypeProto::OnGetChatInfo)
+ GetChatInfoRequest(const char *chatId, const CMStringW topic) :
+ AsyncHttpRequest(REQUEST_GET, HOST_DEFAULT, 0, &CSkypeProto::OnGetChatInfo)
{
- m_szUrl.Format("/threads/%s%s", ppro->m_szServer, strstr(chatId, "19:") == chatId ? "" : "19:", chatId);
+ m_szUrl.AppendFormat("/threads/%s%s", strstr(chatId, "19:") == chatId ? "" : "19:", chatId);
pUserInfo = topic.Detach();
this << CHAR_PARAM("view", "msnp24Equivalent");
-
- AddHeader("Accept", "application/json, text/javascript");
- AddHeader("Content-Type", "application/json; charset=UTF-8");
- AddRegistrationToken(ppro);
}
};
struct InviteUserToChatRequest : public AsyncHttpRequest
{
- InviteUserToChatRequest(const char *chatId, const char *skypename, const char* role, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_PUT)
+ InviteUserToChatRequest(const char *chatId, const char *skypename, const char *role) :
+ AsyncHttpRequest(REQUEST_PUT, HOST_DEFAULT)
{
- 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);
+ m_szUrl.AppendFormat("/threads/19:%s/members/8:%s", chatId, skypename);
JSONNode node;
- node << JSONNode("role", role);
+ node << CHAR_PARAM("role", role);
m_szParam = node.write().c_str();
}
};
struct KickUserRequest : public AsyncHttpRequest
{
- KickUserRequest(const char *chatId, const char *skypename, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_DELETE)
+ KickUserRequest(const char *chatId, const char *skypename) :
+ AsyncHttpRequest(REQUEST_DELETE, HOST_DEFAULT)
{
- 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);
+ m_szUrl.AppendFormat("/threads/19:%s/members/8:%s", chatId, skypename);
}
};
struct SetChatPropertiesRequest : public AsyncHttpRequest
{
- SetChatPropertiesRequest(const char *chatId, const char *propname, const char *value, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_PUT)
+ SetChatPropertiesRequest(const char *chatId, const char *propname, const char *value) :
+ AsyncHttpRequest(REQUEST_PUT, HOST_DEFAULT)
{
- 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);
+ m_szUrl.AppendFormat("/threads/19:%s/properties?name=%s", chatId, propname);
JSONNode node;
- node << JSONNode(propname, value);
+ node << CHAR_PARAM(propname, value);
m_szParam = node.write().c_str();
}
};
diff --git a/protocols/SkypeWeb/src/requests/contacts.h b/protocols/SkypeWeb/src/requests/contacts.h index 57866eb18c..ea22bb49a0 100644 --- a/protocols/SkypeWeb/src/requests/contacts.h +++ b/protocols/SkypeWeb/src/requests/contacts.h @@ -21,9 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct GetContactListRequest : public AsyncHttpRequest
{
GetContactListRequest(CSkypeProto *ppro, const char *filter) :
- AsyncHttpRequest(REQUEST_GET, 0, &CSkypeProto::LoadContactList)
+ AsyncHttpRequest(REQUEST_GET, HOST_CONTACTS, 0, &CSkypeProto::LoadContactList)
{
- m_szUrl.Format("contacts.skype.com/contacts/v1/users/%s/contacts", ppro->m_szSkypename.MakeLower().GetBuffer());
+ m_szUrl.AppendFormat("/contacts/v1/users/%s/contacts", ppro->m_szSkypename.MakeLower().GetBuffer());
// ?filter=contacts[?(@.type="skype" or @.type="msn")]
if (filter != NULL)
@@ -35,63 +35,55 @@ struct GetContactListRequest : public AsyncHttpRequest struct GetContactsAuthRequest : public AsyncHttpRequest
{
- GetContactsAuthRequest(CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_GET, "contacts.skype.com/contacts/v2/users/SELF/invites", &CSkypeProto::LoadContactsAuth)
+ GetContactsAuthRequest() :
+ AsyncHttpRequest(REQUEST_GET, HOST_CONTACTS, "/contacts/v2/users/SELF/invites", &CSkypeProto::LoadContactsAuth)
{
- AddHeader("X-Skypetoken", ppro->m_szApiToken);
AddHeader("Accept", "application/json");
}
};
struct AddContactRequest : public AsyncHttpRequest
{
- AddContactRequest(CSkypeProto *ppro, const char *who, const char *greeting = "") :
- AsyncHttpRequest(REQUEST_PUT, "contacts.skype.com/contacts/v2/users/SELF/contacts")
+ AddContactRequest(const char *who, const char *greeting = "") :
+ AsyncHttpRequest(REQUEST_PUT, HOST_CONTACTS, "/contacts/v2/users/SELF/contacts")
{
- 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())
- << JSONNode("greeting", greeting);
-
+ node << CHAR_PARAM("mri", CMStringA(::FORMAT, "8:", who).GetString()) << CHAR_PARAM("greeting", greeting);
m_szParam = node.write().c_str();
}
};
struct DeleteContactRequest : public AsyncHttpRequest
{
- DeleteContactRequest(CSkypeProto *ppro, const char *who) :
- AsyncHttpRequest(REQUEST_DELETE)
+ DeleteContactRequest(const char *who) :
+ AsyncHttpRequest(REQUEST_DELETE, HOST_CONTACTS)
{
- m_szUrl.Format("contacts.skype.com/contacts/v2/users/SELF/contacts/8:%s", who);
+ m_szUrl.AppendFormat("/contacts/v2/users/SELF/contacts/8:%s", who);
- AddHeader("X-Skypetoken", ppro->m_szApiToken);
AddHeader("Accept", "application/json");
}
};
struct AuthAcceptRequest : public AsyncHttpRequest
{
- AuthAcceptRequest(CSkypeProto *ppro, const char *who) :
- AsyncHttpRequest(REQUEST_PUT)
+ AuthAcceptRequest(const char *who) :
+ AsyncHttpRequest(REQUEST_PUT, HOST_CONTACTS)
{
- m_szUrl.Format("contacts.skype.com/contacts/v2/users/SELF/invites/8:%s/accept", who);
+ m_szUrl.AppendFormat("/contacts/v2/users/SELF/invites/8:%s/accept", who);
- AddHeader("X-Skypetoken", ppro->m_szApiToken);
AddHeader("Accept", "application/json");
}
};
struct AuthDeclineRequest : public AsyncHttpRequest
{
- AuthDeclineRequest(CSkypeProto *ppro, const char *who) :
- AsyncHttpRequest(REQUEST_PUT)
+ AuthDeclineRequest(const char *who) :
+ AsyncHttpRequest(REQUEST_PUT, HOST_CONTACTS)
{
- m_szUrl.Format("contacts.skype.com/contacts/v2/users/SELF/invites/8:%s/decline", who);
+ m_szUrl.AppendFormat("/contacts/v2/users/SELF/invites/8:%s/decline", who);
- AddHeader("X-Skypetoken", ppro->m_szApiToken);
AddHeader("Accept", "application/json");
}
};
@@ -99,32 +91,28 @@ struct AuthDeclineRequest : public AsyncHttpRequest struct BlockContactRequest : public AsyncHttpRequest
{
BlockContactRequest(CSkypeProto *ppro, MCONTACT hContact) :
- AsyncHttpRequest(REQUEST_PUT, 0, &CSkypeProto::OnBlockContact)
+ AsyncHttpRequest(REQUEST_PUT, HOST_CONTACTS, 0, &CSkypeProto::OnBlockContact)
{
- m_szUrl.Format("contacts.skype.com/contacts/v2/users/SELF/contacts/blocklist/8:%s", ppro->getId(hContact).c_str());
+ m_szUrl.AppendFormat("/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;
- AddHeader("X-Skypetoken", ppro->m_szApiToken);
AddHeader("Accept", "application/json");
- AddHeader("Content-type", "application/x-www-form-urlencoded");
}
};
struct UnblockContactRequest : public AsyncHttpRequest
{
UnblockContactRequest(CSkypeProto *ppro, MCONTACT hContact) :
- AsyncHttpRequest(REQUEST_DELETE, 0, &CSkypeProto::OnUnblockContact)
+ AsyncHttpRequest(REQUEST_DELETE, HOST_CONTACTS, 0, &CSkypeProto::OnUnblockContact)
{
- m_szUrl.Format("contacts.skype.com/contacts/v2/users/SELF/contacts/blocklist/8:%s", ppro->getId(hContact).c_str());
+ m_szUrl.AppendFormat("/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);
+ // TODO: user ip address
+ this << CHAR_PARAM("reporterIp", "123.123.123.123") << CHAR_PARAM("uiVersion", g_szMirVer);
}
};
diff --git a/protocols/SkypeWeb/src/requests/endpoint.h b/protocols/SkypeWeb/src/requests/endpoint.h index 07baa3c409..135ca178dc 100644 --- a/protocols/SkypeWeb/src/requests/endpoint.h +++ b/protocols/SkypeWeb/src/requests/endpoint.h @@ -21,12 +21,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct CreateEndpointRequest : public AsyncHttpRequest
{
CreateEndpointRequest(CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_POST, "/users/ME/endpoints", &CSkypeProto::OnEndpointCreated)
+ AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/endpoints", &CSkypeProto::OnEndpointCreated)
{
m_szParam = "{}";
- AddHeader("Accept", "application/json, text/javascript");
- AddHeader("Content-Type", "application/json; charset=UTF-8");
AddHeader("Authentication", CMStringA(FORMAT, "skypetoken=%s", ppro->m_szApiToken.get()));
}
};
@@ -34,12 +32,9 @@ struct CreateEndpointRequest : public AsyncHttpRequest struct DeleteEndpointRequest : public AsyncHttpRequest
{
DeleteEndpointRequest(CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_DELETE)
+ AsyncHttpRequest(REQUEST_DELETE, HOST_DEFAULT)
{
- m_szUrl.Format("/users/ME/endpoints/%s", mir_urlEncode(ppro->m_szId).c_str());
-
- AddHeader("Accept", "application/json, text/javascript");
- AddRegistrationToken(ppro);
+ m_szUrl.AppendFormat("/users/ME/endpoints/%s", mir_urlEncode(ppro->m_szId).c_str());
}
};
diff --git a/protocols/SkypeWeb/src/requests/files.h b/protocols/SkypeWeb/src/requests/files.h index 11123e3f03..6afd64d7f5 100644 --- a/protocols/SkypeWeb/src/requests/files.h +++ b/protocols/SkypeWeb/src/requests/files.h @@ -3,7 +3,7 @@ struct ASMObjectCreateRequest : public AsyncHttpRequest { ASMObjectCreateRequest(CSkypeProto *ppro, CFileUploadParam *fup) : - AsyncHttpRequest(REQUEST_POST, "api.asm.skype.com/v1/objects", &CSkypeProto::OnASMObjectCreated) + AsyncHttpRequest(REQUEST_POST, HOST_OTHER, "https://api.asm.skype.com/v1/objects", &CSkypeProto::OnASMObjectCreated) { flags &= (~NLHRF_DUMPASTEXT); pUserInfo = fup; @@ -19,9 +19,9 @@ struct ASMObjectCreateRequest : public AsyncHttpRequest JSONNode node, jPermissions, jPermission(JSON_ARRAY); jPermissions.set_name("permissions"); jPermission.set_name(szContact.c_str()); - jPermission << JSONNode("", "read"); + jPermission << CHAR_PARAM("", "read"); jPermissions << jPermission; - node << JSONNode("type", "sharing/file") << JSONNode("filename", szFileName) << jPermissions; + node << CHAR_PARAM("type", "sharing/file") << CHAR_PARAM("filename", szFileName) << jPermissions; m_szParam = node.write().c_str(); } }; @@ -29,9 +29,9 @@ struct ASMObjectCreateRequest : public AsyncHttpRequest struct ASMObjectUploadRequest : public AsyncHttpRequest { ASMObjectUploadRequest(CSkypeProto *ppro, const char *szObject, const PBYTE data, const size_t size, CFileUploadParam *fup) : - AsyncHttpRequest(REQUEST_PUT, 0, &CSkypeProto::OnASMObjectUploaded) + AsyncHttpRequest(REQUEST_PUT, HOST_OTHER, 0, &CSkypeProto::OnASMObjectUploaded) { - m_szUrl.Format("api.asm.skype.com/v1/objects/%s/content/original", szObject); + m_szUrl.AppendFormat("https://api.asm.skype.com/v1/objects/%s/content/original", szObject); pUserInfo = fup; AddHeader("Authorization", CMStringA(FORMAT, "skype_token %s", ppro->m_szApiToken.get())); diff --git a/protocols/SkypeWeb/src/requests/history.h b/protocols/SkypeWeb/src/requests/history.h index ed65be8b2d..4c2394ed0c 100644 --- a/protocols/SkypeWeb/src/requests/history.h +++ b/protocols/SkypeWeb/src/requests/history.h @@ -14,55 +14,42 @@ 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_HISTORY_H_
#define _SKYPE_REQUEST_HISTORY_H_
struct SyncHistoryFirstRequest : public AsyncHttpRequest
{
- SyncHistoryFirstRequest(int pageSize, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_GET, "/users/ME/conversations", &CSkypeProto::OnSyncHistory)
+ SyncHistoryFirstRequest(int pageSize) :
+ AsyncHttpRequest(REQUEST_GET, HOST_DEFAULT, "/users/ME/conversations", &CSkypeProto::OnSyncHistory)
{
this << INT_PARAM("startTime", 0) << INT_PARAM("pageSize", pageSize)
<< CHAR_PARAM("view", "msnp24Equivalent") << CHAR_PARAM("targetType", "Passport|Skype|Lync");
-
- AddHeader("Accept", "application/json, text/javascript");
- AddHeader("Content-Type", "application/json; charset = UTF-8");
- AddRegistrationToken(ppro);
}
- SyncHistoryFirstRequest(const char *url, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_GET, url, &CSkypeProto::OnSyncHistory)
+ SyncHistoryFirstRequest(const char *url) :
+ AsyncHttpRequest(REQUEST_GET, HOST_DEFAULT, url, &CSkypeProto::OnSyncHistory)
{
- AddHeader("Accept", "application/json, text/javascript");
- AddHeader("Content-Type", "application/json; charset = UTF-8");
- AddRegistrationToken(ppro);
}
};
struct GetHistoryRequest : public AsyncHttpRequest
{
- GetHistoryRequest(const char *username, int pageSize, bool isChat, LONGLONG timestamp, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_GET, 0, &CSkypeProto::OnGetServerHistory)
+ GetHistoryRequest(const char *username, int pageSize, bool isChat, LONGLONG timestamp) :
+ AsyncHttpRequest(REQUEST_GET, HOST_DEFAULT, 0, &CSkypeProto::OnGetServerHistory)
{
- m_szUrl.Format("/users/ME/conversations/%d:%s/messages", isChat ? 19 : 8, mir_urlEncode(username).c_str());
+ m_szUrl.AppendFormat("/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");
-
- AddHeader("Accept", "application/json, text/javascript");
- AddHeader("Content-Type", "application/json; charset = UTF-8");
- AddRegistrationToken(ppro);
}
};
struct GetHistoryOnUrlRequest : public AsyncHttpRequest
{
- GetHistoryOnUrlRequest(const char *url, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_GET, url, &CSkypeProto::OnGetServerHistory)
+ GetHistoryOnUrlRequest(const char *url) :
+ AsyncHttpRequest(REQUEST_GET, HOST_DEFAULT, url, &CSkypeProto::OnGetServerHistory)
{
- 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 bb5e5d00ad..da293572e5 100644 --- a/protocols/SkypeWeb/src/requests/login.h +++ b/protocols/SkypeWeb/src/requests/login.h @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct LoginOAuthRequest : public AsyncHttpRequest
{
LoginOAuthRequest(CMStringA username, const char *password) :
- AsyncHttpRequest(REQUEST_POST, "api.skype.com/login/skypetoken", &CSkypeProto::OnLoginOAuth)
+ AsyncHttpRequest(REQUEST_POST, HOST_API, "/login/skypetoken", &CSkypeProto::OnLoginOAuth)
{
username.MakeLower();
CMStringA hashStr(::FORMAT, "%s\nskyper\n%s", username.c_str(), password);
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h index fdcb8d8ae6..817d459046 100644 --- a/protocols/SkypeWeb/src/requests/messages.h +++ b/protocols/SkypeWeb/src/requests/messages.h @@ -26,20 +26,14 @@ struct SendMessageParam struct SendMessageRequest : public AsyncHttpRequest
{
- SendMessageRequest(const char *username, time_t timestamp, const char *message, CSkypeProto *ppro, const char *MessageType = nullptr) :
- AsyncHttpRequest(REQUEST_POST, 0, &CSkypeProto::OnMessageSent)
+ SendMessageRequest(const char *username, time_t timestamp, const char *message, const char *MessageType = nullptr) :
+ AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, 0, &CSkypeProto::OnMessageSent)
{
- 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);
+ m_szUrl.AppendFormat("/users/ME/conversations/8:%s/messages", username);
JSONNode node;
- node << JSONNode("clientmessageid", CMStringA(::FORMAT, "%llu", (ULONGLONG)timestamp))
- << JSONNode("messagetype", MessageType ? MessageType : "Text")
- << JSONNode("contenttype", "text")
- << JSONNode("content", message);
+ node << INT64_PARAM("clientmessageid", timestamp) << CHAR_PARAM("messagetype", MessageType ? MessageType : "Text")
+ << CHAR_PARAM("contenttype", "text") << CHAR_PARAM("content", message);
m_szParam = node.write().c_str();
}
};
@@ -47,66 +41,45 @@ struct SendMessageRequest : public AsyncHttpRequest struct SendActionRequest : public AsyncHttpRequest
{
SendActionRequest(const char *username, time_t timestamp, const char *message, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_POST, 0, &CSkypeProto::OnMessageSent)
+ AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, 0, &CSkypeProto::OnMessageSent)
{
- 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);
+ m_szUrl.AppendFormat("/users/ME/conversations/8:%s/messages", username);
CMStringA content;
content.AppendFormat("%s %s", ppro->m_szSkypename.c_str(), message);
JSONNode node;
- node
- << JSONNode("clientmessageid", CMStringA(::FORMAT, "%llu", (ULONGLONG)timestamp))
- << JSONNode("messagetype", "RichText")
- << JSONNode("contenttype", "text")
- << JSONNode("content", content)
- << JSONNode("skypeemoteoffset", ppro->m_szSkypename.GetLength() + 1);
+ node << INT64_PARAM("clientmessageid", timestamp) << CHAR_PARAM("messagetype", "RichText") << CHAR_PARAM("contenttype", "text")
+ << CHAR_PARAM("content", content) << INT_PARAM("skypeemoteoffset", ppro->m_szSkypename.GetLength() + 1);
m_szParam = node.write().c_str();
}
};
struct SendTypingRequest : public AsyncHttpRequest
{
- SendTypingRequest(const char *username, int iState, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_POST)
+ SendTypingRequest(const char *username, int iState) :
+ AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT)
{
- 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);
+ m_szUrl.AppendFormat("/users/ME/conversations/8:%s/messages", mir_urlEncode(username).c_str());
const char *state = (iState == PROTOTYPE_SELFTYPING_ON) ? "Control/Typing" : "Control/ClearTyping";
JSONNode node;
- node
- << JSONNode("clientmessageid", (long)time(NULL))
- << JSONNode("messagetype", state)
- << JSONNode("contenttype", "text")
- << JSONNode("content", "");
+ node << INT_PARAM("clientmessageid", (long)time(NULL)) << CHAR_PARAM("messagetype", state)
+ << CHAR_PARAM("contenttype", "text") << CHAR_PARAM("content", "");
m_szParam = node.write().c_str();
}
};
struct MarkMessageReadRequest : public AsyncHttpRequest
{
- MarkMessageReadRequest(const char *username, LONGLONG /*msgId*/, LONGLONG msgTimestamp, bool isChat, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_PUT)
+ MarkMessageReadRequest(const char *username, LONGLONG /*msgId*/, LONGLONG msgTimestamp, bool isChat) :
+ AsyncHttpRequest(REQUEST_PUT, HOST_DEFAULT)
{
- 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"
+ m_szUrl.AppendFormat("/users/ME/conversations/%d:%s/properties?name=consumptionhorizon", !isChat ? 8 : 19, username);
JSONNode node(JSON_NODE);
- node << JSONNode("consumptionhorizon", CMStringA(::FORMAT, "%lld000;%lld000;%lld000", msgTimestamp, time(NULL), msgTimestamp));
+ node << CHAR_PARAM("consumptionhorizon", CMStringA(::FORMAT, "%lld000;%lld000;%lld000", msgTimestamp, time(NULL), msgTimestamp));
m_szParam = node.write().c_str();
}
};
diff --git a/protocols/SkypeWeb/src/requests/oauth.h b/protocols/SkypeWeb/src/requests/oauth.h index 3f23ea50e3..f5bf8afd1b 100644 --- a/protocols/SkypeWeb/src/requests/oauth.h +++ b/protocols/SkypeWeb/src/requests/oauth.h @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct OAuthRequest : public AsyncHttpRequest { OAuthRequest() : - AsyncHttpRequest(REQUEST_GET, "login.live.com/login.srf", &CSkypeProto::OnOAuthStart) + AsyncHttpRequest(REQUEST_GET, HOST_OTHER, "https://login.live.com/login.srf", &CSkypeProto::OnOAuthStart) { flags |= NLHRF_REDIRECT; @@ -31,7 +31,7 @@ struct OAuthRequest : public AsyncHttpRequest } OAuthRequest(const char *login, const char *password, const char *cookies, const char *ppft) : - AsyncHttpRequest(REQUEST_POST, "login.live.com/ppsecure/post.srf", &CSkypeProto::OnOAuthAuthorize) + AsyncHttpRequest(REQUEST_POST, HOST_OTHER, "https://login.live.com/ppsecure/post.srf", &CSkypeProto::OnOAuthAuthorize) { 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") @@ -39,17 +39,14 @@ struct OAuthRequest : public AsyncHttpRequest m_szUrl.AppendFormat("?%s", m_szParam.c_str()); m_szParam.Empty(); - AddHeader("Content-Type", "application/x-www-form-urlencoded"); AddHeader("Cookie", cookies); this << CHAR_PARAM("login", login) << CHAR_PARAM("passwd", password) << CHAR_PARAM("PPFT", ppft); } OAuthRequest(const char *t) : - AsyncHttpRequest(REQUEST_POST, "login.skype.com/login/microsoft", &CSkypeProto::OnOAuthEnd) + AsyncHttpRequest(REQUEST_POST, HOST_LOGIN, "/login/microsoft", &CSkypeProto::OnOAuthEnd) { - AddHeader("Content-Type", "application/x-www-form-urlencoded"); - 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 d74030dbd4..89aaef587b 100644 --- a/protocols/SkypeWeb/src/requests/poll.h +++ b/protocols/SkypeWeb/src/requests/poll.h @@ -21,19 +21,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct PollRequest : public AsyncHttpRequest
{
PollRequest(CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_POST, "/users/ME/endpoints/SELF/subscriptions/0/poll")
+ AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/endpoints/SELF/subscriptions/0/poll")
{
timeout = 120000;
if (ppro->m_iPollingId != -1)
- this << INT_PARAM("ackId", ppro->m_iPollingId);
+ m_szUrl.AppendFormat("?ackId=%d", ppro->m_iPollingId);
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 5f872b7fe8..802449e910 100644 --- a/protocols/SkypeWeb/src/requests/profile.h +++ b/protocols/SkypeWeb/src/requests/profile.h @@ -21,12 +21,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct GetProfileRequest : public AsyncHttpRequest
{
GetProfileRequest(CSkypeProto *ppro, MCONTACT hContact) :
- AsyncHttpRequest(REQUEST_GET, 0, &CSkypeProto::LoadProfile)
+ AsyncHttpRequest(REQUEST_GET, HOST_API, 0, &CSkypeProto::LoadProfile)
{
- m_szUrl.Format("api.skype.com/users/%s/profile", (hContact == 0) ? "self" : ppro->getId(hContact).c_str());
+ m_szUrl.AppendFormat("/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 3df9f2fda2..369e19651d 100644 --- a/protocols/SkypeWeb/src/requests/search.h +++ b/protocols/SkypeWeb/src/requests/search.h @@ -20,14 +20,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct GetSearchRequest : public AsyncHttpRequest
{
- GetSearchRequest(const char *string, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_GET, "skypegraph.skype.com/search/v1.1/namesearch/swx/", &CSkypeProto::OnSearch)
+ GetSearchRequest(const char *string) :
+ AsyncHttpRequest(REQUEST_GET, HOST_GRAPH, "/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);
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 5b68b46ddd..166b2e7bbe 100644 --- a/protocols/SkypeWeb/src/requests/status.h +++ b/protocols/SkypeWeb/src/requests/status.h @@ -20,42 +20,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct GetStatusRequest : public AsyncHttpRequest
{
- GetStatusRequest(CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_GET, "/users/ME/contacts/ALL/presenceDocs/messagingService", &CSkypeProto::OnReceiveStatus)
- {
- AddHeader("Accept", "application/json, text/javascript");
- AddHeader("Content-Type", "application/json; charset=UTF-8");
- AddRegistrationToken(ppro);
- }
+ GetStatusRequest() :
+ AsyncHttpRequest(REQUEST_GET, HOST_DEFAULT, "/users/ME/contacts/ALL/presenceDocs/messagingService", &CSkypeProto::OnReceiveStatus)
+ {}
};
struct SetStatusRequest : public AsyncHttpRequest
{
- SetStatusRequest(const char *status, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_PUT, "/users/ME/presenceDocs/messagingService", &CSkypeProto::OnStatusChanged)
+ SetStatusRequest(const char *status) :
+ AsyncHttpRequest(REQUEST_PUT, HOST_DEFAULT, "/users/ME/presenceDocs/messagingService", &CSkypeProto::OnStatusChanged)
{
- AddHeader("Accept", "application/json, text/javascript");
- AddHeader("Content-Type", "application/json; charset=UTF-8");
- AddRegistrationToken(ppro);
-
JSONNode node(JSON_NODE);
- node << JSONNode("status", status);
+ node << CHAR_PARAM("status", status);
m_szParam = node.write().c_str();
}
};
struct SetStatusMsgRequest : public AsyncHttpRequest
{
- SetStatusMsgRequest(const char *status, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_POST, "api.skype.com/users/self/profile/partial")
+ SetStatusMsgRequest(const char *status) :
+ AsyncHttpRequest(REQUEST_POST, HOST_API, "/users/self/profile/partial")
{
- 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));
+ node << (payload << CHAR_PARAM("mood", status));
m_szParam = node.write().c_str();
}
};
diff --git a/protocols/SkypeWeb/src/requests/subscriptions.h b/protocols/SkypeWeb/src/requests/subscriptions.h index 610373f52b..1f8717e91d 100644 --- a/protocols/SkypeWeb/src/requests/subscriptions.h +++ b/protocols/SkypeWeb/src/requests/subscriptions.h @@ -20,49 +20,35 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct CreateSubscriptionsRequest : public AsyncHttpRequest
{
- CreateSubscriptionsRequest(CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_POST, "/users/ME/endpoints/SELF/subscriptions", &CSkypeProto::OnSubscriptionsCreated)
+ CreateSubscriptionsRequest() :
+ AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/endpoints/SELF/subscriptions", &CSkypeProto::OnSubscriptionsCreated)
{
- 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
- << JSONNode("", "/v1/users/ME/conversations/ALL/properties")
- << JSONNode("", "/v1/users/ME/conversations/ALL/messages")
- << JSONNode("", "/v1/users/ME/contacts/ALL")
- << JSONNode("", "/v1/threads/ALL");
+ interestedResources << CHAR_PARAM("", "/v1/users/ME/conversations/ALL/properties")
+ << CHAR_PARAM("", "/v1/users/ME/conversations/ALL/messages")
+ << CHAR_PARAM("", "/v1/users/ME/contacts/ALL")
+ << CHAR_PARAM("", "/v1/threads/ALL");
JSONNode node;
- node
- << JSONNode("channelType", "httpLongPoll")
- << JSONNode("template", "raw")
- << interestedResources;
-
+ node << CHAR_PARAM("channelType", "httpLongPoll") << CHAR_PARAM("template", "raw") << interestedResources;
m_szParam = node.write().c_str();
}
};
struct CreateContactsSubscriptionRequest : public AsyncHttpRequest
{
- CreateContactsSubscriptionRequest(const LIST<char> &skypenames, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_POST, "/users/ME/contacts")
+ CreateContactsSubscriptionRequest(const LIST<char> &skypenames) :
+ AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/contacts")
{
- 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) {
JSONNode contact;
- contact << JSONNode("id", CMStringA(::FORMAT, "8:%s", it));
+ contact << CHAR_PARAM("id", CMStringA(::FORMAT, "8:%s", it));
contacts << contact;
}
- node << contacts;
+ JSONNode node;
+ node << contacts;
m_szParam = node.write().c_str();
}
};
diff --git a/protocols/SkypeWeb/src/requests/trouter.h b/protocols/SkypeWeb/src/requests/trouter.h deleted file mode 100644 index baeba2a861..0000000000 --- a/protocols/SkypeWeb/src/requests/trouter.h +++ /dev/null @@ -1,146 +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/>.
-*/
-
-#pragma once
-
-struct CreateTrouterRequest : public AsyncHttpRequest
-{
- CreateTrouterRequest() :
- AsyncHttpRequest(REQUEST_POST, "go.trouter.io/v2/a", &CSkypeProto::OnCreateTrouter)
- {
- AddHeader("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml");
- }
-};
-
-struct CreateTrouterPoliciesRequest : public AsyncHttpRequest
-{
- CreateTrouterPoliciesRequest(CSkypeProto *ppro, const char *sr) :
- AsyncHttpRequest(REQUEST_POST, "prod.tpc.skype.com/v1/policies", &CSkypeProto::OnTrouterPoliciesCreated)
- {
- 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);
-
- m_szParam = node.write().c_str();
- }
-};
-
-struct RegisterTrouterRequest : public AsyncHttpRequest
-{
- RegisterTrouterRequest(CSkypeProto *ppro, const char *trouterUrl, const char *id) :
- AsyncHttpRequest(REQUEST_POST, "prod.registrar.skype.com/v2/registrations")
- {
- 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
- << JSONNode("aesKey", "")
- << JSONNode("languageId", "en-US")
- << JSONNode("platform", "SWX")
- << JSONNode("templateKey", "SkypeWeb_1.0");
-
- JSONNode TRouter;
- TRouter
- << JSONNode("context", "")
- << JSONNode("path", trouterUrl)
- << JSONNode("ttl", 3600);
-
- JSONNode TRouters(JSON_ARRAY); TRouters.set_name("TROUTER");
- TRouters << TRouter;
-
- JSONNode transports; transports.set_name("transports");
- transports << TRouters;
-
- JSONNode node;
- node
- << JSONNode("registrationId", id)
- << JSONNode("nodeId", "")
- << clientDescription
- << transports;
-
- m_szParam = node.write().c_str();
- }
-};
-
-struct HealthTrouterRequest : public AsyncHttpRequest
-{
- HealthTrouterRequest(const char *ccid) :
- AsyncHttpRequest(REQUEST_POST, "go.trouter.io/v2/h", &CSkypeProto::OnHealth)
- {
- this << CHAR_PARAM("ccid", ccid);
-
- AddHeader("Accept", "application/json, text/javascript, text/html,application/xhtml+xml, application/xml");
-
- }
-};
-
-struct GetTrouterRequest : public AsyncHttpRequest
-{
- 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) :
- AsyncHttpRequest(REQUEST_GET, 0, &CSkypeProto::OnGetTrouter)
- {
- 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");
- }
-};
-
-struct TrouterPollRequest : public AsyncHttpRequest
-{
- 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) :
- AsyncHttpRequest(REQUEST_GET)
- {
- m_szUrl.Format("%ssocket.io/1/xhr-polling/%s", socketio.c_str(), sessId.c_str());
-
- timeout = 60000;
- flags |= NLHRF_PERSISTENT;
- 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");
- }
-};
|