summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/requests
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/SkypeWeb/src/requests')
-rw-r--r--protocols/SkypeWeb/src/requests/avatars.h6
-rw-r--r--protocols/SkypeWeb/src/requests/capabilities.h6
-rw-r--r--protocols/SkypeWeb/src/requests/chatrooms.h50
-rw-r--r--protocols/SkypeWeb/src/requests/contacts.h56
-rw-r--r--protocols/SkypeWeb/src/requests/endpoint.h12
-rw-r--r--protocols/SkypeWeb/src/requests/history.h22
-rw-r--r--protocols/SkypeWeb/src/requests/messages.h30
-rw-r--r--protocols/SkypeWeb/src/requests/poll.h6
-rw-r--r--protocols/SkypeWeb/src/requests/profile.h4
-rw-r--r--protocols/SkypeWeb/src/requests/search.h4
-rw-r--r--protocols/SkypeWeb/src/requests/status.h6
-rw-r--r--protocols/SkypeWeb/src/requests/subscriptions.h12
-rw-r--r--protocols/SkypeWeb/src/requests/trouter.h8
13 files changed, 105 insertions, 117 deletions
diff --git a/protocols/SkypeWeb/src/requests/avatars.h b/protocols/SkypeWeb/src/requests/avatars.h
index dd8f970dd4..23be77bee1 100644
--- a/protocols/SkypeWeb/src/requests/avatars.h
+++ b/protocols/SkypeWeb/src/requests/avatars.h
@@ -30,11 +30,11 @@ public:
class SetAvatarRequest : public HttpRequest
{
public:
- SetAvatarRequest(const char *token, const char *skypename, const char *data, size_t dataSize) :
- HttpRequest(REQUEST_PUT, FORMAT, "api.skype.com/users/%s/profile/avatar", skypename)
+ SetAvatarRequest(const char *data, size_t dataSize, LoginInfo &li) :
+ HttpRequest(REQUEST_PUT, FORMAT, "api.skype.com/users/%s/profile/avatar", li.szSkypename)
{
Headers
- << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("X-Skypetoken", li.api.szToken)
<< CHAR_VALUE("Content-Type", "image/jpeg");
pData = (char*)mir_alloc(dataSize);
diff --git a/protocols/SkypeWeb/src/requests/capabilities.h b/protocols/SkypeWeb/src/requests/capabilities.h
index bfdc6a5a60..dc5d18939a 100644
--- a/protocols/SkypeWeb/src/requests/capabilities.h
+++ b/protocols/SkypeWeb/src/requests/capabilities.h
@@ -21,13 +21,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class SendCapabilitiesRequest : public HttpRequest
{
public:
- SendCapabilitiesRequest(const char *regToken, const char *endpointID, const char *hostname, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/endpoints/%s/presenceDocs/messagingService", server, ptrA(mir_urlEncode(endpointID)))
+ SendCapabilitiesRequest(const char *hostname, LoginInfo &li) :
+ HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/endpoints/%s/presenceDocs/messagingService", li.endpoint.szServer, ptrA(mir_urlEncode(li.endpoint.szId)))
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken);
JSONNode privateInfo; privateInfo.set_name("privateInfo");
privateInfo << JSONNode("epname", hostname);
diff --git a/protocols/SkypeWeb/src/requests/chatrooms.h b/protocols/SkypeWeb/src/requests/chatrooms.h
index 3a5b28c111..6e7f53ee84 100644
--- a/protocols/SkypeWeb/src/requests/chatrooms.h
+++ b/protocols/SkypeWeb/src/requests/chatrooms.h
@@ -21,8 +21,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class LoadChatsRequest : public HttpRequest
{
public:
- LoadChatsRequest(const char *regToken, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations", server)
+ LoadChatsRequest(LoginInfo &li) :
+ HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations", li.endpoint.szServer)
{
Url
<< INT_VALUE("startTime", 0)
@@ -32,7 +32,7 @@ public:
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken)
<< CHAR_VALUE("Content-Type", "application/json; charset = UTF-8");
}
};
@@ -40,12 +40,12 @@ public:
class SendChatMessageRequest : public HttpRequest
{
public:
- SendChatMessageRequest(const char *regToken, const char *username, time_t timestamp, const char *message, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/19:%s/messages", server, username)
+ SendChatMessageRequest(const char *to, time_t timestamp, const char *message, LoginInfo &li) :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/19:%s/messages", li.endpoint.szServer, to)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken)
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
JSONNode node;
@@ -62,12 +62,12 @@ public:
class SendChatActionRequest : public HttpRequest
{
public:
- SendChatActionRequest(const char *regToken, const char *id, time_t timestamp, const char *message, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/19:%s/messages", server, id)
+ SendChatActionRequest(const char *to, time_t timestamp, const char *message, LoginInfo &li) :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/19:%s/messages", li.endpoint.szServer, to)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken)
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
JSONNode node(JSON_NODE);
@@ -85,15 +85,15 @@ public:
class CreateChatroomRequest : public HttpRequest
{
public:
- CreateChatroomRequest(const char *regToken, const LIST<char> &skypenames, const char *selfname, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/threads", server)
+ CreateChatroomRequest(const LIST<char> &skypenames, LoginInfo &li) :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/threads", li.endpoint.szServer)
{
//{"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", regToken);
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken);
JSONNode node;
JSONNode members(JSON_ARRAY); members.set_name("members");
@@ -103,7 +103,7 @@ public:
JSONNode member;
member
<< JSONNode("id", CMStringA(::FORMAT, "8:%s", skypenames[i]).GetBuffer())
- << JSONNode("role", !mir_strcmpi(skypenames[i], selfname) ? "Admin" : "User");
+ << JSONNode("role", !mir_strcmpi(skypenames[i], li.szSkypename) ? "Admin" : "User");
members << member;
}
node << members;
@@ -115,28 +115,28 @@ public:
class GetChatInfoRequest : public HttpRequest
{
public:
- GetChatInfoRequest(const char *regToken, const char *chatId, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/v1/threads/19:%s", server, chatId)
+ GetChatInfoRequest(const char *chatId, LoginInfo &li) :
+ HttpRequest(REQUEST_GET, FORMAT, "%s/v1/threads/19:%s", li.endpoint.szServer, chatId)
{
Url << CHAR_VALUE("view", "msnp24Equivalent");
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken);
}
};
class InviteUserToChatRequest : public HttpRequest
{
public:
- InviteUserToChatRequest(const char *regToken, const char *chatId, const char *skypename, const char* role, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/threads/19:%s/members/8:%s", server, chatId, skypename)
+ InviteUserToChatRequest(const char *chatId, const char *skypename, const char* role, LoginInfo &li) :
+ HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/threads/19:%s/members/8:%s", li.endpoint.szServer, chatId, skypename)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken);
JSONNode node;
@@ -149,26 +149,26 @@ public:
class KickUserRequest : public HttpRequest
{
public:
- KickUserRequest(const char *regToken, const char *chatId, const char *skypename, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_DELETE, FORMAT, "%s/v1/threads/19:%s/members/8:%s", server, chatId, skypename)
+ KickUserRequest(const char *chatId, const char *skypename, LoginInfo &li) :
+ HttpRequest(REQUEST_DELETE, FORMAT, "%s/v1/threads/19:%s/members/8:%s", li.endpoint.szServer, chatId, skypename)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken);
}
};
class SetChatPropertiesRequest : public HttpRequest
{
public:
- SetChatPropertiesRequest(const char *regToken, const char *chatId, const char *propname, const char *value, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/threads/19:%s/properties?name=%s", server, chatId, propname)
+ SetChatPropertiesRequest(const char *chatId, const char *propname, const char *value, LoginInfo &li) :
+ HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/threads/19:%s/properties?name=%s", li.endpoint.szServer, chatId, propname)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken);
JSONNode node;
node << JSONNode(propname, value);
diff --git a/protocols/SkypeWeb/src/requests/contacts.h b/protocols/SkypeWeb/src/requests/contacts.h
index 613b9962ab..affd0debda 100644
--- a/protocols/SkypeWeb/src/requests/contacts.h
+++ b/protocols/SkypeWeb/src/requests/contacts.h
@@ -21,17 +21,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class GetContactListRequest : public HttpRequest
{
public:
- GetContactListRequest(const char *token, const char *skypename = "self") :
+ /*GetContactListRequest(LoginInfo &li, const char *skypename = "self") :
HttpRequest(REQUEST_GET, FORMAT, "api.skype.com/users/%s/contacts", skypename)
{
Url << CHAR_VALUE("hideDetails", "true");
Headers
- << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("X-Skypetoken", li.api.szToken)
<< CHAR_VALUE("Accept", "application/json");
- }
- GetContactListRequest(const char *token, const char *skypename, const char *filter) :
- HttpRequest(REQUEST_GET, FORMAT, "contacts.skype.com/contacts/v1/users/%s/contacts", CMStringA(skypename).MakeLower().GetBuffer())
+ }*/
+ GetContactListRequest(LoginInfo &li, const char *filter) :
+ HttpRequest(REQUEST_GET, FORMAT, "contacts.skype.com/contacts/v1/users/%s/contacts", CMStringA(li.szSkypename).MakeLower().GetBuffer())
{
if (filter != NULL)
{
@@ -40,18 +40,18 @@ public:
}
Headers
- << CHAR_VALUE("X-SkypeToken", token);
+ << CHAR_VALUE("X-SkypeToken", li.api.szToken);
}
};
class GetContactsInfoRequest : public HttpRequest
{
public:
- GetContactsInfoRequest(const char *token, const LIST<char> &skypenames, const char *skypename = "self") :
+ GetContactsInfoRequest(LoginInfo &li, const LIST<char> &skypenames, const char *skypename = "self") :
HttpRequest(REQUEST_POST, FORMAT, "api.skype.com/users/%s/contacts/profiles", skypename)
{
Headers
- << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("X-Skypetoken", li.api.szToken)
<< CHAR_VALUE("Accept", "application/json");
for (int i = 0; i < skypenames.getCount(); i++)
@@ -59,26 +59,14 @@ public:
}
};
-class GetContactStatusRequest : public HttpRequest
-{
-public:
- GetContactStatusRequest(const char *regToken, const char *skypename, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/contacts/8:%s/presenceDocs/messagingService", server, skypename)
- {
- Headers
- << CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
- }
-};
-
class GetContactsAuthRequest : public HttpRequest
{
public:
- GetContactsAuthRequest(const char *token, const char *skypename = "self") :
+ GetContactsAuthRequest(LoginInfo &li, const char *skypename = "self") :
HttpRequest(REQUEST_GET, FORMAT, "api.skype.com/users/%s/contacts/auth-request", skypename)
{
Headers
- << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("X-Skypetoken", li.api.szToken)
<< CHAR_VALUE("Accept", "application/json");
}
};
@@ -86,11 +74,11 @@ public:
class AddContactRequest : public HttpRequest
{
public:
- AddContactRequest(const char *token, const char *who, const char *greeting = "", const char *skypename = "self") :
+ AddContactRequest(LoginInfo &li, const char *who, const char *greeting = "", const char *skypename = "self") :
HttpRequest(REQUEST_PUT, FORMAT, "api.skype.com/users/%s/contacts/auth-request/%s", skypename, who)
{
Headers
- << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("X-Skypetoken", li.api.szToken)
<< CHAR_VALUE("Accept", "application/json")
<< CHAR_VALUE("Content-type", "application/x-www-form-urlencoded");
@@ -101,11 +89,11 @@ public:
class DeleteContactRequest : public HttpRequest
{
public:
- DeleteContactRequest(const char *token, const char *who, const char *skypename = "self") :
+ DeleteContactRequest(LoginInfo &li, const char *who, const char *skypename = "self") :
HttpRequest(REQUEST_DELETE, FORMAT, "api.skype.com/users/%s/contacts/%s", skypename, who)
{
Headers
- << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("X-Skypetoken", li.api.szToken)
<< CHAR_VALUE("Accept", "application/json")
<< CHAR_VALUE("Content-type", "application/x-www-form-urlencoded");
}
@@ -114,11 +102,11 @@ public:
class AuthAcceptRequest : public HttpRequest
{
public:
- AuthAcceptRequest(const char *token, const char *who, const char *skypename = "self") :
+ AuthAcceptRequest(LoginInfo &li, const char *who, const char *skypename = "self") :
HttpRequest(REQUEST_PUT, FORMAT, "api.skype.com/users/%s/contacts/auth-request/%s/accept", skypename, who)
{
Headers
- << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("X-Skypetoken", li.api.szToken)
<< CHAR_VALUE("Accept", "application/json");
}
};
@@ -126,11 +114,11 @@ public:
class AuthDeclineRequest : public HttpRequest
{
public:
- AuthDeclineRequest(const char *token, const char *who, const char *skypename = "self") :
+ AuthDeclineRequest(LoginInfo &li, const char *who, const char *skypename = "self") :
HttpRequest(REQUEST_PUT, FORMAT, "api.skype.com/users/%s/contacts/auth-request/%s/decline", skypename, who)
{
Headers
- << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("X-Skypetoken", li.api.szToken)
<< CHAR_VALUE("Accept", "application/json");
}
};
@@ -138,11 +126,11 @@ public:
class BlockContactRequest : public HttpRequest
{
public:
- BlockContactRequest(const char *token, const char *who, const char *skypename = "self") :
+ BlockContactRequest(LoginInfo &li, const char *who, const char *skypename = "self") :
HttpRequest(REQUEST_PUT, FORMAT, "api.skype.com/users/%s/contacts/%s/block", skypename, who)
{
Headers
- << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("X-Skypetoken", li.api.szToken)
<< CHAR_VALUE("Accept", "application/json")
<< CHAR_VALUE("Content-type", "application/x-www-form-urlencoded");
@@ -155,11 +143,11 @@ public:
class UnblockContactRequest : public HttpRequest
{
public:
- UnblockContactRequest(const char *token, const char *who, const char *skypename = "self") :
+ UnblockContactRequest(LoginInfo &li, const char *who, const char *skypename = "self") :
HttpRequest(REQUEST_PUT, FORMAT, "api.skype.com/users/%s/contacts/%s/unblock", skypename, who)
{
Headers
- << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("X-Skypetoken", li.api.szToken)
<< CHAR_VALUE("Accept", "application/json")
<< CHAR_VALUE("Content-type", "application/x-www-form-urlencoded");
diff --git a/protocols/SkypeWeb/src/requests/endpoint.h b/protocols/SkypeWeb/src/requests/endpoint.h
index bec924d03a..1305030ae4 100644
--- a/protocols/SkypeWeb/src/requests/endpoint.h
+++ b/protocols/SkypeWeb/src/requests/endpoint.h
@@ -21,13 +21,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class CreateEndpointRequest : public HttpRequest
{
public:
- CreateEndpointRequest(const char *token, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints", server)
+ CreateEndpointRequest(LoginInfo &li) :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints", li.endpoint.szServer)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << FORMAT_VALUE("Authentication", "skypetoken=%s", token);
+ << FORMAT_VALUE("Authentication", "skypetoken=%s", li.api.szToken);
Body << VALUE("{}");
}
@@ -36,12 +36,12 @@ public:
class DeleteEndpointRequest : public HttpRequest
{
public:
- DeleteEndpointRequest(const char *regToken, const char *EndpointId, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_DELETE, FORMAT, "%s/v1/users/ME/endpoints/%s", server, ptrA(mir_urlEncode(EndpointId)))
+ DeleteEndpointRequest(LoginInfo &li) :
+ HttpRequest(REQUEST_DELETE, FORMAT, "%s/v1/users/ME/endpoints/%s", li.endpoint.szServer, ptrA(mir_urlEncode(li.endpoint.szId)))
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken);
}
};
diff --git a/protocols/SkypeWeb/src/requests/history.h b/protocols/SkypeWeb/src/requests/history.h
index 2fb05c824c..7581c094ef 100644
--- a/protocols/SkypeWeb/src/requests/history.h
+++ b/protocols/SkypeWeb/src/requests/history.h
@@ -20,8 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class SyncHistoryFirstRequest : public HttpRequest
{
public:
- SyncHistoryFirstRequest(const char *regToken, int pageSize = 100, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations", server)
+ SyncHistoryFirstRequest(int pageSize, LoginInfo &li) :
+ HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations", li.endpoint.szServer)
{
Url
<< INT_VALUE("startTime", 0)
@@ -31,17 +31,17 @@ public:
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken)
<< CHAR_VALUE("Content-Type", "application/json; charset = UTF-8");
}
- SyncHistoryFirstRequest(const char *url, const char *regToken) :
+ SyncHistoryFirstRequest(const char *url, LoginInfo &li) :
HttpRequest(REQUEST_GET, url)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken)
<< CHAR_VALUE("Content-Type", "application/json; charset = UTF-8");
}
};
@@ -49,18 +49,18 @@ public:
class GetHistoryRequest : public HttpRequest
{
public:
- GetHistoryRequest(const char *regToken, const char *username, int pageSize = 100, bool isChat = false, LONGLONG timestamp = 0, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations/%s:%s/messages", server, isChat ? "19" : "8", ptrA(mir_urlEncode(username)))
+ GetHistoryRequest(const char *username, int pageSize, bool isChat, LONGLONG timestamp, LoginInfo &li) :
+ HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations/%d:%s/messages", li.endpoint.szServer, isChat ? 19 : 8, ptrA(mir_urlEncode(username)))
{
Url
- << INT_VALUE("startTime", timestamp)
+ << LONG_VALUE("startTime", timestamp)
<< INT_VALUE("pageSize", pageSize)
<< CHAR_VALUE("view", "msnp24Equivalent")
<< CHAR_VALUE("targetType", "Passport|Skype|Lync|Thread");
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken)
<< CHAR_VALUE("Content-Type", "application/json; charset = UTF-8");
}
};
@@ -68,12 +68,12 @@ public:
class GetHistoryOnUrlRequest : public HttpRequest
{
public:
- GetHistoryOnUrlRequest(const char *url, const char *regToken) :
+ GetHistoryOnUrlRequest(const char *url, LoginInfo &li) :
HttpRequest(REQUEST_GET, url)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken)
<< CHAR_VALUE("Content-Type", "application/json; charset = UTF-8");
}
};
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h
index 451f89cb23..9750be58ad 100644
--- a/protocols/SkypeWeb/src/requests/messages.h
+++ b/protocols/SkypeWeb/src/requests/messages.h
@@ -21,18 +21,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class SendMessageRequest : public HttpRequest
{
public:
- SendMessageRequest(const char *regToken, const char *username, time_t timestamp, const char *message, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", server, username)
+ SendMessageRequest(const char *username, time_t timestamp, const char *message, LoginInfo &li) :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", li.endpoint.szServer, username)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken)
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
JSONNode node;
node
<< JSONNode("clientmessageid", (long)timestamp)
- << JSONNode("messagetype", "RichText")
+ << JSONNode("messagetype", "Text")
<< JSONNode("contenttype", "text")
<< JSONNode("content", message);
@@ -43,16 +43,16 @@ public:
class SendActionRequest : public HttpRequest
{
public:
- SendActionRequest(const char *regToken, const char *username, const char *selfusername, time_t timestamp, const char *message, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", server, username)
+ SendActionRequest(const char *username, time_t timestamp, const char *message, LoginInfo &li) :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", li.endpoint.szServer, username)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken)
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
CMStringA content;
- content.AppendFormat("%s %s", selfusername, message);
+ content.AppendFormat("%s %s", li.szSkypename, message);
JSONNode node;
node
@@ -60,7 +60,7 @@ public:
<< JSONNode("messagetype", "RichText")
<< JSONNode("contenttype", "text")
<< JSONNode("content", content)
- << JSONNode("skypeemoteoffset", (int)(mir_strlen(selfusername) + 1));
+ << JSONNode("skypeemoteoffset", (int)(mir_strlen(li.szSkypename) + 1));
Body << VALUE(node.write().c_str());
}
@@ -69,12 +69,12 @@ public:
class SendTypingRequest : public HttpRequest
{
public:
- SendTypingRequest(const char *regToken, const char *username, int iState, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", server, ptrA(mir_urlEncode(username)))
+ SendTypingRequest(const char *username, int iState, LoginInfo &li) :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", li.endpoint.szServer, ptrA(mir_urlEncode(username)))
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken)
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
const char *state = (iState == PROTOTYPE_SELFTYPING_ON) ? "Control/Typing" : "Control/ClearTyping";
@@ -93,12 +93,12 @@ public:
class MarkMessageReadRequest : public HttpRequest
{
public:
- MarkMessageReadRequest(const char *username, const char *regToken, LONGLONG /*msgId*/ = 0, LONGLONG msgTimestamp = 0, bool isChat = false, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/conversations/%s:%s/properties?name=consumptionhorizon", server, !isChat ? "8" : "19", username)
+ MarkMessageReadRequest(const char *username, LONGLONG /*msgId*/, LONGLONG msgTimestamp, bool isChat, LoginInfo &li) :
+ HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/conversations/%d:%s/properties?name=consumptionhorizon", li.endpoint.szServer, !isChat ? 8 : 19, username)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken)
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
//"lastReadMessageTimestamp;modificationTime;lastReadMessageId"
diff --git a/protocols/SkypeWeb/src/requests/poll.h b/protocols/SkypeWeb/src/requests/poll.h
index 8efecb21d0..39e7cbd6c6 100644
--- a/protocols/SkypeWeb/src/requests/poll.h
+++ b/protocols/SkypeWeb/src/requests/poll.h
@@ -21,15 +21,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class PollRequest : public HttpRequest
{
public:
- PollRequest(const char *regToken, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions/0/poll", server)
+ PollRequest(LoginInfo &li) :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions/0/poll", li.endpoint.szServer)
{
timeout = 60000;
flags |= NLHRF_PERSISTENT;
Headers
<< CHAR_VALUE("Connection", "keep-alive")
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken);
}
};
#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 0a8c119a44..95e36dde10 100644
--- a/protocols/SkypeWeb/src/requests/profile.h
+++ b/protocols/SkypeWeb/src/requests/profile.h
@@ -21,11 +21,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class GetProfileRequest : public HttpRequest
{
public:
- GetProfileRequest(const char *token, const char *skypename = "self") :
+ GetProfileRequest(LoginInfo &li, const char *skypename = "self") :
HttpRequest(REQUEST_GET, FORMAT, "api.skype.com/users/%s/profile", skypename)
{
Headers
- << CHAR_VALUE("X-Skypetoken", token)
+ << CHAR_VALUE("X-Skypetoken", li.api.szToken)
<< CHAR_VALUE("Accept", "application/json");
}
};
diff --git a/protocols/SkypeWeb/src/requests/search.h b/protocols/SkypeWeb/src/requests/search.h
index 6a6f87d9e4..23cbf48233 100644
--- a/protocols/SkypeWeb/src/requests/search.h
+++ b/protocols/SkypeWeb/src/requests/search.h
@@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class GetSearchRequest : public HttpRequest
{
public:
- GetSearchRequest(const char *token, const char *string) :
+ GetSearchRequest(const char *string, LoginInfo &li) :
HttpRequest(REQUEST_GET, "api.skype.com/search/users/any")
{
Url
@@ -29,7 +29,7 @@ public:
Headers
<< CHAR_VALUE("Accept", "application/json")
<< CHAR_VALUE("Connection", "keep-alive")
- << CHAR_VALUE("X-Skypetoken", token);
+ << CHAR_VALUE("X-Skypetoken", li.api.szToken);
}
};
diff --git a/protocols/SkypeWeb/src/requests/status.h b/protocols/SkypeWeb/src/requests/status.h
index b34f4fbce9..7c5c5e68b9 100644
--- a/protocols/SkypeWeb/src/requests/status.h
+++ b/protocols/SkypeWeb/src/requests/status.h
@@ -21,12 +21,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class SetStatusRequest : public HttpRequest
{
public:
- SetStatusRequest(const char *regToken, const char *status, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/presenceDocs/messagingService", server)
+ SetStatusRequest(const char *status, LoginInfo &li) :
+ HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/presenceDocs/messagingService", li.endpoint.szServer)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken)
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
JSONNode node(JSON_NODE);
diff --git a/protocols/SkypeWeb/src/requests/subscriptions.h b/protocols/SkypeWeb/src/requests/subscriptions.h
index 403f7368e9..35b3eae39b 100644
--- a/protocols/SkypeWeb/src/requests/subscriptions.h
+++ b/protocols/SkypeWeb/src/requests/subscriptions.h
@@ -21,12 +21,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class CreateSubscriptionsRequest : public HttpRequest
{
public:
- CreateSubscriptionsRequest(const char *regToken, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions", server)
+ CreateSubscriptionsRequest(LoginInfo &li) :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions", li.endpoint.szServer)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken)
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken)
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8");
JSONNode interestedResources(JSON_ARRAY); interestedResources.set_name("interestedResources");
@@ -49,13 +49,13 @@ public:
class CreateContactsSubscriptionRequest : public HttpRequest
{
public:
- CreateContactsSubscriptionRequest(const char *regToken, const LIST<char> &skypenames, const char *server = SKYPE_ENDPOINTS_HOST) :
- HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/contacts", server)
+ CreateContactsSubscriptionRequest(const LIST<char> &skypenames, LoginInfo &li) :
+ HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/contacts", li.endpoint.szServer)
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", regToken);
+ << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken);
JSONNode node;
diff --git a/protocols/SkypeWeb/src/requests/trouter.h b/protocols/SkypeWeb/src/requests/trouter.h
index 37cacc8c92..0f8cd6e8d2 100644
--- a/protocols/SkypeWeb/src/requests/trouter.h
+++ b/protocols/SkypeWeb/src/requests/trouter.h
@@ -30,13 +30,13 @@ public:
class CreateTrouterPoliciesRequest : public HttpRequest
{
public:
- CreateTrouterPoliciesRequest(const char *token, const char *sr) :
+ CreateTrouterPoliciesRequest(LoginInfo &li, const char *sr) :
HttpRequest(REQUEST_POST, FORMAT, "prod.tpc.skype.com/v1/policies")
{
Headers
<< CHAR_VALUE("Accept", "application/json, text/javascript")
<< CHAR_VALUE("Content-Type", "application/json; charset=UTF-8")
- << CHAR_VALUE("X-Skypetoken", token);
+ << CHAR_VALUE("X-Skypetoken", li.api.szToken);
JSONNode node;
node << JSONNode("sr", sr);
@@ -48,12 +48,12 @@ public:
class RegisterTrouterRequest : public HttpRequest
{
public:
- RegisterTrouterRequest(const char *token, const char *trouterUrl, const char *id) :
+ RegisterTrouterRequest(LoginInfo &li, const char *trouterUrl, const char *id) :
HttpRequest(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", token);
+ << CHAR_VALUE("X-Skypetoken", li.api.szToken);
JSONNode clientDescription; clientDescription.set_name("clientDescription");
clientDescription