From c311534fbf724850cbd8555a9e57f67b3096d7a0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 12 Jul 2019 19:20:45 +0300 Subject: SkypeWeb: - fixes #2002 (Skype caches wrong server data); - unused structure removed; - version bump --- protocols/SkypeWeb/src/requests/asm/files.h | 8 ++-- protocols/SkypeWeb/src/requests/avatars.h | 6 +-- protocols/SkypeWeb/src/requests/capabilities.h | 6 +-- protocols/SkypeWeb/src/requests/chatrooms.h | 50 ++++++++++++------------- protocols/SkypeWeb/src/requests/contacts.h | 38 +++++++++---------- protocols/SkypeWeb/src/requests/endpoint.h | 12 +++--- protocols/SkypeWeb/src/requests/history.h | 20 +++++----- protocols/SkypeWeb/src/requests/messages.h | 28 +++++++------- protocols/SkypeWeb/src/requests/poll.h | 6 +-- protocols/SkypeWeb/src/requests/profile.h | 4 +- protocols/SkypeWeb/src/requests/search.h | 4 +- protocols/SkypeWeb/src/requests/status.h | 10 ++--- protocols/SkypeWeb/src/requests/subscriptions.h | 12 +++--- protocols/SkypeWeb/src/requests/trouter.h | 8 ++-- protocols/SkypeWeb/src/skype_avatars.cpp | 2 +- protocols/SkypeWeb/src/skype_chatrooms.cpp | 26 ++++++------- protocols/SkypeWeb/src/skype_contacts.cpp | 14 +++---- protocols/SkypeWeb/src/skype_dialogs.cpp | 3 +- protocols/SkypeWeb/src/skype_files.cpp | 6 +-- protocols/SkypeWeb/src/skype_history_sync.cpp | 8 ++-- protocols/SkypeWeb/src/skype_login.cpp | 39 +++++++++---------- protocols/SkypeWeb/src/skype_messages.cpp | 6 +-- protocols/SkypeWeb/src/skype_polling.cpp | 2 +- protocols/SkypeWeb/src/skype_profile.cpp | 8 ++-- protocols/SkypeWeb/src/skype_proto.cpp | 21 ++++++----- protocols/SkypeWeb/src/skype_proto.h | 17 ++++----- protocols/SkypeWeb/src/skype_search.cpp | 2 +- protocols/SkypeWeb/src/skype_timers.cpp | 2 +- protocols/SkypeWeb/src/skype_trouter.cpp | 4 +- protocols/SkypeWeb/src/stdafx.h | 37 +++++------------- protocols/SkypeWeb/src/version.h | 2 +- 31 files changed, 195 insertions(+), 216 deletions(-) (limited to 'protocols/SkypeWeb/src') diff --git a/protocols/SkypeWeb/src/requests/asm/files.h b/protocols/SkypeWeb/src/requests/asm/files.h index 9f2fff89c9..89d42274d3 100644 --- a/protocols/SkypeWeb/src/requests/asm/files.h +++ b/protocols/SkypeWeb/src/requests/asm/files.h @@ -3,12 +3,12 @@ class ASMObjectCreateRequest : public HttpRequest { public: - ASMObjectCreateRequest(LoginInfo &li, const char *szContact, const char *szFileName) : + ASMObjectCreateRequest(CSkypeProto *ppro, const char *szContact, const char *szFileName) : HttpRequest(REQUEST_POST, "api.asm.skype.com/v1/objects") { flags &= (~NLHRF_DUMPASTEXT); Headers - << FORMAT_VALUE("Authorization", "skype_token %s", li.api.szToken) + << FORMAT_VALUE("Authorization", "skype_token %s", ppro->m_szApiToken) << CHAR_VALUE("Content-Type", "text/json"); JSONNode node, jPermissions, jPermission(JSON_ARRAY); @@ -26,11 +26,11 @@ public: class ASMObjectUploadRequest : public HttpRequest { public: - ASMObjectUploadRequest(LoginInfo &li, const char *szObject, const PBYTE data, const size_t size) : + ASMObjectUploadRequest(CSkypeProto *ppro, const char *szObject, const PBYTE data, const size_t size) : HttpRequest(REQUEST_PUT, FORMAT, "api.asm.skype.com/v1/objects/%s/content/original", szObject) { Headers - << FORMAT_VALUE("Authorization", "skype_token %s", li.api.szToken) + << FORMAT_VALUE("Authorization", "skype_token %s", ppro->m_szApiToken) << CHAR_VALUE("Content-Type", "application/octet-stream"); pData = (char*)mir_alloc(size); diff --git a/protocols/SkypeWeb/src/requests/avatars.h b/protocols/SkypeWeb/src/requests/avatars.h index 8257874caa..01332d3bad 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 PBYTE data, size_t dataSize, const char *szMime, LoginInfo &li) : - HttpRequest(REQUEST_PUT, FORMAT, "api.skype.com/users/%s/profile/avatar", li.szSkypename.MakeLower().c_str()) + SetAvatarRequest(const PBYTE data, size_t dataSize, const char *szMime, CSkypeProto *ppro) : + HttpRequest(REQUEST_PUT, FORMAT, "api.skype.com/users/%s/profile/avatar", ppro->m_szSkypename.MakeLower().c_str()) { Headers - << CHAR_VALUE("X-Skypetoken", li.api.szToken) + << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken) << CHAR_VALUE("Content-Type", szMime); pData = (char*)mir_alloc(dataSize); diff --git a/protocols/SkypeWeb/src/requests/capabilities.h b/protocols/SkypeWeb/src/requests/capabilities.h index 174b486ed7..70ca5f7311 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 . class SendCapabilitiesRequest : public HttpRequest { public: - SendCapabilitiesRequest(const char *hostname, LoginInfo &li) : - HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/endpoints/%s/presenceDocs/messagingService", li.endpoint.szServer, mir_urlEncode(li.endpoint.szId).c_str()) + SendCapabilitiesRequest(const char *hostname, CSkypeProto *ppro) : + HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/endpoints/%s/presenceDocs/messagingService", ppro->m_szServer, mir_urlEncode(ppro->m_szId).c_str()) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_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 dc00b3d0ae..1b6b352411 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 . class LoadChatsRequest : public HttpRequest { public: - LoadChatsRequest(LoginInfo &li) : - HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations", li.endpoint.szServer) + LoadChatsRequest(CSkypeProto *ppro) : + HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations", ppro->m_szServer) { Url << INT_VALUE("startTime", 0) @@ -32,7 +32,7 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8"); } }; @@ -40,12 +40,12 @@ public: class SendChatMessageRequest : public HttpRequest { public: - 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) + SendChatMessageRequest(const char *to, time_t timestamp, const char *message, CSkypeProto *ppro) : + HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/19:%s/messages", ppro->m_szServer, to) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); JSONNode node; node @@ -61,12 +61,12 @@ public: class SendChatActionRequest : public HttpRequest { public: - 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) + SendChatActionRequest(const char *to, time_t timestamp, const char *message, CSkypeProto *ppro) : + HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/19:%s/messages", ppro->m_szServer, to) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); JSONNode node(JSON_NODE); @@ -84,15 +84,15 @@ public: class CreateChatroomRequest : public HttpRequest { public: - CreateChatroomRequest(const LIST &skypenames, LoginInfo &li) : - HttpRequest(REQUEST_POST, FORMAT, "%s/v1/threads", li.endpoint.szServer) + CreateChatroomRequest(const LIST &skypenames, CSkypeProto *ppro) : + HttpRequest(REQUEST_POST, FORMAT, "%s/v1/threads", ppro->m_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", li.endpoint.szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); JSONNode node; JSONNode members(JSON_ARRAY); members.set_name("members"); @@ -102,7 +102,7 @@ public: JSONNode member; member << JSONNode("id", CMStringA(::FORMAT, "8:%s", it).GetBuffer()) - << JSONNode("role", !mir_strcmpi(it, li.szSkypename) ? "Admin" : "User"); + << JSONNode("role", !mir_strcmpi(it, ppro->m_szSkypename) ? "Admin" : "User"); members << member; } node << members; @@ -114,28 +114,28 @@ public: class GetChatInfoRequest : public HttpRequest { public: - GetChatInfoRequest(const char *chatId, LoginInfo &li) : - HttpRequest(REQUEST_GET, FORMAT, "%s/v1/threads/%s%s", li.endpoint.szServer, strstr(chatId, "19:") == chatId ? "" : "19:", chatId) + GetChatInfoRequest(const char *chatId, CSkypeProto *ppro) : + HttpRequest(REQUEST_GET, FORMAT, "%s/v1/threads/%s%s", ppro->m_szServer, strstr(chatId, "19:") == chatId ? "" : "19:", 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", li.endpoint.szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); } }; class InviteUserToChatRequest : public HttpRequest { public: - 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) + InviteUserToChatRequest(const char *chatId, const char *skypename, const char* role, CSkypeProto *ppro) : + HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/threads/19:%s/members/8:%s", ppro->m_szServer, chatId, skypename) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); JSONNode node; @@ -148,26 +148,26 @@ public: class KickUserRequest : public HttpRequest { public: - 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) + KickUserRequest(const char *chatId, const char *skypename, CSkypeProto *ppro) : + HttpRequest(REQUEST_DELETE, FORMAT, "%s/v1/threads/19:%s/members/8:%s", ppro->m_szServer, chatId, skypename) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); } }; class SetChatPropertiesRequest : public HttpRequest { public: - 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) + SetChatPropertiesRequest(const char *chatId, const char *propname, const char *value, CSkypeProto *ppro) : + HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/threads/19:%s/properties?name=%s", ppro->m_szServer, chatId, propname) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); JSONNode node; node << JSONNode(propname, value); diff --git a/protocols/SkypeWeb/src/requests/contacts.h b/protocols/SkypeWeb/src/requests/contacts.h index cbe66faca9..bfdf10a749 100644 --- a/protocols/SkypeWeb/src/requests/contacts.h +++ b/protocols/SkypeWeb/src/requests/contacts.h @@ -21,8 +21,8 @@ along with this program. If not, see . class GetContactListRequest : public HttpRequest { public: - GetContactListRequest(LoginInfo &li, const char *filter) : - HttpRequest(REQUEST_GET, FORMAT, "contacts.skype.com/contacts/v1/users/%s/contacts", li.szSkypename.MakeLower().GetBuffer()) + GetContactListRequest(CSkypeProto *ppro, const char *filter) : + HttpRequest(REQUEST_GET, FORMAT, "contacts.skype.com/contacts/v1/users/%s/contacts", ppro->m_szSkypename.MakeLower().GetBuffer()) { if (filter != NULL) { @@ -31,18 +31,18 @@ public: } Headers - << CHAR_VALUE("X-SkypeToken", li.api.szToken); + << CHAR_VALUE("X-SkypeToken", ppro->m_szApiToken); } }; class GetContactsInfoRequest : public HttpRequest { public: - GetContactsInfoRequest(LoginInfo &li, const LIST &skypenames, const char *skypename = "self") : + GetContactsInfoRequest(CSkypeProto *ppro, const LIST &skypenames, const char *skypename = "self") : HttpRequest(REQUEST_POST, FORMAT, "api.skype.com/users/%s/contacts/profiles", skypename) { Headers - << CHAR_VALUE("X-Skypetoken", li.api.szToken) + << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken) << CHAR_VALUE("Accept", "application/json"); for (auto &it : skypenames) @@ -53,11 +53,11 @@ public: class GetContactsAuthRequest : public HttpRequest { public: - GetContactsAuthRequest(LoginInfo &li) : + GetContactsAuthRequest(CSkypeProto *ppro) : HttpRequest(REQUEST_GET, FORMAT, "contacts.skype.com/contacts/v2/users/SELF/invites") { Headers - << CHAR_VALUE("X-Skypetoken", li.api.szToken) + << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken) << CHAR_VALUE("Accept", "application/json"); } }; @@ -65,11 +65,11 @@ public: class AddContactRequest : public HttpRequest { public: - AddContactRequest(LoginInfo &li, const char *who, const char *greeting = "") : + AddContactRequest(CSkypeProto *ppro, const char *who, const char *greeting = "") : HttpRequest(REQUEST_PUT, "contacts.skype.com/contacts/v2/users/SELF/contacts") { Headers - << CHAR_VALUE("X-Skypetoken", li.api.szToken) + << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken) << CHAR_VALUE("Accept", "application/json") << CHAR_VALUE("Content-type", "application/x-www-form-urlencoded"); @@ -85,11 +85,11 @@ public: class DeleteContactRequest : public HttpRequest { public: - DeleteContactRequest(LoginInfo &li, const char *who) : + DeleteContactRequest(CSkypeProto *ppro, const char *who) : HttpRequest(REQUEST_DELETE, FORMAT, "contacts.skype.com/contacts/v2/users/SELF/contacts/8:%s", who) { Headers - << CHAR_VALUE("X-Skypetoken", li.api.szToken) + << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken) << CHAR_VALUE("Accept", "application/json") << CHAR_VALUE("Content-type", "application/x-www-form-urlencoded"); } @@ -98,11 +98,11 @@ public: class AuthAcceptRequest : public HttpRequest { public: - AuthAcceptRequest(LoginInfo &li, const char *who) : + AuthAcceptRequest(CSkypeProto *ppro, const char *who) : HttpRequest(REQUEST_PUT, FORMAT, "contacts.skype.com/contacts/v2/users/SELF/invites/8:%s/accept", who) { Headers - << CHAR_VALUE("X-Skypetoken", li.api.szToken) + << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken) << CHAR_VALUE("Accept", "application/json"); } }; @@ -110,11 +110,11 @@ public: class AuthDeclineRequest : public HttpRequest { public: - AuthDeclineRequest(LoginInfo &li, const char *who) : + AuthDeclineRequest(CSkypeProto *ppro, const char *who) : HttpRequest(REQUEST_PUT, FORMAT, "contacts.skype.com/contacts/v2/users/SELF/invites/8:%s/decline", who) { Headers - << CHAR_VALUE("X-Skypetoken", li.api.szToken) + << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken) << CHAR_VALUE("Accept", "application/json"); } }; @@ -122,11 +122,11 @@ public: class BlockContactRequest : public HttpRequest { public: - BlockContactRequest(LoginInfo &li, const char *who) : + BlockContactRequest(CSkypeProto *ppro, const char *who) : HttpRequest(REQUEST_PUT, FORMAT, "contacts.skype.com/contacts/v2/users/SELF/contacts/blocklist/8:%s", who) { Headers - << CHAR_VALUE("X-Skypetoken", li.api.szToken) + << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken) << CHAR_VALUE("Accept", "application/json") << CHAR_VALUE("Content-type", "application/x-www-form-urlencoded"); @@ -137,11 +137,11 @@ public: class UnblockContactRequest : public HttpRequest { public: - UnblockContactRequest(LoginInfo &li, const char *who) : + UnblockContactRequest(CSkypeProto *ppro, const char *who) : HttpRequest(REQUEST_DELETE, FORMAT, "contacts.skype.com/contacts/v2/users/SELF/contacts/blocklist/8:%s", who) { Headers - << CHAR_VALUE("X-Skypetoken", li.api.szToken) + << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken) << 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 70cc922fcd..fe9c3c6a3e 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 . class CreateEndpointRequest : public HttpRequest { public: - CreateEndpointRequest(LoginInfo &li) : - HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints", li.endpoint.szServer) + CreateEndpointRequest(CSkypeProto *ppro) : + HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints", ppro->m_szServer) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") - << FORMAT_VALUE("Authentication", "skypetoken=%s", li.api.szToken); + << FORMAT_VALUE("Authentication", "skypetoken=%s", ppro->m_szApiToken); Body << VALUE("{}"); } @@ -36,12 +36,12 @@ public: class DeleteEndpointRequest : public HttpRequest { public: - DeleteEndpointRequest(LoginInfo &li) : - HttpRequest(REQUEST_DELETE, FORMAT, "%s/v1/users/ME/endpoints/%s", li.endpoint.szServer, mir_urlEncode(li.endpoint.szId).c_str()) + DeleteEndpointRequest(CSkypeProto *ppro) : + HttpRequest(REQUEST_DELETE, FORMAT, "%s/v1/users/ME/endpoints/%s", ppro->m_szServer, mir_urlEncode(ppro->m_szId).c_str()) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); } }; diff --git a/protocols/SkypeWeb/src/requests/history.h b/protocols/SkypeWeb/src/requests/history.h index 2f82821b31..30294dff30 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 . class SyncHistoryFirstRequest : public HttpRequest { public: - SyncHistoryFirstRequest(int pageSize, LoginInfo &li) : - HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations", li.endpoint.szServer) + SyncHistoryFirstRequest(int pageSize, CSkypeProto *ppro) : + HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations", ppro->m_szServer) { Url << INT_VALUE("startTime", 0) @@ -31,17 +31,17 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8"); } - SyncHistoryFirstRequest(const char *url, LoginInfo &li) : + SyncHistoryFirstRequest(const char *url, CSkypeProto *ppro) : HttpRequest(REQUEST_GET, url) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8"); } }; @@ -49,8 +49,8 @@ public: class GetHistoryRequest : public HttpRequest { public: - 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, mir_urlEncode(username).c_str()) + GetHistoryRequest(const char *username, int pageSize, bool isChat, LONGLONG timestamp, CSkypeProto *ppro) : + HttpRequest(REQUEST_GET, FORMAT, "%s/v1/users/ME/conversations/%d:%s/messages", ppro->m_szServer, isChat ? 19 : 8, mir_urlEncode(username).c_str()) { Url << LONG_VALUE("startTime", timestamp) @@ -60,7 +60,7 @@ public: Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) << CHAR_VALUE("Content-Type", "application/json; charset = UTF-8"); } }; @@ -68,12 +68,12 @@ public: class GetHistoryOnUrlRequest : public HttpRequest { public: - GetHistoryOnUrlRequest(const char *url, LoginInfo &li) : + GetHistoryOnUrlRequest(const char *url, CSkypeProto *ppro) : HttpRequest(REQUEST_GET, url) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_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 d2cf5d69dc..949704cbea 100644 --- a/protocols/SkypeWeb/src/requests/messages.h +++ b/protocols/SkypeWeb/src/requests/messages.h @@ -21,12 +21,12 @@ along with this program. If not, see . class SendMessageRequest : public HttpRequest { public: - SendMessageRequest(const char *username, time_t timestamp, const char *message, LoginInfo &li, const char *MessageType = nullptr) : - HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", li.endpoint.szServer, username) + SendMessageRequest(const char *username, time_t timestamp, const char *message, CSkypeProto *ppro, const char *MessageType = nullptr) : + HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", ppro->m_szServer, username) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); JSONNode node; @@ -43,16 +43,16 @@ public: class SendActionRequest : public HttpRequest { public: - 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) + SendActionRequest(const char *username, time_t timestamp, const char *message, CSkypeProto *ppro) : + HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", ppro->m_szServer, username) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); CMStringA content; - content.AppendFormat("%s %s", li.szSkypename.c_str(), message); + content.AppendFormat("%s %s", ppro->m_szSkypename.c_str(), message); JSONNode node; node @@ -60,7 +60,7 @@ public: << JSONNode("messagetype", "RichText") << JSONNode("contenttype", "text") << JSONNode("content", content) - << JSONNode("skypeemoteoffset", li.szSkypename.GetLength() + 1); + << JSONNode("skypeemoteoffset", ppro->m_szSkypename.GetLength() + 1); Body << VALUE(node.write().c_str()); } @@ -69,12 +69,12 @@ public: class SendTypingRequest : public HttpRequest { public: - SendTypingRequest(const char *username, int iState, LoginInfo &li) : - HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", li.endpoint.szServer, mir_urlEncode(username).c_str()) + SendTypingRequest(const char *username, int iState, CSkypeProto *ppro) : + HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", ppro->m_szServer, mir_urlEncode(username).c_str()) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_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, 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) + MarkMessageReadRequest(const char *username, LONGLONG /*msgId*/, LONGLONG msgTimestamp, bool isChat, CSkypeProto *ppro) : + HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/conversations/%d:%s/properties?name=consumptionhorizon", ppro->m_szServer, !isChat ? 8 : 19, username) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_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 5caf2321ed..2c306ff958 100644 --- a/protocols/SkypeWeb/src/requests/poll.h +++ b/protocols/SkypeWeb/src/requests/poll.h @@ -21,14 +21,14 @@ along with this program. If not, see . class PollRequest : public HttpRequest { public: - PollRequest(LoginInfo &li) : - HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions/0/poll", li.endpoint.szServer) + PollRequest(CSkypeProto *ppro) : + HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions/0/poll", ppro->m_szServer) { timeout = 60000; flags |= NLHRF_PERSISTENT; Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_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 626896c30d..b6006b669f 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 . class GetProfileRequest : public HttpRequest { public: - GetProfileRequest(LoginInfo &li, const char *skypename = "self") : + GetProfileRequest(CSkypeProto *ppro, const char *skypename = "self") : HttpRequest(REQUEST_GET, FORMAT, "api.skype.com/users/%s/profile", skypename) { Headers - << CHAR_VALUE("X-Skypetoken", li.api.szToken) + << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken) << CHAR_VALUE("Accept", "application/json"); } }; diff --git a/protocols/SkypeWeb/src/requests/search.h b/protocols/SkypeWeb/src/requests/search.h index 244ba54838..da2fd1d501 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 . class GetSearchRequest : public HttpRequest { public: - GetSearchRequest(const char *string, LoginInfo &li) : + GetSearchRequest(const char *string, CSkypeProto *ppro) : HttpRequest(REQUEST_GET, "skypegraph.skype.com/search/v1.1/namesearch/swx/") { @@ -34,7 +34,7 @@ public: << CHAR_VALUE("searchstring", string); Headers << CHAR_VALUE("Accept", "application/json") - << CHAR_VALUE("X-Skypetoken", li.api.szToken); + << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken); } }; diff --git a/protocols/SkypeWeb/src/requests/status.h b/protocols/SkypeWeb/src/requests/status.h index db29fcf503..c66cbd8ec2 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 . class SetStatusRequest : public HttpRequest { public: - SetStatusRequest(const char *status, LoginInfo &li) : - HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/presenceDocs/messagingService", li.endpoint.szServer) + SetStatusRequest(const char *status, CSkypeProto *ppro) : + HttpRequest(REQUEST_PUT, FORMAT, "%s/v1/users/ME/presenceDocs/messagingService", ppro->m_szServer) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken) << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); JSONNode node(JSON_NODE); @@ -39,12 +39,12 @@ public: class SetStatusMsgRequest : public HttpRequest { public: - SetStatusMsgRequest(const char *status, LoginInfo &li) : + SetStatusMsgRequest(const char *status, CSkypeProto *ppro) : HttpRequest(REQUEST_POST, "api.skype.com/users/self/profile/partial") { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << CHAR_VALUE("X-Skypetoken", li.api.szToken) + << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken) << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8"); JSONNode node, payload; diff --git a/protocols/SkypeWeb/src/requests/subscriptions.h b/protocols/SkypeWeb/src/requests/subscriptions.h index 82c4eaaa0c..979c472639 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 . class CreateSubscriptionsRequest : public HttpRequest { public: - CreateSubscriptionsRequest(LoginInfo &li) : - HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions", li.endpoint.szServer) + CreateSubscriptionsRequest(CSkypeProto *ppro) : + HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions", ppro->m_szServer) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken) + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_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 LIST &skypenames, LoginInfo &li) : - HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/contacts", li.endpoint.szServer) + CreateContactsSubscriptionRequest(const LIST &skypenames, CSkypeProto *ppro) : + HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/contacts", ppro->m_szServer) { Headers << CHAR_VALUE("Accept", "application/json, text/javascript") << CHAR_VALUE("Content-Type", "application/json; charset=UTF-8") - << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", li.endpoint.szToken); + << FORMAT_VALUE("RegistrationToken", "registrationToken=%s", ppro->m_szToken); JSONNode node; diff --git a/protocols/SkypeWeb/src/requests/trouter.h b/protocols/SkypeWeb/src/requests/trouter.h index 7373a4ec57..cca90d1ed7 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(LoginInfo &li, const char *sr) : + CreateTrouterPoliciesRequest(CSkypeProto *ppro, 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", li.api.szToken); + << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken); JSONNode node; node << JSONNode("sr", sr); @@ -48,12 +48,12 @@ public: class RegisterTrouterRequest : public HttpRequest { public: - RegisterTrouterRequest(LoginInfo &li, const char *trouterUrl, const char *id) : + RegisterTrouterRequest(CSkypeProto *ppro, 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", li.api.szToken); + << CHAR_VALUE("X-Skypetoken", ppro->m_szApiToken); JSONNode clientDescription; clientDescription.set_name("clientDescription"); clientDescription diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp index b39a4bf90c..691290104b 100644 --- a/protocols/SkypeWeb/src/skype_avatars.cpp +++ b/protocols/SkypeWeb/src/skype_avatars.cpp @@ -181,7 +181,7 @@ INT_PTR CSkypeProto::SvcSetMyAvatar(WPARAM, LPARAM lParam) if (data != NULL && fread(data, sizeof(BYTE), length, hFile) == length) { const char *szMime = FreeImage_GetFIFMimeType(FreeImage_GetFIFFromFilenameU(path)); - PushRequest(new SetAvatarRequest(data, length, szMime, li), &CSkypeProto::OnSentAvatar); + PushRequest(new SetAvatarRequest(data, length, szMime, this), &CSkypeProto::OnSentAvatar); fclose(hFile); return 0; } diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 7965447c9b..ef6dfdf717 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -70,7 +70,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(), li), &CSkypeProto::OnSyncHistory); + PushRequest(new SyncHistoryFirstRequest(syncState.c_str(), this), &CSkypeProto::OnSyncHistory); for (size_t i = 0; i < conversations.size(); i++) { const JSONNode &conversation = conversations.at(i); @@ -81,7 +81,7 @@ void CSkypeProto::OnLoadChats(const NETLIBHTTPREQUEST *response) continue; CMStringW topic(threadProperties["topic"].as_mstring()); - SendRequest(new GetChatInfoRequest(id.as_string().c_str(), li), &CSkypeProto::OnGetChatInfo, topic.Detach()); + SendRequest(new GetChatInfoRequest(id.as_string().c_str(), this), &CSkypeProto::OnGetChatInfo, topic.Detach()); } } @@ -132,7 +132,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) MCONTACT hContact = dlg.m_hContact; if (hContact != NULL) - SendRequest(new InviteUserToChatRequest(chat_id, Contacts[hContact], "User", li)); + SendRequest(new InviteUserToChatRequest(chat_id, Contacts[hContact], "User", this)); { mir_cslock lck(m_InviteDialogsLock); @@ -148,7 +148,7 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) case 30: CMStringW newTopic = ChangeTopicForm(); if (!newTopic.IsEmpty()) - SendRequest(new SetChatPropertiesRequest(chat_id, "topic", T2Utf(newTopic.GetBuffer()), li)); + SendRequest(new SetChatPropertiesRequest(chat_id, "topic", T2Utf(newTopic.GetBuffer()), this)); break; } break; @@ -156,13 +156,13 @@ int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam) case GC_USER_NICKLISTMENU: switch (gch->dwData) { case 10: - SendRequest(new KickUserRequest(chat_id, user_id, li)); + SendRequest(new KickUserRequest(chat_id, user_id, this)); break; case 30: - SendRequest(new InviteUserToChatRequest(chat_id, user_id, "Admin", li)); + SendRequest(new InviteUserToChatRequest(chat_id, user_id, "Admin", this)); break; case 40: - SendRequest(new InviteUserToChatRequest(chat_id, user_id, "User", li)); + SendRequest(new InviteUserToChatRequest(chat_id, user_id, "User", this)); break; case 50: ptrA tnick_old(GetChatContactNick(chat_id, user_id, T2Utf(gch->ptszText))); @@ -229,7 +229,7 @@ INT_PTR CSkypeProto::OnLeaveChatRoom(WPARAM hContact, LPARAM) Chat_Control(m_szModuleName, idT, SESSION_OFFLINE); Chat_Terminate(m_szModuleName, idT); - SendRequest(new KickUserRequest(_T2A(idT), li.szSkypename, li)); + SendRequest(new KickUserRequest(_T2A(idT), m_szSkypename, this)); db_delete_contact(hContact); } @@ -251,7 +251,7 @@ void CSkypeProto::OnChatEvent(const JSONNode &node) int nEmoteOffset = node["skypeemoteoffset"].as_int(); if (FindChatRoom(szConversationName) == NULL) - SendRequest(new GetChatInfoRequest(szConversationName, li), &CSkypeProto::OnGetChatInfo, szTopic.Detach()); + SendRequest(new GetChatInfoRequest(szConversationName, this), &CSkypeProto::OnGetChatInfo, szTopic.Detach()); std::string messageType = node["messagetype"].as_string(); if (messageType == "Text" || messageType == "RichText") { @@ -336,9 +336,9 @@ void CSkypeProto::OnSendChatMessage(const char *chat_id, const wchar_t *tszMessa ptrA szMessage(mir_utf8encodeW(buf)); if (strncmp(szMessage, "/me ", 4) == 0) - SendRequest(new SendChatActionRequest(chat_id, time(0), szMessage, li)); + SendRequest(new SendChatActionRequest(chat_id, time(0), szMessage, this)); else - SendRequest(new SendChatMessageRequest(chat_id, time(0), szMessage, li)); + SendRequest(new SendChatMessageRequest(chat_id, time(0), szMessage, this)); } void CSkypeProto::AddMessageToChat(const char *chat_id, const char *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading) @@ -391,7 +391,7 @@ void CSkypeProto::OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p) std::string role = member["role"].as_string(); AddChatContact(chatId, username, username, role.c_str(), true); } - PushRequest(new GetHistoryRequest(chatId, 15, true, 0, li), &CSkypeProto::OnGetServerHistory); + PushRequest(new GetHistoryRequest(chatId, 15, true, 0, this), &CSkypeProto::OnGetServerHistory); } void CSkypeProto::RenameChat(const char *chat_id, const char *name) @@ -491,7 +491,7 @@ INT_PTR CSkypeProto::SvcCreateChat(WPARAM, LPARAM) if (!dlg.DoModal()) { return 1; } - SendRequest(new CreateChatroomRequest(dlg.m_ContactsList, li)); + SendRequest(new CreateChatroomRequest(dlg.m_ContactsList, this)); { 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 93b938e1e6..4ad569bf7e 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -254,13 +254,13 @@ void CSkypeProto::LoadContactList(const NETLIBHTTPREQUEST *response) LIST users(1); for (; i < skypenames.getCount() && users.getCount() <= 50; i++) users.insert(skypenames[i]); - PushRequest(new GetContactsInfoRequest(li, users), &CSkypeProto::LoadContactsInfo); + PushRequest(new GetContactsInfoRequest(this, users), &CSkypeProto::LoadContactsInfo); } while (i < skypenames.getCount()); FreeList(skypenames); skypenames.destroy(); } - PushRequest(new GetContactsAuthRequest(li), &CSkypeProto::LoadContactsAuth); + PushRequest(new GetContactsAuthRequest(this), &CSkypeProto::LoadContactsAuth); } INT_PTR CSkypeProto::OnRequestAuth(WPARAM hContact, LPARAM) @@ -268,7 +268,7 @@ INT_PTR CSkypeProto::OnRequestAuth(WPARAM hContact, LPARAM) if (hContact == INVALID_CONTACT_ID) return 1; - PushRequest(new AddContactRequest(li, Contacts[hContact])); + PushRequest(new AddContactRequest(this, Contacts[hContact])); return 0; } @@ -277,7 +277,7 @@ INT_PTR CSkypeProto::OnGrantAuth(WPARAM hContact, LPARAM) if (hContact == INVALID_CONTACT_ID) return 1; - PushRequest(new AuthAcceptRequest(li, Contacts[hContact])); + PushRequest(new AuthAcceptRequest(this, Contacts[hContact])); return 0; } @@ -285,7 +285,7 @@ void CSkypeProto::OnContactDeleted(MCONTACT hContact) { if (IsOnline()) if (hContact && !isChatRoom(hContact)) - PushRequest(new DeleteContactRequest(li, Contacts[hContact])); + PushRequest(new DeleteContactRequest(this, Contacts[hContact])); } INT_PTR CSkypeProto::BlockContact(WPARAM hContact, LPARAM) @@ -293,7 +293,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(li, Contacts[hContact]), &CSkypeProto::OnBlockContact, (void *)hContact); + SendRequest(new BlockContactRequest(this, Contacts[hContact]), &CSkypeProto::OnBlockContact, (void *)hContact); return 0; } @@ -308,7 +308,7 @@ void CSkypeProto::OnBlockContact(const NETLIBHTTPREQUEST *response, void *p) INT_PTR CSkypeProto::UnblockContact(WPARAM hContact, LPARAM) { - SendRequest(new UnblockContactRequest(li, Contacts[hContact]), &CSkypeProto::OnUnblockContact, (void *)hContact); + SendRequest(new UnblockContactRequest(this, Contacts[hContact]), &CSkypeProto::OnUnblockContact, (void *)hContact); return 0; } diff --git a/protocols/SkypeWeb/src/skype_dialogs.cpp b/protocols/SkypeWeb/src/skype_dialogs.cpp index 4a67b9316a..f692c146b4 100644 --- a/protocols/SkypeWeb/src/skype_dialogs.cpp +++ b/protocols/SkypeWeb/src/skype_dialogs.cpp @@ -88,7 +88,8 @@ void CSkypeGCCreateDlg::btnOk_OnOk(CCtrlButton*) } } } - m_ContactsList.insert(m_proto->li.szSkypename.GetBuffer()); + + m_ContactsList.insert(m_proto->m_szSkypename.GetBuffer()); EndDialog(m_hwnd, m_ContactsList.getCount()); } diff --git a/protocols/SkypeWeb/src/skype_files.cpp b/protocols/SkypeWeb/src/skype_files.cpp index 28a1f1e908..17cbab0b34 100644 --- a/protocols/SkypeWeb/src/skype_files.cpp +++ b/protocols/SkypeWeb/src/skype_files.cpp @@ -26,7 +26,7 @@ void CSkypeProto::SendFileThread(void *p) ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, (HANDLE)fup); T2Utf uszFileName(fup->tszFileName); - SendRequest(new ASMObjectCreateRequest(li, CMStringA(FORMAT, "%d:%s", isChatRoom(fup->hContact) ? 19 : 8, Contacts[fup->hContact]), strrchr((const char*)uszFileName + 1, '\\')), &CSkypeProto::OnASMObjectCreated, fup); + SendRequest(new ASMObjectCreateRequest(this, CMStringA(FORMAT, "%d:%s", isChatRoom(fup->hContact) ? 19 : 8, Contacts[fup->hContact]), strrchr((const char*)uszFileName + 1, '\\')), &CSkypeProto::OnASMObjectCreated, fup); } void CSkypeProto::OnASMObjectCreated(const NETLIBHTTPREQUEST *response, void *arg) @@ -59,7 +59,7 @@ void CSkypeProto::OnASMObjectCreated(const NETLIBHTTPREQUEST *response, void *ar } fup->size = lBytes; ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, (HANDLE)fup); - SendRequest(new ASMObjectUploadRequest(li, strObjectId.c_str(), pData, lBytes), &CSkypeProto::OnASMObjectUploaded, fup); + SendRequest(new ASMObjectUploadRequest(this, strObjectId.c_str(), pData, lBytes), &CSkypeProto::OnASMObjectUploaded, fup); fclose(pFile); } } @@ -94,7 +94,7 @@ void CSkypeProto::OnASMObjectUploaded(const NETLIBHTTPREQUEST *response, void *a tinyxml2::XMLPrinter printer(0, true); doc.Print(&printer); - SendRequest(new SendMessageRequest(Contacts[fup->hContact], time(NULL), printer.CStr(), li, "RichText/Media_GenericFile")); + SendRequest(new SendMessageRequest(Contacts[fup->hContact], time(NULL), printer.CStr(), this, "RichText/Media_GenericFile")); ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, (HANDLE)fup); delete fup; diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp index 2d05c40e54..025718215b 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(), li), &CSkypeProto::OnGetServerHistory); + PushRequest(new GetHistoryOnUrlRequest(syncState.c_str(), this), &CSkypeProto::OnGetServerHistory); for (int i = (int)conversations.size(); i >= 0; i--) { const JSONNode &message = conversations.at(i); @@ -104,7 +104,7 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response) INT_PTR CSkypeProto::GetContactHistory(WPARAM hContact, LPARAM) { - PushRequest(new GetHistoryRequest(Contacts[hContact], 100, false, 0, li), &CSkypeProto::OnGetServerHistory); + PushRequest(new GetHistoryRequest(Contacts[hContact], 100, false, 0, this), &CSkypeProto::OnGetServerHistory); return 0; } @@ -124,7 +124,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(), li), &CSkypeProto::OnSyncHistory); + PushRequest(new SyncHistoryFirstRequest(syncState.c_str(), this), &CSkypeProto::OnSyncHistory); for (size_t i = 0; i < conversations.size(); i++) { const JSONNode &conversation = conversations.at(i); @@ -139,7 +139,7 @@ void CSkypeProto::OnSyncHistory(const NETLIBHTTPREQUEST *response) MCONTACT hContact = FindContact(szSkypename); if (hContact != NULL) { if (getDword(hContact, "LastMsgTime", 0) < composeTime) { - PushRequest(new GetHistoryRequest(szSkypename, 100, false, 0, li), &CSkypeProto::OnGetServerHistory); + PushRequest(new GetHistoryRequest(szSkypename, 100, false, 0, this), &CSkypeProto::OnGetServerHistory); } } } diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index a00ecb9513..f82eaa67ce 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -26,10 +26,10 @@ void CSkypeProto::Login() requestQueue->Start(); int tokenExpires(getDword("TokenExpiresIn", 0)); - li.szSkypename = getStringA(SKYPE_SETTINGS_ID); + m_szSkypename = getMStringA(SKYPE_SETTINGS_ID); pass_ptrA szPassword(getStringA(SKYPE_SETTINGS_PASSWORD)); - if (li.szSkypename.IsEmpty() || szPassword == NULL) { + if (m_szSkypename.IsEmpty() || szPassword == NULL) { ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN); return; } @@ -111,11 +111,9 @@ void CSkypeProto::OnLoginSuccess() m_bThreadsTerminated = false; ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_SUCCESS, NULL, 0); - li.api.szToken = getStringA("TokenSecret"); + m_szApiToken = getStringA("TokenSecret"); - li.endpoint.szServer = ((ptrA(getStringA("Server")) == NULL) ? mir_strdup(SKYPE_ENDPOINTS_HOST) : getStringA("Server")); - - SendRequest(new CreateEndpointRequest(li), &CSkypeProto::OnEndpointCreated); + SendRequest(new CreateEndpointRequest(this), &CSkypeProto::OnEndpointCreated); } void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response) @@ -145,15 +143,14 @@ void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response) setString(szCookieName, szCookieVal); if (szCookieName == "registrationToken") - li.endpoint.szToken = szCookieVal.Detach(); + m_szToken = szCookieVal.Detach(); else if (szCookieName == "endpointId") - li.endpoint.szId = szCookieVal.Detach(); + m_szId = szCookieVal.Detach(); } } else if (!mir_strcmpi(response->headers[i].szName, "Location")) { CMStringA szValue = response->headers[i].szValue; - li.endpoint.szServer = GetServerFromUrl(szValue).Detach(); - setString("Server", li.endpoint.szServer); + m_szServer = GetServerFromUrl(szValue).Detach(); } } @@ -167,7 +164,7 @@ void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response) if (response->resultCode != 201) { if (response->resultCode == 401) { delSetting("TokenExpiresIn"); - SendRequest(new LoginOAuthRequest(li.szSkypename, pass_ptrA(getStringA(SKYPE_SETTINGS_PASSWORD))), &CSkypeProto::OnLoginOAuth); + SendRequest(new LoginOAuthRequest(m_szSkypename, pass_ptrA(getStringA(SKYPE_SETTINGS_PASSWORD))), &CSkypeProto::OnLoginOAuth); return; } if (response->resultCode == 400) { @@ -177,11 +174,11 @@ void CSkypeProto::OnEndpointCreated(const NETLIBHTTPREQUEST *response) return; } // it should be rewritten - SendRequest(new CreateEndpointRequest(li), &CSkypeProto::OnEndpointCreated); + SendRequest(new CreateEndpointRequest(this), &CSkypeProto::OnEndpointCreated); return; } - SendRequest(new CreateSubscriptionsRequest(li), &CSkypeProto::OnSubscriptionsCreated); + SendRequest(new CreateSubscriptionsRequest(this), &CSkypeProto::OnSubscriptionsCreated); } void CSkypeProto::OnSubscriptionsCreated(const NETLIBHTTPREQUEST *response) @@ -213,9 +210,9 @@ void CSkypeProto::SendPresence(bool isLogin) } if (isLogin) - SendRequest(new SendCapabilitiesRequest(epname, li), &CSkypeProto::OnCapabilitiesSended); + SendRequest(new SendCapabilitiesRequest(epname, this), &CSkypeProto::OnCapabilitiesSended); else - PushRequest(new SendCapabilitiesRequest(epname, li)); + PushRequest(new SendCapabilitiesRequest(epname, this)); } void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) @@ -229,32 +226,32 @@ void CSkypeProto::OnCapabilitiesSended(const NETLIBHTTPREQUEST *response) return; } - SendRequest(new SetStatusRequest(MirandaToSkypeStatus(m_iDesiredStatus), li), &CSkypeProto::OnStatusChanged); + SendRequest(new SetStatusRequest(MirandaToSkypeStatus(m_iDesiredStatus), this), &CSkypeProto::OnStatusChanged); LIST skypenames(1); for (auto &hContact : AccContacts()) if (!isChatRoom(hContact)) skypenames.insert(getStringA(hContact, SKYPE_SETTINGS_ID)); - SendRequest(new CreateContactsSubscriptionRequest(skypenames, li)); + SendRequest(new CreateContactsSubscriptionRequest(skypenames, this)); FreeList(skypenames); skypenames.destroy(); m_hPollingEvent.Set(); - SendRequest(new LoadChatsRequest(li), &CSkypeProto::OnLoadChats); + SendRequest(new LoadChatsRequest(this), &CSkypeProto::OnLoadChats); SendRequest(new CreateTrouterRequest(), &CSkypeProto::OnCreateTrouter); - PushRequest(new GetContactListRequest(li, nullptr), &CSkypeProto::LoadContactList); + PushRequest(new GetContactListRequest(this, nullptr), &CSkypeProto::LoadContactList); PushRequest(new GetAvatarRequest(ptrA(getStringA("AvatarUrl"))), &CSkypeProto::OnReceiveAvatar, NULL); if (m_opts.bAutoHistorySync) - PushRequest(new SyncHistoryFirstRequest(100, li), &CSkypeProto::OnSyncHistory); + PushRequest(new SyncHistoryFirstRequest(100, this), &CSkypeProto::OnSyncHistory); JSONNode root = JSONNode::parse(response->pData); if (root) setString("SelfEndpointName", UrlToSkypename(root["selfLink"].as_string().c_str())); - PushRequest(new GetProfileRequest(li), &CSkypeProto::LoadProfile, nullptr); + PushRequest(new GetProfileRequest(this), &CSkypeProto::LoadProfile, nullptr); } void CSkypeProto::OnStatusChanged(const NETLIBHTTPREQUEST *response) diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 80f054b2f8..565f4e1153 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -41,9 +41,9 @@ int CSkypeProto::OnSendMessage(MCONTACT hContact, int, const char *szMessage) ptrA username(getStringA(hContact, "Skypename")); if (strncmp(szMessage, "/me ", 4) == 0) - SendRequest(new SendActionRequest(username, param->hMessage, &szMessage[4], li), &CSkypeProto::OnMessageSent, param); + SendRequest(new SendActionRequest(username, param->hMessage, &szMessage[4], this), &CSkypeProto::OnMessageSent, param); else - SendRequest(new SendMessageRequest(username, param->hMessage, szMessage, li), &CSkypeProto::OnMessageSent, param); + SendRequest(new SendMessageRequest(username, param->hMessage, szMessage, this), &CSkypeProto::OnMessageSent, param); { mir_cslock lck(m_lckOutMessagesList); @@ -192,7 +192,7 @@ 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(Contacts[hContact], timestamp, timestamp, false, li)); + PushRequest(new MarkMessageReadRequest(Contacts[hContact], timestamp, timestamp, false, this)); } void CSkypeProto::ProcessContactRecv(MCONTACT hContact, time_t timestamp, const char *szContent, const char *szMessageId) diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp index cb3ea22bce..1e5b7b1586 100644 --- a/protocols/SkypeWeb/src/skype_polling.cpp +++ b/protocols/SkypeWeb/src/skype_polling.cpp @@ -28,7 +28,7 @@ void CSkypeProto::PollingThread(void*) int nErrors = 0; - PollRequest *request = new PollRequest(li); + PollRequest *request = new PollRequest(this); while ((nErrors < POLLING_ERRORS_LIMIT) && m_iStatus != ID_STATUS_OFFLINE) { request->nlc = m_pollingConnection; diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index 52be5e902f..58b28f3434 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -119,7 +119,7 @@ void CSkypeProto::InitLanguages() result[L"la"] = L"Latin"; result[L"lv"] = L"Latvian"; result[L"lb"] = L"Letzeburgesch"; - result[L"li"] = L"Limburgan"; + result[L"this"] = L"Limburgan"; result[L"ln"] = L"Lingala"; result[L"lt"] = L"Lithuanian"; result[L"lu"] = L"Luba-Katanga"; @@ -418,10 +418,10 @@ void CSkypeProto::LoadProfile(const NETLIBHTTPREQUEST *response, void *arg) return; } - if (li.szSkypename != username.c_str()) - li.szMyname = username.c_str(); + if (m_szSkypename != username.c_str()) + m_szMyname = username.c_str(); else - li.szMyname = li.szSkypename; + m_szMyname = m_szSkypename; UpdateProfileFirstName(root, hContact); UpdateProfileLastName(root, hContact); diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index ae1b3b104b..eb57d4741d 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -27,7 +27,8 @@ CSkypeProto::CSkypeProto(const char* protoName, const wchar_t* userName) : m_TrouterConnection(nullptr), m_pollingConnection(nullptr), m_opts(this), - Contacts(this) + Contacts(this), + m_szServer(mir_strdup(SKYPE_ENDPOINTS_HOST)) { InitNetwork(); @@ -126,13 +127,13 @@ INT_PTR CSkypeProto::GetCaps(int type, MCONTACT) int CSkypeProto::SetAwayMsg(int, const wchar_t *msg) { - PushRequest(new SetStatusMsgRequest(msg ? T2Utf(msg) : "", li)); + PushRequest(new SetStatusMsgRequest(msg ? T2Utf(msg) : "", this)); return 0; } HANDLE CSkypeProto::GetAwayMsg(MCONTACT hContact) { - PushRequest(new GetProfileRequest(li, Contacts[hContact]), [this, hContact](const NETLIBHTTPREQUEST *response) { + PushRequest(new GetProfileRequest(this, Contacts[hContact]), [this, hContact](const NETLIBHTTPREQUEST *response) { if (!response || !response->pData) return; @@ -192,7 +193,7 @@ int CSkypeProto::Authorize(MEVENT hDbEvent) if (hContact == INVALID_CONTACT_ID) return 1; - PushRequest(new AuthAcceptRequest(li, Contacts[hContact])); + PushRequest(new AuthAcceptRequest(this, Contacts[hContact])); return 0; } @@ -202,7 +203,7 @@ int CSkypeProto::AuthDeny(MEVENT hDbEvent, const wchar_t*) if (hContact == INVALID_CONTACT_ID) return 1; - PushRequest(new AuthDeclineRequest(li, Contacts[hContact])); + PushRequest(new AuthDeclineRequest(this, Contacts[hContact])); return 0; } @@ -216,7 +217,7 @@ int CSkypeProto::AuthRequest(MCONTACT hContact, const wchar_t *szMessage) if (hContact == INVALID_CONTACT_ID) return 1; - PushRequest(new AddContactRequest(li, Contacts[hContact], T2Utf(szMessage))); + PushRequest(new AddContactRequest(this, Contacts[hContact], T2Utf(szMessage))); return 0; } @@ -225,7 +226,7 @@ int CSkypeProto::GetInfo(MCONTACT hContact, int) if (isChatRoom(hContact)) return 1; - PushRequest(new GetProfileRequest(li, Contacts[hContact]), &CSkypeProto::LoadProfile, (void*)hContact); + PushRequest(new GetProfileRequest(this, Contacts[hContact]), &CSkypeProto::LoadProfile, (void*)hContact); return 0; } @@ -258,7 +259,7 @@ int CSkypeProto::SetStatus(int iNewStatus) if (iNewStatus == ID_STATUS_OFFLINE) { if (m_iStatus > ID_STATUS_CONNECTING + 1) { - SendRequest(new DeleteEndpointRequest(li)); + SendRequest(new DeleteEndpointRequest(this)); } m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE; // logout @@ -279,7 +280,7 @@ int CSkypeProto::SetStatus(int iNewStatus) Login(); } else { - SendRequest(new SetStatusRequest(MirandaToSkypeStatus(m_iDesiredStatus), li), &CSkypeProto::OnStatusChanged); + SendRequest(new SetStatusRequest(MirandaToSkypeStatus(m_iDesiredStatus), this), &CSkypeProto::OnStatusChanged); } } @@ -289,7 +290,7 @@ int CSkypeProto::SetStatus(int iNewStatus) int CSkypeProto::UserIsTyping(MCONTACT hContact, int type) { - SendRequest(new SendTypingRequest(Contacts[hContact], type, li)); + SendRequest(new SendTypingRequest(Contacts[hContact], type, this)); return 0; } diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 6c40be3f62..9cff9b5a9d 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -85,10 +85,10 @@ public: CSkypeOptions m_opts; -private: - - LoginInfo li; + ptrA m_szApiToken, m_szToken, m_szId, m_szServer; + CMStringA m_szSkypename, m_szMyname; +private: struct contacts_list { CSkypeProto *m_proto; @@ -121,7 +121,7 @@ private: static UINT_PTR m_timer; - RequestQueue *requestQueue; + class RequestQueue *requestQueue; bool m_bHistorySynced; @@ -135,6 +135,7 @@ private: LIST m_PopupClasses; LIST m_OutMessages; + // dialogs LIST m_InviteDialogs; LIST m_GCCreateDialogs; @@ -280,7 +281,6 @@ private: void OnUnblockContact(const NETLIBHTTPREQUEST *response, void *p); // messages - std::map m_mpOutMessagesIds; MEVENT GetMessageFromDb(const char *messageId); @@ -301,8 +301,7 @@ private: void OnGetServerHistory(const NETLIBHTTPREQUEST *response); void OnSyncHistory(const NETLIBHTTPREQUEST *response); - //chats - + // chats void InitGroupChatModule(); MCONTACT FindChatRoom(const char *chatname); @@ -328,7 +327,7 @@ private: void SetChatStatus(MCONTACT hContact, int iStatus); - //polling + // polling void __cdecl PollingThread (void*); void __cdecl ParsePollData (const char*); void ProcessEndpointPresence (const JSONNode &node); @@ -350,7 +349,7 @@ private: } __forceinline bool IsMe(const char *str) - { return (!mir_strcmpi(str, li.szMyname) || !mir_strcmp(str, ptrA(getStringA("SelfEndpointName")))); + { return (!mir_strcmpi(str, m_szMyname) || !mir_strcmp(str, 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 d71d825034..364318c1a5 100644 --- a/protocols/SkypeWeb/src/skype_search.cpp +++ b/protocols/SkypeWeb/src/skype_search.cpp @@ -27,7 +27,7 @@ void CSkypeProto::SearchBasicThread(void* id) { debugLogA("CSkypeProto::OnSearchBasicThread"); if (IsOnline()) - SendRequest(new GetSearchRequest(mir_urlEncode(T2Utf((wchar_t*)id)), li), &CSkypeProto::OnSearch); + SendRequest(new GetSearchRequest(mir_urlEncode(T2Utf((wchar_t*)id)), this), &CSkypeProto::OnSearch); } void CSkypeProto::OnSearch(const NETLIBHTTPREQUEST *response) diff --git a/protocols/SkypeWeb/src/skype_timers.cpp b/protocols/SkypeWeb/src/skype_timers.cpp index 34b12c2346..a88083bfd6 100644 --- a/protocols/SkypeWeb/src/skype_timers.cpp +++ b/protocols/SkypeWeb/src/skype_timers.cpp @@ -23,7 +23,7 @@ mir_cs CSkypeProto::accountsLock; void CSkypeProto::ProcessTimer() { if (IsOnline()) { - PushRequest(new GetContactListRequest(li, nullptr), &CSkypeProto::LoadContactList); + PushRequest(new GetContactListRequest(this, nullptr), &CSkypeProto::LoadContactList); SendPresence(false); } } diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index 1207beec23..2b046799dd 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -44,7 +44,7 @@ LBL_Error: TRouter.socketIo = socketio.as_string(); TRouter.url = url.as_string(); - SendRequest(new CreateTrouterPoliciesRequest(li, TRouter.connId.c_str()), &CSkypeProto::OnTrouterPoliciesCreated); + SendRequest(new CreateTrouterPoliciesRequest(this, TRouter.connId.c_str()), &CSkypeProto::OnTrouterPoliciesCreated); } void CSkypeProto::OnTrouterPoliciesCreated(const NETLIBHTTPREQUEST *response) @@ -96,7 +96,7 @@ void CSkypeProto::OnGetTrouter(const NETLIBHTTPREQUEST *response) m_hTrouterHealthEvent.Set(); if ((time(0) - TRouter.lastRegistrationTime) >= 3600) { - SendRequest(new RegisterTrouterRequest(li, TRouter.url.c_str(), TRouter.sessId.c_str())); + SendRequest(new RegisterTrouterRequest(this, TRouter.url.c_str(), TRouter.sessId.c_str())); TRouter.lastRegistrationTime = time(0); } } diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h index bf98658877..724a8bf128 100644 --- a/protocols/SkypeWeb/src/stdafx.h +++ b/protocols/SkypeWeb/src/stdafx.h @@ -63,35 +63,17 @@ 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; - - CMStringA szSkypename, szMyname; -}; - - struct TRInfo { std::string socketIo, - connId, - st, - se, - instance, - ccid, - sessId, - sig, - url; + connId, + st, + se, + instance, + ccid, + sessId, + sig, + url; time_t lastRegistrationTime; }; @@ -102,7 +84,6 @@ struct MessageId }; -//#include "websocket.h" #include "version.h" #include "resource.h" #include "skype_menus.h" @@ -112,6 +93,7 @@ struct MessageId #include "skype_utils.h" #include "skype_db.h" #include "http_request.h" +#include "skype_proto.h" #include "requests/login.h" #include "requests/profile.h" #include "requests/contacts.h" @@ -130,7 +112,6 @@ struct MessageId #include "requests/oauth.h" #include "requests/asm/files.h" #include "request_queue.h" -#include "skype_proto.h" void SkypeHttpResponse(const NETLIBHTTPREQUEST *response, void *arg); diff --git a/protocols/SkypeWeb/src/version.h b/protocols/SkypeWeb/src/version.h index 4f751ca9a7..73370ff417 100644 --- a/protocols/SkypeWeb/src/version.h +++ b/protocols/SkypeWeb/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 12 #define __RELEASE_NUM 3 -#define __BUILD_NUM 3 +#define __BUILD_NUM 4 #include -- cgit v1.2.3