summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/SkypeWeb/SkypeWeb.vcxproj1
-rw-r--r--protocols/SkypeWeb/SkypeWeb.vcxproj.filters3
-rw-r--r--protocols/SkypeWeb/src/requests/messages.h58
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp12
-rw-r--r--protocols/SkypeWeb/src/skype_proto.cpp20
-rw-r--r--protocols/SkypeWeb/src/stdafx.h1
6 files changed, 26 insertions, 69 deletions
diff --git a/protocols/SkypeWeb/SkypeWeb.vcxproj b/protocols/SkypeWeb/SkypeWeb.vcxproj
index 7901c5c0e9..f44147ab8f 100644
--- a/protocols/SkypeWeb/SkypeWeb.vcxproj
+++ b/protocols/SkypeWeb/SkypeWeb.vcxproj
@@ -56,7 +56,6 @@
<ClInclude Include="src\requests\contacts.h" />
<ClInclude Include="src\requests\history.h" />
<ClInclude Include="src\requests\login.h" />
- <ClInclude Include="src\requests\messages.h" />
<ClInclude Include="src\requests\oauth.h" />
<ClInclude Include="src\requests\poll.h" />
<ClInclude Include="src\requests\profile.h" />
diff --git a/protocols/SkypeWeb/SkypeWeb.vcxproj.filters b/protocols/SkypeWeb/SkypeWeb.vcxproj.filters
index 924e0aadbe..e6d0bb2fc3 100644
--- a/protocols/SkypeWeb/SkypeWeb.vcxproj.filters
+++ b/protocols/SkypeWeb/SkypeWeb.vcxproj.filters
@@ -93,9 +93,6 @@
<ClInclude Include="src\requests\login.h">
<Filter>Header Files\Requests</Filter>
</ClInclude>
- <ClInclude Include="src\requests\messages.h">
- <Filter>Header Files\Requests</Filter>
- </ClInclude>
<ClInclude Include="src\requests\oauth.h">
<Filter>Header Files\Requests</Filter>
</ClInclude>
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h
deleted file mode 100644
index 4c7a3cecae..0000000000
--- a/protocols/SkypeWeb/src/requests/messages.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-Copyright (c) 2015-25 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 << INT64_PARAM("clientmessageid", getRandomId()) << 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/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
index d4fdd4c373..71bd4aea31 100644
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ b/protocols/SkypeWeb/src/skype_messages.cpp
@@ -224,8 +224,16 @@ 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)));
+ if (dbei && dbei.szId) {
+ auto *pReq = new AsyncHttpRequest(REQUEST_PUT, HOST_DEFAULT, "/users/ME/conversations/" + mir_urlEncode(getId(hContact)) + "/properties?name=consumptionhorizon");
+ auto msgTimestamp = _atoi64(dbei.szId);
+
+ JSONNode node(JSON_NODE);
+ node << CHAR_PARAM("consumptionhorizon", CMStringA(::FORMAT, "%lld;%lld;%lld", msgTimestamp, msgTimestamp, msgTimestamp));
+ pReq->m_szParam = node.write().c_str();
+
+ PushRequest(pReq);
+ }
}
}
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp
index 6e68c5ce16..094ef23e5e 100644
--- a/protocols/SkypeWeb/src/skype_proto.cpp
+++ b/protocols/SkypeWeb/src/skype_proto.cpp
@@ -74,8 +74,13 @@ void CSkypeProto::OnEventDeleted(MCONTACT hContact, MEVENT hDbEvent, int flags)
return;
DB::EventInfo dbei(hDbEvent, false);
- if (dbei.szId)
- PushRequest(new DeleteMessageRequest(this, getId(hContact), dbei.szId));
+ if (dbei.szId) {
+ auto *pReq = new AsyncHttpRequest(REQUEST_DELETE, HOST_DEFAULT, "/users/ME/conversations/" + mir_urlEncode(getId(hContact)) + "/messages/" + dbei.szId);
+ pReq->AddAuthentication(this);
+ pReq->AddHeader("Origin", "https://web.skype.com");
+ pReq->AddHeader("Referer", "https://web.skype.com/");
+ PushRequest(pReq);
+ }
}
void CSkypeProto::OnEventEdited(MCONTACT hContact, MEVENT, const DBEVENTINFO &dbei)
@@ -240,9 +245,16 @@ int CSkypeProto::SetStatus(int iNewStatus)
return 0;
}
-int CSkypeProto::UserIsTyping(MCONTACT hContact, int type)
+int CSkypeProto::UserIsTyping(MCONTACT hContact, int iState)
{
- PushRequest(new SendTypingRequest(getId(hContact), type));
+ auto *pReq = new AsyncHttpRequest(REQUEST_POST, HOST_DEFAULT, "/users/ME/conversations/" + mir_urlEncode(getId(hContact)) + "/messages");
+
+ JSONNode node;
+ node << INT64_PARAM("clientmessageid", getRandomId()) << CHAR_PARAM("contenttype", "text") << CHAR_PARAM("content", "")
+ << CHAR_PARAM("messagetype", (iState == PROTOTYPE_SELFTYPING_ON) ? "Control/Typing" : "Control/ClearTyping");
+ pReq->m_szParam = node.write().c_str();
+
+ PushRequest(pReq);
return 0;
}
diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h
index 917bea0194..ef94f3040c 100644
--- a/protocols/SkypeWeb/src/stdafx.h
+++ b/protocols/SkypeWeb/src/stdafx.h
@@ -118,7 +118,6 @@ struct AsyncHttpRequest : public MTHttpRequest<CSkypeProto>
#include "requests/contacts.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"