summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/SkypeWeb/src')
-rw-r--r--protocols/SkypeWeb/src/main.cpp86
-rw-r--r--protocols/SkypeWeb/src/request_queue.cpp175
-rw-r--r--protocols/SkypeWeb/src/requests/capabilities.h41
-rw-r--r--protocols/SkypeWeb/src/requests/chatrooms.h92
-rw-r--r--protocols/SkypeWeb/src/requests/contacts.h89
-rw-r--r--protocols/SkypeWeb/src/requests/endpoint.h40
-rw-r--r--protocols/SkypeWeb/src/requests/files.h67
-rw-r--r--protocols/SkypeWeb/src/requests/history.h56
-rw-r--r--protocols/SkypeWeb/src/requests/login.h43
-rw-r--r--protocols/SkypeWeb/src/requests/messages.h58
-rw-r--r--protocols/SkypeWeb/src/requests/oauth.h74
-rw-r--r--protocols/SkypeWeb/src/requests/poll.h38
-rw-r--r--protocols/SkypeWeb/src/requests/profile.h33
-rw-r--r--protocols/SkypeWeb/src/requests/search.h33
-rw-r--r--protocols/SkypeWeb/src/requests/status.h32
-rw-r--r--protocols/SkypeWeb/src/requests/subscriptions.h56
-rw-r--r--protocols/SkypeWeb/src/resource.h44
-rw-r--r--protocols/SkypeWeb/src/skype_avatars.cpp232
-rw-r--r--protocols/SkypeWeb/src/skype_chatrooms.cpp605
-rw-r--r--protocols/SkypeWeb/src/skype_contacts.cpp293
-rw-r--r--protocols/SkypeWeb/src/skype_db.cpp53
-rw-r--r--protocols/SkypeWeb/src/skype_db.h37
-rw-r--r--protocols/SkypeWeb/src/skype_events.cpp143
-rw-r--r--protocols/SkypeWeb/src/skype_files.cpp246
-rw-r--r--protocols/SkypeWeb/src/skype_history_sync.cpp152
-rw-r--r--protocols/SkypeWeb/src/skype_icons.cpp35
-rw-r--r--protocols/SkypeWeb/src/skype_login.cpp325
-rw-r--r--protocols/SkypeWeb/src/skype_menus.cpp99
-rw-r--r--protocols/SkypeWeb/src/skype_menus.h30
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp325
-rw-r--r--protocols/SkypeWeb/src/skype_mood.cpp146
-rw-r--r--protocols/SkypeWeb/src/skype_oauth.cpp165
-rw-r--r--protocols/SkypeWeb/src/skype_options.cpp101
-rw-r--r--protocols/SkypeWeb/src/skype_polling.cpp180
-rw-r--r--protocols/SkypeWeb/src/skype_popups.cpp87
-rw-r--r--protocols/SkypeWeb/src/skype_profile.cpp148
-rw-r--r--protocols/SkypeWeb/src/skype_proto.cpp268
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h361
-rw-r--r--protocols/SkypeWeb/src/skype_search.cpp62
-rw-r--r--protocols/SkypeWeb/src/skype_utils.cpp895
-rw-r--r--protocols/SkypeWeb/src/skype_utils.h84
-rw-r--r--protocols/SkypeWeb/src/stdafx.cxx18
-rw-r--r--protocols/SkypeWeb/src/stdafx.h141
-rw-r--r--protocols/SkypeWeb/src/version.h13
44 files changed, 0 insertions, 6301 deletions
diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp
deleted file mode 100644
index d508708754..0000000000
--- a/protocols/SkypeWeb/src/main.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-CMPlugin g_plugin;
-
-char g_szMirVer[100];
-HANDLE g_hCallEvent;
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-PLUGININFOEX pluginInfoEx =
-{
- sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __COPYRIGHT,
- __AUTHORWEB,
- UNICODE_AWARE,
- // {57E90AC6-1067-423B-8CA3-70A39D200D4F}
- { 0x57e90ac6, 0x1067, 0x423b, { 0x8c, 0xa3, 0x70, 0xa3, 0x9d, 0x20, 0xd, 0x4f } }
-};
-
-CMPlugin::CMPlugin() :
- ACCPROTOPLUGIN<CSkypeProto>("SKYPE", pluginInfoEx),
- szDefaultServer("azeus1-client-s.gateway.messenger.live.com")
-{
- SetUniqueId(SKYPE_SETTINGS_ID);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static int OnModulesLoaded(WPARAM, LPARAM)
-{
- if (ServiceExists(MS_ASSOCMGR_ADDNEWURLTYPE)) {
- CreateServiceFunction(MODULE "/ParseUri", &CSkypeProto::GlobalParseSkypeUriService);
- AssocMgr_AddNewUrlTypeW("skype:", TranslateT("Skype Link Protocol"), g_plugin.getInst(), IDI_SKYPE, MODULE "/ParseUri", 0);
- }
- return 0;
-}
-
-int CMPlugin::Load()
-{
- Miranda_GetVersionText(g_szMirVer, sizeof(g_szMirVer));
-
- CSkypeProto::InitIcons();
- CSkypeProto::InitMenus();
-
- CreateServiceFunction(MODULE "/GetEventIcon", &CSkypeProto::SvcEventGetIcon);
- CreateServiceFunction(MODULE "/GetEventText", &CSkypeProto::SvcGetEventText);
-
- g_hCallEvent = CreateHookableEvent(MODULE "/IncomingCall");
-
- HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
-
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-int CMPlugin::Unload()
-{
- DestroyHookableEvent(g_hCallEvent);
- return 0;
-}
diff --git a/protocols/SkypeWeb/src/request_queue.cpp b/protocols/SkypeWeb/src/request_queue.cpp
deleted file mode 100644
index 7012d9998f..0000000000
--- a/protocols/SkypeWeb/src/request_queue.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-AsyncHttpRequest::AsyncHttpRequest(int type, SkypeHost host, LPCSTR url, MTHttpRequestHandler pFunc) :
- m_host(host)
-{
- switch (host) {
- case HOST_API: m_szUrl = "api.skype.com"; break;
- case HOST_PEOPLE: m_szUrl = "people.skype.com/v2"; break;
- case HOST_CONTACTS: m_szUrl = "edge.skype.com/pcs/contacts/v2"; break;
- case HOST_GRAPH: m_szUrl = "skypegraph.skype.com"; break;
- case HOST_LOGIN: m_szUrl = "login.skype.com"; break;
- case HOST_DEFAULT:
- m_szUrl.Format("%s/v1", g_plugin.szDefaultServer.c_str());
- break;
- }
-
- AddHeader("User-Agent", NETLIB_USER_AGENT);
-
- if (url)
- m_szUrl.Append(url);
- m_pFunc = pFunc;
- flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_DUMPASTEXT;
- requestType = type;
-}
-
-void AsyncHttpRequest::AddAuthentication(CSkypeProto *ppro)
-{
- AddHeader("Authentication", CMStringA("skypetoken=") + ppro->m_szApiToken);
-}
-
-void AsyncHttpRequest::AddRegister(CSkypeProto *ppro)
-{
- AddHeader("RegistrationToken", CMStringA("registrationToken=") + ppro->m_szToken);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-void CSkypeProto::StartQueue()
-{
- if (!m_isTerminated)
- return;
-
- m_isTerminated = false;
- if (m_hRequestQueueThread == nullptr)
- ForkThread(&CSkypeProto::WorkerThread);
-}
-
-void CSkypeProto::StopQueue()
-{
- m_isTerminated = true;
- m_iPollingId = -1;
-
- if (m_hRequestQueueThread)
- m_hRequestQueueEvent.Set();
-
- if (m_hPollingConn) {
- Netlib_Shutdown(m_hPollingConn);
- m_hPollingConn = 0;
- }
-}
-
-void CSkypeProto::PushRequest(AsyncHttpRequest *request)
-{
- if (m_isTerminated)
- return;
- {
- mir_cslock lock(m_requestQueueLock);
- m_requests.insert(request);
- }
- m_hRequestQueueEvent.Set();
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-MHttpResponse* CSkypeProto::DoSend(AsyncHttpRequest *pReq)
-{
- if (pReq->m_host != HOST_OTHER)
- pReq->m_szUrl.Insert(0, ((pReq->flags & NLHRF_SSL) ? "https://" : "http://"));
-
- if (!pReq->m_szParam.IsEmpty()) {
- switch (pReq->requestType) {
- case REQUEST_PUT:
- case REQUEST_POST:
- if (!pReq->FindHeader("Content-Type")) {
- if (pReq->m_szParam[0] == '[' || pReq->m_szParam[0] == '{')
- pReq->AddHeader("Content-Type", "application/json; charset=UTF-8");
- else
- pReq->AddHeader("Content-Type", "application/x-www-form-urlencoded");
- }
- }
- }
-
- switch (pReq->m_host) {
- case HOST_API:
- case HOST_PEOPLE:
- case HOST_CONTACTS:
- if (m_szApiToken)
- pReq->AddHeader("X-Skypetoken", m_szApiToken);
-
- pReq->AddHeader("Accept", "application/json");
- pReq->AddHeader("Origin", "https://web.skype.com");
- pReq->AddHeader("Referer", "https://web.skype.com/");
- break;
-
- case HOST_GRAPH:
- if (m_szApiToken)
- pReq->AddHeader("X-Skypetoken", m_szApiToken);
- pReq->AddHeader("Accept", "application/json");
- break;
-
- case HOST_DEFAULT:
- if (m_szToken)
- pReq->AddRegister(this);
- pReq->AddHeader("Accept", "application/json, text/javascript");
- break;
- }
-
- debugLogA("Send request to %s", pReq->m_szUrl.c_str());
-
- return Netlib_HttpTransaction(m_hNetlibUser, pReq);
-}
-
-void CSkypeProto::Execute(AsyncHttpRequest *item)
-{
- NLHR_PTR response(DoSend(item));
- if (item->m_pFunc != nullptr)
- (this->*item->m_pFunc)(response, item);
- m_requests.remove(item);
- delete item;
-}
-
-void CSkypeProto::WorkerThread(void*)
-{
- m_hRequestQueueThread = GetCurrentThread();
-
- while (true) {
- m_hRequestQueueEvent.Wait();
- if (m_isTerminated)
- break;
-
- while (true) {
- AsyncHttpRequest *item = nullptr;
- {
- mir_cslock lock(m_requestQueueLock);
-
- if (m_requests.getCount() == 0)
- break;
-
- item = m_requests[0];
- m_requests.remove(0);
- }
- if (item != nullptr)
- Execute(item);
- }
- }
-
- m_hRequestQueueThread = nullptr;
-}
diff --git a/protocols/SkypeWeb/src/requests/capabilities.h b/protocols/SkypeWeb/src/requests/capabilities.h
deleted file mode 100644
index e9def732ac..0000000000
--- a/protocols/SkypeWeb/src/requests/capabilities.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_REQUEST_CAPS_H_
-#define _SKYPE_REQUEST_CAPS_H_
-
-struct SendCapabilitiesRequest : public AsyncHttpRequest
-{
- SendCapabilitiesRequest(const char *hostname, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_PUT, HOST_DEFAULT, "/users/ME/endpoints/" + mir_urlEncode(ppro->m_szId) + "/presenceDocs/messagingService", &CSkypeProto::OnCapabilitiesSended)
- {
- JSONNode privateInfo; privateInfo.set_name("privateInfo");
- privateInfo << CHAR_PARAM("epname", hostname);
-
- JSONNode publicInfo; publicInfo.set_name("publicInfo");
- publicInfo << CHAR_PARAM("capabilities", "Audio|Video") << INT_PARAM("typ", 125)
- << CHAR_PARAM("skypeNameVersion", "Miranda NG Skype") << CHAR_PARAM("nodeInfo", "xx") << CHAR_PARAM("version", g_szMirVer);
-
- JSONNode node;
- node << CHAR_PARAM("id", "messagingService") << CHAR_PARAM("type", "EndpointPresenceDoc")
- << CHAR_PARAM("selfLink", "uri") << privateInfo << publicInfo;
-
- m_szParam = node.write().c_str();
- }
-};
-
-#endif //_SKYPE_REQUEST_CAPS_H_
diff --git a/protocols/SkypeWeb/src/requests/chatrooms.h b/protocols/SkypeWeb/src/requests/chatrooms.h
deleted file mode 100644
index 4bad87bc8a..0000000000
--- a/protocols/SkypeWeb/src/requests/chatrooms.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_REQUEST_CHATS_H_
-#define _SKYPE_REQUEST_CHATS_H_
-
-struct CreateChatroomRequest : public AsyncHttpRequest
-{
- CreateChatroomRequest(const LIST<char> &skypenames, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/threads")
- {
- //{"members":[{"id":"8:user3","role":"User"},{"id":"8:user2","role":"User"},{"id":"8:user1","role":"Admin"}]}
- JSONNode node;
- JSONNode members(JSON_ARRAY); members.set_name("members");
-
- for (auto &it : skypenames) {
- JSONNode member;
- member << CHAR_PARAM("id", it) << CHAR_PARAM("role", !mir_strcmpi(it, ppro->m_szSkypename) ? "Admin" : "User");
- members << member;
- }
- node << members;
- m_szParam = node.write().c_str();
- }
-};
-
-struct GetChatMembersRequest : public AsyncHttpRequest
-{
- GetChatMembersRequest(const LIST<char> &ids, SESSION_INFO *si) :
- AsyncHttpRequest(REQUEST_POST, HOST_PEOPLE, "/profiles", &CSkypeProto::OnGetChatMembers)
- {
- JSONNode node, mris(JSON_ARRAY); mris.set_name("mris");
- for (auto &it : ids)
- mris.push_back(JSONNode("", it));
- node << mris << CHAR_PARAM("locale", "en-US");
- m_szParam = node.write().c_str();
-
- pUserInfo = si;
- }
-};
-
-struct GetChatInfoRequest : public AsyncHttpRequest
-{
- GetChatInfoRequest(const wchar_t *chatId) :
- AsyncHttpRequest(REQUEST_GET, HOST_DEFAULT, 0, &CSkypeProto::OnGetChatInfo)
- {
- m_szUrl.AppendFormat("/threads/%S", chatId);
-
- this << CHAR_PARAM("view", "msnp24Equivalent");
- }
-};
-
-struct InviteUserToChatRequest : public AsyncHttpRequest
-{
- InviteUserToChatRequest(const char *chatId, const char *skypename, const char *role) :
- AsyncHttpRequest(REQUEST_PUT, HOST_DEFAULT)
- {
- m_szUrl.AppendFormat("/threads/%s/members/%s", chatId, skypename);
-
- JSONNode node;
- node << CHAR_PARAM("role", role);
- m_szParam = node.write().c_str();
- }
-};
-
-struct SetChatPropertiesRequest : public AsyncHttpRequest
-{
- SetChatPropertiesRequest(const char *chatId, const char *propname, const char *value) :
- AsyncHttpRequest(REQUEST_PUT, HOST_DEFAULT)
- {
- m_szUrl.AppendFormat("/threads/%s/properties?name=%s", chatId, propname);
-
- JSONNode node;
- node << CHAR_PARAM(propname, value);
- m_szParam = node.write().c_str();
- }
-};
-
-#endif //_SKYPE_REQUEST_CHATS_H_ \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/requests/contacts.h b/protocols/SkypeWeb/src/requests/contacts.h
deleted file mode 100644
index 6256087559..0000000000
--- a/protocols/SkypeWeb/src/requests/contacts.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_REQUEST_CONTACTS_H_
-#define _SKYPE_REQUEST_CONTACTS_H_
-
-struct GetContactListRequest : public AsyncHttpRequest
-{
- GetContactListRequest() :
- AsyncHttpRequest(REQUEST_GET, HOST_CONTACTS, "/users/SELF/contacts", &CSkypeProto::LoadContactList)
- {
- }
-};
-
-struct GetContactsAuthRequest : public AsyncHttpRequest
-{
- GetContactsAuthRequest() :
- AsyncHttpRequest(REQUEST_GET, HOST_CONTACTS, "/users/SELF/invites", &CSkypeProto::LoadContactsAuth)
- {
- }
-};
-
-struct AddContactRequest : public AsyncHttpRequest
-{
- AddContactRequest(const char *who, const char *greeting = "") :
- AsyncHttpRequest(REQUEST_PUT, HOST_CONTACTS, "/users/SELF/contacts")
- {
- JSONNode node;
- node << CHAR_PARAM("mri", who) << CHAR_PARAM("greeting", greeting);
- m_szParam = node.write().c_str();
- }
-};
-
-struct AuthAcceptRequest : public AsyncHttpRequest
-{
- AuthAcceptRequest(const char *who) :
- AsyncHttpRequest(REQUEST_PUT, HOST_CONTACTS)
- {
- m_szUrl.AppendFormat("/users/SELF/invites/%s/accept", mir_urlEncode(who).c_str());
- }
-};
-
-struct AuthDeclineRequest : public AsyncHttpRequest
-{
- AuthDeclineRequest(const char *who) :
- AsyncHttpRequest(REQUEST_PUT, HOST_CONTACTS)
- {
- m_szUrl.AppendFormat("/users/SELF/invites/%s/decline", mir_urlEncode(who).c_str());
- }
-};
-
-struct BlockContactRequest : public AsyncHttpRequest
-{
- BlockContactRequest(CSkypeProto *ppro, MCONTACT hContact) :
- AsyncHttpRequest(REQUEST_PUT, HOST_CONTACTS, "/users/SELF/contacts/blocklist/" + ppro->getId(hContact), &CSkypeProto::OnBlockContact)
- {
- m_szParam = "{\"report_abuse\":\"false\",\"ui_version\":\"skype.com\"}";
- pUserInfo = (void *)hContact;
- }
-};
-
-struct UnblockContactRequest : public AsyncHttpRequest
-{
- UnblockContactRequest(CSkypeProto *ppro, MCONTACT hContact) :
- AsyncHttpRequest(REQUEST_DELETE, HOST_CONTACTS, 0, &CSkypeProto::OnUnblockContact)
- {
- m_szUrl.AppendFormat("/users/SELF/contacts/blocklist/%s", ppro->getId(hContact).c_str());
- pUserInfo = (void *)hContact;
-
- // TODO: user ip address
- this << CHAR_PARAM("reporterIp", "123.123.123.123") << CHAR_PARAM("uiVersion", g_szMirVer);
- }
-};
-
-#endif //_SKYPE_REQUEST_CONTACTS_H_ \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/requests/endpoint.h b/protocols/SkypeWeb/src/requests/endpoint.h
deleted file mode 100644
index 4f15d4b534..0000000000
--- a/protocols/SkypeWeb/src/requests/endpoint.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_REQUEST_ENDPOINT_H_
-#define _SKYPE_REQUEST_ENDPOINT_H_
-
-struct CreateEndpointRequest : public AsyncHttpRequest
-{
- CreateEndpointRequest(CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/endpoints", &CSkypeProto::OnEndpointCreated)
- {
- m_szParam = "{}";
-
- AddAuthentication(ppro);
- }
-};
-
-struct DeleteEndpointRequest : public AsyncHttpRequest
-{
- DeleteEndpointRequest(CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_DELETE, HOST_DEFAULT, "/users/ME/endpoints/" + mir_urlEncode(ppro->m_szId), &CSkypeProto::OnEndpointDeleted)
- {
- }
-};
-
-#endif //_SKYPE_REQUEST_ENDPOINT_H_
diff --git a/protocols/SkypeWeb/src/requests/files.h b/protocols/SkypeWeb/src/requests/files.h
deleted file mode 100644
index 7c04baabfb..0000000000
--- a/protocols/SkypeWeb/src/requests/files.h
+++ /dev/null
@@ -1,67 +0,0 @@
-#pragma once
-
-struct ASMObjectCreateRequest : public AsyncHttpRequest
-{
- ASMObjectCreateRequest(CSkypeProto *ppro, CFileUploadParam *fup) :
- AsyncHttpRequest(REQUEST_POST, HOST_OTHER, "https://api.asm.skype.com/v1/objects", &CSkypeProto::OnASMObjectCreated)
- {
- flags &= (~NLHRF_DUMPASTEXT);
- pUserInfo = fup;
-
- AddHeader("Authorization", CMStringA(FORMAT, "skype_token %s", ppro->m_szApiToken.get()));
- AddHeader("Content-Type", "application/json");
- AddHeader("X-Client-Version", "0/0.0.0.0");
-
- CMStringA szContact(ppro->getId(fup->hContact));
- T2Utf uszFileName(fup->tszFileName);
- const char *szFileName = strrchr(uszFileName.get() + 1, '\\');
-
- JSONNode node;
- if (fup->isPicture)
- node << CHAR_PARAM("type", "pish/image");
- else
- node << CHAR_PARAM("type", "sharing/file");
-
- JSONNode jPermission(JSON_ARRAY); jPermission.set_name(szContact.c_str()); jPermission << CHAR_PARAM("", "read");
- JSONNode jPermissions; jPermissions.set_name("permissions"); jPermissions << jPermission;
- node << CHAR_PARAM("filename", szFileName) << jPermissions;
- m_szParam = node.write().c_str();
- }
-};
-
-struct ASMObjectUploadRequest : public AsyncHttpRequest
-{
- ASMObjectUploadRequest(CSkypeProto *ppro, const char *szObject, const uint8_t *data, int size, CFileUploadParam *fup) :
- AsyncHttpRequest(REQUEST_PUT, HOST_OTHER, 0, &CSkypeProto::OnASMObjectUploaded)
- {
- m_szUrl.AppendFormat("https://api.asm.skype.com/v1/objects/%s/content/%s",
- szObject, fup->isPicture ? "imgpsh" : "original");
- pUserInfo = fup;
-
- AddHeader("Authorization", CMStringA(FORMAT, "skype_token %s", ppro->m_szApiToken.get()));
- AddHeader("Content-Type", fup->isPicture ? "application" : "application/octet-stream");
-
- m_szParam.Truncate(size);
- memcpy(m_szParam.GetBuffer(), data, size);
- }
-};
-
-struct SendFileRequest : public AsyncHttpRequest
-{
- SendFileRequest(CFileUploadParam *fup, const char *username, const char *message) :
- AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, 0, &CSkypeProto::OnMessageSent)
- {
- m_szUrl.AppendFormat("/users/ME/conversations/%s/messages", mir_urlEncode(username).c_str());
-
- JSONNode ref(JSON_ARRAY); ref.set_name("amsreferences"); ref << CHAR_PARAM("", fup->uid);
-
- JSONNode node;
- if (fup->isPicture)
- node << CHAR_PARAM("messagetype", "RichText/UriObject");
- else
- node << CHAR_PARAM("messagetype", "RichText/Media_GenericFile");
-
- node << INT64_PARAM("clientmessageid", time(0)) << CHAR_PARAM("contenttype", "text") << CHAR_PARAM("content", message) << ref;
- m_szParam = node.write().c_str();
- }
-};
diff --git a/protocols/SkypeWeb/src/requests/history.h b/protocols/SkypeWeb/src/requests/history.h
deleted file mode 100644
index 4f25a2ec8c..0000000000
--- a/protocols/SkypeWeb/src/requests/history.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_REQUEST_HISTORY_H_
-#define _SKYPE_REQUEST_HISTORY_H_
-
-struct SyncConversations : public AsyncHttpRequest
-{
- SyncConversations() :
- AsyncHttpRequest(REQUEST_GET, HOST_DEFAULT, "/users/ME/conversations", &CSkypeProto::OnSyncConversations)
- {
- this << INT_PARAM("startTime", 0) << INT_PARAM("pageSize", 100)
- << CHAR_PARAM("view", "msnp24Equivalent") << CHAR_PARAM("targetType", "Passport|Skype|Lync|Thread");
- }
-};
-
-struct GetHistoryRequest : public AsyncHttpRequest
-{
- CMStringA m_who;
-
- GetHistoryRequest(MCONTACT _1, const char *who, int pageSize, int64_t timestamp, bool bOperative) :
- AsyncHttpRequest(REQUEST_GET, HOST_DEFAULT, "/users/ME/conversations/" + mir_urlEncode(who) + "/messages", &CSkypeProto::OnGetServerHistory),
- m_who(who)
- {
- hContact = _1;
- if (bOperative)
- pUserInfo = this;
-
- this << INT64_PARAM("startTime", timestamp) << INT_PARAM("pageSize", pageSize)
- << CHAR_PARAM("view", "msnp24Equivalent") << CHAR_PARAM("targetType", "Passport|Skype|Lync|Thread");
- }
-};
-
-struct EmptyHistoryRequest : public AsyncHttpRequest
-{
- EmptyHistoryRequest(const char *who) :
- AsyncHttpRequest(REQUEST_DELETE, HOST_DEFAULT, "/users/ME/conversations/" + mir_urlEncode(who) + "/messages")
- {
- }
-};
-
-#endif //_SKYPE_REQUEST_HISTORY_H_
diff --git a/protocols/SkypeWeb/src/requests/login.h b/protocols/SkypeWeb/src/requests/login.h
deleted file mode 100644
index 9d8423a183..0000000000
--- a/protocols/SkypeWeb/src/requests/login.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_REQUEST_LOGIN_H_
-#define _SKYPE_REQUEST_LOGIN_H_
-
-struct LoginOAuthRequest : public AsyncHttpRequest
-{
- LoginOAuthRequest(CMStringA username, const char *password) :
- AsyncHttpRequest(REQUEST_POST, HOST_API, "/login/skypetoken", &CSkypeProto::OnLoginOAuth)
- {
- username.MakeLower();
- const char *pszLogin = username;
- if (int iOffset = username.Find(':'))
- pszLogin += iOffset + 1;
-
- CMStringA hashStr(::FORMAT, "%s\nskyper\n%s", pszLogin, password);
-
- uint8_t digest[16];
- mir_md5_hash((const uint8_t*)hashStr.GetString(), hashStr.GetLength(), digest);
-
- this << CHAR_PARAM("scopes", "client")
- << CHAR_PARAM("clientVersion", mir_urlEncode("0/7.4.85.102/259/").c_str())
- << CHAR_PARAM("username", mir_urlEncode(pszLogin).c_str())
- << CHAR_PARAM("passwordHash", mir_urlEncode(ptrA(mir_base64_encode(digest, sizeof(digest)))).c_str());
- }
-};
-
-#endif //_SKYPE_REQUEST_LOGIN_H_
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h
deleted file mode 100644
index 345ce2e662..0000000000
--- a/protocols/SkypeWeb/src/requests/messages.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_REQUEST_MESSAGES_H_
-#define _SKYPE_REQUEST_MESSAGES_H_
-
-struct SendTypingRequest : public AsyncHttpRequest
-{
- SendTypingRequest(const char *username, int iState) :
- AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/conversations/" + mir_urlEncode(username) + "/messages")
- {
- const char *state = (iState == PROTOTYPE_SELFTYPING_ON) ? "Control/Typing" : "Control/ClearTyping";
-
- JSONNode node;
- node << INT_PARAM("clientmessageid", (long)time(NULL)) << CHAR_PARAM("messagetype", state)
- << CHAR_PARAM("contenttype", "text") << CHAR_PARAM("content", "");
- m_szParam = node.write().c_str();
- }
-};
-
-struct DeleteMessageRequest : public AsyncHttpRequest
-{
- DeleteMessageRequest(CSkypeProto *ppro, const char *username, const char *msgId) :
- AsyncHttpRequest(REQUEST_DELETE, HOST_DEFAULT, "/users/ME/conversations/" + mir_urlEncode(username) + "/messages/" + msgId)
- {
- AddAuthentication(ppro);
-
- AddHeader("Origin", "https://web.skype.com");
- AddHeader("Referer", "https://web.skype.com/");
- }
-};
-
-struct MarkMessageReadRequest : public AsyncHttpRequest
-{
- MarkMessageReadRequest(const char *username, int64_t msgTimestamp) :
- AsyncHttpRequest(REQUEST_PUT, HOST_DEFAULT, "/users/ME/conversations/" + mir_urlEncode(username) + "/properties?name=consumptionhorizon")
- {
- JSONNode node(JSON_NODE);
- node << CHAR_PARAM("consumptionhorizon", CMStringA(::FORMAT, "%lld;%lld;%lld", msgTimestamp, msgTimestamp, msgTimestamp));
- m_szParam = node.write().c_str();
- }
-};
-
-#endif //_SKYPE_REQUEST_MESSAGES_H_
diff --git a/protocols/SkypeWeb/src/requests/oauth.h b/protocols/SkypeWeb/src/requests/oauth.h
deleted file mode 100644
index f9e00a5262..0000000000
--- a/protocols/SkypeWeb/src/requests/oauth.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_REQUEST_OAUTH_H_
-#define _SKYPE_REQUEST_OAUTH_H_
-
-struct OAuthRequest : public AsyncHttpRequest
-{
- OAuthRequest() :
- AsyncHttpRequest(REQUEST_GET, HOST_OTHER, "https://login.live.com/login.srf", &CSkypeProto::OnOAuthStart)
- {
- flags |= NLHRF_REDIRECT;
-
- this << CHAR_PARAM("wa", "wsignin1.0") << CHAR_PARAM("wp", "MBI_SSL")
- << CHAR_PARAM("wreply", "https://lw.skype.com/login/oauth/proxy?site_name=lw.skype.com")
- << CHAR_PARAM("cobrandid", "90010");
- }
-
- OAuthRequest(const char *login, const char *password, const char *cookies, const char *ppft) :
- AsyncHttpRequest(REQUEST_POST, HOST_OTHER, "https://login.live.com/ppsecure/post.srf", &CSkypeProto::OnOAuthConfirm)
- {
- this << CHAR_PARAM("wa", "wsignin1.0") << CHAR_PARAM("wp", "MBI_SSL")
- << CHAR_PARAM("wreply", "https://lw.skype.com/login/oauth/proxy?site_name=lw.skype.com")
- << CHAR_PARAM("cobrandid", "90010");
- m_szUrl.AppendFormat("?%s", m_szParam.c_str());
- m_szParam.Empty();
-
- AddHeader("Cookie", cookies);
-
- if (auto *delim = strchr(login, ':'))
- login = delim + 1;
-
- this << CHAR_PARAM("login", login) << CHAR_PARAM("passwd", password) << CHAR_PARAM("PPFT", ppft);
- }
-
- OAuthRequest(const char *cookies, const char* ppft, const char* opid) :
- AsyncHttpRequest(REQUEST_POST, HOST_OTHER, "https://login.live.com/ppsecure/post.srf", &CSkypeProto::OnOAuthAuthorize)
- {
- this << CHAR_PARAM("wa", "wsignin1.0") << CHAR_PARAM("wp", "MBI_SSL")
- << CHAR_PARAM("wreply", "https://lw.skype.com/login/oauth/proxy?site_name=lw.skype.com")
- << CHAR_PARAM("cobrandid", "90010")
- << CHAR_PARAM("id", "293290")
- << CHAR_PARAM("opid", opid);
-
- m_szUrl.AppendFormat("?%s", m_szParam.c_str());
- m_szParam.Empty();
-
- AddHeader("Cookie", cookies);
-
- this << CHAR_PARAM("type", "28") << CHAR_PARAM("PPFT", ppft);
- }
-
- OAuthRequest(const char *t) :
- AsyncHttpRequest(REQUEST_POST, HOST_LOGIN, "/login/microsoft", &CSkypeProto::OnOAuthEnd)
- {
- this << CHAR_PARAM ("t", t) << CHAR_PARAM("site_name", "lw.skype.com") << INT_PARAM ("oauthPartner", 999);
- }
-};
-
-#endif //_SKYPE_REQUEST_OAUTH_H_
diff --git a/protocols/SkypeWeb/src/requests/poll.h b/protocols/SkypeWeb/src/requests/poll.h
deleted file mode 100644
index b0ea4de52a..0000000000
--- a/protocols/SkypeWeb/src/requests/poll.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_POLL_H_
-#define _SKYPE_POLL_H_
-
-struct PollRequest : public AsyncHttpRequest
-{
- PollRequest(CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/endpoints/" + mir_urlEncode(ppro->m_szId) + "/subscriptions/0/poll")
- {
- flags |= NLHRF_PERSISTENT;
- timeout = 120000;
-
- if (ppro->m_iPollingId != -1)
- m_szUrl.AppendFormat("?ackId=%d", ppro->m_iPollingId);
-
- AddHeader("Referer", "https://web.skype.com/main");
- AddHeader("ClientInfo", "os=Windows; osVer=8.1; proc=Win32; lcid=en-us; deviceType=1; country=n/a; clientName=swx-skype.com; clientVer=908/1.85.0.29");
- AddHeader("Accept", "application/json");
- AddHeader("Accept-Language", "en, C");
- }
-};
-#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
deleted file mode 100644
index 24f6125382..0000000000
--- a/protocols/SkypeWeb/src/requests/profile.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_REQUEST_PROFILE_H_
-#define _SKYPE_REQUEST_PROFILE_H_
-
-struct GetProfileRequest : public AsyncHttpRequest
-{
- GetProfileRequest(CSkypeProto *ppro, MCONTACT hContact) :
- AsyncHttpRequest(REQUEST_GET, HOST_API, 0, &CSkypeProto::LoadProfile)
- {
- m_szUrl.AppendFormat("/users/%s/profile", (hContact == 0) ? "self" : mir_urlEncode(ppro->getId(hContact)));
- pUserInfo = (void *)hContact;
-
- AddHeader("Accept", "application/json");
- }
-};
-
-#endif //_SKYPE_REQUEST_PROFILE_H_
diff --git a/protocols/SkypeWeb/src/requests/search.h b/protocols/SkypeWeb/src/requests/search.h
deleted file mode 100644
index 7abbf276de..0000000000
--- a/protocols/SkypeWeb/src/requests/search.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_REQUEST_SEARCH_H_
-#define _SKYPE_REQUEST_SEARCH_H_
-
-struct GetSearchRequest : public AsyncHttpRequest
-{
- GetSearchRequest(const char *string) :
- AsyncHttpRequest(REQUEST_GET, HOST_GRAPH, "/v2.0/search/", &CSkypeProto::OnSearch)
- {
- this << CHAR_PARAM("requestid", Utils_GenerateUUID())
- << CHAR_PARAM("locale", "en-US") << CHAR_PARAM("searchstring", string);
-
- AddHeader("Accept", "application/json");
- }
-};
-
-#endif //_SKYPE_REQUEST_SEARCH_H_
diff --git a/protocols/SkypeWeb/src/requests/status.h b/protocols/SkypeWeb/src/requests/status.h
deleted file mode 100644
index ba07bd7156..0000000000
--- a/protocols/SkypeWeb/src/requests/status.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_REQUEST_STATUS_H_
-#define _SKYPE_REQUEST_STATUS_H_
-
-struct SetStatusRequest : public AsyncHttpRequest
-{
- SetStatusRequest(const char *status) :
- AsyncHttpRequest(REQUEST_PUT, HOST_DEFAULT, "/users/ME/presenceDocs/messagingService", &CSkypeProto::OnStatusChanged)
- {
- JSONNode node(JSON_NODE);
- node << CHAR_PARAM("status", status);
- m_szParam = node.write().c_str();
- }
-};
-
-#endif //_SKYPE_REQUEST_STATUS_H_
diff --git a/protocols/SkypeWeb/src/requests/subscriptions.h b/protocols/SkypeWeb/src/requests/subscriptions.h
deleted file mode 100644
index 77711e4aef..0000000000
--- a/protocols/SkypeWeb/src/requests/subscriptions.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_REQUEST_SUBSCIPTIONS_H_
-#define _SKYPE_REQUEST_SUBSCIPTIONS_H_
-
-struct CreateSubscriptionsRequest : public AsyncHttpRequest
-{
- CreateSubscriptionsRequest() :
- AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/endpoints/SELF/subscriptions", &CSkypeProto::OnSubscriptionsCreated)
- {
- JSONNode interestedResources(JSON_ARRAY); interestedResources.set_name("interestedResources");
- interestedResources << CHAR_PARAM("", "/v1/users/ME/conversations/ALL/properties")
- << CHAR_PARAM("", "/v1/users/ME/conversations/ALL/messages")
- << CHAR_PARAM("", "/v1/users/ME/contacts/ALL")
- << CHAR_PARAM("", "/v1/threads/ALL");
-
- JSONNode node;
- node << CHAR_PARAM("channelType", "httpLongPoll") << CHAR_PARAM("template", "raw") << interestedResources;
- m_szParam = node.write().c_str();
- }
-};
-
-struct CreateContactsSubscriptionRequest : public AsyncHttpRequest
-{
- CreateContactsSubscriptionRequest(const LIST<char> &skypenames) :
- AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/contacts")
- {
- JSONNode contacts(JSON_ARRAY); contacts.set_name("contacts");
- for (auto &it : skypenames) {
- JSONNode contact;
- contact << CHAR_PARAM("id", it);
- contacts << contact;
- }
-
- JSONNode node;
- node << contacts;
- m_szParam = node.write().c_str();
- }
-};
-
-#endif //_SKYPE_REQUEST_SUBSCIPTIONS_H_
diff --git a/protocols/SkypeWeb/src/resource.h b/protocols/SkypeWeb/src/resource.h
deleted file mode 100644
index 2fc0d57719..0000000000
--- a/protocols/SkypeWeb/src/resource.h
+++ /dev/null
@@ -1,44 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by W:\miranda-ng\protocols\SkypeWeb\res\resource.rc
-//
-#define IDI_SKYPE 100
-#define IDC_SKYPENAME 101
-#define IDC_PASSWORD 102
-#define IDD_ACCOUNT_MANAGER 103
-#define IDD_OPTIONS_MAIN 104
-#define IDD_MOOD 105
-#define IDC_GROUP 106
-#define IDD_GC_CREATE 111
-#define IDD_GC_INVITE 112
-#define IDI_CONFERENCE 114
-#define IDI_BLOCKUSER 118
-#define IDI_UNBLOCKUSER 119
-#define IDI_CALL 120
-#define IDI_NOTIFY 121
-#define IDI_ERRORICON 122
-#define IDI_ACTION_ME 123
-#define IDC_AUTOSYNC 1028
-#define IDC_LOCALTIME 1029
-#define IDC_CLIST 1030
-#define IDC_TITLE 1031
-#define IDC_CONTACT 1032
-#define IDC_PLACE 1034
-#define IDC_USEHOST 1035
-#define IDC_BBCODES 1036
-#define IDC_MOOD_COMBO 1037
-#define IDC_CHANGEPASS 1038
-#define IDC_MOOD_EMOJI 1039
-#define IDC_EDIT1 1041
-#define IDC_MOOD_TEXT 1041
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 126
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1042
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/protocols/SkypeWeb/src/skype_avatars.cpp b/protocols/SkypeWeb/src/skype_avatars.cpp
deleted file mode 100644
index 342e32c571..0000000000
--- a/protocols/SkypeWeb/src/skype_avatars.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-void CSkypeProto::GetAvatarFileName(MCONTACT hContact, wchar_t *pszDest, size_t cbLen)
-{
- CMStringW wszPath(GetAvatarPath());
- wszPath += '\\';
-
- const wchar_t *szFileType = ProtoGetAvatarExtension(getByte(hContact, "AvatarType", PA_FORMAT_JPEG));
- CMStringA username(getId(hContact));
- username.Replace("live:", "__live_");
- username.Replace("facebook:", "__facebook_");
- wszPath.AppendFormat(L"%S%s", username.c_str(), szFileType);
-
- wcsncpy_s(pszDest, cbLen, wszPath, _TRUNCATE);
-}
-
-void CSkypeProto::ReloadAvatarInfo(MCONTACT hContact)
-{
- if (hContact == NULL) {
- ReportSelfAvatarChanged();
- return;
- }
-
- PROTO_AVATAR_INFORMATION ai = { 0 };
- ai.hContact = hContact;
- SvcGetAvatarInfo(0, (LPARAM)&ai);
-}
-
-void CSkypeProto::SetAvatarUrl(MCONTACT hContact, const CMStringW &tszUrl)
-{
- ptrW oldUrl(getWStringA(hContact, "AvatarUrl"));
- if (oldUrl != NULL)
- if (tszUrl == oldUrl)
- return;
-
- if (tszUrl.IsEmpty()) {
- delSetting(hContact, "AvatarUrl");
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, nullptr);
- }
- else {
- setWString(hContact, "AvatarUrl", tszUrl);
- setByte(hContact, "NeedNewAvatar", 1);
-
- PROTO_AVATAR_INFORMATION ai = {};
- ai.hContact = hContact;
- GetAvatarFileName(ai.hContact, ai.filename, _countof(ai.filename));
- ai.format = ProtoGetAvatarFormat(ai.filename);
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai);
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Avatar services for Miranda
-
-INT_PTR CSkypeProto::SvcGetAvatarCaps(WPARAM wParam, LPARAM lParam)
-{
- switch (wParam) {
- case AF_MAXSIZE:
- ((POINT*)lParam)->x = 98;
- ((POINT*)lParam)->y = 98;
- break;
-
- case AF_MAXFILESIZE:
- return 32000;
-
- case AF_PROPORTION:
- return PIP_SQUARE;
-
- case AF_FORMATSUPPORTED:
- case AF_ENABLED:
- case AF_DONTNEEDDELAYS:
- case AF_FETCHIFPROTONOTVISIBLE:
- case AF_FETCHIFCONTACTOFFLINE:
- return 1;
- }
- return 0;
-}
-
-INT_PTR CSkypeProto::SvcGetAvatarInfo(WPARAM, LPARAM lParam)
-{
- PROTO_AVATAR_INFORMATION *pai = (PROTO_AVATAR_INFORMATION *)lParam;
-
- pai->format = getByte(pai->hContact, "AvatarType", PA_FORMAT_JPEG);
-
- wchar_t tszFileName[MAX_PATH];
- GetAvatarFileName(pai->hContact, tszFileName, _countof(tszFileName));
- wcsncpy(pai->filename, tszFileName, _countof(pai->filename));
-
- if (::_waccess(pai->filename, 0) == 0 && !getBool(pai->hContact, "NeedNewAvatar", 0))
- return GAIR_SUCCESS;
-
- if (IsOnline())
- if (ReceiveAvatar(pai->hContact))
- return GAIR_WAITFOR;
-
- debugLogA("No avatar");
- return GAIR_NOAVATAR;
-}
-
-INT_PTR CSkypeProto::SvcGetMyAvatar(WPARAM wParam, LPARAM lParam)
-{
- wchar_t path[MAX_PATH];
- GetAvatarFileName(NULL, path, _countof(path));
- wcsncpy((wchar_t *)wParam, path, (int)lParam);
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Avatars' receiving
-
-struct GetAvatarRequest : public AsyncHttpRequest
-{
- GetAvatarRequest(const char *url, MCONTACT hContact) :
- AsyncHttpRequest(REQUEST_GET, HOST_OTHER, url, &CSkypeProto::OnReceiveAvatar)
- {
- flags |= NLHRF_REDIRECT;
- pUserInfo = (void *)hContact;
- }
-};
-
-void CSkypeProto::OnReceiveAvatar(MHttpResponse *response, AsyncHttpRequest *pRequest)
-{
- if (response == nullptr || response->body.IsEmpty())
- return;
-
- MCONTACT hContact = (DWORD_PTR)pRequest->pUserInfo;
- if (response->resultCode != 200)
- return;
-
- PROTO_AVATAR_INFORMATION ai = { 0 };
- ai.format = ProtoGetBufferFormat(response->body);
- setByte(hContact, "AvatarType", ai.format);
- GetAvatarFileName(hContact, ai.filename, _countof(ai.filename));
-
- FILE *out = _wfopen(ai.filename, L"wb");
- if (out == nullptr) {
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &ai, 0);
- return;
- }
-
- fwrite(response->body, 1, response->body.GetLength(), out);
- fclose(out);
- setByte(hContact, "NeedNewAvatar", 0);
- ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai, 0);
-}
-
-bool CSkypeProto::ReceiveAvatar(MCONTACT hContact)
-{
- ptrA szUrl(getStringA(hContact, "AvatarUrl"));
- if (!mir_strlen(szUrl))
- return false;
-
- PushRequest(new GetAvatarRequest(szUrl, hContact));
- debugLogA("Requested to read an avatar from '%s'", szUrl.get());
- return true;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Setting my own avatar
-
-struct SetAvatarRequest : public AsyncHttpRequest
-{
- SetAvatarRequest(const uint8_t *data, int dataSize, const char *szMime, CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_PUT, HOST_API, 0, &CSkypeProto::OnSentAvatar)
- {
- m_szUrl.AppendFormat("/users/%s/profile/avatar", ppro->m_szSkypename.MakeLower().c_str());
-
- AddHeader("Content-Type", szMime);
-
- m_szParam.Truncate(dataSize);
- memcpy(m_szParam.GetBuffer(), data, dataSize);
- }
-};
-
-void CSkypeProto::OnSentAvatar(MHttpResponse *response, AsyncHttpRequest*)
-{
- JsonReply root(response);
- if (root.error())
- return;
-}
-
-INT_PTR CSkypeProto::SvcSetMyAvatar(WPARAM, LPARAM lParam)
-{
- wchar_t *path = (wchar_t*)lParam;
- wchar_t avatarPath[MAX_PATH];
- GetAvatarFileName(NULL, avatarPath, _countof(avatarPath));
- if (path != nullptr) {
- if (CopyFile(path, avatarPath, FALSE)) {
- FILE *hFile = _wfopen(path, L"rb");
- if (hFile) {
- fseek(hFile, 0, SEEK_END);
- size_t length = ftell(hFile);
- if (length != -1) {
- rewind(hFile);
-
- mir_ptr<uint8_t> data((uint8_t*)mir_alloc(length));
-
- if (data != NULL && fread(data, sizeof(uint8_t), length, hFile) == length) {
- const char *szMime = FreeImage_GetFIFMimeType(FreeImage_GetFIFFromFilenameU(path));
-
- PushRequest(new SetAvatarRequest(data, (int)length, szMime, this));
- fclose(hFile);
- return 0;
- }
- }
- fclose(hFile);
- }
- }
- return -1;
- }
- else if (IsFileExists(avatarPath))
- DeleteFile(avatarPath);
-
- return 0;
-}
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp
deleted file mode 100644
index e73fc74629..0000000000
--- a/protocols/SkypeWeb/src/skype_chatrooms.cpp
+++ /dev/null
@@ -1,605 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-void CSkypeProto::InitGroupChatModule()
-{
- GCREGISTER gcr = {};
- gcr.dwFlags = GC_DATABASE | GC_PERSISTENT;
- gcr.iMaxText = 0;
- gcr.ptszDispName = m_tszUserName;
- gcr.pszModule = m_szModuleName;
- Chat_Register(&gcr);
-
- HookProtoEvent(ME_GC_EVENT, &CSkypeProto::OnGroupChatEventHook);
- HookProtoEvent(ME_GC_BUILDMENU, &CSkypeProto::OnGroupChatMenuHook);
-
- CreateProtoService(PS_JOINCHAT, &CSkypeProto::OnJoinChatRoom);
- CreateProtoService(PS_LEAVECHAT, &CSkypeProto::OnLeaveChatRoom);
-}
-
-SESSION_INFO* CSkypeProto::StartChatRoom(const wchar_t *tid, const wchar_t *tname, const char *pszVersion)
-{
- // Create the group chat session
- SESSION_INFO *si = Chat_NewSession(GCW_CHATROOM, m_szModuleName, tid, tname);
- if (!si)
- return nullptr;
-
- bool bFetchInfo = si->arUsers.getCount() == 0;
- if (pszVersion) {
- CMStringA oldVersion(getMStringA(si->hContact, "Version"));
- if (oldVersion != pszVersion)
- bFetchInfo = true;
- }
-
- if (bFetchInfo) {
- // Create user statuses
- Chat_AddGroup(si, TranslateT("Admin"));
- Chat_AddGroup(si, TranslateT("User"));
-
- PushRequest(new GetChatInfoRequest(tid));
- }
-
- // Finish initialization
- Chat_Control(si, (getBool("HideChats", 1) ? WINDOW_HIDDEN : SESSION_INITDONE));
- Chat_Control(si, SESSION_ONLINE);
- return si;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Group chat invitation dialog
-
-class CSkypeInviteDlg : public CSkypeDlgBase
-{
- CCtrlCombo m_combo;
-
-public:
- MCONTACT m_hContact = 0;
-
- CSkypeInviteDlg(CSkypeProto *proto) :
- CSkypeDlgBase(proto, IDD_GC_INVITE),
- m_combo(this, IDC_CONTACT)
- {}
-
- bool OnInitDialog() override
- {
- for (auto &hContact : m_proto->AccContacts())
- if (!m_proto->isChatRoom(hContact))
- m_combo.AddString(Clist_GetContactDisplayName(hContact), hContact);
- return true;
- }
-
- bool OnApply() override
- {
- m_hContact = m_combo.GetCurData();
- return true;
- }
-};
-
-int CSkypeProto::OnGroupChatEventHook(WPARAM, LPARAM lParam)
-{
- GCHOOK *gch = (GCHOOK*)lParam;
- if (!gch)
- return 0;
-
- auto *si = gch->si;
- if (mir_strcmp(si->pszModule, m_szModuleName) != 0)
- return 0;
-
- T2Utf chat_id(si->ptszID), user_id(gch->ptszUID);
-
- switch (gch->iType) {
- case GC_USER_MESSAGE:
- SendChatMessage(si, gch->ptszText);
- break;
-
- case GC_USER_PRIVMESS:
- {
- MCONTACT hContact = FindContact(user_id);
- if (hContact == NULL) {
- hContact = AddContact(user_id, T2Utf(gch->ptszNick), true);
- setWord(hContact, "Status", ID_STATUS_ONLINE);
- Contact::Hide(hContact);
- }
- CallService(MS_MSG_SENDMESSAGEW, hContact, 0);
- }
- break;
-
- case GC_USER_LOGMENU:
- switch (gch->dwData) {
- case 10:
- {
- CSkypeInviteDlg dlg(this);
- if (dlg.DoModal())
- if (dlg.m_hContact != NULL)
- PushRequest(new InviteUserToChatRequest(chat_id, getId(dlg.m_hContact), "User"));
- }
- break;
-
- case 20:
- OnLeaveChatRoom(si->hContact, NULL);
- break;
-
- case 30:
- CMStringW newTopic = ChangeTopicForm();
- if (!newTopic.IsEmpty())
- PushRequest(new SetChatPropertiesRequest(chat_id, "topic", T2Utf(newTopic.GetBuffer())));
- break;
- }
- break;
-
- case GC_USER_NICKLISTMENU:
- switch (gch->dwData) {
- case 10:
- KickChatUser(chat_id, user_id);
- break;
- case 30:
- PushRequest(new InviteUserToChatRequest(chat_id, user_id, "Admin"));
- break;
- case 40:
- PushRequest(new InviteUserToChatRequest(chat_id, user_id, "User"));
- break;
- case 50:
- ptrW tnick_old(GetChatContactNick(si->hContact, gch->ptszUID, gch->ptszText));
-
- ENTER_STRING pForm = {};
- pForm.type = ESF_COMBO;
- pForm.caption = TranslateT("Enter new nickname");
- pForm.szModuleName = m_szModuleName;
- pForm.szDataPrefix = "renamenick_";
-
- if (EnterString(&pForm)) {
- if (si->hContact == NULL)
- break; // This probably shouldn't happen, but if chat is NULL for some reason, do nothing
-
- ptrW tnick_new(pForm.ptszResult);
- bool reset = mir_wstrlen(tnick_new) == 0;
- if (reset) {
- // User fill blank name, which means we reset the custom nick
- db_unset(si->hContact, "UsersNicks", user_id);
- tnick_new = GetChatContactNick(si->hContact, gch->ptszUID, gch->ptszText);
- }
-
- if (!mir_wstrcmp(tnick_old, tnick_new))
- break; // New nick is same, do nothing
-
- GCEVENT gce = { si, GC_EVENT_NICK };
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.pszNick.w = tnick_old;
- gce.bIsMe = IsMe(user_id);
- gce.pszUID.w = gch->ptszUID;
- gce.pszText.w= tnick_new;
- gce.time = time(0);
- Chat_Event(&gce);
-
- if (!reset)
- db_set_ws(si->hContact, "UsersNicks", user_id, tnick_new);
- }
- break;
- }
- break;
- }
- return 1;
-}
-
-INT_PTR CSkypeProto::OnJoinChatRoom(WPARAM hContact, LPARAM)
-{
- if (hContact) {
- ptrW idT(getWStringA(hContact, SKYPE_SETTINGS_ID));
- ptrW nameT(getWStringA(hContact, "Nick"));
- StartChatRoom(idT, nameT != NULL ? nameT : idT);
- }
- return 0;
-}
-
-INT_PTR CSkypeProto::OnLeaveChatRoom(WPARAM hContact, LPARAM)
-{
- if (!IsOnline())
- return 1;
-
- if (hContact && IDYES == MessageBox(nullptr, TranslateT("This chat is going to be destroyed forever with all its contents. This action cannot be undone. Are you sure?"), TranslateT("Warning"), MB_YESNO | MB_ICONQUESTION)) {
- ptrW idT(getWStringA(hContact, SKYPE_SETTINGS_ID));
- auto *si = Chat_Find(idT, m_szModuleName);
- Chat_Control(si, SESSION_OFFLINE);
- Chat_Terminate(si);
-
- db_delete_contact(hContact, CDF_DEL_CONTACT);
- }
- return 0;
-}
-
-/* CHAT EVENT */
-
-bool CSkypeProto::OnChatEvent(const JSONNode &node)
-{
- CMStringW wszChatId(UrlToSkypeId(node["conversationLink"].as_mstring()));
- CMStringW szFromId(UrlToSkypeId(node["from"].as_mstring()));
-
- CMStringW wszTopic(node["threadtopic"].as_mstring());
- CMStringW wszContent(node["content"].as_mstring());
-
- SESSION_INFO *si = Chat_Find(wszChatId, m_szModuleName);
- if (si == nullptr) {
- si = StartChatRoom(wszChatId, wszTopic);
- if (si == nullptr) {
- debugLogW(L"unable to create chat %s", wszChatId.c_str());
- return true;
- }
- }
-
- std::string messageType = node["messagetype"].as_string();
- if (messageType == "ThreadActivity/AddMember") {
- // <addmember><eventtime>1429186229164</eventtime><initiator>8:initiator</initiator><target>8:user</target></addmember>
- TiXmlDocument doc;
- if (!doc.Parse(T2Utf(wszContent))) {
- if (auto *pRoot = doc.FirstChildElement("addMember")) {
- CMStringW target = Utf2T(XmlGetChildText(pRoot, "target"));
- if (!AddChatContact(si, target, L"User")) {
- OBJLIST<char> arIds(1);
- arIds.insert(mir_u2a(target));
- PushRequest(new GetChatMembersRequest(arIds, si));
- }
- }
- }
- return true;
- }
-
- if (messageType == "ThreadActivity/DeleteMember") {
- // <deletemember><eventtime>1429186229164</eventtime><initiator>8:initiator</initiator><target>8:user</target></deletemember>
- TiXmlDocument doc;
- if (!doc.Parse(T2Utf(wszContent))) {
- if (auto *pRoot = doc.FirstChildElement("deletemember")) {
- CMStringW target = Utf2T(UrlToSkypeId(XmlGetChildText(pRoot, "target")));
- CMStringW initiator = Utf2T(XmlGetChildText(pRoot, "initiator"));
- RemoveChatContact(si, target, true, initiator);
- }
- }
- return true;
- }
-
- if (messageType == "ThreadActivity/TopicUpdate") {
- // <topicupdate><eventtime>1429532702130</eventtime><initiator>8:user</initiator><value>test topic</value></topicupdate>
- TiXmlDocument doc;
- if (!doc.Parse(T2Utf(wszContent))) {
- if (auto *pRoot = doc.FirstChildElement("topicupdate")) {
- CMStringW initiator = Utf2T(XmlGetChildText(pRoot, "initiator"));
- CMStringW value = Utf2T(XmlGetChildText(pRoot, "value"));
- Chat_ChangeSessionName(si, value);
-
- GCEVENT gce = { si, GC_EVENT_TOPIC };
- gce.pszUID.w = initiator;
- gce.pszNick.w = GetSkypeNick(initiator);
- gce.pszText.w = wszTopic;
- Chat_Event(&gce);
- }
- }
- return true;
- }
-
- if (messageType == "ThreadActivity/RoleUpdate") {
- // <roleupdate><eventtime>1429551258363</eventtime><initiator>8:user</initiator><target><id>8:user1</id><role>admin</role></target></roleupdate>
- TiXmlDocument doc;
- if (!doc.Parse(T2Utf(wszContent))) {
- if (auto *pRoot = doc.FirstChildElement("roleupdate")) {
- CMStringW initiator = Utf2T(UrlToSkypeId(XmlGetChildText(pRoot, "initiator")));
-
- auto *pTarget = pRoot->FirstChildElement("target");
- if (pTarget) {
- CMStringW id = Utf2T(UrlToSkypeId(XmlGetChildText(pTarget, "id")));
- const char *role = XmlGetChildText(pTarget, "role");
-
- GCEVENT gce = { si, !mir_strcmpi(role, "Admin") ? GC_EVENT_ADDSTATUS : GC_EVENT_REMOVESTATUS };
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.pszNick.w = id;
- gce.pszUID.w = id;
- gce.pszText.w = initiator;
- gce.time = time(0);
- gce.bIsMe = IsMe(T2Utf(id));
- gce.pszStatus.w = TranslateT("Admin");
- Chat_Event(&gce);
- }
- }
- }
- return true;
- }
-
- // some slack, let's drop it
- if (messageType == "ThreadActivity/HistoryDisclosedUpdate" || messageType == "ThreadActivity/JoiningEnabledUpdate")
- return true;
-
- return false;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-void CSkypeProto::SendChatMessage(SESSION_INFO *si, const wchar_t *tszMessage)
-{
- if (!IsOnline())
- return;
-
- CMStringA szMessage(ptrA(mir_utf8encodeW(tszMessage)));
- szMessage.TrimRight();
- bool bRich = AddBbcodes(szMessage);
-
- CMStringA szUrl = "/users/ME/conversations/" + mir_urlEncode(T2Utf(si->ptszID)) + "/messages";
- AsyncHttpRequest *pReq = new AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, szUrl, &CSkypeProto::OnMessageSent);
-
- JSONNode node;
- node << CHAR_PARAM("clientmessageid", CMStringA(::FORMAT, "%llu000", (ULONGLONG)time(0)))
- << CHAR_PARAM("messagetype", bRich ? "RichText" : "Text") << CHAR_PARAM("contenttype", "text") << CHAR_PARAM("content", szMessage);
- if (strncmp(szMessage, "/me ", 4) == 0)
- node << INT_PARAM("skypeemoteoffset", 4);
- pReq->m_szParam = node.write().c_str();
-
- PushRequest(pReq);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-void CSkypeProto::OnGetChatMembers(MHttpResponse *response, AsyncHttpRequest *pRequest)
-{
- JsonReply reply(response);
- if (reply.error())
- return;
-
- auto &root = reply.data();
- auto *si = (SESSION_INFO *)pRequest->pUserInfo;
-
- for (auto &it : root["profiles"]) {
- CMStringW wszUserId(Utf2T(it.name()));
- if (auto *pUser = g_chatApi.UM_FindUser(si, wszUserId)) {
- auto &pProfile = it["profile"];
- if (auto &pName = pProfile["displayName"])
- replaceStrW(pUser->pszNick, pName.as_mstring());
- }
- }
-
- g_chatApi.OnChangeNick(si);
-}
-
-void CSkypeProto::OnGetChatInfo(MHttpResponse *response, AsyncHttpRequest*)
-{
- JsonReply reply(response);
- if (reply.error())
- return;
-
- auto &root = reply.data();
- const JSONNode &properties = root["properties"];
- if (!properties["capabilities"] || properties["capabilities"].empty())
- return;
-
- CMStringW wszChatId(UrlToSkypeId(root["messages"].as_mstring()));
- auto *si = Chat_Find(wszChatId, m_szModuleName);
- if (si == nullptr)
- return;
-
- setString(si->hContact, "Version", root["version"].as_string().c_str());
-
- OBJLIST<char> arIds(1);
- for (auto &member : root["members"]) {
- CMStringW username(UrlToSkypeId(member["userLink"].as_mstring()));
- CMStringW role = member["role"].as_mstring();
- if (!AddChatContact(si, username, role, true))
- arIds.insert(newStr(mir_u2a(username)));
- }
-
- if (arIds.getCount())
- PushRequest(new GetChatMembersRequest(arIds, si));
-
- PushRequest(new GetHistoryRequest(si->hContact, T2Utf(si->ptszID), 100, 0, true));
-}
-
-wchar_t* CSkypeProto::GetChatContactNick(MCONTACT hContact, const wchar_t *id, const wchar_t *name, bool *isQualified)
-{
- if (isQualified)
- *isQualified = true;
-
- // Check if there is custom nick for this chat contact
- if (hContact)
- if (auto *tname = db_get_wsa(hContact, "UsersNicks", T2Utf(id)))
- return tname;
-
- // Check if we have this contact in database
- if (IsMe(id)) {
- // Return my nick
- if (auto *tname = getWStringA("Nick"))
- return tname;
- }
- else {
- hContact = FindContact(id);
- if (hContact != NULL) {
- // Primarily return custom name
- if (auto *tname = db_get_wsa(hContact, "CList", "MyHandle"))
- return tname;
-
- // If not exists, then user nick
- if (auto *tname = getWStringA(hContact, "Nick"))
- return tname;
- }
- }
-
- if (isQualified)
- *isQualified = false;
-
- // Return default value as nick - given name or user id
- if (name != nullptr)
- return mir_wstrdup(name);
- return mir_wstrdup(GetSkypeNick(id));
-}
-
-bool CSkypeProto::AddChatContact(SESSION_INFO *si, const wchar_t *id, const wchar_t *role, bool isChange)
-{
- bool isQualified;
- ptrW szNick(GetChatContactNick(si->hContact, id, 0, &isQualified));
-
- GCEVENT gce = { si, GC_EVENT_JOIN };
- gce.dwFlags = GCEF_ADDTOLOG;
- gce.pszNick.w = szNick;
- gce.pszUID.w = id;
- gce.time = !isChange ? time(0) : NULL;
- gce.bIsMe = IsMe(id);
- gce.pszStatus.w = TranslateW(role);
- Chat_Event(&gce);
-
- return isQualified;
-}
-
-void CSkypeProto::RemoveChatContact(SESSION_INFO *si, const wchar_t *id, bool isKick, const wchar_t *initiator)
-{
- if (IsMe(id))
- return;
-
- ptrW szNick(GetChatContactNick(si->hContact, id));
- ptrW szInitiator(GetChatContactNick(si->hContact, initiator));
-
- GCEVENT gce = { si, isKick ? GC_EVENT_KICK : GC_EVENT_PART };
- gce.pszNick.w = szNick;
- gce.pszUID.w = id;
- gce.time = time(0);
- if (isKick)
- gce.pszStatus.w = szInitiator;
- else {
- gce.dwFlags += GCEF_ADDTOLOG;
- gce.bIsMe = IsMe(id);
- }
-
- Chat_Event(&gce);
-}
-
-void CSkypeProto::KickChatUser(const char *chatId, const char *userId)
-{
- PushRequest(new AsyncHttpRequest(REQUEST_DELETE, HOST_DEFAULT, "/threads/" + mir_urlEncode(chatId) + "/members/" + mir_urlEncode(userId)));
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Group chat creation dialog
-
-class CSkypeGCCreateDlg : public CSkypeDlgBase
-{
- CCtrlClc m_clc;
-
-public:
- LIST<char> m_ContactsList;
-
- CSkypeGCCreateDlg(CSkypeProto *proto) :
- CSkypeDlgBase(proto, IDD_GC_CREATE),
- m_clc(this, IDC_CLIST),
- m_ContactsList(1)
- {
- m_clc.OnListRebuilt = Callback(this, &CSkypeGCCreateDlg::FilterList);
- }
-
- ~CSkypeGCCreateDlg()
- {
- CSkypeProto::FreeList(m_ContactsList);
- m_ContactsList.destroy();
- }
-
- bool OnInitDialog() override
- {
- SetWindowLongPtr(m_clc.GetHwnd(), GWL_STYLE,
- GetWindowLongPtr(m_clc.GetHwnd(), GWL_STYLE) | CLS_CHECKBOXES | CLS_HIDEEMPTYGROUPS | CLS_USEGROUPS | CLS_GREYALTERNATE);
- m_clc.SendMsg(CLM_SETEXSTYLE, CLS_EX_DISABLEDRAGDROP | CLS_EX_TRACKSELECT, 0);
-
- ResetListOptions(&m_clc);
- return true;
- }
-
- bool OnApply() override
- {
- for (auto &hContact : m_proto->AccContacts()) {
- if (!m_proto->isChatRoom(hContact))
- if (HANDLE hItem = m_clc.FindContact(hContact))
- if (m_clc.GetCheck(hItem))
- m_ContactsList.insert(m_proto->getId(hContact).Detach());
- }
-
- m_ContactsList.insert(m_proto->m_szSkypename.GetBuffer());
- return true;
- }
-
- void FilterList(CCtrlClc *)
- {
- for (auto &hContact : Contacts()) {
- char *proto = Proto_GetBaseAccountName(hContact);
- if (mir_strcmp(proto, m_proto->m_szModuleName) || m_proto->isChatRoom(hContact))
- if (HANDLE hItem = m_clc.FindContact(hContact))
- m_clc.DeleteItem(hItem);
- }
- }
-
- void ResetListOptions(CCtrlClc *)
- {
- m_clc.SetHideEmptyGroups(true);
- m_clc.SetHideOfflineRoot(true);
- }
-};
-
-INT_PTR CSkypeProto::SvcCreateChat(WPARAM, LPARAM)
-{
- if (IsOnline()) {
- CSkypeGCCreateDlg dlg(this);
- if (dlg.DoModal()) {
- PushRequest(new CreateChatroomRequest(dlg.m_ContactsList, this));
- return 0;
- }
- }
- return 1;
-}
-
-/* Menus */
-
-int CSkypeProto::OnGroupChatMenuHook(WPARAM, LPARAM lParam)
-{
- GCMENUITEMS *gcmi = (GCMENUITEMS*)lParam;
- if (mir_strcmpi(gcmi->pszModule, m_szModuleName)) return 0;
-
- if (gcmi->Type == MENU_ON_LOG) {
- static const struct gc_item Items[] =
- {
- { LPGENW("&Invite user..."), 10, MENU_ITEM, FALSE },
- { LPGENW("&Leave chat session"), 20, MENU_ITEM, FALSE },
- { LPGENW("&Change topic..."), 30, MENU_ITEM, FALSE }
- };
- Chat_AddMenuItems(gcmi->hMenu, _countof(Items), Items, &g_plugin);
- }
- else if (gcmi->Type == MENU_ON_NICKLIST) {
- static const struct gc_item Items[] =
- {
- { LPGENW("Kick &user"), 10, MENU_ITEM },
- { nullptr, 0, MENU_SEPARATOR },
- { LPGENW("Set &role"), 20, MENU_NEWPOPUP },
- { LPGENW("&Admin"), 30, MENU_POPUPITEM },
- { LPGENW("&User"), 40, MENU_POPUPITEM },
- { LPGENW("Change nick..."), 50, MENU_ITEM },
- };
- Chat_AddMenuItems(gcmi->hMenu, _countof(Items), Items, &g_plugin);
- }
-
- return 0;
-}
-
-CMStringW CSkypeProto::ChangeTopicForm()
-{
- CMStringW caption(FORMAT, L"[%s] %s", _A2T(m_szModuleName).get(), TranslateT("Enter new chatroom topic"));
- ENTER_STRING pForm = {};
- pForm.type = ESF_MULTILINE;
- pForm.caption = caption;
- pForm.szModuleName = m_szModuleName;
- return (!EnterString(&pForm)) ? CMStringW() : CMStringW(ptrW(pForm.ptszResult));
-}
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp
deleted file mode 100644
index e1264b1781..0000000000
--- a/protocols/SkypeWeb/src/skype_contacts.cpp
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-uint16_t CSkypeProto::GetContactStatus(MCONTACT hContact)
-{
- return getWord(hContact, "Status", ID_STATUS_OFFLINE);
-}
-
-void CSkypeProto::SetContactStatus(MCONTACT hContact, uint16_t status)
-{
- uint16_t oldStatus = GetContactStatus(hContact);
- if (oldStatus != status) {
- setWord(hContact, "Status", status);
- if (status == ID_STATUS_OFFLINE)
- delSetting(hContact, "MirVer");
- }
-}
-
-void CSkypeProto::SetChatStatus(MCONTACT hContact, int iStatus)
-{
- ptrW tszChatID(getWStringA(hContact, SKYPE_SETTINGS_ID));
- if (tszChatID != NULL)
- Chat_Control(Chat_Find(tszChatID, m_szModuleName), (iStatus == ID_STATUS_OFFLINE) ? SESSION_OFFLINE : SESSION_ONLINE);
-}
-
-MCONTACT CSkypeProto::GetContactFromAuthEvent(MEVENT hEvent)
-{
- uint32_t body[3];
- DBEVENTINFO dbei = {};
- dbei.cbBlob = sizeof(uint32_t) * 2;
- dbei.pBlob = (char *)&body;
-
- if (db_event_get(hEvent, &dbei))
- return INVALID_CONTACT_ID;
-
- if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
- return INVALID_CONTACT_ID;
-
- if (mir_strcmp(dbei.szModule, m_szModuleName) != 0)
- return INVALID_CONTACT_ID;
- return DbGetAuthEventContact(&dbei);
-}
-
-MCONTACT CSkypeProto::FindContact(const char *skypeId)
-{
- for (auto &hContact : AccContacts())
- if (!mir_strcmpi(skypeId, ptrA(getUStringA(hContact, SKYPE_SETTINGS_ID))))
- return hContact;
-
- return 0;
-}
-
-MCONTACT CSkypeProto::FindContact(const wchar_t *skypeId)
-{
- for (auto &hContact : AccContacts())
- if (!mir_wstrcmpi(skypeId, getMStringW(hContact, SKYPE_SETTINGS_ID)))
- return hContact;
-
- return 0;
-}
-
-MCONTACT CSkypeProto::AddContact(const char *skypeId, const char *nick, bool isTemporary)
-{
- MCONTACT hContact = FindContact(skypeId);
- if (hContact)
- return hContact;
-
- hContact = db_add_contact();
- Proto_AddToContact(hContact, m_szModuleName);
-
- setString(hContact, SKYPE_SETTINGS_ID, skypeId);
- setUString(hContact, "Nick", (nick) ? nick : GetSkypeNick(skypeId));
-
- if (m_wstrCListGroup) {
- Clist_GroupCreate(0, m_wstrCListGroup);
- Clist_SetGroup(hContact, m_wstrCListGroup);
- }
-
- setByte(hContact, "Auth", 1);
- setByte(hContact, "Grant", 1);
-
- if (isTemporary)
- Contact::RemoveFromList(hContact);
- return hContact;
-}
-
-void CSkypeProto::LoadContactsAuth(MHttpResponse *response, AsyncHttpRequest*)
-{
- JsonReply reply(response);
- if (reply.error())
- return;
-
- auto &root = reply.data();
- for (auto &item : root["invite_list"]) {
- std::string skypeId = item["mri"].as_string();
- std::string reason = item["greeting"].as_string();
-
- time_t eventTime = 0;
- for (auto &it : item["invites"])
- eventTime = IsoToUnixTime(it["time"].as_string());
-
- std::string displayName = item["displayname"].as_string();
- const char *szNick = (displayName.empty()) ? nullptr : displayName.c_str();
-
- MCONTACT hContact = AddContact(skypeId.c_str(), szNick);
- time_t lastEventTime = getDword(hContact, "LastAuthRequestTime");
- if (lastEventTime && lastEventTime >= eventTime)
- continue;
-
- setUString(hContact, "Nick", displayName.c_str());
-
- setDword(hContact, "LastAuthRequestTime", eventTime);
- delSetting(hContact, "Auth");
-
- DB::AUTH_BLOB blob(hContact, displayName.c_str(), nullptr, nullptr, skypeId.c_str(), reason.c_str());
-
- DB::EventInfo dbei;
- dbei.timestamp = time(0);
- dbei.cbBlob = blob.size();
- dbei.pBlob = blob;
- ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&dbei);
- }
-}
-
-void CSkypeProto::LoadContactList(MHttpResponse *response, AsyncHttpRequest*)
-{
- JsonReply reply(response);
- if (reply.error())
- return;
-
- auto &root = reply.data();
- for (auto &item : root["contacts"]) {
- CMStringA szSkypeId = item["person_id"].as_mstring();
- if (!IsPossibleUserType(szSkypeId))
- continue;
-
- MCONTACT hContact = AddContact(szSkypeId, nullptr);
- if (szSkypeId == "28:e7a9407c-2467-4a04-9546-70081f4ea80d")
- m_hMyContact = hContact;
-
- std::string displayName = item["display_name"].as_string();
- if (!displayName.empty()) {
- if (m_hMyContact == hContact) {
- displayName = getMStringU("Nick");
- displayName += " ";
- displayName += TranslateU("(You)");
-
- setWord(hContact, "Status", ID_STATUS_ONLINE);
- }
- setUString(hContact, "Nick", displayName.c_str());
- }
-
- if (item["authorized"].as_bool()) {
- delSetting(hContact, "Auth");
- delSetting(hContact, "Grant");
- }
- else setByte(hContact, "Grant", 1);
-
- if (item["blocked"].as_bool())
- setByte(hContact, "IsBlocked", 1);
- else
- delSetting(hContact, "IsBlocked");
-
- ptrW wszGroup(Clist_GetGroup(hContact));
- if (wszGroup == nullptr && m_wstrCListGroup) {
- Clist_GroupCreate(0, m_wstrCListGroup);
- Clist_SetGroup(hContact, m_wstrCListGroup);
- }
-
- auto &profile = item["profile"];
- SetString(hContact, "Homepage", profile["website"]);
-
- auto wstr = profile["birthday"].as_mstring();
- if (!wstr.IsEmpty() ) {
- int nYear, nMonth, nDay;
- if (swscanf(wstr, L"%d-%d-%d", &nYear, &nMonth, &nDay) == 3) {
- setWord(hContact, "BirthYear", nYear);
- setByte(hContact, "BirthMonth", nMonth);
- setByte(hContact, "BirthDay", nDay);
- }
- }
-
- wstr = profile["gender"].as_mstring();
- if (wstr == "male")
- setByte(hContact, "Gender", 'M');
- else if (wstr == "female")
- setByte(hContact, "Gender", 'F');
-
- auto &name = profile["name"];
- SetString(hContact, "FirstName", name["first"]);
- SetString(hContact, "LastName", name["surname"]);
-
- if (auto &pMood = profile["mood"])
- db_set_ws(hContact, "CList", "StatusMsg", RemoveHtml(pMood.as_mstring()));
-
- SetAvatarUrl(hContact, profile["avatar_url"].as_mstring());
- ReloadAvatarInfo(hContact);
-
- for (auto &phone : profile["phones"]) {
- CMStringW number = phone["number"].as_mstring();
-
- auto wszType = phone["type"].as_mstring();
- if (wszType == L"mobile")
- setWString(hContact, "Cellular", number);
- else if (wszType == L"phone")
- setWString(hContact, "Phone", number);
- }
- }
-
- PushRequest(new GetContactsAuthRequest());
-}
-
-INT_PTR CSkypeProto::OnRequestAuth(WPARAM hContact, LPARAM)
-{
- if (hContact == INVALID_CONTACT_ID)
- return 1;
-
- PushRequest(new AddContactRequest(getId(hContact)));
- return 0;
-}
-
-INT_PTR CSkypeProto::OnGrantAuth(WPARAM hContact, LPARAM)
-{
- if (hContact == INVALID_CONTACT_ID)
- return 1;
-
- PushRequest(new AuthAcceptRequest(getId(hContact)));
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-bool CSkypeProto::OnContactDeleted(MCONTACT hContact, uint32_t flags)
-{
- if (IsOnline() && hContact && (flags & CDF_DEL_CONTACT)) {
- CMStringA szId(getId(hContact));
- if (isChatRoom(hContact))
- KickChatUser(szId, m_szOwnSkypeId);
- else
- PushRequest(new AsyncHttpRequest(REQUEST_DELETE, HOST_CONTACTS, "/users/SELF/contacts/" + mir_urlEncode(szId)));
- }
- return true;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-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))
- PushRequest(new BlockContactRequest(this, hContact));
- return 0;
-}
-
-void CSkypeProto::OnBlockContact(MHttpResponse *response, AsyncHttpRequest *pRequest)
-{
- MCONTACT hContact = (DWORD_PTR)pRequest->pUserInfo;
- if (response != nullptr)
- Contact::Hide(hContact);
-}
-
-INT_PTR CSkypeProto::UnblockContact(WPARAM hContact, LPARAM)
-{
- PushRequest(new UnblockContactRequest(this, hContact));
- return 0;
-}
-
-void CSkypeProto::OnUnblockContact(MHttpResponse *response, AsyncHttpRequest *pRequest)
-{
- if (response == nullptr)
- return;
-
- MCONTACT hContact = (DWORD_PTR)pRequest->pUserInfo;
- Contact::Hide(hContact, false);
- delSetting(hContact, "IsBlocked");
-}
diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp
deleted file mode 100644
index 967aa1e5a4..0000000000
--- a/protocols/SkypeWeb/src/skype_db.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-struct {
- int type;
- char *name;
- int flags;
-}
-static g_SkypeDBTypes[] =
-{
- { SKYPE_DB_EVENT_TYPE_INCOMING_CALL, LPGEN("Incoming call"), DETF_NONOTIFY },
- { SKYPE_DB_EVENT_TYPE_ACTION, LPGEN("Action"), 0 },
- { SKYPE_DB_EVENT_TYPE_CALL_INFO, LPGEN("Call information"), 0 },
- { SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO, LPGEN("File transfer information"), 0 },
- { SKYPE_DB_EVENT_TYPE_MOJI, LPGEN("Moji"), 0 },
- { SKYPE_DB_EVENT_TYPE_UNKNOWN, LPGEN("Unknown event"), 0 },
-};
-
-void CSkypeProto::InitDBEvents()
-{
- // custom event
- DBEVENTTYPEDESCR dbEventType = {};
- dbEventType.module = m_szModuleName;
- dbEventType.flags = DETF_HISTORY | DETF_MSGWINDOW;
- dbEventType.iconService = MODULE "/GetEventIcon";
- dbEventType.textService = MODULE "/GetEventText";
-
- for (auto &cur : g_SkypeDBTypes) {
- dbEventType.eventType = cur.type;
- dbEventType.descr = Translate(cur.name);
- dbEventType.flags |= cur.flags;
-
- DbEvent_RegisterType(&dbEventType);
-
- dbEventType.flags &= (~cur.flags);
- }
-}
diff --git a/protocols/SkypeWeb/src/skype_db.h b/protocols/SkypeWeb/src/skype_db.h
deleted file mode 100644
index 47bca1bcc4..0000000000
--- a/protocols/SkypeWeb/src/skype_db.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_DB_H_
-#define _SKYPE_DB_H_
-
-enum SKYPE_DB_EVENT_TYPE
-{
- SKYPE_DB_EVENT_TYPE_ACTION = 10001,
- SKYPE_DB_EVENT_TYPE_INCOMING_CALL,
- SKYPE_DB_EVENT_TYPE_CALL_INFO,
- SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO,
- SKYPE_DB_EVENT_TYPE_MOJI,
- SKYPE_DB_EVENT_TYPE_UNKNOWN
-};
-
-#define SKYPE_SETTINGS_ID "SkypeId"
-#define SKYPE_SETTINGS_LOGIN "Skypename"
-#define SKYPE_SETTINGS_USERTYPE "UserType"
-#define SKYPE_SETTINGS_PASSWORD "Password"
-#define SKYPE_SETTINGS_GROUP "DefaultGroup"
-
-#endif //_SKYPE_DB_H_ \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp
deleted file mode 100644
index acd5208277..0000000000
--- a/protocols/SkypeWeb/src/skype_events.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-INT_PTR CSkypeProto::SvcGetEventText(WPARAM pEvent, LPARAM datatype)
-{
- DBEVENTINFO *dbei = (DBEVENTINFO*)pEvent;
-
- CMStringA szText = Translate("SkypeWeb error: Invalid data!");
-
- switch (dbei->eventType) {
- case SKYPE_DB_EVENT_TYPE_CALL_INFO:
- {
- TiXmlDocument doc;
- if (0 != doc.Parse((char*)dbei->pBlob))
- break;
-
- if (auto *pRoot = doc.FirstChildElement("partlist")) {
- bool bType = pRoot->IntAttribute("started") ? 1 : 0;
-
- time_t callDuration = 0;
- for (auto *it : TiXmlFilter(pRoot, "part")) {
- auto *xmlDuration = it->FirstChildElement("duration");
- if (xmlDuration != nullptr) {
- callDuration = atoi(xmlDuration->GetText());
- break;
- }
- }
-
- if (bType)
- szText = Translate("Call");
- else if (callDuration == 0)
- szText = Translate("Call missed");
- else {
- char szTime[100];
- strftime(szTime, sizeof(szTime), "%X", gmtime(&callDuration));
- szText.Format(Translate("Call ended (%s)"), szTime);
- }
- }
- }
- break;
-
- case SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO:
- {
- TiXmlDocument doc;
- if (0 != doc.Parse((char*)dbei->pBlob))
- break;
-
- if (auto *pRoot = doc.FirstChildElement("files")) {
- for (auto *it : TiXmlFilter(pRoot, "file")) {
- LONGLONG fileSize = it->Int64Attribute("size");
- const char *fileName = it->GetText();
- if (fileName != nullptr)
- szText.AppendFormat(Translate("File transfer:\n\tFile name: %s \n\tSize: %lld bytes \n"), fileName, fileSize);
- }
- }
- }
- break;
-
- case SKYPE_DB_EVENT_TYPE_MOJI:
- {
- TiXmlDocument doc;
- if (0 != doc.Parse((char*)dbei->pBlob))
- break;
-
- szText.Empty();
- if (auto *pRoot = doc.FirstChildElement("URIObject")) {
- if (auto *xmlA = pRoot->FirstChildElement("a"))
- szText += xmlA->Attribute("href");
- if (auto *xmlThumb = pRoot->Attribute("url_thumbnail")) {
- szText.AppendFormat("\r\n%s: %s", TranslateU("Preview"), xmlThumb);
-
- CMStringA szUrl(xmlThumb);
- int iCount = szUrl.Replace("/views/imgt1_anim", "/views/imgpsh_fullsize_anim");
- if (!iCount)
- iCount = szUrl.Replace("/views/imgt1", "/views/imgpsh_fullsize_anim");
- if (iCount)
- szText.AppendFormat("\r\n%s: %s", TranslateU("Full image"), szUrl.c_str());
- }
- }
- }
- break;
-
- case SKYPE_DB_EVENT_TYPE_INCOMING_CALL:
- szText = Translate("Incoming call");
- break;
-
- case SKYPE_DB_EVENT_TYPE_UNKNOWN:
- szText.Format(Translate("Unknown event, please send this text for developer: \"%s\""), mir_utf8decodeA((char*)dbei->pBlob));
- break;
-
- default:
- szText = ptrA(mir_utf8decodeA((char*)dbei->pBlob));
- }
-
- return (datatype == DBVT_WCHAR) ? (INT_PTR)mir_a2u(szText) : (INT_PTR)szText.Detach();
-}
-
-INT_PTR CSkypeProto::SvcEventGetIcon(WPARAM flags, LPARAM pEvent)
-{
- DBEVENTINFO *dbei = (DBEVENTINFO*)pEvent;
- HICON icon = nullptr;
-
- switch (dbei->eventType) {
- case SKYPE_DB_EVENT_TYPE_CALL_INFO:
- case SKYPE_DB_EVENT_TYPE_INCOMING_CALL:
- icon = g_plugin.getIcon(IDI_CALL);
- break;
-
- case SKYPE_DB_EVENT_TYPE_ACTION:
- icon = g_plugin.getIcon(IDI_ACTION_ME);
- break;
-
- case SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO:
- icon = Skin_LoadIcon(SKINICON_EVENT_FILE);
- break;
-
- case SKYPE_DB_EVENT_TYPE_UNKNOWN:
- icon = Skin_LoadIcon(SKINICON_WARNING);
- break;
-
- default:
- icon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
- break;
- }
-
- return (INT_PTR)((flags & LR_SHARED) ? icon : CopyIcon(icon));
-}
diff --git a/protocols/SkypeWeb/src/skype_files.cpp b/protocols/SkypeWeb/src/skype_files.cpp
deleted file mode 100644
index 24f279a600..0000000000
--- a/protocols/SkypeWeb/src/skype_files.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-#include "stdafx.h"
-
-////////////////////////////////////////////////////////////////////////////////////////
-// File receiving
-
-static void __cdecl DownloadCallack(size_t iProgress, void *pParam)
-{
- auto *ofd = (OFDTHREAD *)pParam;
-
- DBVARIANT dbv = { DBVT_DWORD };
- dbv.dVal = unsigned(iProgress);
- db_event_setJson(ofd->hDbEvent, "ft", &dbv);
-}
-
-void CSkypeProto::ReceiveFileThread(void *param)
-{
- auto *ofd = (OFDTHREAD *)param;
-
- DB::EventInfo dbei(ofd->hDbEvent);
- if (IsOnline() && dbei && !strcmp(dbei.szModule, m_szModuleName) && dbei.eventType == EVENTTYPE_FILE) {
- DB::FILE_BLOB blob(dbei);
-
- if (ofd->bCopy) {
- ofd->wszPath = Utf2T(blob.getUrl()).get();
- ofd->pCallback->Invoke(*ofd);
- }
- else {
- CMStringA szCookie, szUrl;
- szCookie.AppendFormat("skypetoken_asm=%s", m_szApiToken.get());
-
- auto &json = dbei.getJson();
- auto skft = json["skft"].as_string();
- {
- const char *preview;
- if (skft == "Picture.1")
- preview = "imgpsh_mobile_save_anim";
- else if (skft == "Video.1")
- preview = "video";
- else
- preview = "original";
-
- MHttpRequest nlhr(REQUEST_GET);
- nlhr.flags = NLHRF_HTTP11 | NLHRF_NOUSERAGENT;
- nlhr.m_szUrl = blob.getUrl();
- nlhr.m_szUrl.AppendFormat("/views/%s/status", preview);
- nlhr.AddHeader("Accept", "*/*");
- nlhr.AddHeader("Accept-Encoding", "gzip, deflate");
- nlhr.AddHeader("Cookie", szCookie);
- NLHR_PTR response(Netlib_HttpTransaction(m_hNetlibUser, &nlhr));
- if (response) {
- JsonReply reply(response);
- if (!reply.error()) {
- auto &root = reply.data();
- if (root["content_state"].as_string() == "ready")
- szUrl = root["view_location"].as_string().c_str();
- }
- }
- }
-
- if (!szUrl.IsEmpty()) {
- MHttpRequest nlhr(REQUEST_GET);
- nlhr.flags = NLHRF_HTTP11 | NLHRF_NOUSERAGENT;
- nlhr.m_szUrl = blob.getUrl();
- if (skft == "Picture.1")
- nlhr.m_szUrl += "/views/imgpsh_fullsize_anim";
- else if (skft == "Video.1")
- nlhr.m_szUrl += "/views/video";
- else
- nlhr.m_szUrl += "/views/original";
-
- nlhr.AddHeader("Accept", "*/*");
- nlhr.AddHeader("Accept-Encoding", "gzip, deflate");
- nlhr.AddHeader("Cookie", szCookie);
-
- NLHR_PTR reply(Netlib_DownloadFile(m_hNetlibUser, &nlhr, ofd->wszPath, DownloadCallack, ofd));
- if (reply && reply->resultCode == 200) {
- struct _stat st;
- _wstat(ofd->wszPath, &st);
-
- DBVARIANT dbv = { DBVT_DWORD };
- dbv.dVal = st.st_size;
- db_event_setJson(ofd->hDbEvent, "ft", &dbv);
-
- ofd->Finish();
- }
- }
- }
- }
-
- delete ofd;
-}
-
-INT_PTR CSkypeProto::SvcOfflineFile(WPARAM param, LPARAM)
-{
- ForkThread(&CSkypeProto::ReceiveFileThread, (void *)param);
- return 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////
-// File sending
-
-#define FILETRANSFER_FAILED(fup) { ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)fup); delete fup; fup = nullptr;}
-
-HANDLE CSkypeProto::SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles)
-{
- if (IsOnline()) {
- CFileUploadParam *fup = new CFileUploadParam(hContact, szDescription, ppszFiles);
- ForkThread(&CSkypeProto::SendFileThread, (void*)fup);
- return (HANDLE)fup;
- }
- return INVALID_HANDLE_VALUE;
-}
-
-void CSkypeProto::SendFileThread(void *p)
-{
- CFileUploadParam *fup = (CFileUploadParam *)p;
- if (!IsOnline()) {
- FILETRANSFER_FAILED(fup);
- return;
- }
- if (!fup->IsAccess()) {
- FILETRANSFER_FAILED(fup);
- return;
- }
-
- if (auto *pBitmap = FreeImage_LoadU(FreeImage_GetFIFFromFilenameU(fup->tszFileName), fup->tszFileName)) {
- fup->isPicture = true;
- fup->width = FreeImage_GetWidth(pBitmap);
- fup->height = FreeImage_GetHeight(pBitmap);
- FreeImage_Unload(pBitmap);
- }
-
- ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, (HANDLE)fup);
- PushRequest(new ASMObjectCreateRequest(this, fup));
-}
-
-void CSkypeProto::OnASMObjectCreated(MHttpResponse *response, AsyncHttpRequest *pRequest)
-{
- auto *fup = (CFileUploadParam*)pRequest->pUserInfo;
- if (response == nullptr || response->body.IsEmpty()) {
-LBL_Error:
- FILETRANSFER_FAILED(fup);
- return;
- }
-
- if (response->resultCode != 200 && response->resultCode != 201) {
- debugLogA("Object creation failed with error code %d", response->resultCode);
- goto LBL_Error;
- }
-
- JSONNode node = JSONNode::parse(response->body);
- std::string strObjectId = node["id"].as_string();
- if (strObjectId.empty()) {
- debugLogA("Invalid server response (empty object id)");
- goto LBL_Error;
- }
-
- fup->uid = mir_strdup(strObjectId.c_str());
- FILE *pFile = _wfopen(fup->tszFileName, L"rb");
- if (pFile == nullptr) return;
-
- fseek(pFile, 0, SEEK_END);
- long lFileLen = ftell(pFile);
- if (lFileLen < 1) {
- fclose(pFile);
- goto LBL_Error;
- }
-
- fseek(pFile, 0, SEEK_SET);
-
- mir_ptr<uint8_t> pData((uint8_t*)mir_alloc(lFileLen));
- long lBytes = (long)fread(pData, sizeof(uint8_t), lFileLen, pFile);
- if (lBytes != lFileLen) {
- fclose(pFile);
- goto LBL_Error;
- }
- fup->size = lBytes;
- ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, (HANDLE)fup);
- PushRequest(new ASMObjectUploadRequest(this, strObjectId.c_str(), pData, lBytes, fup));
- fclose(pFile);
-}
-
-void CSkypeProto::OnASMObjectUploaded(MHttpResponse *response, AsyncHttpRequest *pRequest)
-{
- auto *fup = (CFileUploadParam*)pRequest->pUserInfo;
- if (response == nullptr) {
- FILETRANSFER_FAILED(fup);
- return;
- }
-
- wchar_t *tszFile = wcsrchr(fup->tszFileName, L'\\') + 1;
-
- TiXmlDocument doc;
- auto *pRoot = doc.NewElement("URIObject");
- doc.InsertEndChild(pRoot);
-
- pRoot->SetAttribute("doc_id", fup->uid.get());
- pRoot->SetAttribute("uri", CMStringA(FORMAT, "https://api.asm.skype.com/v1/objects/%s", fup->uid.get()));
-
- // is that a picture?
- CMStringA href;
- if (fup->isPicture) {
- pRoot->SetAttribute("type", "Picture.1");
- pRoot->SetAttribute("url_thumbnail", CMStringA(FORMAT, "https://api.asm.skype.com/v1/objects/%s/views/imgt1_anim", fup->uid.get()));
- pRoot->SetAttribute("width", fup->width);
- pRoot->SetAttribute("height", fup->height);
- pRoot->SetText("To view this shared photo, go to:");
-
- href.Format("https://login.skype.com/login/sso?go=xmmfallback?pic=%s", fup->uid.get());
- }
- else {
- pRoot->SetAttribute("type", "File.1");
- pRoot->SetAttribute("url_thumbnail", CMStringA(FORMAT, "https://api.asm.skype.com/v1/objects/%s/views/original", fup->uid.get()));
- pRoot->SetText("To view this file, go to:");
-
- href.Format("https://login.skype.com/login/sso?go=webclient.xmm&docid=%s", fup->uid.get());
- }
-
- auto *xmlA = doc.NewElement("a"); xmlA->SetText(href);
- xmlA->SetAttribute("href", href);
- pRoot->InsertEndChild(xmlA);
-
- auto *xmlOrigName = doc.NewElement("OriginalName"); xmlOrigName->SetAttribute("v", tszFile); pRoot->InsertEndChild(xmlOrigName);
- auto *xmlSize = doc.NewElement("FileSize"); xmlSize->SetAttribute("v", (int)fup->size); pRoot->InsertEndChild(xmlSize);
-
- if (fup->isPicture) {
- auto xmlMeta = doc.NewElement("meta");
- xmlMeta->SetAttribute("type", "photo"); xmlMeta->SetAttribute("originalName", tszFile);
- pRoot->InsertEndChild(xmlMeta);
- }
-
- tinyxml2::XMLPrinter printer(0, true);
- doc.Print(&printer);
-
- uint32_t hMessage;
- Utils_GetRandom(&hMessage, sizeof(hMessage));
- hMessage &= ~0x80000000;
-
- auto *pReq = new SendFileRequest(fup, getId(fup->hContact), printer.CStr());
- pReq->hContact = fup->hContact;
- pReq->pUserInfo = (HANDLE)hMessage;
- PushRequest(pReq);
-
- 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
deleted file mode 100644
index 36e1763fdd..0000000000
--- a/protocols/SkypeWeb/src/skype_history_sync.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-/* HISTORY SYNC */
-
-void CSkypeProto::OnGetServerHistory(MHttpResponse *response, AsyncHttpRequest *pRequest)
-{
- JsonReply reply(response);
- if (reply.error())
- return;
-
- auto *pOrig = (GetHistoryRequest *)pRequest;
- auto &root = reply.data();
- const JSONNode &metadata = root["_metadata"];
-
- int totalCount = metadata["totalCount"].as_int();
- std::string syncState = metadata["syncState"].as_string();
-
- bool bOperative = pRequest->pUserInfo != 0;
- bool bUseLocalTime = !m_bUseServerTime && bOperative;
- bool bSetLastTime = false;
-
- int64_t lastMsgTime = 0; // max timestamp on this page
- time_t iLocalTime = time(0);
-
- auto &conv = root["messages"];
- for (auto it = conv.rbegin(); it != conv.rend(); ++it) {
- auto &message = *it;
- CMStringA szMessageId = message["id"].as_mstring();
- int64_t id = _atoi64(szMessageId);
- if (id > lastMsgTime) {
- bSetLastTime = true;
- lastMsgTime = id;
- }
-
- int iUserType;
- CMStringA szChatId = UrlToSkypeId(message["conversationLink"].as_mstring(), &iUserType);
- CMStringA szFrom = UrlToSkypeId(message["from"].as_mstring());
-
- MCONTACT hContact = FindContact(szChatId);
-
- DB::EventInfo dbei(db_event_getById(m_szModuleName, szMessageId));
- dbei.hContact = hContact;
- dbei.szModule = m_szModuleName;
- dbei.timestamp = (bUseLocalTime) ? iLocalTime : IsoToUnixTime(message["composetime"].as_string());
- dbei.szId = szMessageId;
- if (iUserType == 19) {
- dbei.szUserId = szFrom;
-
- CMStringA szType(message["messagetype"].as_mstring());
- if (szType.Left(15) == "ThreadActivity/")
- continue;
- }
-
- dbei.flags = DBEF_UTF;
- if (!bOperative && !dbei.getEvent())
- dbei.flags |= DBEF_READ;
- if (IsMe(szFrom))
- dbei.flags |= DBEF_SENT;
-
- if (ParseMessage(message, dbei)) {
- if (dbei)
- db_event_edit(dbei.getEvent(), &dbei, true);
- else
- db_event_add(hContact, &dbei);
- }
- }
-
- if (bSetLastTime && lastMsgTime > getLastTime(pOrig->hContact))
- setLastTime(pOrig->hContact, lastMsgTime);
-
- if (totalCount >= 99 || conv.size() >= 99)
- PushRequest(new GetHistoryRequest(pOrig->hContact, pOrig->m_who, 100, lastMsgTime, pRequest->pUserInfo != 0));
-}
-
-INT_PTR CSkypeProto::SvcLoadHistory(WPARAM hContact, LPARAM)
-{
- PushRequest(new GetHistoryRequest(hContact, getId(hContact), 100, 0, false));
- return 0;
-}
-
-void CSkypeProto::OnSyncConversations(MHttpResponse *response, AsyncHttpRequest*)
-{
- JsonReply reply(response);
- if (reply.error())
- return;
-
- auto &root = reply.data();
- const JSONNode &metadata = root["_metadata"];
- const JSONNode &conversations = root["conversations"].as_array();
-
- // int totalCount = metadata["totalCount"].as_int();
- std::string syncState = metadata["syncState"].as_string();
-
- for (auto &it: conversations) {
- const JSONNode &lastMessage = it["lastMessage"];
- if (!lastMessage)
- continue;
-
- int iUserType;
- std::string strConversationLink = lastMessage["conversationLink"].as_string();
- CMStringA szSkypename = UrlToSkypeId(strConversationLink.c_str(), &iUserType);
- switch (iUserType) {
- case 19:
- {
- auto &props = it["threadProperties"];
- if (!props["lastleaveat"])
- StartChatRoom(it["id"].as_mstring(), props["topic"].as_mstring(), props["version"].as_string().c_str());
- }
- __fallthrough;
-
- case 8:
- case 2:
- int64_t id = _atoi64(lastMessage["id"].as_string().c_str());
-
- MCONTACT hContact = FindContact(szSkypename);
- if (hContact != NULL) {
- auto lastMsgTime = getLastTime(hContact);
- if (lastMsgTime && lastMsgTime < id && m_bAutoHistorySync)
- PushRequest(new GetHistoryRequest(hContact, szSkypename, 100, lastMsgTime, true));
- }
- }
- }
-
- m_bHistorySynced = true;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-
-INT_PTR CSkypeProto::SvcEmptyHistory(WPARAM hContact, LPARAM flags)
-{
- if (flags & CDF_DEL_HISTORY) {
- PushRequest(new EmptyHistoryRequest(getId(hContact)));
- }
- return 0;
-}
diff --git a/protocols/SkypeWeb/src/skype_icons.cpp b/protocols/SkypeWeb/src/skype_icons.cpp
deleted file mode 100644
index 0443fd98ed..0000000000
--- a/protocols/SkypeWeb/src/skype_icons.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-static IconItem iconList[] =
-{
- { LPGEN("Protocol icon"), "main", IDI_SKYPE },
- { LPGEN("Create new chat icon"), "conference", IDI_CONFERENCE },
- { LPGEN("Block user icon"), "user_block", IDI_BLOCKUSER },
- { LPGEN("Unblock user icon"), "user_unblock", IDI_UNBLOCKUSER },
- { LPGEN("Incoming call icon"), "inc_call", IDI_CALL },
- { LPGEN("Notification icon"), "notify", IDI_NOTIFY },
- { LPGEN("Error icon"), "error", IDI_ERRORICON },
- { LPGEN("Action icon"), "me_action", IDI_ACTION_ME }
-};
-
-void CSkypeProto::InitIcons()
-{
- g_plugin.registerIcon(LPGEN("Protocols") "/" MODULE, iconList, MODULE);
-}
diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp
deleted file mode 100644
index 951952e8ce..0000000000
--- a/protocols/SkypeWeb/src/skype_login.cpp
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-void CSkypeProto::CheckConvert()
-{
- m_szSkypename = getMStringA(SKYPE_SETTINGS_ID);
- if (m_szSkypename.IsEmpty()) {
- m_szSkypename = getMStringA(SKYPE_SETTINGS_LOGIN);
- if (!m_szSkypename.IsEmpty()) { // old settings format, need to update all settings
- m_szSkypename.Insert(0, "8:");
- setString(SKYPE_SETTINGS_ID, m_szSkypename);
-
- for (auto &hContact : AccContacts()) {
- CMStringA id(ptrA(getUStringA(hContact, "Skypename")));
- if (!id.IsEmpty())
- setString(hContact, SKYPE_SETTINGS_ID, (isChatRoom(hContact)) ? "19:" + id : "8:" + id);
-
- ptrW wszNick(getWStringA(hContact, "Nick"));
- if (wszNick == nullptr)
- setUString(hContact, "Nick", id);
-
- delSetting(hContact, "Skypename");
- }
- }
- }
-}
-
-void CSkypeProto::ProcessTimer()
-{
- if (!IsOnline())
- return;
-
- PushRequest(new GetContactListRequest());
- SendPresence();
-}
-
-void CSkypeProto::Login()
-{
- CheckConvert();
-
- // login
- int oldStatus = m_iStatus;
- m_iStatus = ID_STATUS_CONNECTING;
- ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
-
- StartQueue();
- int tokenExpires = getDword("TokenExpiresIn");
-
- pass_ptrA szPassword(getStringA(SKYPE_SETTINGS_PASSWORD));
- if (m_szSkypename.IsEmpty() || szPassword == NULL) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- return;
- }
-
- m_bHistorySynced = false;
- if ((tokenExpires - 1800) > time(0))
- OnLoginSuccess();
- else
- PushRequest(new OAuthRequest());
-}
-
-void CSkypeProto::OnLoginOAuth(MHttpResponse *response, AsyncHttpRequest*)
-{
- if (!IsStatusConnecting(m_iStatus))
- return;
-
- if (response == nullptr || response->body.IsEmpty()) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- JSONNode json = JSONNode::parse(response->body);
- if (!json) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- if (response->resultCode != 200) {
- int error = 0;
- if (json["status"]) {
- const JSONNode &status = json["status"];
- if (status["code"]) {
- switch (status["code"].as_int()) {
- case 40002:
- ShowNotification(L"Skype", TranslateT("Authentication failed. Invalid username."), NULL, 1);
- error = LOGINERR_BADUSERID;
- break;
-
- case 40120:
- ShowNotification(L"Skype", TranslateT("Authentication failed. Bad username or password."), NULL, 1);
- error = LOGINERR_WRONGPASSWORD;
- break;
-
- case 40121:
- ShowNotification(L"Skype", TranslateT("Too many failed authentication attempts with given username or IP."), NULL, 1);
- error = LOGIN_ERROR_TOOMANY_REQUESTS;
- break;
-
- default:
- ShowNotification(L"Skype", status["text"] ? status["text"].as_mstring() : TranslateT("Authentication failed. Unknown error."), NULL, 1);
- error = LOGIN_ERROR_UNKNOWN;
- }
- }
- }
-
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, error);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- if (!json["skypetoken"] || !json["expiresIn"]) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- setString("TokenSecret", json["skypetoken"].as_string().c_str());
- setDword("TokenExpiresIn", time(NULL) + json["expiresIn"].as_int());
-
- OnLoginSuccess();
-}
-
-void CSkypeProto::OnLoginSuccess()
-{
- if (!IsStatusConnecting(m_iStatus))
- return;
-
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_SUCCESS, NULL, 0);
-
- int oldStatus = m_iStatus;
- m_iStatus = m_iDesiredStatus;
- ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
-
- m_szApiToken = getStringA("TokenSecret");
-
- m_impl.m_heartBeat.StartSafe(600 * 1000);
-
- PushRequest(new CreateEndpointRequest(this));
-}
-
-void CSkypeProto::OnEndpointCreated(MHttpResponse *response, AsyncHttpRequest*)
-{
- if (IsStatusConnecting(m_iStatus))
- m_iStatus++;
-
- if (response == nullptr) {
- debugLogA(__FUNCTION__ ": failed to get create endpoint");
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- switch (response->resultCode) {
- case 200:
- case 201: // okay, endpoint created
- break;
-
- case 301:
- case 302: // redirect to the closest data center
- if (auto *hdr = response->FindHeader("Location")) {
- CMStringA szUrl(hdr+8);
- int iEnd = szUrl.Find('/');
- g_plugin.szDefaultServer = (iEnd != -1) ? szUrl.Left(iEnd) : szUrl;
- }
- PushRequest(new CreateEndpointRequest(this));
- return;
-
- case 401: // unauthorized
- if (auto *szStatus = response->FindHeader("StatusText"))
- if (strstr(szStatus, "SkypeTokenExpired"))
- delSetting("TokenSecret");
- delSetting("TokenExpiresIn");
- PushRequest(new LoginOAuthRequest(m_szSkypename, pass_ptrA(getStringA(SKYPE_SETTINGS_PASSWORD))));
- return;
-
- default:
- delSetting("TokenExpiresIn");
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- // Succeeded, decode the answer
- if (auto *hdr = response->FindHeader("Set-RegistrationToken")) {
- CMStringA szValue = hdr;
- int iStart = 0;
- while (true) {
- CMStringA szToken = szValue.Tokenize(";", iStart).Trim();
- if (iStart == -1)
- break;
-
- int iStart2 = 0;
- CMStringA name = szToken.Tokenize("=", iStart2);
- CMStringA val = szToken.Mid(iStart2);
-
- if (name == "registrationToken")
- m_szToken = val.Detach();
- else if (name == "endpointId")
- m_szId = val.Detach();
- }
- }
-
- if (m_szId && m_hPollingThread == nullptr)
- ForkThread(&CSkypeProto::PollingThread);
-
- PushRequest(new CreateSubscriptionsRequest());
-}
-
-void CSkypeProto::OnEndpointDeleted(MHttpResponse *, AsyncHttpRequest *)
-{
- m_szId = nullptr;
- m_szToken = nullptr;
-}
-
-void CSkypeProto::OnSubscriptionsCreated(MHttpResponse *response, AsyncHttpRequest*)
-{
- if (response == nullptr) {
- debugLogA(__FUNCTION__ ": failed to create subscription");
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- SendPresence();
-}
-
-void CSkypeProto::SendPresence()
-{
- ptrA epname;
-
- if (!m_bUseHostnameAsPlace && m_wstrPlace && *m_wstrPlace)
- epname = mir_utf8encodeW(m_wstrPlace);
- else {
- wchar_t compName[MAX_COMPUTERNAME_LENGTH + 1];
- DWORD size = _countof(compName);
- GetComputerName(compName, &size);
- epname = mir_utf8encodeW(compName);
- }
-
- PushRequest(new SendCapabilitiesRequest(epname, this));
-}
-
-void CSkypeProto::OnCapabilitiesSended(MHttpResponse *response, AsyncHttpRequest*)
-{
- if (response == nullptr || response->body.IsEmpty()) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- PushRequest(new SetStatusRequest(MirandaToSkypeStatus(m_iDesiredStatus)));
-
- LIST<char> skypenames(1);
- for (auto &hContact : AccContacts())
- if (!isChatRoom(hContact))
- skypenames.insert(getId(hContact).Detach());
-
- PushRequest(new CreateContactsSubscriptionRequest(skypenames));
- FreeList(skypenames);
- skypenames.destroy();
-
- ReceiveAvatar(0);
- PushRequest(new GetContactListRequest());
- PushRequest(new SyncConversations());
-
- JSONNode root = JSONNode::parse(response->body);
- if (root)
- m_szOwnSkypeId = UrlToSkypeId(root["selfLink"].as_string().c_str()).Detach();
-
- PushRequest(new GetProfileRequest(this, 0));
-}
-
-void CSkypeProto::OnStatusChanged(MHttpResponse *response, AsyncHttpRequest*)
-{
- if (response == nullptr || response->body.IsEmpty()) {
- debugLogA(__FUNCTION__ ": failed to change status");
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- JSONNode json = JSONNode::parse(response->body);
- if (!json) {
- debugLogA(__FUNCTION__ ": failed to change status");
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- const JSONNode &nStatus = json["status"];
- if (!nStatus) {
- debugLogA(__FUNCTION__ ": result contains no valid status to switch to");
- return;
- }
-
- int iNewStatus = SkypeToMirandaStatus(nStatus.as_string().c_str());
- if (iNewStatus == ID_STATUS_OFFLINE) {
- debugLogA(__FUNCTION__ ": failed to change status");
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- int oldStatus = m_iStatus;
- m_iStatus = m_iDesiredStatus = iNewStatus;
- ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
-}
diff --git a/protocols/SkypeWeb/src/skype_menus.cpp b/protocols/SkypeWeb/src/skype_menus.cpp
deleted file mode 100644
index 021c2991f1..0000000000
--- a/protocols/SkypeWeb/src/skype_menus.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-HGENMENU CSkypeProto::ContactMenuItems[CMI_MAX];
-
-int CSkypeProto::OnPrebuildContactMenu(WPARAM hContact, LPARAM)
-{
- if (!hContact)
- return 0;
-
- if (m_iStatus < ID_STATUS_ONLINE)
- return 0;
-
- if (isChatRoom(hContact))
- return 0;
-
- bool isCtrlPressed = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
- bool isAuthNeed = getByte(hContact, "Auth", 0) > 0;
- bool isGrantNeed = getByte(hContact, "Grant", 0) > 0;
- bool isBlocked = getBool(hContact, "IsBlocked", false);
-
- Menu_ShowItem(GetMenuItem(PROTO_MENU_REQ_AUTH), isCtrlPressed || isAuthNeed);
- Menu_ShowItem(GetMenuItem(PROTO_MENU_GRANT_AUTH), isCtrlPressed || isGrantNeed);
-
- Menu_ShowItem(ContactMenuItems[CMI_BLOCK], true);
- Menu_ShowItem(ContactMenuItems[CMI_UNBLOCK], isCtrlPressed || isBlocked);
- return 0;
-}
-
-int CSkypeProto::PrebuildContactMenu(WPARAM hContact, LPARAM lParam)
-{
- for (auto &it : ContactMenuItems)
- Menu_ShowItem(it, false);
- CSkypeProto *proto = CMPlugin::getInstance(hContact);
- return proto ? proto->OnPrebuildContactMenu(hContact, lParam) : 0;
-}
-
-void CSkypeProto::InitMenus()
-{
- HookEvent(ME_CLIST_PREBUILDCONTACTMENU, &CSkypeProto::PrebuildContactMenu);
-
- CMenuItem mi(&g_plugin);
- mi.flags = CMIF_UNICODE;
-
- mi.pszService = MODULE"/BlockContact";
- mi.name.w = LPGENW("Block contact");
- mi.position = CMI_POSITION + CMI_BLOCK;
- mi.hIcolibItem = g_plugin.getIconHandle(IDI_BLOCKUSER);
- SET_UID(mi, 0xc6169b8f, 0x53ab, 0x4242, 0xbe, 0x90, 0xe2, 0x4a, 0xa5, 0x73, 0x88, 0x32);
- ContactMenuItems[CMI_BLOCK] = Menu_AddContactMenuItem(&mi);
- CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::BlockContact>);
-
- mi.pszService = MODULE"/UnblockContact";
- mi.name.w = LPGENW("Unblock contact");
- mi.position = CMI_POSITION + CMI_UNBLOCK;
- mi.hIcolibItem = g_plugin.getIconHandle(IDI_UNBLOCKUSER);
- SET_UID(mi, 0x88542f43, 0x7448, 0x48d0, 0x81, 0xa3, 0x26, 0x0, 0x4f, 0x37, 0xee, 0xe0);
- ContactMenuItems[CMI_UNBLOCK] = Menu_AddContactMenuItem(&mi);
- CreateServiceFunction(mi.pszService, GlobalService<&CSkypeProto::UnblockContact>);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Protocol's menu in the status bar
-
-void CSkypeProto::OnBuildProtoMenu()
-{
- CMenuItem mi(&g_plugin);
- mi.root = Menu_GetProtocolRoot(this);
-
- mi.pszService = "/CreateNewChat";
- CreateProtoService(mi.pszService, &CSkypeProto::SvcCreateChat);
- mi.name.a = LPGEN("Create new chat");
- mi.position = 200000;
- mi.hIcolibItem = g_plugin.getIconHandle(IDI_CONFERENCE);
- Menu_AddProtoMenuItem(&mi, m_szModuleName);
-
- mi.pszService = "/SetMood";
- CreateProtoService(mi.pszService, &CSkypeProto::SvcSetMood);
- mi.name.a = LPGEN("Set own mood");
- mi.position++;
- mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_USERONLINE);
- Menu_AddProtoMenuItem(&mi, m_szModuleName);
-}
diff --git a/protocols/SkypeWeb/src/skype_menus.h b/protocols/SkypeWeb/src/skype_menus.h
deleted file mode 100644
index 748c61b773..0000000000
--- a/protocols/SkypeWeb/src/skype_menus.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_MENUS_H_
-#define _SKYPE_MENUS_H_
-
-#define CMI_POSITION -201001000
-
-enum
-{
- CMI_BLOCK,
- CMI_UNBLOCK,
- CMI_MAX // this item shall be the last one
-};
-
-#endif //_SKYPE_MENUS_H_ \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
deleted file mode 100644
index 7296e9d7eb..0000000000
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ /dev/null
@@ -1,325 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// MESSAGE SENDING
-
-void CSkypeProto::OnMessageSent(MHttpResponse *response, AsyncHttpRequest *pRequest)
-{
- MCONTACT hContact = pRequest->hContact;
- HANDLE hMessage = (HANDLE)pRequest->pUserInfo;
-
- if (response != nullptr) {
- if (response->resultCode != 201) {
- std::string strError = Translate("Unknown error!");
-
- if (!response->body.IsEmpty()) {
- JSONNode jRoot = JSONNode::parse(response->body);
- const JSONNode &jErr = jRoot["errorCode"];
- if (jErr)
- strError = jErr.as_string();
- }
-
- ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, hMessage, _A2T(strError.c_str()));
- }
- }
- else ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, hMessage, (LPARAM)TranslateT("Network error!"));
-}
-
-// outcoming message flow
-int CSkypeProto::SendMsg(MCONTACT hContact, MEVENT, const char *szMessage)
-{
- if (!IsOnline())
- return -1;
-
- uint32_t hMessage;
- Utils_GetRandom(&hMessage, sizeof(hMessage));
- hMessage &= ~0x80000000;
-
- CMStringA str(szMessage);
- bool bRich = AddBbcodes(str);
-
- CMStringA szUrl = "/users/ME/conversations/" + mir_urlEncode(getId(hContact)) + "/messages";
- AsyncHttpRequest *pReq = new AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, szUrl, &CSkypeProto::OnMessageSent);
- pReq->hContact = hContact;
- pReq->pUserInfo = (HANDLE)hMessage;
-
- JSONNode node;
- node << INT64_PARAM("clientmessageid", hMessage) << CHAR_PARAM("messagetype", bRich ? "RichText" : "Text") << CHAR_PARAM("contenttype", "text");
- if (strncmp(str, "/me ", 4) == 0)
- node << CHAR_PARAM("content", m_szSkypename + " " + str);
- else
- node << CHAR_PARAM("content", str);
- pReq->m_szParam = node.write().c_str();
-
- PushRequest(pReq);
-
- mir_cslock lck(m_lckOutMessagesList);
- m_OutMessages.insert((void*)hMessage);
- return hMessage;
-}
-
-// preparing message/action to be written into db
-int CSkypeProto::OnPreCreateMessage(WPARAM, LPARAM lParam)
-{
- MessageWindowEvent *evt = (MessageWindowEvent*)lParam;
- if (mir_strcmp(Proto_GetBaseAccountName(evt->hContact), m_szModuleName))
- return 0;
-
- char *message = (char*)evt->dbei->pBlob;
- if (strncmp(message, "/me ", 4) == 0) {
- evt->dbei->cbBlob = evt->dbei->cbBlob - 4;
- memmove(evt->dbei->pBlob, &evt->dbei->pBlob[4], evt->dbei->cbBlob);
- evt->dbei->eventType = SKYPE_DB_EVENT_TYPE_ACTION;
- }
- return 0;
-}
-
-/* MESSAGE EVENT */
-
-bool CSkypeProto::ParseMessage(const JSONNode &node, DB::EventInfo &dbei)
-{
- int nEmoteOffset = node["skypeemoteoffset"].as_int();
-
- auto &pContent = node["content"];
- if (!pContent) {
-LBL_Deleted:
- if (dbei)
- db_event_delete(dbei.getEvent());
- return false;
- }
-
- CMStringW wszContent = pContent.as_mstring();
- if (wszContent.IsEmpty())
- goto LBL_Deleted;
-
- std::string strMessageType = node["messagetype"].as_string();
- if (strMessageType == "RichText/Media_GenericFile" || strMessageType == "RichText/Media_Video" || strMessageType == "RichText/UriObject" ) {
- ProcessFileRecv(dbei.hContact, node["content"].as_string().c_str(), dbei);
- return false;
- }
- if (strMessageType == "RichText/Contacts") {
- ProcessContactRecv(dbei.hContact, node["content"].as_string().c_str(), dbei);
- return false;
- }
-
- if (strMessageType == "Text" || strMessageType == "RichText") {
- std::string szOwnMessageId = node["clientmessageid"].as_string();
- if ((dbei.flags & DBEF_SENT) && !szOwnMessageId.empty()) {
- HANDLE hMessage = (HANDLE)atoi(szOwnMessageId.c_str());
- if (m_OutMessages.getIndex(hMessage) != -1) {
- ProtoBroadcastAck(dbei.hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, hMessage, (LPARAM)dbei.szId);
-
- mir_cslock lck(m_lckOutMessagesList);
- m_OutMessages.remove(hMessage);
- return false;
- }
- }
-
- if (strMessageType == "RichText")
- wszContent = RemoveHtml(wszContent);
-
- dbei.eventType = nEmoteOffset == 0 ? EVENTTYPE_MESSAGE : SKYPE_DB_EVENT_TYPE_ACTION;
- }
- else if (strMessageType == "Event/Call") {
- dbei.eventType = SKYPE_DB_EVENT_TYPE_CALL_INFO;
- }
- else if (strMessageType == "RichText/Files") {
- dbei.eventType = SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO;
- }
- else if (strMessageType == "RichText/Media_FlikMsg") {
- dbei.eventType = SKYPE_DB_EVENT_TYPE_MOJI;
- }
- else if (strMessageType == "RichText/Media_Album") {
- return false;
- }
- else {
- dbei.eventType = SKYPE_DB_EVENT_TYPE_UNKNOWN;
- }
-
- replaceStr(dbei.pBlob, mir_utf8encodeW(wszContent));
- dbei.cbBlob = (uint32_t)mir_strlen(dbei.pBlob);
- return true;
-}
-
-void CSkypeProto::ProcessNewMessage(const JSONNode &node)
-{
- int iUserType;
- UrlToSkypeId(node["conversationLink"].as_string().c_str(), &iUserType);
-
- CMStringA szMessageId = node["id"].as_mstring();
- CMStringA szConversationName(UrlToSkypeId(node["conversationLink"].as_string().c_str()));
- CMStringA szFromSkypename(UrlToSkypeId(node["from"].as_mstring()));
-
- if (iUserType == 19)
- if (OnChatEvent(node))
- return;
-
- MCONTACT hContact = AddContact(szConversationName, nullptr, true);
-
- if (m_bHistorySynced) {
- int64_t lastMsgId = _atoi64(szMessageId);
- if (lastMsgId > getLastTime(hContact))
- setLastTime(hContact, lastMsgId);
- }
-
- std::string strMessageType = node["messagetype"].as_string();
- if (strMessageType == "Control/Typing") {
- CallService(MS_PROTO_CONTACTISTYPING, hContact, 30);
- return;
- }
- if (strMessageType == "Control/ClearTyping") {
- CallService(MS_PROTO_CONTACTISTYPING, hContact, PROTOTYPE_CONTACTTYPING_OFF);
- return;
- }
-
- DB::EventInfo dbei(db_event_getById(m_szModuleName, szMessageId));
- dbei.hContact = hContact;
- dbei.timestamp = time(0);
- dbei.szId = szMessageId;
- dbei.flags = DBEF_UTF;
- if (IsMe(szFromSkypename))
- dbei.flags |= DBEF_SENT;
- if (iUserType == 19)
- dbei.szUserId = szFromSkypename;
-
- if (ParseMessage(node, dbei)) {
- if (dbei)
- db_event_edit(dbei.getEvent(), &dbei, true);
- else
- ProtoChainRecvMsg(hContact, dbei);
- }
-}
-
-void CSkypeProto::OnMarkRead(MCONTACT hContact, MEVENT hDbEvent)
-{
- if (IsOnline()) {
- DB::EventInfo dbei(hDbEvent, false);
- if (dbei && dbei.szId)
- PushRequest(new MarkMessageReadRequest(getId(hContact), _atoi64(dbei.szId)));
- }
-}
-
-void CSkypeProto::OnReceiveOfflineFile(DB::EventInfo &dbei, DB::FILE_BLOB &blob)
-{
- if (auto *ft = (CSkypeTransfer *)blob.getUserInfo()) {
- blob.setUrl(ft->url);
- blob.setSize(ft->iFileSize);
-
- auto &json = dbei.setJson();
- json << CHAR_PARAM("skft", ft->fileType);
- if (ft->iHeight != -1)
- json << INT_PARAM("h", ft->iHeight);
- if (ft->iWidth != -1)
- json << INT_PARAM("w", ft->iWidth);
- delete ft;
- }
-}
-
-void CSkypeProto::ProcessFileRecv(MCONTACT hContact, const char *szContent, DB::EventInfo &dbei)
-{
- TiXmlDocument doc;
- if (0 != doc.Parse(szContent))
- return;
-
- auto *xmlRoot = doc.FirstChildElement("URIObject");
- if (xmlRoot == nullptr)
- return;
-
- CSkypeTransfer *ft = new CSkypeTransfer;
- if (auto *str = xmlRoot->Attribute("doc_id"))
- ft->docId = str;
- if (auto *str = xmlRoot->Attribute("uri"))
- ft->url = str;
- ft->iWidth = xmlRoot->IntAttribute("width", -1);
- ft->iHeight = xmlRoot->IntAttribute("heighr", -1);
- if (auto *str = xmlRoot->Attribute("type"))
- ft->fileType = str;
- if (auto *xml = xmlRoot->FirstChildElement("FileSize"))
- if (auto *str = xml->Attribute("v"))
- ft->iFileSize = atoi(str);
- if (auto *xml = xmlRoot->FirstChildElement("OriginalName"))
- if (auto *str = xml->Attribute("v"))
- ft->fileName = str;
-
- if (ft->url.IsEmpty() || ft->fileName.IsEmpty() || ft->iFileSize == 0) {
- debugLogA("Missing file info: url=<%s> name=<%s> %d", ft->url.c_str(), ft->fileName.c_str(), ft->iFileSize);
- delete ft;
- return;
- }
-
- int idx = ft->fileType.Find('/');
- if (idx != -1)
- ft->fileType = ft->fileType.Left(idx);
-
- // ordinary file
- if (ft->fileType == "File.1" || ft->fileType == "Picture.1" || ft->fileType == "Video.1") {
- MEVENT hEvent;
- dbei.flags |= DBEF_TEMPORARY | DBEF_JSON;
- if (dbei) {
- DB::FILE_BLOB blob(dbei);
- OnReceiveOfflineFile(dbei, blob);
- blob.write(dbei);
- db_event_edit(dbei.getEvent(), &dbei, true);
- delete ft;
- hEvent = dbei.getEvent();
- }
- else hEvent = ProtoChainRecvFile(hContact, DB::FILE_BLOB(ft, ft->fileName), dbei);
- }
- else debugLogA("Invalid or unsupported file type <%s> ignored", ft->fileType.c_str());
-}
-
-void CSkypeProto::ProcessContactRecv(MCONTACT hContact, const char *szContent, DB::EventInfo &dbei)
-{
- TiXmlDocument doc;
- if (0 != doc.Parse(szContent))
- return;
-
- auto *xmlNode = doc.FirstChildElement("contacts");
- if (xmlNode == nullptr)
- return;
-
- int nCount = 0;
- for (auto *it : TiXmlEnum(xmlNode)) {
- UNREFERENCED_PARAMETER(it);
- nCount++;
- }
-
- PROTOSEARCHRESULT **psr = (PROTOSEARCHRESULT**)mir_calloc(sizeof(PROTOSEARCHRESULT*) * nCount);
-
- nCount = 0;
- for (auto *xmlContact : TiXmlFilter(xmlNode, "c")) {
- psr[nCount] = (PROTOSEARCHRESULT*)mir_calloc(sizeof(PROTOSEARCHRESULT));
- psr[nCount]->cbSize = sizeof(psr);
- psr[nCount]->id.a = mir_strdup(xmlContact->Attribute("s"));
- nCount++;
- }
-
- if (nCount) {
- dbei.pBlob = (char*)psr;
- dbei.cbBlob = nCount;
-
- ProtoChainRecv(hContact, PSR_CONTACTS, 0, (LPARAM)&dbei);
- for (int i = 0; i < nCount; i++) {
- mir_free(psr[i]->id.a);
- mir_free(psr[i]);
- }
- }
- mir_free(psr);
-}
diff --git a/protocols/SkypeWeb/src/skype_mood.cpp b/protocols/SkypeWeb/src/skype_mood.cpp
deleted file mode 100644
index dfaa5b0922..0000000000
--- a/protocols/SkypeWeb/src/skype_mood.cpp
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-struct
-{
- const char *ss;
- const wchar_t *defStatus;
- int defIcon;
-}
-static moods[] =
-{
- { "", LPGENW("None") },
- { "", LPGENW("Custom emoji") },
- { "brb", LPGENW("Be right back") },
- { "burger", LPGENW("Out for lunch") },
- { "wait", LPGENW("In meetings") },
- { "learn", LPGENW("At school") },
- { "movie", LPGENW("At the movies") },
- { "plane", LPGENW("Traveling") },
- { "party", LPGENW("Celebrating") },
- { "car", LPGENW("Driving") },
- { "skip", LPGENW("At the gym") },
- { "wfh", LPGENW("Working from home") },
-};
-
-struct SetStatusMsgRequest : public AsyncHttpRequest
-{
- SetStatusMsgRequest(CSkypeProto *ppro) :
- AsyncHttpRequest(REQUEST_POST, HOST_API, "/users/self/profile/partial")
- {
- int m_iMood = ppro->m_iMood;
- auto &pMood = moods[m_iMood];
-
- JSONNode node, payload;
- payload.set_name("payload");
-
- CMStringW s1, s2;
- switch (m_iMood) {
- case 0: // none
- s1 = ppro->m_wstrMoodMessage;
- break;
- case 1: // custom
- s1.Format(L"(%x) %s", Utf16toUtf32(ppro->m_wstrMoodEmoji), (wchar_t *)ppro->m_wstrMoodMessage);
- break;
- default:
- s1.Format(L"(%S) %s", pMood.ss, (wchar_t *)ppro->m_wstrMoodMessage);
- break;
- }
- payload << WCHAR_PARAM("mood", s1);
-
- if (m_iMood > 1)
- s2.Format(L"<ss type=\"%S\">(%S)</ss>%s", pMood.ss, pMood.ss, (wchar_t*)ppro->m_wstrMoodMessage);
- else if (m_iMood == 1) {
- int code = Utf16toUtf32(ppro->m_wstrMoodEmoji);
- s2.Format(L"<ss type=\"%x\">(%x)</ss>%s", code, code, (wchar_t *)ppro->m_wstrMoodMessage);
- }
-
- if (!s2.IsEmpty())
- payload << WCHAR_PARAM("richMood", s2);
-
- node << payload;
- m_szParam = node.write().c_str();
- }
-};
-
-int getMoodIndex(const char *pszMood)
-{
- for (auto &it : moods)
- if (!mir_strcmpi(it.ss, pszMood))
- return int(&it - moods);
-
- return -1;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Mood dialog
-
-class CMoodDialog : public CSkypeDlg
-{
- CCtrlEdit edtText, edtEmoji;
- CCtrlCombo cmbMoods;
-
-public:
- CMoodDialog(CSkypeProto *ppro) :
- CSkypeDlg(ppro, IDD_MOOD),
- edtText(this, IDC_MOOD_TEXT),
- edtEmoji(this, IDC_MOOD_EMOJI),
- cmbMoods(this, IDC_MOOD_COMBO)
- {
- CreateLink(edtText, ppro->m_wstrMoodMessage);
- CreateLink(edtEmoji, ppro->m_wstrMoodEmoji);
-
- cmbMoods.OnChange = Callback(this, &CMoodDialog::onChangeSel_Mood);
- }
-
- bool OnInitDialog() override
- {
- for (auto &it : moods)
- cmbMoods.AddString(TranslateW(it.defStatus), int(&it - moods));
- cmbMoods.SetCurSel(m_proto->m_iMood);
- onChangeSel_Mood(0);
- return true;
- }
-
- bool OnApply() override
- {
- m_proto->m_iMood = cmbMoods.GetCurSel();
-
- CMStringA szSetting(FORMAT, "Mood%d", (int)m_proto->m_iMood);
- m_proto->setWString(szSetting, m_proto->m_wstrMoodMessage);
-
- m_proto->PushRequest(new SetStatusMsgRequest(m_proto));
- return true;
- }
-
- void onChangeSel_Mood(CCtrlCombo *)
- {
- int m_iMood = cmbMoods.GetCurSel();
- edtEmoji.Enable(m_iMood == 1);
-
- CMStringA szSetting(FORMAT, "Mood%d", m_iMood);
- edtText.SetText(m_proto->getMStringW(szSetting));
- }
-};
-
-INT_PTR CSkypeProto::SvcSetMood(WPARAM, LPARAM)
-{
- CMoodDialog(this).DoModal();
- return 0;
-}
diff --git a/protocols/SkypeWeb/src/skype_oauth.cpp b/protocols/SkypeWeb/src/skype_oauth.cpp
deleted file mode 100644
index 1a8efc2447..0000000000
--- a/protocols/SkypeWeb/src/skype_oauth.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-static std::string sub(const std::string &str, const char *start, const char *end)
-{
- size_t i1 = str.find(start);
- if (i1 == -1)
- return "";
-
- i1 += strlen(start);
- size_t i2 = str.find(end, i1);
- return (i2 == -1) ? "" : str.substr(i1, i2 - i1);
-}
-
-void CSkypeProto::OnOAuthStart(MHttpResponse *response, AsyncHttpRequest*)
-{
- if (response == nullptr || response->body.IsEmpty()) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- std::regex regex;
- std::smatch match;
- std::string content = response->body.c_str();
-
- regex = "<input.+?type=\"hidden\".+?name=\"PPFT\".+?id=\"i0327\".+?value=\"(.+?)\".*?/>";
-
- if (!std::regex_search(content, match, regex)) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
- std::string PPFT = match[1];
-
- std::map<std::string, std::string> scookies;
- regex = "^(.+?)=(.*?);";
-
- for (auto &it : *response) {
- if (mir_strcmpi(it->szName, "Set-Cookie"))
- continue;
-
- content = it->szValue;
- if (std::regex_search(content, match, regex))
- scookies[match[1]] = match[2];
- }
-
- ptrA login(getStringA(SKYPE_SETTINGS_ID));
- ptrA password(getStringA(SKYPE_SETTINGS_PASSWORD));
- CMStringA mscookies(FORMAT, "MSPRequ=%s;MSPOK=%s;CkTst=G%lld;", scookies["MSPRequ"].c_str(), scookies["MSPOK"].c_str(), time(NULL));
-
- cookies["MSPRequ"] = scookies["MSPRequ"];
-
- PushRequest(new OAuthRequest(login, password, mscookies.c_str(), PPFT.c_str()));
-}
-
-bool CSkypeProto::CheckOauth(const char *szResponse)
-{
- std::string content = szResponse;
- std::smatch match;
- if (!std::regex_search(content, match, std::regex("<input.+?type=\"hidden\".+?name=\"t\".+?id=\"t\".+?value=\"(.+?)\".*?>")))
- if (!std::regex_search(content, match, std::regex("<input.+?type=\"hidden\".+?name=\"ipt\".+?id=\"ipt\".+?value=\"(.+?)\".*?>")))
- return false;
-
- std::string t = match[1];
- PushRequest(new OAuthRequest(t.c_str()));
- return true;
-}
-
-void CSkypeProto::OnOAuthConfirm(MHttpResponse *response, AsyncHttpRequest *)
-{
- if (response == nullptr || response->body.IsEmpty()) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- if (CheckOauth(response->body))
- return;
-
- std::string content = response->body.c_str();
- std::string PPFT = sub(content, "sFT:'", "'");
- std::string opid = sub(content, "opid=", "&");
- if (PPFT.empty() || opid.empty()) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- std::regex regex("^(.+?=.*?;)");
- std::smatch match;
- CMStringA mscookies;
-
- for (auto &it : *response) {
- if (mir_strcmpi(it->szName, "Set-Cookie"))
- continue;
-
- content = it->szValue;
- if (std::regex_search(content, match, regex))
- mscookies.Append(match[1].str().c_str());
- }
-
- PushRequest(new OAuthRequest(mscookies.c_str(), PPFT.c_str(), opid.c_str()));
-}
-
-void CSkypeProto::OnOAuthAuthorize(MHttpResponse *response, AsyncHttpRequest*)
-{
- if (response == nullptr || response->body.IsEmpty()) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- if (!CheckOauth(response->body)) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- }
-}
-
-void CSkypeProto::OnOAuthEnd(MHttpResponse *response, AsyncHttpRequest*)
-{
- if (response == nullptr || response->body.IsEmpty()) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
-
- std::regex regex;
- std::smatch match;
- std::string content = response->body;
-
- regex = "<input.+?type=\"hidden\".+?name=\"skypetoken\".+?value=\"(.+?)\".*?/>";
- if (!std::regex_search(content, match, regex)) {
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGIN_ERROR_UNKNOWN);
- SetStatus(ID_STATUS_OFFLINE);
- return;
- }
- std::string token = match[1];
- setString("TokenSecret", token.c_str());
- regex = "<input.+?type=\"hidden\".+?name=\"expires_in\".+?value=\"(.+?)\".*?/>";
-
- if (std::regex_search(content, match, regex)) {
- std::string expiresIn = match[1];
- int seconds = atoi(expiresIn.c_str());
- setDword("TokenExpiresIn", time(NULL) + seconds);
- }
-
- OnLoginSuccess();
-}
diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp
deleted file mode 100644
index 08bd45942f..0000000000
--- a/protocols/SkypeWeb/src/skype_options.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-class CSkypeOptionsMain : public CSkypeDlgBase
-{
- CCtrlEdit m_skypename, m_password, m_group, m_place;
- CCtrlCheck m_autosync, m_usehostname, m_usebb;
- CCtrlHyperlink m_link;
-
-public:
- CSkypeOptionsMain(CSkypeProto *proto, int idDialog) :
- CSkypeDlgBase(proto, idDialog),
- m_skypename(this, IDC_SKYPENAME),
- m_password(this, IDC_PASSWORD),
- m_group(this, IDC_GROUP),
- m_place(this, IDC_PLACE),
- m_autosync(this, IDC_AUTOSYNC),
- m_usehostname(this, IDC_USEHOST),
- m_usebb(this, IDC_BBCODES),
- m_link(this, IDC_CHANGEPASS, "https://login.skype.com/recovery/password-change") // TODO : ...?username=%username%
- {
- CreateLink(m_group, proto->m_wstrCListGroup);
- CreateLink(m_autosync, proto->m_bAutoHistorySync);
- CreateLink(m_place, proto->m_wstrPlace);
- CreateLink(m_usehostname, proto->m_bUseHostnameAsPlace);
- CreateLink(m_usebb, proto->m_bUseBBCodes);
- m_usehostname.OnChange = Callback(this, &CSkypeOptionsMain::OnUsehostnameCheck);
- }
-
- bool OnInitDialog() override
- {
- m_skypename.SetTextA(ptrA(m_proto->getStringA(SKYPE_SETTINGS_ID)));
- m_password.SetTextA(pass_ptrA(m_proto->getStringA("Password")));
- m_place.Enable(!m_proto->m_bUseHostnameAsPlace);
- m_skypename.SendMsg(EM_LIMITTEXT, 128, 0);
- m_password.SendMsg(EM_LIMITTEXT, 128, 0);
- m_group.SendMsg(EM_LIMITTEXT, 64, 0);
- return true;
- }
-
- bool OnApply() override
- {
- ptrA szNewSkypename(m_skypename.GetTextA()),
- szOldSkypename(m_proto->getStringA(SKYPE_SETTINGS_ID));
- pass_ptrA szNewPassword(m_password.GetTextA()),
- szOldPassword(m_proto->getStringA("Password"));
- if (mir_strcmpi(szNewSkypename, szOldSkypename) || mir_strcmp(szNewPassword, szOldPassword))
- m_proto->delSetting("TokenExpiresIn");
- m_proto->setString(SKYPE_SETTINGS_ID, szNewSkypename);
- m_proto->setString("Password", szNewPassword);
- ptrW group(m_group.GetText());
- if (mir_wstrlen(group) > 0 && !Clist_GroupExists(group))
- Clist_GroupCreate(0, group);
- return true;
- }
-
- void OnUsehostnameCheck(CCtrlCheck *)
- {
- m_place.Enable(!m_usehostname.GetState());
- }
-};
-
-/////////////////////////////////////////////////////////////////////////////////
-
-MWindow CSkypeProto::OnCreateAccMgrUI(MWindow hwndParent)
-{
- auto *pDlg = new CSkypeOptionsMain(this, IDD_ACCOUNT_MANAGER);
- pDlg->SetParent(hwndParent);
- pDlg->Show();
- return pDlg->GetHwnd();
-}
-
-int CSkypeProto::OnOptionsInit(WPARAM wParam, LPARAM)
-{
- OPTIONSDIALOGPAGE odp = { sizeof(odp) };
- odp.szTitle.w = m_tszUserName;
- odp.flags = ODPF_BOLDGROUPS | ODPF_UNICODE | ODPF_DONTTRANSLATE;
- odp.szGroup.w = LPGENW("Network");
-
- odp.szTab.w = LPGENW("Account");
- odp.pDialog = new CSkypeOptionsMain(this, IDD_OPTIONS_MAIN);
- g_plugin.addOptions(wParam, &odp);
-
- return 0;
-}
diff --git a/protocols/SkypeWeb/src/skype_polling.cpp b/protocols/SkypeWeb/src/skype_polling.cpp
deleted file mode 100644
index 5303c5d190..0000000000
--- a/protocols/SkypeWeb/src/skype_polling.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-void CSkypeProto::PollingThread(void *)
-{
- debugLogA(__FUNCTION__ ": entering");
-
- int nErrors = 0;
- m_iPollingId = -1;
-
- while (true) {
- if (m_isTerminated || m_szId == nullptr)
- break;
-
- std::unique_ptr<PollRequest> request(new PollRequest(this));
- request->nlc = m_hPollingConn;
- NLHR_PTR response(DoSend(request.get()));
- if (m_isTerminated || m_szId == nullptr)
- break;
-
- if (response == nullptr || response->resultCode != 200) {
- if (nErrors < POLLING_ERRORS_LIMIT) {
- nErrors++;
- continue;
- }
- break;
- }
-
- m_hPollingConn = response->nlc;
- if (!response->body.IsEmpty())
- ParsePollData(response->body);
- }
-
- if (!m_isTerminated) {
- debugLogA(__FUNCTION__ ": unexpected termination; switching protocol to offline");
- SetStatus(ID_STATUS_OFFLINE);
- }
-
- m_hPollingConn = nullptr;
- m_hPollingThread = nullptr;
- debugLogA(__FUNCTION__ ": leaving");
-}
-
-void CSkypeProto::ParsePollData(const char *szData)
-{
- debugLogA(__FUNCTION__);
-
- JSONNode data = JSONNode::parse(szData);
- if (!data)
- return;
-
- for (auto &message : data["eventMessages"]) {
- int eventId = message["id"].as_int();
- if (eventId > m_iPollingId)
- m_iPollingId = eventId;
-
- const JSONNode &resource = message["resource"];
-
- std::string resourceType = message["resourceType"].as_string();
- if (resourceType == "NewMessage")
- ProcessNewMessage(resource);
- else if (resourceType == "UserPresence")
- ProcessUserPresence(resource);
- else if (resourceType == "EndpointPresence")
- ProcessEndpointPresence(resource);
- else if (resourceType == "ConversationUpdate")
- ProcessConversationUpdate(resource);
- else if (resourceType == "ThreadUpdate")
- ProcessThreadUpdate(resource);
- }
-}
-
-void CSkypeProto::ProcessEndpointPresence(const JSONNode &node)
-{
- debugLogA(__FUNCTION__);
- std::string selfLink = node["selfLink"].as_string();
- CMStringA skypename(UrlToSkypeId(selfLink.c_str()));
-
- MCONTACT hContact = FindContact(skypename);
- if (hContact == NULL)
- return;
-
- const JSONNode &publicInfo = node["publicInfo"];
- const JSONNode &privateInfo = node["privateInfo"];
- CMStringA MirVer;
- if (publicInfo) {
- std::string skypeNameVersion = publicInfo["skypeNameVersion"].as_string();
- std::string version = publicInfo["version"].as_string();
- std::string typ = publicInfo["typ"].as_string();
- int iTyp = atoi(typ.c_str());
- switch (iTyp) {
- case 0:
- case 1:
- MirVer.Append("Skype (Web) " + ParseUrl(version.c_str(), "/"));
- break;
- case 10:
- MirVer.Append("Skype (XBOX) " + ParseUrl(skypeNameVersion.c_str(), "/"));
- break;
- case 17:
- MirVer.Append("Skype (Android) " + ParseUrl(skypeNameVersion.c_str(), "/"));
- break;
- case 16:
- MirVer.Append("Skype (iOS) " + ParseUrl(skypeNameVersion.c_str(), "/"));
- break;
- case 12:
- MirVer.Append("Skype (WinRT) " + ParseUrl(skypeNameVersion.c_str(), "/"));
- break;
- case 15:
- MirVer.Append("Skype (WP) " + ParseUrl(skypeNameVersion.c_str(), "/"));
- break;
- case 13:
- MirVer.Append("Skype (OSX) " + ParseUrl(skypeNameVersion.c_str(), "/"));
- break;
- case 11:
- MirVer.Append("Skype (Windows) " + ParseUrl(skypeNameVersion.c_str(), "/"));
- break;
- case 14:
- MirVer.Append("Skype (Linux) " + ParseUrl(skypeNameVersion.c_str(), "/"));
- break;
- case 125:
- MirVer.AppendFormat("Miranda NG Skype %s", version.c_str());
- break;
- default:
- MirVer.Append("Skype (Unknown)");
- }
- }
-
- if (privateInfo != NULL) {
- std::string epname = privateInfo["epname"].as_string();
- if (!epname.empty())
- MirVer.AppendFormat(" [%s]", epname.c_str());
- }
-
- setString(hContact, "MirVer", MirVer);
-}
-
-void CSkypeProto::ProcessUserPresence(const JSONNode &node)
-{
- debugLogA(__FUNCTION__);
-
- std::string selfLink = node["selfLink"].as_string();
- std::string status = node["status"].as_string();
- CMStringA skypename = UrlToSkypeId(selfLink.c_str());
-
- if (!skypename.IsEmpty()) {
- if (IsMe(skypename)) {
- int iNewStatus = SkypeToMirandaStatus(status.c_str());
- if (iNewStatus == ID_STATUS_OFFLINE) return;
- int old_status = m_iStatus;
- m_iDesiredStatus = iNewStatus;
- m_iStatus = iNewStatus;
- if (old_status != iNewStatus)
- ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, iNewStatus);
- }
- else {
- MCONTACT hContact = FindContact(skypename);
- if (hContact != NULL)
- SetContactStatus(hContact, SkypeToMirandaStatus(status.c_str()));
- }
- }
-}
-
-void CSkypeProto::ProcessConversationUpdate(const JSONNode &) {}
-void CSkypeProto::ProcessThreadUpdate(const JSONNode &) {}
diff --git a/protocols/SkypeWeb/src/skype_popups.cpp b/protocols/SkypeWeb/src/skype_popups.cpp
deleted file mode 100644
index 7aa386b279..0000000000
--- a/protocols/SkypeWeb/src/skype_popups.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-#include "stdafx.h"
-
-void CSkypeProto::InitPopups()
-{
- wchar_t desc[256];
- char name[256];
-
- POPUPCLASS ppc = {};
- ppc.flags = PCF_UNICODE;
- ppc.pszName = name;
- ppc.pszDescription.w = desc;
-
- mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Notifications"));
- mir_snprintf(name, "%s_%s", m_szModuleName, "Notification");
- ppc.hIcon = g_plugin.getIcon(IDI_NOTIFY);
- ppc.iSeconds = 5;
- m_PopupClasses.insert(Popup_RegisterClass(&ppc));
-
- mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Errors"));
- mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
- ppc.hIcon = g_plugin.getIcon(IDI_ERRORICON);
- ppc.iSeconds = -1;
- m_PopupClasses.insert(Popup_RegisterClass(&ppc));
-
- mir_snwprintf(desc, L"%s/%s", m_tszUserName, TranslateT("Calls"));
- mir_snprintf(name, "%s_%s", m_szModuleName, "Call");
- ppc.hIcon = g_plugin.getIcon(IDI_CALL);
- ppc.iSeconds = 30;
- ppc.PluginWindowProc = PopupDlgProcCall;
- m_PopupClasses.insert(Popup_RegisterClass(&ppc));
-}
-
-void CSkypeProto::UninitPopups()
-{
- for (auto &it : m_PopupClasses)
- Popup_UnregisterClass(it);
-}
-
-void CSkypeProto::ShowNotification(const wchar_t *caption, const wchar_t *message, MCONTACT hContact, int type)
-{
- if (Miranda_IsTerminated())
- return;
-
- CMStringA className(FORMAT, "%s_", m_szModuleName);
-
- switch (type) {
- case 1:
- className.Append("Error");
- break;
-
- case SKYPE_DB_EVENT_TYPE_INCOMING_CALL:
- className.Append("Call");
- break;
-
- default:
- className.Append("Notification");
- break;
- }
-
- POPUPDATACLASS ppd = {};
- ppd.szTitle.w = caption;
- ppd.szText.w = message;
- ppd.pszClassName = className.GetBuffer();
- ppd.hContact = hContact;
- Popup_AddClass(&ppd);
-}
-
-void CSkypeProto::ShowNotification(const wchar_t *message, MCONTACT hContact)
-{
- ShowNotification(_T(MODULE), message, hContact);
-}
-
-LRESULT CSkypeProto::PopupDlgProcCall(HWND hPopup, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- switch (uMsg) {
- case WM_CONTEXTMENU:
- PUDeletePopup(hPopup);
- CallService(MODULE "/IncomingCallPP", 0, PUGetContact(hPopup));
- break;
- case WM_COMMAND:
- PUDeletePopup(hPopup);
- CallService(MODULE "/IncomingCallPP", 1, PUGetContact(hPopup));
- break;
- }
-
- return DefWindowProc(hPopup, uMsg, wParam, lParam);
-}
diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp
deleted file mode 100644
index 2b5dc0eced..0000000000
--- a/protocols/SkypeWeb/src/skype_profile.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-void CSkypeProto::UpdateProfileDisplayName(const JSONNode &root, MCONTACT hContact)
-{
- ptrW firstname(getWStringA(hContact, "FirstName"));
- ptrW lastname(getWStringA(hContact, "LastName"));
- if (firstname) {
- CMStringW nick(firstname);
- if (lastname)
- nick.AppendFormat(L" %s", lastname.get());
- setWString(hContact, "Nick", nick);
- }
- else if (lastname)
- setWString(hContact, "Nick", lastname);
- else {
- const JSONNode &node = root["displayname"];
- SetString(hContact, "Nick", (node) ? node : root["username"]);
- }
-}
-
-void CSkypeProto::UpdateProfileGender(const JSONNode &root, MCONTACT hContact)
-{
- CMStringW gender = root["gender"].as_mstring();
- if (!gender.IsEmpty() && gender != "null")
- setByte(hContact, "Gender", (uint8_t)(_wtoi(gender) == 1 ? 'M' : 'F'));
- else
- delSetting(hContact, "Gender");
-}
-
-void CSkypeProto::UpdateProfileBirthday(const JSONNode &root, MCONTACT hContact)
-{
- CMStringW birthday = root["birthday"].as_mstring();
- if (!birthday.IsEmpty() && birthday != "null") {
- int d, m, y;
- if (3 == swscanf(birthday.GetBuffer(), L"%d-%d-%d", &y, &m, &d)) {
- setWord(hContact, "BirthYear", y);
- setByte(hContact, "BirthDay", d);
- setByte(hContact, "BirthMonth", m);
- }
- }
-
- delSetting(hContact, "BirthYear");
- delSetting(hContact, "BirthDay");
- delSetting(hContact, "BirthMonth");
-}
-
-void CSkypeProto::UpdateProfileCountry(const JSONNode &root, MCONTACT hContact)
-{
- std::string isocode = root["country"].as_string();
- if (!isocode.empty() && isocode != "null") {
- char *country = (char *)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)isocode.c_str(), 0);
- setString(hContact, "Country", country);
- }
- else delSetting(hContact, "Country");
-}
-
-void CSkypeProto::UpdateProfileEmails(const JSONNode &root, MCONTACT hContact)
-{
- const JSONNode &node = root["emails"];
- if (node) {
- const JSONNode &items = node.as_array();
- for (int i = 0; i < min(items.size(), 3); i++) {
- const JSONNode &item = items.at(i);
- if (!item)
- break;
-
- CMStringA name(FORMAT, "e-mail%d", i);
- setWString(hContact, name, item.as_mstring());
- }
- }
- else {
- delSetting(hContact, "e-mail0");
- delSetting(hContact, "e-mail1");
- delSetting(hContact, "e-mail2");
- }
-}
-
-void CSkypeProto::UpdateProfileAvatar(const JSONNode &root, MCONTACT hContact)
-{
- CMStringW szUrl = root["avatarUrl"].as_mstring();
- if (!szUrl.IsEmpty() && szUrl != "null") {
- SetAvatarUrl(hContact, szUrl);
- ReloadAvatarInfo(hContact);
- }
-}
-
-//{"firstname":"Echo \/ Sound Test Service", "lastname" : null, "birthday" : null, "gender" : null, "country" : null, "city" : null, "language" : null, "homepage" : null, "about" : null, "province" : null, "jobtitle" : null, "emails" : [], "phoneMobile" : null, "phoneHome" : null, "phoneOffice" : null, "mood" : null, "richMood" : null, "avatarUrl" : null, "username" : "echo123"}
-void CSkypeProto::LoadProfile(MHttpResponse *response, AsyncHttpRequest *pRequest)
-{
- MCONTACT hContact = (DWORD_PTR)pRequest->pUserInfo;
-
- JsonReply reply(response);
- if (reply.error()) {
- ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, 0);
- return;
- }
-
- auto &root = reply.data();
- std::string username = root["username"].as_string();
- if (username.empty()) {
- ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, 0);
- return;
- }
-
- if (m_szSkypename != username.c_str())
- m_szMyname = username.c_str();
- else
- m_szMyname = m_szSkypename;
-
- SetString(hContact, "City", root["city"]);
- SetString(hContact, "About", root["about"]);
- SetString(hContact, "Phone", root["phone"]);
- SetString(hContact, "State", root["province"]);
- SetString(hContact, "Cellular", root["phoneMobile"]);
- SetString(hContact, "Homepage", root["homepage"]);
- SetString(hContact, "LastName", root["lastname"]);
- SetString(hContact, "FirstName", root["firstname"]);
- SetString(hContact, "CompanyPhone", root["phoneOffice"]);
-
- if (auto &pMood = root["richMood"])
- RemoveHtml(pMood.as_mstring(), true); // this call extracts only emoji / mood id
-
- UpdateProfileDisplayName(root, hContact);
- UpdateProfileGender(root, hContact);
- UpdateProfileBirthday(root, hContact);
- UpdateProfileCountry(root, hContact);
- UpdateProfileEmails(root, hContact);
- UpdateProfileAvatar(root, hContact);
-
- ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, 0);
-}
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp
deleted file mode 100644
index 9320c5d490..0000000000
--- a/protocols/SkypeWeb/src/skype_proto.cpp
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-CSkypeProto::CSkypeProto(const char *protoName, const wchar_t *userName) :
- PROTO<CSkypeProto>(protoName, userName),
- m_PopupClasses(1),
- m_OutMessages(3, PtrKeySortT),
- m_impl(*this),
- m_requests(1),
- m_bAutoHistorySync(this, "AutoSync", true),
- m_bUseHostnameAsPlace(this, "UseHostName", true),
- m_bUseBBCodes(this, "UseBBCodes", true),
- m_bUseServerTime(this, "UseServerTime", false),
- m_wstrCListGroup(this, SKYPE_SETTINGS_GROUP, L"Skype"),
- m_wstrPlace(this, "Place", L""),
- m_iMood(this, "Mood", 0),
- m_wstrMoodEmoji(this, "MoodEmoji", L""),
- m_wstrMoodMessage(this, "XStatusMsg", L"")
-{
- NETLIBUSER nlu = {};
- nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE;
- nlu.szDescriptiveName.w = m_tszUserName;
- nlu.szSettingsModule = m_szModuleName;
- m_hNetlibUser = Netlib_RegisterUser(&nlu);
-
- CreateProtoService(PS_GETAVATARINFO, &CSkypeProto::SvcGetAvatarInfo);
- CreateProtoService(PS_GETAVATARCAPS, &CSkypeProto::SvcGetAvatarCaps);
- CreateProtoService(PS_GETMYAVATAR, &CSkypeProto::SvcGetMyAvatar);
- CreateProtoService(PS_SETMYAVATAR, &CSkypeProto::SvcSetMyAvatar);
-
- CreateProtoService(PS_OFFLINEFILE, &CSkypeProto::SvcOfflineFile);
-
- CreateProtoService(PS_MENU_REQAUTH, &CSkypeProto::OnRequestAuth);
- CreateProtoService(PS_MENU_GRANTAUTH, &CSkypeProto::OnGrantAuth);
-
- CreateProtoService(PS_MENU_LOADHISTORY, &CSkypeProto::SvcLoadHistory);
- CreateProtoService(PS_EMPTY_SRV_HISTORY, &CSkypeProto::SvcEmptyHistory);
-
- HookProtoEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit);
-
- CreateDirectoryTreeW(GetAvatarPath());
-
- // sounds
- g_plugin.addSound("skype_inc_call", L"SkypeWeb", LPGENW("Incoming call"));
- g_plugin.addSound("skype_call_canceled", L"SkypeWeb", LPGENW("Incoming call canceled"));
-
- CheckConvert();
- InitGroupChatModule();
-}
-
-CSkypeProto::~CSkypeProto()
-{
- UninitPopups();
-}
-
-void CSkypeProto::OnEventDeleted(MCONTACT hContact, MEVENT hDbEvent, int flags)
-{
- if (!hContact || !(flags & CDF_DEL_HISTORY))
- return;
-
- DB::EventInfo dbei(hDbEvent, false);
- if (dbei.szId)
- PushRequest(new DeleteMessageRequest(this, getId(hContact), dbei.szId));
-}
-
-void CSkypeProto::OnModulesLoaded()
-{
- setAllContactStatuses(ID_STATUS_OFFLINE, false);
-
- HookProtoEvent(ME_MSG_PRECREATEEVENT, &CSkypeProto::OnPreCreateMessage);
-
- InitDBEvents();
- InitPopups();
-}
-
-void CSkypeProto::OnShutdown()
-{
- StopQueue();
-}
-
-INT_PTR CSkypeProto::GetCaps(int type, MCONTACT)
-{
- switch (type) {
- case PFLAGNUM_1:
- return PF1_IM | PF1_AUTHREQ | PF1_CHAT | PF1_BASICSEARCH | PF1_MODEMSG | PF1_FILE | PF1_SERVERCLIST;
- case PFLAGNUM_2:
- return PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_HEAVYDND;
- case PFLAGNUM_3:
- return PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_HEAVYDND;
- case PFLAGNUM_4:
- return PF4_NOAUTHDENYREASON | PF4_SUPPORTTYPING | PF4_AVATARS | PF4_IMSENDOFFLINE | PF4_OFFLINEFILES | PF4_SERVERMSGID | PF4_SERVERFORMATTING;
- case PFLAG_UNIQUEIDTEXT:
- return (INT_PTR)TranslateT("Skypename");
- }
- return 0;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-MCONTACT CSkypeProto::AddToList(int, PROTOSEARCHRESULT *psr)
-{
- debugLogA(__FUNCTION__);
-
- if (psr->id.a == nullptr)
- return NULL;
-
- MCONTACT hContact;
- if (psr->flags & PSR_UNICODE)
- hContact = AddContact(T2Utf(psr->id.w), T2Utf(psr->nick.w));
- else
- hContact = AddContact(psr->id.a, psr->nick.a);
-
- return hContact;
-}
-
-MCONTACT CSkypeProto::AddToListByEvent(int, int, MEVENT hDbEvent)
-{
- debugLogA(__FUNCTION__);
-
- DB::EventInfo dbei(hDbEvent);
- if (!dbei)
- return NULL;
- if (mir_strcmp(dbei.szModule, m_szModuleName))
- return NULL;
- if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
- return NULL;
-
- DB::AUTH_BLOB blob(dbei.pBlob);
- return AddContact(blob.get_email(), blob.get_nick());
-}
-
-int CSkypeProto::Authorize(MEVENT hDbEvent)
-{
- MCONTACT hContact = GetContactFromAuthEvent(hDbEvent);
- if (hContact == INVALID_CONTACT_ID)
- return 1;
-
- PushRequest(new AuthAcceptRequest(getId(hContact)));
- return 0;
-}
-
-int CSkypeProto::AuthDeny(MEVENT hDbEvent, const wchar_t*)
-{
- MCONTACT hContact = GetContactFromAuthEvent(hDbEvent);
- if (hContact == INVALID_CONTACT_ID)
- return 1;
-
- PushRequest(new AuthDeclineRequest(getId(hContact)));
- return 0;
-}
-
-int CSkypeProto::AuthRecv(MCONTACT, DB::EventInfo &dbei)
-{
- return Proto_AuthRecv(m_szModuleName, dbei);
-}
-
-int CSkypeProto::AuthRequest(MCONTACT hContact, const wchar_t *szMessage)
-{
- if (hContact == INVALID_CONTACT_ID)
- return 1;
-
- PushRequest(new AddContactRequest(getId(hContact), T2Utf(szMessage)));
- return 0;
-}
-
-int CSkypeProto::GetInfo(MCONTACT hContact, int)
-{
- if (isChatRoom(hContact))
- return 1;
-
- PushRequest(new GetProfileRequest(this, hContact));
- return 0;
-}
-
-int CSkypeProto::SetStatus(int iNewStatus)
-{
- if (iNewStatus == m_iDesiredStatus)
- return 0;
-
- switch (iNewStatus) {
- case ID_STATUS_FREECHAT: iNewStatus = ID_STATUS_ONLINE; break;
- case ID_STATUS_NA: iNewStatus = ID_STATUS_AWAY; break;
- case ID_STATUS_OCCUPIED: iNewStatus = ID_STATUS_DND; break;
- }
-
- debugLogA(__FUNCTION__ ": changing status from %i to %i", m_iStatus, iNewStatus);
-
- int old_status = m_iStatus;
- m_iDesiredStatus = iNewStatus;
-
- if (iNewStatus == ID_STATUS_OFFLINE) {
- if (m_iStatus > ID_STATUS_CONNECTING + 1 && m_szId)
- PushRequest(new DeleteEndpointRequest(this));
-
- m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
- // logout
- StopQueue();
-
- ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, ID_STATUS_OFFLINE);
-
- m_impl.m_heartBeat.StopSafe();
-
- if (!Miranda_IsTerminated())
- setAllContactStatuses(ID_STATUS_OFFLINE, false);
- return 0;
- }
-
- if (m_iStatus == ID_STATUS_CONNECTING)
- return 0;
-
- if (m_iStatus == ID_STATUS_OFFLINE)
- Login();
- else
- PushRequest(new SetStatusRequest(MirandaToSkypeStatus(m_iDesiredStatus)));
- return 0;
-}
-
-int CSkypeProto::UserIsTyping(MCONTACT hContact, int type)
-{
- PushRequest(new SendTypingRequest(getId(hContact), type));
- return 0;
-}
-
-int CSkypeProto::RecvContacts(MCONTACT hContact, DB::EventInfo &dbei)
-{
- PROTOSEARCHRESULT **isrList = (PROTOSEARCHRESULT**)dbei.pBlob;
-
- int nCount = dbei.cbBlob;
-
- uint32_t cbBlob = 0;
- for (int i = 0; i < nCount; i++)
- cbBlob += int(/*mir_wstrlen(isrList[i]->nick.w)*/0 + 2 + mir_wstrlen(isrList[i]->id.w));
-
- char *pBlob = (char *)mir_calloc(cbBlob);
- char *pCurBlob = pBlob;
-
- for (int i = 0; i < nCount; i++) {
- pCurBlob += mir_strlen(pCurBlob) + 1;
-
- mir_strcpy(pCurBlob, _T2A(isrList[i]->id.w));
- pCurBlob += mir_strlen(pCurBlob) + 1;
- }
-
- dbei.szModule = m_szModuleName;
- dbei.eventType = EVENTTYPE_CONTACTS;
- dbei.cbBlob = cbBlob;
- dbei.pBlob = pBlob;
- db_event_add(hContact, &dbei);
-
- mir_free(pBlob);
- return 0;
-}
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
deleted file mode 100644
index 70f4bada85..0000000000
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _SKYPE_PROTO_H_
-#define _SKYPE_PROTO_H_
-
-struct CSkypeTransfer
-{
- CMStringA docId, fileName, fileType, url;
- int iFileSize = 0, iWidth = -1, iHeight = -1;
-};
-
-struct CSkypeProto : public PROTO <CSkypeProto>
-{
- friend class CSkypeOptionsMain;
- friend class CSkypeGCCreateDlg;
- friend class CSkypeInviteDlg;
- friend class CMoodDialog;
-
- class CSkypeProtoImpl
- {
- friend struct CSkypeProto;
- CSkypeProto &m_proto;
-
- CTimer m_heartBeat;
- void OnHeartBeat(CTimer *)
- {
- m_proto.ProcessTimer();
- }
-
- CSkypeProtoImpl(CSkypeProto &pro) :
- m_proto(pro),
- m_heartBeat(Miranda_GetSystemWindow(), UINT_PTR(this) + 1)
- {
- m_heartBeat.OnEvent = Callback(this, &CSkypeProtoImpl::OnHeartBeat);
- }
- } m_impl;
-
-public:
- CSkypeProto(const char *protoName, const wchar_t *userName);
- ~CSkypeProto();
-
- //////////////////////////////////////////////////////////////////////////////////////
- // Virtual functions
-
- MCONTACT AddToList(int flags, PROTOSEARCHRESULT* psr) override;
- MCONTACT AddToListByEvent(int flags, int iContact, MEVENT hDbEvent) override;
- int AuthRequest(MCONTACT hContact, const wchar_t* szMessage) override;
- int Authorize(MEVENT hDbEvent) override;
- int AuthDeny(MEVENT hDbEvent, const wchar_t* szReason) override;
- int AuthRecv(MCONTACT hContact, DB::EventInfo &dbei) override;
- INT_PTR GetCaps(int type, MCONTACT hContact = NULL) override;
- int GetInfo(MCONTACT hContact, int infoType) override;
- HANDLE SearchBasic(const wchar_t* id) override;
- int SendMsg(MCONTACT hContact, MEVENT hReplyEvent, const char* msg) override;
- int SetStatus(int iNewStatus) override;
- int UserIsTyping(MCONTACT hContact, int type) override;
- int RecvContacts(MCONTACT hContact, DB::EventInfo &dbei) override;
- HANDLE SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles) override;
-
- void OnBuildProtoMenu(void) override;
- bool OnContactDeleted(MCONTACT, uint32_t flags) override;
- MWindow OnCreateAccMgrUI(MWindow) override;
- void OnEventDeleted(MCONTACT hContact, MEVENT hDbEvent, int flags) override;
- void OnMarkRead(MCONTACT, MEVENT) override;
- void OnModulesLoaded() override;
- void OnReceiveOfflineFile(DB::EventInfo &dbei, DB::FILE_BLOB &blob) override;
- void OnShutdown() override;
-
- // icons
- static void InitIcons();
-
- // menus
- static void InitMenus();
-
- // popups
- void InitPopups();
- void UninitPopups();
-
- // search
- void __cdecl SearchBasicThread(void *param);
-
- // threads
- void __cdecl CSkypeProto::SendFileThread(void *p);
-
- //////////////////////////////////////////////////////////////////////////////////////
- // services
-
- static INT_PTR __cdecl SvcEventGetIcon(WPARAM, LPARAM);
- static INT_PTR __cdecl SvcGetEventText(WPARAM, LPARAM);
-
- //////////////////////////////////////////////////////////////////////////////////////
- // settings
-
- CMOption<bool> m_bAutoHistorySync;
- CMOption<bool> m_bUseBBCodes;
- CMOption<bool> m_bUseServerTime; // hidden setting!
-
- CMOption<bool> m_bUseHostnameAsPlace;
- CMOption<wchar_t*> m_wstrPlace;
-
- CMOption<wchar_t*> m_wstrCListGroup;
-
- CMOption<uint8_t> m_iMood;
- CMOption<wchar_t*> m_wstrMoodMessage, m_wstrMoodEmoji;
-
- //////////////////////////////////////////////////////////////////////////////////////
- // other data
-
- int m_iPollingId;
- ptrA m_szApiToken, m_szToken, m_szId, m_szOwnSkypeId;
- CMStringA m_szSkypename, m_szMyname;
- MCONTACT m_hMyContact;
-
- __forceinline CMStringA getId(MCONTACT hContact) {
- return getMStringA(hContact, SKYPE_SETTINGS_ID);
- }
-
- void OnSearch(MHttpResponse *response, AsyncHttpRequest *pRequest);
-
- // login
- void OnLoginOAuth(MHttpResponse *response, AsyncHttpRequest *pRequest);
- void OnSubscriptionsCreated(MHttpResponse *response, AsyncHttpRequest *pRequest);
- void OnCapabilitiesSended(MHttpResponse *response, AsyncHttpRequest *pRequest);
- void OnStatusChanged(MHttpResponse *response, AsyncHttpRequest *pRequest);
-
- void OnEndpointCreated(MHttpResponse *response, AsyncHttpRequest *pRequest);
- void OnEndpointDeleted(MHttpResponse *response, AsyncHttpRequest *pRequest);
-
- // oauth
- void OnOAuthStart(MHttpResponse *response, AsyncHttpRequest *pRequest);
- void OnOAuthConfirm(MHttpResponse* response, AsyncHttpRequest* pRequest);
- void OnOAuthAuthorize(MHttpResponse* response, AsyncHttpRequest* pRequest);
- void OnOAuthEnd(MHttpResponse *response, AsyncHttpRequest *pRequest);
-
- void OnASMObjectCreated(MHttpResponse *response, AsyncHttpRequest *pRequest);
- void OnASMObjectUploaded(MHttpResponse *response, AsyncHttpRequest *pRequest);
-
- void LoadContactsAuth(MHttpResponse *response, AsyncHttpRequest *pRequest);
- void LoadContactList(MHttpResponse *response, AsyncHttpRequest *pRequest);
-
- void OnBlockContact(MHttpResponse *response, AsyncHttpRequest *pRequest);
- void OnUnblockContact(MHttpResponse *response, AsyncHttpRequest *pRequest);
-
- void OnReceiveAvatar(MHttpResponse *response, AsyncHttpRequest *pRequest);
- void OnSentAvatar(MHttpResponse *response, AsyncHttpRequest *pRequest);
-
- void OnMessageSent(MHttpResponse *response, AsyncHttpRequest *pRequest);
-
- void OnGetServerHistory(MHttpResponse *response, AsyncHttpRequest *pRequest);
- void OnSyncConversations(MHttpResponse *response, AsyncHttpRequest *pRequest);
-
- void OnGetChatInfo(MHttpResponse *response, AsyncHttpRequest *pRequest);
- void OnGetChatMembers(MHttpResponse *response, AsyncHttpRequest *pRequest);
-
- void CheckConvert(void);
- bool CheckOauth(const char *szResponse);
-
- void LoadProfile(MHttpResponse *response, AsyncHttpRequest *pRequest);
-
- static INT_PTR __cdecl GlobalParseSkypeUriService(WPARAM, LPARAM lParam);
-
-private:
- bool m_bHistorySynced;
-
- std::map<std::string, std::string> cookies;
- static std::map<std::wstring, std::wstring> languages;
-
- LIST<void> m_PopupClasses;
- LIST<void> m_OutMessages;
-
- // locks
- mir_cs m_lckOutMessagesList;
- mir_cs messageSyncLock;
- mir_cs m_StatusLock;
-
- HANDLE m_hPollingThread;
- HNETLIBCONN m_hPollingConn;
-
- // requests
- bool m_isTerminated = true;
- mir_cs m_requestQueueLock;
- LIST<AsyncHttpRequest> m_requests;
- EventHandle m_hRequestQueueEvent;
- HANDLE m_hRequestQueueThread;
-
- void __cdecl WorkerThread(void *);
-
- void StartQueue();
- void StopQueue();
-
- MHttpResponse* DoSend(AsyncHttpRequest *request);
-
- void Execute(AsyncHttpRequest *request);
- void PushRequest(AsyncHttpRequest *request);
-
- // avatars
- void SetAvatarUrl(MCONTACT hContact, const CMStringW &tszUrl);
- bool ReceiveAvatar(MCONTACT hContact);
- void ReloadAvatarInfo(MCONTACT hContact);
- void GetAvatarFileName(MCONTACT hContact, wchar_t *pszDest, size_t cbLen);
-
- INT_PTR __cdecl SvcGetAvatarInfo(WPARAM, LPARAM);
- INT_PTR __cdecl SvcGetAvatarCaps(WPARAM, LPARAM);
- INT_PTR __cdecl SvcGetMyAvatar(WPARAM, LPARAM);
- INT_PTR __cdecl SvcSetMyAvatar(WPARAM, LPARAM);
-
- // menus
- static HGENMENU ContactMenuItems[CMI_MAX];
- int OnPrebuildContactMenu(WPARAM hContact, LPARAM);
- static int PrebuildContactMenu(WPARAM hContact, LPARAM lParam);
-
- // options
- int __cdecl OnOptionsInit(WPARAM wParam, LPARAM lParam);
-
- // login
- void Login();
- void OnLoginSuccess();
- void SendPresence();
-
- // profile
- void UpdateProfileDisplayName(const JSONNode &root, MCONTACT hContact = NULL);
- void UpdateProfileGender(const JSONNode &root, MCONTACT hContact = NULL);
- void UpdateProfileBirthday(const JSONNode &root, MCONTACT hContact = NULL);
- void UpdateProfileCountry(const JSONNode &node, MCONTACT hContact = NULL);
- void UpdateProfileEmails(const JSONNode &root, MCONTACT hContact = NULL);
- void UpdateProfileAvatar(const JSONNode &root, MCONTACT hContact = NULL);
-
- // contacts
- uint16_t GetContactStatus(MCONTACT hContact);
- void SetContactStatus(MCONTACT hContact, uint16_t status);
-
- MCONTACT FindContact(const char *skypeId);
- MCONTACT FindContact(const wchar_t *skypeId);
-
- MCONTACT AddContact(const char *skypename, const char *nick, bool isTemporary = false);
-
- MCONTACT GetContactFromAuthEvent(MEVENT hEvent);
-
- // files
- void __cdecl ReceiveFileThread(void *param);
-
- INT_PTR __cdecl SvcOfflineFile(WPARAM, LPARAM);
-
- // messages
- std::map<ULONGLONG, HANDLE> m_mpOutMessagesIds;
-
- int __cdecl OnPreCreateMessage(WPARAM, LPARAM lParam);
-
- void ProcessContactRecv(MCONTACT hContact, const char *szContent, DB::EventInfo &dbei);
- void ProcessFileRecv(MCONTACT hContact, const char *szContent, DB::EventInfo &dbei);
-
- // chats
- void InitGroupChatModule();
-
- int __cdecl OnGroupChatEventHook(WPARAM, LPARAM lParam);
- int __cdecl OnGroupChatMenuHook(WPARAM, LPARAM lParam);
- INT_PTR __cdecl OnJoinChatRoom(WPARAM hContact, LPARAM);
- INT_PTR __cdecl OnLeaveChatRoom(WPARAM hContact, LPARAM);
-
- SESSION_INFO* StartChatRoom(const wchar_t *tid, const wchar_t *tname, const char *pszVersion = nullptr);
-
- bool OnChatEvent(const JSONNode &node);
- wchar_t* GetChatContactNick(MCONTACT hContact, const wchar_t *id, const wchar_t *name = nullptr, bool *isQualified = nullptr);
-
- bool AddChatContact(SESSION_INFO *si, const wchar_t *id, const wchar_t *role, bool isChange = false);
- void RemoveChatContact(SESSION_INFO *si, const wchar_t *id, bool isKick = false, const wchar_t *initiator = L"");
- void SendChatMessage(SESSION_INFO *si, const wchar_t *tszMessage);
-
- void KickChatUser(const char *chatId, const char *userId);
-
- void SetChatStatus(MCONTACT hContact, int iStatus);
-
- // polling
- void __cdecl PollingThread(void*);
-
- bool ParseMessage(const JSONNode &node, DB::EventInfo &dbei);
- void ParsePollData(const char*);
-
- void ProcessNewMessage(const JSONNode &node);
- void ProcessUserPresence(const JSONNode &node);
- void ProcessThreadUpdate(const JSONNode &node);
- void ProcessEndpointPresence(const JSONNode &node);
- void ProcessConversationUpdate(const JSONNode &node);
-
- // utils
- template <typename T>
- __inline static void FreeList(const LIST<T> &lst)
- {
- for (auto &it : lst)
- mir_free(it);
- }
-
- __forceinline bool IsOnline() const
- { return (m_iStatus > ID_STATUS_OFFLINE);
- }
-
- bool IsMe(const wchar_t *str);
- bool IsMe(const char *str);
-
- int64_t getLastTime(MCONTACT);
- void setLastTime(MCONTACT, int64_t);
-
- CMStringW RemoveHtml(const CMStringW &src, bool bCheckSS = false);
-
- static time_t IsoToUnixTime(const std::string &stamp);
-
- static int SkypeToMirandaStatus(const char *status);
- static const char *MirandaToSkypeStatus(int status);
-
- void ShowNotification(const wchar_t *message, MCONTACT hContact = NULL);
- void ShowNotification(const wchar_t *caption, const wchar_t *message, MCONTACT hContact = NULL, int type = 0);
- static bool IsFileExists(std::wstring path);
-
- static LRESULT CALLBACK PopupDlgProcCall(HWND hPopup, UINT uMsg, WPARAM wParam, LPARAM lParam);
-
- void ProcessTimer();
-
- void SetString(MCONTACT hContact, const char *pszSetting, const JSONNode &node);
-
- CMStringW ChangeTopicForm();
-
- // events
- void InitDBEvents();
-
- // services
- INT_PTR __cdecl BlockContact(WPARAM hContact, LPARAM);
- INT_PTR __cdecl UnblockContact(WPARAM hContact, LPARAM);
- INT_PTR __cdecl OnRequestAuth(WPARAM hContact, LPARAM);
- INT_PTR __cdecl OnGrantAuth(WPARAM hContact, LPARAM);
- INT_PTR __cdecl SvcLoadHistory(WPARAM hContact, LPARAM);
- INT_PTR __cdecl SvcEmptyHistory(WPARAM hContact, LPARAM);
- INT_PTR __cdecl SvcCreateChat(WPARAM, LPARAM);
- INT_PTR __cdecl SvcSetMood(WPARAM, LPARAM);
- INT_PTR __cdecl ParseSkypeUriService(WPARAM, LPARAM lParam);
-
- template<INT_PTR(__cdecl CSkypeProto::*Service)(WPARAM, LPARAM)>
- static INT_PTR __cdecl GlobalService(WPARAM wParam, LPARAM lParam)
- {
- CSkypeProto *proto = CMPlugin::getInstance((MCONTACT)wParam);
- return proto ? (proto->*Service)(wParam, lParam) : 0;
- }
-};
-
-typedef CProtoDlgBase<CSkypeProto> CSkypeDlgBase;
-
-#endif //_SKYPE_PROTO_H_ \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/skype_search.cpp b/protocols/SkypeWeb/src/skype_search.cpp
deleted file mode 100644
index 22f4ef10e0..0000000000
--- a/protocols/SkypeWeb/src/skype_search.cpp
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-HANDLE CSkypeProto::SearchBasic(const wchar_t *id)
-{
- ForkThread(&CSkypeProto::SearchBasicThread, (void *)id);
- return (HANDLE)1;
-}
-
-void CSkypeProto::SearchBasicThread(void *id)
-{
- debugLogA("CSkypeProto::OnSearchBasicThread");
- if (IsOnline())
- PushRequest(new GetSearchRequest(T2Utf((wchar_t *)id)));
-}
-
-void CSkypeProto::OnSearch(MHttpResponse *response, AsyncHttpRequest*)
-{
- debugLogA(__FUNCTION__);
-
- JsonReply reply(response);
- if (reply.error()) {
- ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
- return;
- }
-
- auto &root = reply.data();
- const JSONNode &items = root["results"].as_array();
- for (auto &it : items) {
- const JSONNode &item = it["nodeProfileData"];
-
- std::string skypeId = item["skypeId"].as_string();
- if (UrlToSkypeId(skypeId.c_str()).IsEmpty())
- skypeId = "8:" + skypeId;
-
- std::string name = item["name"].as_string();
-
- PROTOSEARCHRESULT psr = { sizeof(psr) };
- psr.flags = PSR_UTF8;
- psr.id.a = const_cast<char *>(skypeId.c_str());
- psr.nick.a = const_cast<char *>(name.c_str());
- ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
- }
-
- ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)1, 0);
-}
diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp
deleted file mode 100644
index 57b22cde4f..0000000000
--- a/protocols/SkypeWeb/src/skype_utils.cpp
+++ /dev/null
@@ -1,895 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h"
-
-#pragma warning(disable:4566)
-
-time_t CSkypeProto::IsoToUnixTime(const std::string &stamp)
-{
- char date[9];
- int i, y;
-
- if (stamp.empty())
- return 0;
-
- char *p = NEWSTR_ALLOCA(stamp.c_str());
-
- // skip '-' chars
- int si = 0, sj = 0;
- while (true) {
- if (p[si] == '-')
- si++;
- else if (!(p[sj++] = p[si++]))
- break;
- }
-
- // Get the date part
- for (i = 0; *p != '\0' && i < 8 && isdigit(*p); p++, i++)
- date[i] = *p;
-
- // Parse year
- if (i == 6) {
- // 2-digit year (1970-2069)
- y = (date[0] - '0') * 10 + (date[1] - '0');
- if (y < 70) y += 100;
- }
- else if (i == 8) {
- // 4-digit year
- y = (date[0] - '0') * 1000 + (date[1] - '0') * 100 + (date[2] - '0') * 10 + date[3] - '0';
- y -= 1900;
- }
- else return 0;
-
- struct tm timestamp;
- timestamp.tm_year = y;
-
- // Parse month
- timestamp.tm_mon = (date[i - 4] - '0') * 10 + date[i - 3] - '0' - 1;
-
- // Parse date
- timestamp.tm_mday = (date[i - 2] - '0') * 10 + date[i - 1] - '0';
-
- // Skip any date/time delimiter
- for (; *p != '\0' && !isdigit(*p); p++);
-
- // Parse time
- if (sscanf(p, "%d:%d:%d", &timestamp.tm_hour, &timestamp.tm_min, &timestamp.tm_sec) != 3)
- return (time_t)0;
-
- timestamp.tm_isdst = 0; // DST is already present in _timezone below
- time_t t = mktime(&timestamp);
-
- _tzset();
- t -= _timezone;
- return (t >= 0) ? t : 0;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-
-struct HtmlEntity
-{
- const char *entity;
- const char *symbol;
-};
-
-const HtmlEntity htmlEntities[] =
-{
- { "AElig", "\u00C6" },
- { "Aacute", "\u00C1" },
- { "Acirc", "\u00C2" },
- { "Agrave", "\u00C0" },
- { "Alpha", "\u0391" },
- { "Aring", "\u00C5" },
- { "Atilde", "\u00C3" },
- { "Auml", "\u00C4" },
- { "Beta", "\u0392" },
- { "Ccedil", "\u00C7" },
- { "Chi", "\u03A7" },
- { "Dagger", "‡" },
- { "Delta", "\u0394" },
- { "ETH", "\u00D0" },
- { "Eacute", "\u00C9" },
- { "Ecirc", "\u00CA" },
- { "Egrave", "\u00C8" },
- { "Epsilon", "\u0395" },
- { "Eta", "\u0397" },
- { "Euml", "\u00CB" },
- { "Gamma", "\u0393" },
- { "Iacute", "\u00CD" },
- { "Icirc", "\u00CE" },
- { "Igrave", "\u00CC" },
- { "Iota", "\u0399" },
- { "Iuml", "\u00CF" },
- { "Kappa", "\u039A" },
- { "Lambda", "\u039B" },
- { "Mu", "\u039C" },
- { "Ntilde", "\u00D1" },
- { "Nu", "\u039D" },
- { "OElig", "\u0152" },
- { "Oacute", "\u00D3" },
- { "Ocirc", "\u00D4" },
- { "Ograve", "\u00D2" },
- { "Omega", "\u03A9" },
- { "Omicron", "\u039F" },
- { "Oslash", "\u00D8" },
- { "Otilde", "\u00D5" },
- { "Ouml", "\u00D6" },
- { "Phi", "\u03A6" },
- { "Pi", "\u03A0" },
- { "Prime", "\u2033" },
- { "Psi", "\u03A8" },
- { "Rho", "\u03A1" },
- { "Scaron", "Š" },
- { "Sigma", "Σ" },
- { "THORN", "Þ" },
- { "Tau", "Τ" },
- { "Theta", "Θ" },
- { "Uacute", "Ú" },
- { "Ucirc", "Û" },
- { "Ugrave", "Ù" },
- { "Upsilon", "Υ" },
- { "Uuml", "Ü" },
- { "Xi", "Ξ" },
- { "Yacute", "Ý" },
- { "Yuml", "Ÿ" },
- { "Zeta", "Ζ" },
- { "aacute", "á" },
- { "acirc", "â" },
- { "acute", "´" },
- { "aelig", "æ" },
- { "agrave", "à" },
- { "alefsym", "ℵ" },
- { "alpha", "α" },
- { "amp", "&" },
- { "and", "∧" },
- { "ang", "∠" },
- { "apos", "'" },
- { "aring", "å" },
- { "asymp", "≈" },
- { "atilde", "ã" },
- { "auml", "ä" },
- { "bdquo", "„" },
- { "beta", "β" },
- { "brvbar", "¦" },
- { "bull", "•" },
- { "cap", "∩" },
- { "ccedil", "ç" },
- { "cedil", "¸" },
- { "cent", "¢" },
- { "chi", "χ" },
- { "circ", "ˆ" },
- { "clubs", "♣" },
- { "cong", "≅" },
- { "copy", "©" },
- { "crarr", "↵" },
- { "cup", "∪" },
- { "curren", "¤" },
- { "dArr", "⇓" },
- { "dagger", "†" },
- { "darr", "↓" },
- { "deg", "°" },
- { "delta", "δ" },
- { "diams", "♦" },
- { "divide", "÷" },
- { "eacute", "é" },
- { "ecirc", "ê" },
- { "egrave", "è" },
- { "empty", "∅" },
- { "emsp", " " },
- { "ensp", " " },
- { "epsilon", "ε" },
- { "equiv", "≡" },
- { "eta", "η" },
- { "eth", "ð" },
- { "euml", "ë" },
- { "euro", "€" },
- { "exist", "∃" },
- { "fnof", "ƒ" },
- { "forall", "∀" },
- { "frac12", "½" },
- { "frac14", "¼" },
- { "frac34", "¾" },
- { "frasl", "⁄" },
- { "gamma", "γ" },
- { "ge", "≥" },
- { "gt", ">" },
- { "hArr", "⇔" },
- { "harr", "↔" },
- { "hearts", "♥" },
- { "hellip", "…" },
- { "iacute", "í" },
- { "icirc", "î" },
- { "iexcl", "¡" },
- { "igrave", "ì" },
- { "image", "ℑ" },
- { "infin", "∞" },
- { "int", "∫" },
- { "iota", "ι" },
- { "iquest", "¿" },
- { "isin", "∈" },
- { "iuml", "ï" },
- { "kappa", "κ" },
- { "lArr", "⇐" },
- { "lambda", "λ" },
- { "lang", "〈" },
- { "laquo", "«" },
- { "larr", "←" },
- { "lceil", "⌈" },
- { "ldquo", "“" },
- { "le", "≤" },
- { "lfloor", "⌊" },
- { "lowast", "∗" },
- { "loz", "◊" },
- { "lrm", "\xE2\x80\x8E" },
- { "lsaquo", "‹" },
- { "lsquo", "‘" },
- { "lt", "<" },
- { "macr", "¯" },
- { "mdash", "—" },
- { "micro", "µ" },
- { "middot", "·" },
- { "minus", "−" },
- { "mu", "μ" },
- { "nabla", "∇" },
- { "nbsp", " " },
- { "ndash", "–" },
- { "ne", "≠" },
- { "ni", "∋" },
- { "not", "¬" },
- { "notin", "∉" },
- { "nsub", "⊄" },
- { "ntilde", "ñ" },
- { "nu", "ν" },
- { "oacute", "ó" },
- { "ocirc", "ô" },
- { "oelig", "œ" },
- { "ograve", "ò" },
- { "oline", "‾" },
- { "omega", "ω" },
- { "omicron", "ο" },
- { "oplus", "⊕" },
- { "or", "∨" },
- { "ordf", "ª" },
- { "ordm", "º" },
- { "oslash", "ø" },
- { "otilde", "õ" },
- { "otimes", "⊗" },
- { "ouml", "ö" },
- { "para", "¶" },
- { "part", "∂" },
- { "permil", "‰" },
- { "perp", "⊥" },
- { "phi", "φ" },
- { "pi", "π" },
- { "piv", "ϖ" },
- { "plusmn", "±" },
- { "pound", "£" },
- { "prime", "′" },
- { "prod", "∏" },
- { "prop", "∝" },
- { "psi", "ψ" },
- { "quot", "\"" },
- { "rArr", "⇒" },
- { "radic", "√" },
- { "rang", "〉" },
- { "raquo", "»" },
- { "rarr", "→" },
- { "rceil", "⌉" },
- { "rdquo", "”" },
- { "real", "ℜ" },
- { "reg", "®" },
- { "rfloor", "⌋" },
- { "rho", "ρ" },
- { "rlm", "\xE2\x80\x8F" },
- { "rsaquo", "›" },
- { "rsquo", "’" },
- { "sbquo", "‚" },
- { "scaron", "š" },
- { "sdot", "⋅" },
- { "sect", "§" },
- { "shy", "\xC2\xAD" },
- { "sigma", "σ" },
- { "sigmaf", "ς" },
- { "sim", "∼" },
- { "spades", "♠" },
- { "sub", "⊂" },
- { "sube", "⊆" },
- { "sum", "∑" },
- { "sup", "⊃" },
- { "sup1", "¹" },
- { "sup2", "²" },
- { "sup3", "³" },
- { "supe", "⊇" },
- { "szlig", "ß" },
- { "tau", "τ" },
- { "there4", "∴" },
- { "theta", "θ" },
- { "thetasym", "ϑ" },
- { "thinsp", " " },
- { "thorn", "þ" },
- { "tilde", "˜" },
- { "times", "×" },
- { "trade", "™" },
- { "uArr", "⇑" },
- { "uacute", "ú" },
- { "uarr", "↑" },
- { "ucirc", "û" },
- { "ugrave", "ù" },
- { "uml", "¨" },
- { "upsih", "ϒ" },
- { "upsilon", "υ" },
- { "uuml", "ü" },
- { "weierp", "℘" },
- { "xi", "ξ" },
- { "yacute", "ý" },
- { "yen", "¥" },
- { "yuml", "ÿ" },
- { "zeta", "ζ" },
- { "zwj", "\xE2\x80\x8D" },
- { "zwnj", "\xE2\x80\x8C" }
-};
-
-static CMStringW getAttrText(const wchar_t *pwszText, const wchar_t *pwszAttrName)
-{
- if (auto *p1 = mir_wstrstri(pwszText, pwszAttrName)) {
- p1 += wcslen(pwszAttrName);
- if (p1[0] == '=' && p1[1] == '\"') {
- p1 += 2;
- if (auto *p2 = wcschr(p1, '\"'))
- return CMStringW(p1, p2 - p1);
- }
- }
- return L"";
-}
-
-CMStringW CSkypeProto::RemoveHtml(const CMStringW &data, bool bCheckSS)
-{
- bool inSS = false;
- CMStringW new_string;
-
- for (int i = 0; i < data.GetLength(); i++) {
- wchar_t c = data[i];
- if (c == '<') {
- if (bCheckSS && !wcsncmp(data.c_str() + i + 1, L"ss ", 3))
- inSS = true;
- else if (!wcsncmp(data.c_str() + i + 1, L"/ss>", 4)) {
- CMStringW wszStatusMsg = data.Mid(i + 5);
- wszStatusMsg.Trim();
- m_wstrMoodMessage = wszStatusMsg;
- inSS = false;
- }
- else if (m_bUseBBCodes) {
- bool bEnable = true;
- auto *p = data.c_str() + i + 1;
- if (*p == '/') {
- bEnable = false;
- p++;
- }
-
- if (!wcsncmp(p, L"b>", 2))
- new_string.Append(bEnable ? L"[b]" : L"[/b]");
- else if (!wcsncmp(p, L"i>", 2))
- new_string.Append(bEnable ? L"[i]" : L"[/i]");
- else if (!wcsncmp(p, L"u>", 2))
- new_string.Append(bEnable ? L"[u]" : L"[/u]");
- else if (!wcsncmp(p, L"s>", 2))
- new_string.Append(bEnable ? L"[s]" : L"[/s]");
- else if (!wcsncmp(p, L"pre ", 4))
- new_string.Append(L"[code]");
- else if (!wcsncmp(p, L"pre>", 4))
- new_string.Append(L"[/code]");
- else if (!wcsncmp(p, L"legacyquote>", 12)) {
- if (bEnable)
- i = data.Find(L"legacyquote>", i+13);
- }
- else if (!wcsncmp(p, L"quote ", 6)) {
- CMStringW author(getAttrText(p, L"authorname"));
- CMStringW timestamp(getAttrText(p, L"timestamp"));
-
- wchar_t wszTime[100];
- TimeZone_PrintTimeStamp(0, _wtoi(timestamp), L"D t", wszTime, _countof(wszTime), 0);
-
- new_string.AppendFormat(L"[quote]%s %s %s: \r\n", wszTime, author.c_str(), TranslateT("wrote"));
- }
- else if (!wcsncmp(p, L"quote>", 6)) {
- new_string.Append(L"[/quote]");
- }
- }
-
- i = data.Find('>', i);
- if (i == -1)
- break;
-
- continue;
- }
-
- // special character
- if (c == '&') {
- int begin = i;
- i = data.Find(';', i);
- if (i == -1)
- i = begin;
- else {
- CMStringW entity = data.Mid(begin + 1, i - begin - 1);
-
- bool found = false;
- if (entity.GetLength() > 1 && entity[0] == '#') {
- // Numeric replacement
- bool hex = false;
- if (entity[1] == 'x') {
- hex = true;
- entity.Delete(0, 2);
- }
- else entity.Delete(0, 1);
-
- if (!entity.IsEmpty()) {
- found = true;
- errno = 0;
- unsigned long value = wcstoul(entity, nullptr, hex ? 16 : 10);
- if (errno != 0) { // error with conversion in strtoul, ignore the result
- found = false;
- }
- else if (value <= 127) { // U+0000 .. U+007F
- new_string += (char)value;
- }
- else if (value >= 128 && value <= 2047) { // U+0080 .. U+07FF
- new_string += (char)(192 + (value / 64));
- new_string += (char)(128 + (value % 64));
- }
- else if (value >= 2048 && value <= 65535) { // U+0800 .. U+FFFF
- new_string += (char)(224 + (value / 4096));
- new_string += (char)(128 + ((value / 64) % 64));
- new_string += (char)(128 + (value % 64));
- }
- else {
- new_string += (char)((value >> 24) & 0xFF);
- new_string += (char)((value >> 16) & 0xFF);
- new_string += (char)((value >> 8) & 0xFF);
- new_string += (char)((value) & 0xFF);
- }
- }
- }
- else {
- // Keyword replacement
- CMStringA tmp = entity;
- for (auto &it : htmlEntities) {
- if (!mir_strcmpi(tmp, it.entity)) {
- new_string += it.symbol;
- found = true;
- break;
- }
- }
- }
-
- if (found)
- continue;
- else
- i = begin;
- }
- }
-
- if (c == '(' && inSS) {
- int iEnd = data.Find(')', i);
- if (iEnd != -1) {
- CMStringW ss(data.Mid(i + 1, iEnd - i - 1));
- uint32_t code = getMoodIndex(T2Utf(ss));
- if (code != -1)
- m_iMood = code;
- else if (1 == swscanf(ss, L"%x_", &code)) {
- Utf32toUtf16(code, new_string);
- m_wstrMoodEmoji = new_string;
- }
-
- i = iEnd;
- continue;
- }
- }
-
- new_string.AppendChar(c);
- }
-
- return new_string;
-}
-
-bool AddBbcodes(CMStringA &str)
-{
- bool bUsed = false;
- CMStringA ret;
-
- for (const char *p = str; *p; p++) {
- if (*p == '[') {
- p++;
- if (!strncmp(p, "b]", 2)) {
- p++;
- ret.Append("<b _pre=\"*\" _post=\"*\">");
- bUsed = true;
- }
- else if (!strncmp(p, "/b]", 3)) {
- p += 2;
- ret.Append("</b>");
- bUsed = true;
- }
- else if (!strncmp(p, "i]", 2)) {
- p++;
- ret.Append("<i _pre=\"_\" _post=\"_\">");
- bUsed = true;
- }
- else if (!strncmp(p, "/i]", 3)) {
- p += 2;
- ret.Append("</i>");
- bUsed = true;
- }
- else if (!strncmp(p, "s]", 2)) {
- p++;
- ret.Append("<s _pre=\"~\" _post=\"~\">");
- bUsed = true;
- }
- else if (!strncmp(p, "/s]", 3)) {
- p += 2;
- ret.Append("</s>");
- bUsed = true;
- }
- else if (!strncmp(p, "code]", 5)) {
- p += 4;
- ret.Append("<pre _pre=\"```\" _post=\"```\">");
- bUsed = true;
- }
- else if (!strncmp(p, "/code]", 6)) {
- p += 5;
- ret.Append("</pre>");
- bUsed = true;
- }
- }
- else ret.AppendChar(*p);
- }
-
- if (bUsed)
- str = ret;
- return bUsed;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-
-void Utf32toUtf16(uint32_t c, CMStringW &dest)
-{
- if (c < 0x10000)
- dest.AppendChar(c);
- else {
- unsigned int t = c - 0x10000;
- dest.AppendChar((((t << 12) >> 22) + 0xD800));
- dest.AppendChar((((t << 22) >> 22) + 0xDC00));
- }
-}
-
-bool is_surrogate(wchar_t uc) { return (uc - 0xd800u) < 2048u; }
-bool is_high_surrogate(wchar_t uc) { return (uc & 0xfffffc00) == 0xd800; }
-bool is_low_surrogate(wchar_t uc) { return (uc & 0xfffffc00) == 0xdc00; }
-
-uint32_t Utf16toUtf32(const wchar_t *str)
-{
- if (!is_surrogate(str[0]))
- return str[0];
-
- if (is_high_surrogate(str[0]) && is_low_surrogate(str[1]))
- return (str[0] << 10) + str[1] - 0x35fdc00;
-
- return 0;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-
-const char* CSkypeProto::MirandaToSkypeStatus(int status)
-{
- switch (status) {
- case ID_STATUS_AWAY:
- return "Away";
-
- case ID_STATUS_DND:
- return "Busy";
-
- case ID_STATUS_IDLE:
- return "Idle";
-
- case ID_STATUS_INVISIBLE:
- return "Hidden";
- }
- return "Online";
-}
-
-int CSkypeProto::SkypeToMirandaStatus(const char *status)
-{
- if (!mir_strcmpi(status, "Online"))
- return ID_STATUS_ONLINE;
- else if (!mir_strcmpi(status, "Hidden"))
- return ID_STATUS_INVISIBLE;
- else if (!mir_strcmpi(status, "Away"))
- return ID_STATUS_AWAY;
- else if (!mir_strcmpi(status, "Idle"))
- return ID_STATUS_AWAY;
- else if (!mir_strcmpi(status, "Busy"))
- return ID_STATUS_DND;
- else
- return ID_STATUS_OFFLINE;
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-
-bool CSkypeProto::IsMe(const wchar_t *str)
-{
- return (!mir_wstrcmpi(str, Utf2T(m_szMyname)) || !mir_wstrcmp(str, Utf2T(m_szOwnSkypeId)));
-}
-
-bool CSkypeProto::IsMe(const char *str)
-{
- return (!mir_strcmpi(str, m_szMyname) || !mir_strcmp(str, m_szOwnSkypeId));
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-
-int64_t CSkypeProto::getLastTime(MCONTACT hContact)
-{
- ptrA szLastTime(getStringA(hContact, "LastMsgTime"));
- return (szLastTime) ? _atoi64(szLastTime) : 0;
-}
-
-void CSkypeProto::setLastTime(MCONTACT hContact, int64_t iValue)
-{
- char buf[100];
- _i64toa(iValue, buf, 10);
- setString(hContact, "LastMsgTime", buf);
-}
-
-//////////////////////////////////////////////////////////////////////////////////////////
-
-bool CSkypeProto::IsFileExists(std::wstring path)
-{
- return _waccess(path.c_str(), 0) == 0;
-}
-
-const char* GetSkypeNick(const char *szSkypeId)
-{
- if (auto *p = strchr(szSkypeId, ':'))
- return p + 1;
- return szSkypeId;
-}
-
-const wchar_t* GetSkypeNick(const wchar_t *szSkypeId)
-{
- if (auto *p = wcsrchr(szSkypeId, ':'))
- return p + 1;
- return szSkypeId;
-}
-
-void CSkypeProto::SetString(MCONTACT hContact, const char *pszSetting, const JSONNode &node)
-{
- CMStringW str = node.as_mstring();
- if (str.IsEmpty() || str == L"null")
- delSetting(hContact, pszSetting);
- else
- setWString(hContact, pszSetting, str);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// url parsing
-
-CMStringA ParseUrl(const char *url, const char *token)
-{
- if (url == nullptr)
- return CMStringA();
-
- auto *start = strstr(url, token);
- if (start == nullptr)
- return CMStringA();
-
- auto *end = strchr(++start, '/');
- if (end == nullptr)
- return CMStringA(start);
- return CMStringA(start, end - start);
-}
-
-CMStringW ParseUrl(const wchar_t *url, const wchar_t *token)
-{
- if (url == nullptr)
- return CMStringW();
-
- auto *start = wcsstr(url, token);
- if (start == nullptr)
- return CMStringW();
-
- auto *end = wcschr(++start, '/');
- if (end == nullptr)
- return CMStringW(start);
- return CMStringW(start, end - start);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-static int possibleTypes[] = { 1, 2, 4, 8, 19, 28 };
-
-bool IsPossibleUserType(const char *pszUserId)
-{
- int iType = atoi(pszUserId);
-
- // we don't process 28 and other shit
- for (auto &it : possibleTypes)
- if (it == iType)
- return true;
-
- return false;
-}
-
-CMStringA UrlToSkypeId(const char *url, int *pUserType)
-{
- int userType = -1;
- CMStringA szResult;
-
- if (url != nullptr) {
- for (auto &it : possibleTypes) {
- char tmp[10];
- sprintf_s(tmp, "/%d:", it);
- if (strstr(url, tmp)) {
- userType = it;
- szResult = ParseUrl(url, tmp);
- break;
- }
- }
- }
-
- if (pUserType)
- *pUserType = userType;
-
- return szResult;
-}
-
-CMStringW UrlToSkypeId(const wchar_t *url, int *pUserType)
-{
- int userType = -1;
- CMStringW szResult;
-
- if (url != nullptr) {
- for (auto &it : possibleTypes) {
- wchar_t tmp[10];
- swprintf_s(tmp, L"/%d:", it);
- if (wcsstr(url, tmp)) {
- userType = it;
- szResult = ParseUrl(url, tmp);
- break;
- }
- }
- }
-
- if (pUserType)
- *pUserType = userType;
-
- return szResult;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam)
-{
- wchar_t *arg = (wchar_t *)lParam;
- if (arg == nullptr)
- return 1;
-
- // skip leading prefix
- wchar_t szUri[1024];
- wcsncpy_s(szUri, arg, _TRUNCATE);
- wchar_t *szJid = wcschr(szUri, ':');
- if (szJid == nullptr)
- return 1;
-
- // empty jid?
- if (!*szJid)
- return 1;
-
- // command code
- wchar_t *szCommand = szJid;
- szCommand = wcschr(szCommand, '?');
- if (szCommand)
- *(szCommand++) = 0;
-
- // parameters
- wchar_t *szSecondParam = szCommand ? wcschr(szCommand, '&') : nullptr;
- if (szSecondParam)
- *(szSecondParam++) = 0;
-
- // no command or message command
- if (!szCommand || !mir_wstrcmpi(szCommand, L"chat")) {
- if (szSecondParam) {
- wchar_t *szChatId = wcsstr(szSecondParam, L"id=");
- if (szChatId) {
- szChatId += 5;
- StartChatRoom(szChatId, szChatId);
- return 0;
- }
- }
- MCONTACT hContact = AddContact(_T2A(szJid), nullptr, true);
- CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, NULL);
- return 0;
- }
-
- if (!mir_wstrcmpi(szCommand, L"call")) {
- MCONTACT hContact = AddContact(_T2A(szJid), nullptr, true);
- NotifyEventHooks(g_hCallEvent, (WPARAM)hContact, (LPARAM)0);
- return 0;
- }
-
- if (!mir_wstrcmpi(szCommand, L"userinfo"))
- return 0;
-
- if (!mir_wstrcmpi(szCommand, L"add")) {
- MCONTACT hContact = FindContact(_T2A(szJid));
- if (hContact == NULL) {
- PROTOSEARCHRESULT psr = { 0 };
- psr.cbSize = sizeof(psr);
- psr.id.w = mir_wstrdup(szJid);
- psr.nick.w = mir_wstrdup(szJid);
- psr.flags = PSR_UNICODE;
- Contact::AddBySearch(m_szModuleName, &psr);
- }
- return 0;
- }
-
- if (!mir_wstrcmpi(szCommand, L"sendfile")) {
- MCONTACT hContact = AddContact(_T2A(szJid), nullptr, true);
- File::Send(hContact);
- return 1;
- }
-
- if (!mir_wstrcmpi(szCommand, L"voicemail"))
- return 1;
-
- return 1;
-}
-
-INT_PTR CSkypeProto::GlobalParseSkypeUriService(WPARAM wParam, LPARAM lParam)
-{
- for (auto &it : CMPlugin::g_arInstances)
- if (it->IsOnline())
- return it->ParseSkypeUriService(wParam, lParam);
-
- return 1;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-JsonReply::JsonReply(MHttpResponse *pReply)
-{
- if (pReply == nullptr) {
- m_errorCode = 500;
- return;
- }
-
- m_errorCode = pReply->resultCode;
- if (m_errorCode != 200)
- return;
-
- m_root = json_parse(pReply->body);
- if (m_root == nullptr) {
- m_errorCode = 500;
- return;
- }
-
- m_errorCode = (*m_root)["status"]["code"].as_int();
-}
-
-JsonReply::~JsonReply()
-{
- json_delete(m_root);
-}
diff --git a/protocols/SkypeWeb/src/skype_utils.h b/protocols/SkypeWeb/src/skype_utils.h
deleted file mode 100644
index fcc6d17788..0000000000
--- a/protocols/SkypeWeb/src/skype_utils.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _UTILS_H_
-#define _UTILS_H_
-
-void Utf32toUtf16(uint32_t c, CMStringW &dest);
-uint32_t Utf16toUtf32(const wchar_t *str);
-
-const char* GetSkypeNick(const char *pszSkypeId);
-const wchar_t* GetSkypeNick(const wchar_t *szSkypeId);
-
-CMStringA ParseUrl(const char *url, const char *token);
-
-bool AddBbcodes(CMStringA &str);
-
-bool IsPossibleUserType(const char *pszUserId);
-
-CMStringA UrlToSkypeId(const char *url, int *pUserType = nullptr);
-CMStringW UrlToSkypeId(const wchar_t *url, int *pUserType = nullptr);
-
-int getMoodIndex(const char *pszMood);
-
-class EventHandle
-{
- HANDLE _hEvent;
-public:
- __inline explicit EventHandle() { _hEvent = CreateEvent(NULL, 0, 0, NULL); }
- __inline explicit EventHandle(HANDLE hEvent) : _hEvent(hEvent) {}
- __inline ~EventHandle() { CloseHandle(_hEvent); }
- __inline void Set() { SetEvent(_hEvent); }
- __inline void Wait(uint32_t dwMilliseconds = INFINITE) { WaitForSingleObject(_hEvent, dwMilliseconds); }
- __inline operator HANDLE() { return _hEvent; }
-};
-
-struct CFileUploadParam : public MZeroedObject
-{
- ptrW tszFileName;
- ptrW tszDesc;
- ptrA atr;
- ptrA fname;
- ptrA uid;
- long size;
- int width, height;
- MCONTACT hContact;
- bool isPicture;
-
- __forceinline CFileUploadParam(MCONTACT _hContact, const wchar_t* _desc, wchar_t** _files) :
- hContact(_hContact),
- tszDesc(mir_wstrdup(_desc)),
- tszFileName(mir_wstrdup(_files[0]))
- {};
-
- __forceinline bool IsAccess() { return ::_waccess(tszFileName, 0) == 0; }
-};
-
-class JsonReply
-{
- JSONNode *m_root = nullptr;
- int m_errorCode = 0;
-
-public:
- JsonReply(MHttpResponse *response);
- ~JsonReply();
-
- __forceinline JSONNode &data() const { return *m_root; }
- __forceinline int error() const { return m_errorCode; }
-};
-
-#endif //_UTILS_H_ \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/stdafx.cxx b/protocols/SkypeWeb/src/stdafx.cxx
deleted file mode 100644
index 13f28e1314..0000000000
--- a/protocols/SkypeWeb/src/stdafx.cxx
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "stdafx.h" \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h
deleted file mode 100644
index 5120fb3c46..0000000000
--- a/protocols/SkypeWeb/src/stdafx.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
-Copyright (c) 2015-24 Miranda NG team (https://miranda-ng.org)
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation version 2
-of the License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef _COMMON_H_
-#define _COMMON_H_
-
-#include <windows.h>
-
-#include <malloc.h>
-#include <time.h>
-#include <string>
-#include <vector>
-#include <regex>
-#include <map>
-#include <memory>
-#include <functional>
-
-#include <newpluginapi.h>
-
-#include <m_protoint.h>
-#include <m_protosvc.h>
-
-#include <m_database.h>
-#include <m_langpack.h>
-#include <m_clistint.h>
-#include <m_options.h>
-#include <m_netlib.h>
-#include <m_popup.h>
-#include <m_icolib.h>
-#include <m_userinfo.h>
-#include <m_timezones.h>
-#include <m_contacts.h>
-#include <m_message.h>
-#include <m_avatars.h>
-#include <m_skin.h>
-#include <m_chat_int.h>
-#include <m_genmenu.h>
-#include <m_clc.h>
-#include <m_json.h>
-#include <m_gui.h>
-#include <m_imgsrvc.h>
-#include <m_xml.h>
-#include <m_assocmgr.h>
-#include <m_file.h>
-
-struct CSkypeProto;
-typedef CProtoDlgBase<CSkypeProto> CSkypeDlg;
-
-extern char g_szMirVer[];
-extern HANDLE g_hCallEvent;
-
-struct MessageId
-{
- ULONGLONG id;
- HANDLE handle;
-};
-
-struct CMPlugin : public ACCPROTOPLUGIN<CSkypeProto>
-{
- CMPlugin();
-
- CMStringA szDefaultServer;
-
- int Load() override;
- int Unload() override;
-};
-
-#include "version.h"
-#include "resource.h"
-#include "skype_menus.h"
-#include "skype_utils.h"
-#include "skype_db.h"
-#include "skype_proto.h"
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-#define SKYPEWEB_CLIENTINFO_NAME "swx-skype.com"
-#define SKYPEWEB_CLIENTINFO_VERSION "908/1.85.0.29"
-
-enum SkypeHost
-{
- HOST_API,
- HOST_CONTACTS,
- HOST_DEFAULT,
- HOST_GRAPH,
- HOST_LOGIN,
- HOST_PEOPLE,
- HOST_OTHER
-};
-
-struct AsyncHttpRequest : public MTHttpRequest<CSkypeProto>
-{
- SkypeHost m_host;
- MCONTACT hContact = 0;
-
- AsyncHttpRequest(int type, SkypeHost host, LPCSTR url = nullptr, MTHttpRequestHandler pFunc = nullptr);
-
- void AddRegister(CSkypeProto *ppro);
- void AddAuthentication(CSkypeProto *ppro);
-};
-
-#include "requests/capabilities.h"
-#include "requests/chatrooms.h"
-#include "requests/contacts.h"
-#include "requests/endpoint.h"
-#include "requests/files.h"
-#include "requests/history.h"
-#include "requests/login.h"
-#include "requests/messages.h"
-#include "requests/oauth.h"
-#include "requests/poll.h"
-#include "requests/profile.h"
-#include "requests/search.h"
-#include "requests/status.h"
-#include "requests/subscriptions.h"
-
-#define MODULE "Skype"
-
-enum SKYPE_LOGIN_ERROR
-{
- LOGIN_ERROR_UNKNOWN = 1001,
- LOGIN_ERROR_TOOMANY_REQUESTS
-};
-
-#define POLLING_ERRORS_LIMIT 3
-
-#endif //_COMMON_H_ \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/version.h b/protocols/SkypeWeb/src/version.h
deleted file mode 100644
index 5029f2c626..0000000000
--- a/protocols/SkypeWeb/src/version.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 96
-#define __RELEASE_NUM 6
-#define __BUILD_NUM 1
-
-#include <stdver.h>
-
-#define __PLUGIN_NAME "Skype protocol (Web)"
-#define __FILENAME "SkypeWeb.dll"
-#define __DESCRIPTION "Skype protocol support for Miranda NG. Based on new Skype for Web."
-#define __AUTHOR "Miranda NG team"
-#define __AUTHORWEB "https://miranda-ng.org/p/SkypeWeb"
-#define __COPYRIGHT "© 2015-24 Miranda NG team"