diff options
| author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-08-15 13:10:56 +0000 | 
|---|---|---|
| committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-08-15 13:10:56 +0000 | 
| commit | 9c4370db4f2e5f5ee77e03a8c5c4c1e226274768 (patch) | |
| tree | e6b9936fb28e85ec702d03ff8db294d2b2f50c15 | |
| parent | de6edc08ee0c1faffb6456abc31fc9bd8a5b0e32 (diff) | |
SkypeWeb: refactoring part 1
git-svn-id: http://svn.miranda-ng.org/main/trunk@14960 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
27 files changed, 197 insertions, 191 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 
 diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index 7410ad7ab7..d570055fe7 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -202,7 +202,7 @@ INT_PTR CSkypeProto::SvcSetMyAvatar(WPARAM, LPARAM lParam)  			return -1;
  		}
  		fclose(hFile);
 -		PushRequest(new SetAvatarRequest(m_szTokenSecret, m_szSelfSkypeName, data, length), &CSkypeProto::OnSentAvatar);
 +		PushRequest(new SetAvatarRequest(data, length, li), &CSkypeProto::OnSentAvatar);
  	}
  	else
  	{
 diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 464af1c359..5cd6536814 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -114,7 +114,7 @@ void CSkypeProto::OnLoadChats(const NETLIBHTTPREQUEST *response)  	std::string syncState = metadata["syncState"].as_string();
  	if (totalCount >= 99 || conversations.size() >= 99)
 -		PushRequest(new SyncHistoryFirstRequest(syncState.c_str(), (char*)m_szRegToken), &CSkypeProto::OnSyncHistory);
 +		PushRequest(new SyncHistoryFirstRequest(syncState.c_str(), li), &CSkypeProto::OnSyncHistory);
  	for (size_t i = 0; i < conversations.size(); i++)
  	{
 @@ -129,7 +129,7 @@ void CSkypeProto::OnLoadChats(const NETLIBHTTPREQUEST *response)  		{
  			CMStringA skypename(UrlToSkypename(conversationLink.c_str()));
  			CMString topic(threadProperties["topic"].as_mstring());
 -			SendRequest(new GetChatInfoRequest(m_szRegToken, skypename, m_szServer), &CSkypeProto::OnGetChatInfo, topic.Detach());
 +			SendRequest(new GetChatInfoRequest(skypename, li), &CSkypeProto::OnGetChatInfo, topic.Detach());
  		}
  	}
  }
 @@ -187,7 +187,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam)  			if (hContact != NULL)
  			{
  				ptrA username(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID));
 -				SendRequest(new InviteUserToChatRequest(m_szRegToken, chat_id, username, "User", m_szServer));
 +				SendRequest(new InviteUserToChatRequest(chat_id, username, "User", li));
  			}
  			{ mir_cslock lck(m_InviteDialogsLock); m_InviteDialogs.remove(&dlg); }
 @@ -200,7 +200,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam)  		case 30:
  			CMString newTopic = ChangeTopicForm();
  			if (!newTopic.IsEmpty())
 -				SendRequest(new SetChatPropertiesRequest(m_szRegToken, chat_id, "topic", ptrA(mir_utf8encodeT(newTopic.GetBuffer())), m_szServer));
 +				SendRequest(new SetChatPropertiesRequest(chat_id, "topic", ptrA(mir_utf8encodeT(newTopic.GetBuffer())), li));
  			break;
  		}
  		break;
 @@ -217,13 +217,13 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam)  		switch (gch->dwData)
  		{
  		case 10:
 -			SendRequest(new KickUserRequest(m_szRegToken, chat_id, user_id, m_szServer));
 +			SendRequest(new KickUserRequest(chat_id, user_id, li));
  			break;
  		case 30:
 -			SendRequest(new InviteUserToChatRequest(m_szRegToken, chat_id, user_id, "Admin", m_szServer));
 +			SendRequest(new InviteUserToChatRequest(chat_id, user_id, "Admin", li));
  			break;
  		case 40:
 -			SendRequest(new InviteUserToChatRequest(m_szRegToken, chat_id, user_id, "User", m_szServer));
 +			SendRequest(new InviteUserToChatRequest(chat_id, user_id, "User", li));
  			break;
  		}
 @@ -261,7 +261,7 @@ INT_PTR CSkypeProto::OnLeaveChatRoom(WPARAM hContact, LPARAM)  		CallServiceSync(MS_GC_EVENT, SESSION_OFFLINE, reinterpret_cast<LPARAM>(&gce));
  		CallServiceSync(MS_GC_EVENT, SESSION_TERMINATE, reinterpret_cast<LPARAM>(&gce));
 -		SendRequest(new KickUserRequest(m_szRegToken, _T2A(idT), m_szSelfSkypeName, m_szServer));
 +		SendRequest(new KickUserRequest(_T2A(idT), li.szSkypename, li));
  		CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
  	}
 @@ -285,7 +285,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node)  	if (FindChatRoom(szConversationName) == NULL)
 -		SendRequest(new GetChatInfoRequest(m_szRegToken, szConversationName, m_szServer), &CSkypeProto::OnGetChatInfo, szTopic.Detach());
 +		SendRequest(new GetChatInfoRequest(szConversationName, li), &CSkypeProto::OnGetChatInfo, szTopic.Detach());
  	std::string messageType = node["messagetype"].as_string();
  	if (messageType == "Text" || messageType == "RichText")
 @@ -403,9 +403,9 @@ void CSkypeProto::OnSendChatMessage(const TCHAR *chat_id, const TCHAR * tszMessa  	ptrA szChatId(mir_t2a(chat_id));
  	ptrA szMessage(mir_utf8encodeT(tszMessage));
  	if (strncmp(szMessage, "/me ", 4) == 0)
 -		SendRequest(new SendChatActionRequest(m_szRegToken, szChatId, time(NULL), szMessage, m_szServer));
 +		SendRequest(new SendChatActionRequest(szChatId, time(NULL), szMessage, li));
  	else
 -		SendRequest(new SendChatMessageRequest(m_szRegToken, szChatId, time(NULL), szMessage, m_szServer));
 +		SendRequest(new SendChatMessageRequest(szChatId, time(NULL), szMessage, li));
  }
  void CSkypeProto::AddMessageToChat(const TCHAR *chat_id, const TCHAR *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading)
 @@ -460,7 +460,7 @@ void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p)  		if (!IsChatContact(_A2T(chatId), username))
  			AddChatContact(_A2T(chatId), username, username, _A2T(role.c_str()), true);
  	}
 -	PushRequest(new GetHistoryRequest(m_szRegToken, chatId, 15, true, 0, m_szServer), &CSkypeProto::OnGetServerHistory);
 +	PushRequest(new GetHistoryRequest(chatId, 15, true, 0, li), &CSkypeProto::OnGetServerHistory);
  	mir_free(topic);
  }
 @@ -566,7 +566,7 @@ INT_PTR CSkypeProto::SvcCreateChat(WPARAM, LPARAM)  		if (!dlg.DoModal()) { return 1; }
 -		SendRequest(new CreateChatroomRequest(m_szRegToken, dlg.m_ContactsList, ptrA(getStringA(SKYPE_SETTINGS_ID)), m_szServer));
 +		SendRequest(new CreateChatroomRequest(dlg.m_ContactsList, li));
  		{ mir_cslock lck(m_GCCreateDialogsLock); m_GCCreateDialogs.remove(&dlg); }
  		return 0;
 diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index 05df715501..b4207df6ab 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -285,7 +285,7 @@ void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response)  			for (; i < skypenames.getCount() && users.getCount() <= 50; i++)
  				users.insert(mir_strdup(skypenames[i]));
 -			PushRequest(new GetContactsInfoRequest(m_szTokenSecret, users), &CSkypeProto::LoadContactsInfo);
 +			PushRequest(new GetContactsInfoRequest(li, users), &CSkypeProto::LoadContactsInfo);
  			FreeCharList(users);
  			users.destroy();
 @@ -295,7 +295,7 @@ void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response)  		FreeCharList(skypenames);
  		skypenames.destroy();
  	}
 -	PushRequest(new GetContactsAuthRequest(m_szTokenSecret), &CSkypeProto::LoadContactsAuth);
 +	PushRequest(new GetContactsAuthRequest(li), &CSkypeProto::LoadContactsAuth);
  }
  INT_PTR CSkypeProto::OnRequestAuth(WPARAM hContact, LPARAM)
 @@ -304,7 +304,7 @@ INT_PTR CSkypeProto::OnRequestAuth(WPARAM hContact, LPARAM)  		return 1;
  	ptrA skypename(getStringA(hContact, SKYPE_SETTINGS_ID));
 -	PushRequest(new AddContactRequest(m_szTokenSecret, skypename));
 +	PushRequest(new AddContactRequest(li, skypename));
  	return 0;
  }
 @@ -314,7 +314,7 @@ INT_PTR CSkypeProto::OnGrantAuth(WPARAM hContact, LPARAM)  		return 1;
  	ptrA skypename(getStringA(hContact, SKYPE_SETTINGS_ID));
 -	PushRequest(new AuthAcceptRequest(m_szTokenSecret, skypename));
 +	PushRequest(new AuthAcceptRequest(li, skypename));
  	return 0;
  }
 @@ -323,7 +323,7 @@ int CSkypeProto::OnContactDeleted(MCONTACT hContact, LPARAM)  	if (!IsOnline()) return 1;
  	if (hContact && !isChatRoom(hContact))
 -		PushRequest(new DeleteContactRequest(m_szTokenSecret, db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID)));
 +		PushRequest(new DeleteContactRequest(li, ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID))));
  	return 0;
  }
 @@ -332,7 +332,7 @@ INT_PTR CSkypeProto::BlockContact(WPARAM hContact, LPARAM)  	if (!IsOnline()) return 1;
  	if (IDYES == MessageBox(NULL, TranslateT("Are you sure?"), TranslateT("Warning"), MB_YESNO | MB_ICONQUESTION))
 -		SendRequest(new BlockContactRequest(m_szTokenSecret, ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID))), &CSkypeProto::OnBlockContact, (void *)hContact);
 +		SendRequest(new BlockContactRequest(li, ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID))), &CSkypeProto::OnBlockContact, (void *)hContact);
  	return 0;
  }
 @@ -347,7 +347,7 @@ void CSkypeProto::OnBlockContact(const NETLIBHTTPREQUEST *response, void *p)  INT_PTR CSkypeProto::UnblockContact(WPARAM hContact, LPARAM)
  {
 -	SendRequest(new UnblockContactRequest(m_szTokenSecret, ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID))), &CSkypeProto::OnUnblockContact, (void *)hContact);
 +	SendRequest(new UnblockContactRequest(li, ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID))), &CSkypeProto::OnUnblockContact, (void *)hContact);
  	return 0;
  }
 diff --git a/protocols/SkypeWeb/src/skype_dialogs.cpp b/protocols/SkypeWeb/src/skype_dialogs.cpp index 6df224fe80..3e35bb1909 100644 --- a/protocols/SkypeWeb/src/skype_dialogs.cpp +++ b/protocols/SkypeWeb/src/skype_dialogs.cpp @@ -95,7 +95,7 @@ void CSkypeGCCreateDlg::btnOk_OnOk(CCtrlButton*)  			}
  		}
  	}
 -	m_ContactsList.insert(m_proto->m_szSelfSkypeName);
 +	m_ContactsList.insert(m_proto->li.szSkypename);
  	EndDialog(m_hwnd, m_ContactsList.getCount());
  }
 diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 8d818cf29c..03c786cfe3 100644 --- a/protocols/SkypeWeb/src/skype_history_sync.cpp +++ b/protocols/SkypeWeb/src/skype_history_sync.cpp @@ -37,7 +37,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response)  	bool markAllAsUnread = getBool("MarkMesUnread", true);
  	if (totalCount >= 99 || conversations.size() >= 99)
 -		PushRequest(new GetHistoryOnUrlRequest(syncState.c_str(), m_szRegToken), &CSkypeProto::OnGetServerHistory);
 +		PushRequest(new GetHistoryOnUrlRequest(syncState.c_str(), li), &CSkypeProto::OnGetServerHistory);
  	for (int i = (int)conversations.size(); i >= 0; i--)
  	{
 @@ -111,7 +111,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response)  INT_PTR CSkypeProto::GetContactHistory(WPARAM hContact, LPARAM)
  {
 -	PushRequest(new GetHistoryRequest(m_szRegToken, ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID)), 100, false, 0, m_szServer), &CSkypeProto::OnGetServerHistory);
 +	PushRequest(new GetHistoryRequest(ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID)), 100, false, 0, li), &CSkypeProto::OnGetServerHistory);
  	return 0;
  }
 @@ -131,7 +131,7 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response)  	std::string syncState = metadata["syncState"].as_string();
  	if (totalCount >= 99 || conversations.size() >= 99)
 -		PushRequest(new SyncHistoryFirstRequest(syncState.c_str(), (char*)m_szRegToken), &CSkypeProto::OnSyncHistory);
 +		PushRequest(new SyncHistoryFirstRequest(syncState.c_str(), li), &CSkypeProto::OnSyncHistory);
  	for (size_t i = 0; i < conversations.size(); i++)
  	{
 @@ -151,7 +151,7 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response)  				{
  					if (db_get_dw(hContact, m_szModuleName, "LastMsgTime", 0) < composeTime)
  					{
 -						PushRequest(new GetHistoryRequest(m_szRegToken, szSkypename, 100, false, 0, m_szServer), &CSkypeProto::OnGetServerHistory);
 +						PushRequest(new GetHistoryRequest(szSkypename, 100, false, 0, li), &CSkypeProto::OnGetServerHistory);
  					}
  				}
  			}
 diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index acfc4d53b2..9ce5262488 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -25,9 +25,11 @@ void CSkypeProto::Login()  	m_iStatus = ID_STATUS_CONNECTING;
  	requestQueue->Start();
  	int tokenExpires(getDword("TokenExpiresIn", 0));
 -	ptrA szLogin(getStringA(SKYPE_SETTINGS_ID));
 +
 +	li.szSkypename = getStringA(SKYPE_SETTINGS_ID);
 +
  	pass_ptrA szPassword(getStringA(SKYPE_SETTINGS_PASSWORD));
 -	if (szLogin == NULL || szPassword == NULL)
 +	if (li.szSkypename == NULL || szPassword == NULL)
  	{
  		ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
  		return;
 @@ -37,10 +39,10 @@ void CSkypeProto::Login()  		OnLoginSuccess();
  	else
  	{
 -		if (strchr(szLogin, '@'))
 +		if (strchr(li.szSkypename, '@'))
  			SendRequest(new LoginMSRequest(), &CSkypeProto::OnMSLoginFirst);
  		else
 -			SendRequest(new LoginOAuthRequest(szLogin, szPassword), &CSkypeProto::OnLoginOAuth);
 +			SendRequest(new LoginOAuthRequest(li.szSkypename, szPassword), &CSkypeProto::OnLoginOAuth);
  	}
  }
 @@ -121,12 +123,12 @@ void CSkypeProto::OnLoginSuccess()  {
  	isTerminated = false;
  	ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_SUCCESS, NULL, 0);
 -	m_szSelfSkypeName = getStringA(SKYPE_SETTINGS_ID);
 -	m_szTokenSecret = getStringA("TokenSecret");
 -	m_szServer = getStringA("Server");
 -	if (m_szServer == NULL)
 -		m_szServer = mir_strdup(SKYPE_ENDPOINTS_HOST);
 -	SendRequest(new CreateEndpointRequest(m_szTokenSecret, m_szServer), &CSkypeProto::OnEndpointCreated);
 +
 +	li.api.szToken = getStringA("TokenSecret");
 +
 +	li.endpoint.szServer = ((ptrA(getStringA("Server")) == NULL) ? mir_strdup(SKYPE_ENDPOINTS_HOST) : getStringA("Server"));
 +
 +	SendRequest(new CreateEndpointRequest(li), &CSkypeProto::OnEndpointCreated);
  }
  void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response)
 @@ -161,8 +163,8 @@ void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response)  		else if (!mir_strcmpi(response->headers[i].szName, "Location"))
  		{
  			CMStringA szValue = response->headers[i].szValue;
 -			m_szServer = GetServerFromUrl(szValue).Detach();
 -			setString("Server", m_szServer);
 +			li.endpoint.szServer = GetServerFromUrl(szValue).Detach();
 +			setString("Server", li.endpoint.szServer);
  		}
  	}
 @@ -180,19 +182,20 @@ void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response)  		if (response->resultCode == 401)
  		{
  			delSetting("TokenExpiresIn");
 -			SendRequest(new LoginOAuthRequest(m_szSelfSkypeName, ptrA(getStringA(SKYPE_SETTINGS_PASSWORD))), &CSkypeProto::OnLoginOAuth);
 +			SendRequest(new LoginOAuthRequest(li.szSkypename, ptrA(getStringA(SKYPE_SETTINGS_PASSWORD))), &CSkypeProto::OnLoginOAuth);
  			return;
  		}
  		else //it should be rewritten
  		{
 -			SendRequest(new CreateEndpointRequest(m_szTokenSecret, m_szServer), &CSkypeProto::OnEndpointCreated);
 +			SendRequest(new CreateEndpointRequest(li), &CSkypeProto::OnEndpointCreated);
  			return;
  		}
  	}
 -	m_szRegToken = getStringA("registrationToken");
 -	m_szEndpointId = getStringA("endpointId");
 -	SendRequest(new CreateSubscriptionsRequest(m_szRegToken, m_szServer), &CSkypeProto::OnSubscriptionsCreated);
 +	li.endpoint.szToken = getStringA("registrationToken");
 +	li.endpoint.szId = getStringA("endpointId");
 +
 +	SendRequest(new CreateSubscriptionsRequest(li), &CSkypeProto::OnSubscriptionsCreated);
  }
  void CSkypeProto::OnSubscriptionsCreated(const NETLIBHTTPREQUEST *response)
 @@ -226,9 +229,9 @@ void CSkypeProto::SendPresence(bool isLogin)  	}
  	if (isLogin)
 -		SendRequest(new SendCapabilitiesRequest(m_szRegToken, m_szEndpointId, epname, m_szServer), &CSkypeProto::OnCapabilitiesSended);
 +		SendRequest(new SendCapabilitiesRequest(epname, li), &CSkypeProto::OnCapabilitiesSended);
  	else 
 -		PushRequest(new SendCapabilitiesRequest(m_szRegToken, m_szEndpointId, epname, m_szServer));
 +		PushRequest(new SendCapabilitiesRequest(epname, li));
  }
  void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response)
 @@ -240,7 +243,7 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response)  		return;
  	}
 -	SendRequest(new SetStatusRequest(m_szRegToken, MirandaToSkypeStatus(m_iDesiredStatus), m_szServer), &CSkypeProto::OnStatusChanged);
 +	SendRequest(new SetStatusRequest(MirandaToSkypeStatus(m_iDesiredStatus), li), &CSkypeProto::OnStatusChanged);
  	LIST<char> skypenames(1);
  	for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
 @@ -248,25 +251,25 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response)  		if (!isChatRoom(hContact))
  			skypenames.insert(getStringA(hContact, SKYPE_SETTINGS_ID));
  	}
 -	SendRequest(new CreateContactsSubscriptionRequest(m_szRegToken, skypenames, m_szServer));
 +	SendRequest(new CreateContactsSubscriptionRequest(skypenames, li));
  	FreeCharList(skypenames);
  	skypenames.destroy();
  	m_hPollingThread = ForkThreadEx(&CSkypeProto::PollingThread, 0, NULL);
 -	SendRequest(new LoadChatsRequest(m_szRegToken, m_szServer), &CSkypeProto::OnLoadChats);
 +	SendRequest(new LoadChatsRequest(li), &CSkypeProto::OnLoadChats);
  	SendRequest(new CreateTrouterRequest(), &CSkypeProto::OnCreateTrouter);
 -	PushRequest(new GetContactListRequest(m_szTokenSecret, m_szSelfSkypeName, NULL), &CSkypeProto::LoadContactList);
 +	PushRequest(new GetContactListRequest(li, NULL), &CSkypeProto::LoadContactList);
  	PushRequest(new GetAvatarRequest(ptrA(getStringA("AvatarUrl"))), &CSkypeProto::OnReceiveAvatar, NULL);
  	if (getBool("AutoSync", true))
 -		PushRequest(new SyncHistoryFirstRequest(m_szRegToken, 100, m_szServer), &CSkypeProto::OnSyncHistory);
 +		PushRequest(new SyncHistoryFirstRequest(100, li), &CSkypeProto::OnSyncHistory);
  	JSONNode root = JSONNode::parse(response->pData);
  	if (root)
  		setString("SelfEndpointName", UrlToSkypename(root["selfLink"].as_string().c_str()));
 -	PushRequest(new GetProfileRequest(m_szTokenSecret), &CSkypeProto::LoadProfile);
 +	PushRequest(new GetProfileRequest(li), &CSkypeProto::LoadProfile);
  }
  void CSkypeProto::OnStatusChanged(const NETLIBHTTPREQUEST *response)
 diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 5ac0c1cd78..29e9a4e2aa 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -59,9 +59,9 @@ int CSkypeProto::OnSendMessage(MCONTACT hContact, int, const char *szMessage)  	ptrA username(getStringA(hContact, "Skypename"));
  	if (strncmp(szMessage, "/me ", 4) == 0)
 -		SendRequest(new SendActionRequest(m_szRegToken, username, m_szSelfSkypeName, param->hMessage, &szMessage[4], m_szServer), &CSkypeProto::OnMessageSent, param);
 +		SendRequest(new SendActionRequest(username, param->hMessage, &szMessage[4], li), &CSkypeProto::OnMessageSent, param);
  	else
 -		SendRequest(new SendMessageRequest(m_szRegToken, username, param->hMessage, szMessage, m_szServer), &CSkypeProto::OnMessageSent, param);
 +		SendRequest(new SendMessageRequest(username, param->hMessage, szMessage, li), &CSkypeProto::OnMessageSent, param);
  	m_OutMessages.insert((void*)param->hMessage);
 @@ -232,5 +232,5 @@ void CSkypeProto::MarkMessagesRead(MCONTACT hContact, MEVENT hDbEvent)  	time_t timestamp = dbei.timestamp;
  	if(db_get_dw(hContact, m_szModuleName, "LastMsgTime", 0) > (timestamp - 300))
 -		PushRequest(new MarkMessageReadRequest(username, m_szRegToken, timestamp, timestamp, false, m_szServer));
 +		PushRequest(new MarkMessageReadRequest(username, timestamp, timestamp, false, li));
  }
 diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index 4d9fd04318..f5db4e8140 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -25,7 +25,7 @@ void CSkypeProto::PollingThread(void*)  	isTerminated = false;
  	while (!isTerminated && errors < POLLING_ERRORS_LIMIT)
  	{
 -		PollRequest *request = new PollRequest(m_szRegToken, m_szServer);
 +		PollRequest *request = new PollRequest(li);
  		request->nlc = m_pollingConnection;
  		NLHR_PTR response(request->Send(m_hNetlibUser));
  		delete request;
 diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 731514871a..bc9f1460a7 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -127,7 +127,7 @@ int CSkypeProto::Authorize(MEVENT hDbEvent)  	ptrA token(getStringA("TokenSecret"));
  	ptrA skypename(getStringA(hContact, SKYPE_SETTINGS_ID));
 -	PushRequest(new AuthAcceptRequest(token, skypename));
 +	PushRequest(new AuthAcceptRequest(li, skypename));
  	return 0;
  }
 @@ -139,7 +139,7 @@ int CSkypeProto::AuthDeny(MEVENT hDbEvent, const TCHAR*)  	ptrA token(getStringA("TokenSecret"));
  	ptrA skypename(getStringA(hContact, SKYPE_SETTINGS_ID));
 -	PushRequest(new AuthDeclineRequest(token, skypename));
 +	PushRequest(new AuthDeclineRequest(li, skypename));
  	return 0;
  }
 @@ -155,7 +155,7 @@ int CSkypeProto::AuthRequest(MCONTACT hContact, const TCHAR *szMessage)  	ptrA token(getStringA("TokenSecret"));
  	ptrA skypename(getStringA(hContact, SKYPE_SETTINGS_ID));
 -	PushRequest(new AddContactRequest(token, skypename, T2Utf(szMessage)));
 +	PushRequest(new AddContactRequest(li, skypename, T2Utf(szMessage)));
  	return 0;
  }
 @@ -163,7 +163,7 @@ int CSkypeProto::GetInfo(MCONTACT hContact, int)  {
  	if (!isChatRoom(hContact))
  		PushRequest(
 -			new GetProfileRequest(ptrA(getStringA("TokenSecret")), ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID))),
 +			new GetProfileRequest(li, ptrA(db_get_sa(hContact, m_szModuleName, SKYPE_SETTINGS_ID))),
  			&CSkypeProto::LoadProfile);
  	return 0;
  }
 @@ -211,7 +211,7 @@ int CSkypeProto::SetStatus(int iNewStatus)  		if (m_iStatus > ID_STATUS_CONNECTING + 1)
  		{
 -			SendRequest(new DeleteEndpointRequest(m_szRegToken, m_szEndpointId, m_szServer));
 +			SendRequest(new DeleteEndpointRequest(li));
  			delSetting("registrationRoken");
  			delSetting("endpointId");
  			delSetting("expires");
 @@ -236,7 +236,7 @@ int CSkypeProto::SetStatus(int iNewStatus)  		}
  		else
  		{
 -			SendRequest(new SetStatusRequest(m_szRegToken, MirandaToSkypeStatus(m_iDesiredStatus)), &CSkypeProto::OnStatusChanged);
 +			SendRequest(new SetStatusRequest(MirandaToSkypeStatus(m_iDesiredStatus), li), &CSkypeProto::OnStatusChanged);
  		}
  	}
 @@ -246,7 +246,7 @@ int CSkypeProto::SetStatus(int iNewStatus)  int CSkypeProto::UserIsTyping(MCONTACT hContact, int type)
  {
 -	SendRequest(new SendTypingRequest(m_szRegToken, ptrA(getStringA(hContact, SKYPE_SETTINGS_ID)), type, m_szServer));
 +	SendRequest(new SendTypingRequest(ptrA(getStringA(hContact, SKYPE_SETTINGS_ID)), type, li));
  	return 0;
  }
 diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 66be5509b1..366acb6c97 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -24,6 +24,8 @@ typedef void(CSkypeProto::*SkypeResponseWithArgCallback)(const NETLIBHTTPREQUEST  struct CSkypeProto : public PROTO < CSkypeProto >
  {
  	friend CSkypeGCCreateDlg;
 +	//friend CSkypeChatroom;
 +	//friend ChatUser;
  public:
 @@ -82,6 +84,8 @@ public:  private:
 +	LoginInfo li;
 +
  	static UINT_PTR m_timer;
  	//---Accounts
 @@ -119,13 +123,6 @@ private:  	mir_cs m_AppendMessageLock;
  	static mir_cs accountsLock;
  	static mir_cs timerLock;
 -	
 -
 -	ptrA m_szServer,
 -		 m_szRegToken,
 -		 m_szTokenSecret,
 -		 m_szEndpointId,
 -		 m_szSelfSkypeName;
  	static CSkypeProto* GetContactAccount(MCONTACT hContact);
  	int __cdecl OnAccountLoaded(WPARAM, LPARAM);
 @@ -308,7 +305,7 @@ private:  	}
  	__forceinline bool IsMe(const char *szSkypename)
 -	{	return (!mir_strcmpi(szSkypename, m_szSelfSkypeName) || !mir_strcmp(szSkypename, ptrA(getStringA("SelfEndpointName"))));
 +	{	return (!mir_strcmpi(szSkypename, li.szSkypename) || !mir_strcmp(szSkypename, ptrA(getStringA("SelfEndpointName"))));
  	}
  	MEVENT AddEventToDb(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob);
 diff --git a/protocols/SkypeWeb/src/skype_search.cpp b/protocols/SkypeWeb/src/skype_search.cpp index a5f25d5247..1c6578172d 100644 --- a/protocols/SkypeWeb/src/skype_search.cpp +++ b/protocols/SkypeWeb/src/skype_search.cpp @@ -29,7 +29,7 @@ void CSkypeProto::SearchBasicThread(void* id)  	if (IsOnline())
  	{
  		ptrA szString(mir_urlEncode(T2Utf((TCHAR*)id)));
 -		SendRequest(new GetSearchRequest(m_szTokenSecret, szString), &CSkypeProto::OnSearch);
 +		SendRequest(new GetSearchRequest(szString, li), &CSkypeProto::OnSearch);
  	}
  }
 diff --git a/protocols/SkypeWeb/src/skype_timers.cpp b/protocols/SkypeWeb/src/skype_timers.cpp index 34a2ff5c50..4ab560cd2f 100644 --- a/protocols/SkypeWeb/src/skype_timers.cpp +++ b/protocols/SkypeWeb/src/skype_timers.cpp @@ -24,7 +24,7 @@ void CSkypeProto::ProcessTimer()  {
  	if (IsOnline())
  	{
 -		PushRequest(new GetContactListRequest(m_szTokenSecret), &CSkypeProto::LoadContactList);
 +		PushRequest(new GetContactListRequest(li, NULL), &CSkypeProto::LoadContactList);
  		SendPresence(false);
  		if (!m_hTrouterThread)
  			SendRequest(new CreateTrouterRequest(), &CSkypeProto::OnCreateTrouter);
 diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index 55f96576f7..e3ee811fa3 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -49,7 +49,7 @@ void CSkypeProto::OnCreateTrouter(const NETLIBHTTPREQUEST *response)  	TRouter.socketIo = socketio.as_string();
  	TRouter.url = url.as_string();
 -	SendRequest(new CreateTrouterPoliciesRequest(m_szTokenSecret, TRouter.connId.c_str()), &CSkypeProto::OnTrouterPoliciesCreated);
 +	SendRequest(new CreateTrouterPoliciesRequest(li, TRouter.connId.c_str()), &CSkypeProto::OnTrouterPoliciesCreated);
  }
  void CSkypeProto::OnTrouterPoliciesCreated(const NETLIBHTTPREQUEST *response)
 @@ -110,7 +110,7 @@ void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response)  	if ((time(NULL) - TRouter.lastRegistrationTime) >= 3600)
  	{
 -		SendRequest(new RegisterTrouterRequest(m_szTokenSecret, TRouter.url.c_str(), TRouter.sessId.c_str()));
 +		SendRequest(new RegisterTrouterRequest(li, TRouter.url.c_str(), TRouter.sessId.c_str()));
  		TRouter.lastRegistrationTime = time(NULL);
  	}
  }
 diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h index 94faae7e08..28665e61da 100644 --- a/protocols/SkypeWeb/src/stdafx.h +++ b/protocols/SkypeWeb/src/stdafx.h @@ -61,6 +61,23 @@ extern HANDLE g_hCallEvent;  #define SKYPE_ENDPOINTS_HOST "client-s.gateway.messenger.live.com"
 +struct LoginInfo
 +{
 +	struct
 +	{
 +		ptrA szToken;
 +	} api;
 +
 +	struct
 +	{
 +		ptrA szToken;
 +		ptrA szId;
 +		ptrA szServer;
 +	} endpoint;
 +
 +	ptrA szSkypename;
 +};
 +
  #include "version.h"
  #include "resource.h"
  #include "skype_icons.h"
 @@ -69,6 +86,7 @@ extern HANDLE g_hCallEvent;  #include "skype_options.h"
  #include "skype_trouter.h"
  #include "skype_db.h"
 +//#include "skype_chatrooms.h"
  #include "skype_utils.h"
  #include "http_request.h"
  #include "requests\login.h"
 | 
