diff options
| author | George Hazan <george.hazan@gmail.com> | 2024-08-07 17:19:37 +0300 |
|---|---|---|
| committer | George Hazan <george.hazan@gmail.com> | 2024-08-07 17:19:37 +0300 |
| commit | 5732a19c7dd15ee2a70fb30b3b27db9514208d2f (patch) | |
| tree | c414a6c6582bfdf263b36edf31f6bdb249f9788b /protocols/SkypeWeb/src/requests | |
| parent | af775d509bf12dd75cdc5088a04bd39cae06ef30 (diff) | |
fixes #4542 (SkypeWeb: Load Server History втягивает только некоторое количество свежих сообщений, а не всю историю)
Diffstat (limited to 'protocols/SkypeWeb/src/requests')
| -rw-r--r-- | protocols/SkypeWeb/src/requests/files.h | 34 | ||||
| -rw-r--r-- | protocols/SkypeWeb/src/requests/history.h | 23 | ||||
| -rw-r--r-- | protocols/SkypeWeb/src/requests/messages.h | 4 |
3 files changed, 31 insertions, 30 deletions
diff --git a/protocols/SkypeWeb/src/requests/files.h b/protocols/SkypeWeb/src/requests/files.h index 0517385bf3..7c04baabfb 100644 --- a/protocols/SkypeWeb/src/requests/files.h +++ b/protocols/SkypeWeb/src/requests/files.h @@ -16,12 +16,15 @@ struct ASMObjectCreateRequest : public AsyncHttpRequest T2Utf uszFileName(fup->tszFileName); const char *szFileName = strrchr(uszFileName.get() + 1, '\\'); - JSONNode node, jPermissions, jPermission(JSON_ARRAY); - jPermissions.set_name("permissions"); - jPermission.set_name(szContact.c_str()); - jPermission << CHAR_PARAM("", "read"); - jPermissions << jPermission; - node << CHAR_PARAM("type", "sharing/file") << CHAR_PARAM("filename", szFileName) << jPermissions; + 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(); } }; @@ -31,11 +34,12 @@ 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/original", szObject); + 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", "application/octet-stream"); + AddHeader("Content-Type", fup->isPicture ? "application" : "application/octet-stream"); m_szParam.Truncate(size); memcpy(m_szParam.GetBuffer(), data, size); @@ -44,16 +48,20 @@ struct ASMObjectUploadRequest : public AsyncHttpRequest struct SendFileRequest : public AsyncHttpRequest { - SendFileRequest(const char *username, time_t timestamp, const char *message, const char *messageType, const char *asmRef) : + 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 node, ref(JSON_ARRAY); - ref.set_name("amsreferences"); ref.push_back(JSONNode("", asmRef)); + 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", timestamp) << CHAR_PARAM("messagetype", messageType) - << CHAR_PARAM("contenttype", "text") << CHAR_PARAM("content", message) << ref; + 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 index ecd3fbcb65..4e63278f8c 100644 --- a/protocols/SkypeWeb/src/requests/history.h +++ b/protocols/SkypeWeb/src/requests/history.h @@ -21,35 +21,28 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. struct SyncHistoryFirstRequest : public AsyncHttpRequest
{
SyncHistoryFirstRequest(int pageSize) :
- AsyncHttpRequest(REQUEST_GET, HOST_DEFAULT, "/users/ME/conversations", &CSkypeProto::OnSyncHistory)
+ AsyncHttpRequest(REQUEST_GET, HOST_DEFAULT, "/users/ME/conversations", &CSkypeProto::OnSyncConversations)
{
this << INT_PARAM("startTime", 0) << INT_PARAM("pageSize", pageSize)
<< CHAR_PARAM("view", "msnp24Equivalent") << CHAR_PARAM("targetType", "Passport|Skype|Lync");
}
-
- SyncHistoryFirstRequest(const char *url) :
- AsyncHttpRequest(REQUEST_GET, HOST_DEFAULT, url, &CSkypeProto::OnSyncHistory)
- {
- }
};
struct GetHistoryRequest : public AsyncHttpRequest
{
- GetHistoryRequest(const char *who, int pageSize, uint32_t timestamp, bool bOperative) :
- AsyncHttpRequest(REQUEST_GET, HOST_DEFAULT, "/users/ME/conversations/" + mir_urlEncode(who) + "/messages", &CSkypeProto::OnGetServerHistory)
+ 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 << INT_PARAM("startTime", timestamp) << INT_PARAM("pageSize", pageSize)
+ this << INT64_PARAM("startTime", timestamp) << INT_PARAM("pageSize", pageSize)
<< CHAR_PARAM("view", "msnp24Equivalent") << CHAR_PARAM("targetType", "Passport|Skype|Lync|Thread");
}
-
- GetHistoryRequest(const char *url, void *pInfo) :
- AsyncHttpRequest(REQUEST_GET, HOST_DEFAULT, url, &CSkypeProto::OnGetServerHistory)
- {
- pUserInfo = pInfo;
- }
};
struct EmptyHistoryRequest : public AsyncHttpRequest
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h index e51718e508..a6d9cf4916 100644 --- a/protocols/SkypeWeb/src/requests/messages.h +++ b/protocols/SkypeWeb/src/requests/messages.h @@ -71,13 +71,13 @@ struct SendTypingRequest : public AsyncHttpRequest struct MarkMessageReadRequest : public AsyncHttpRequest
{
- MarkMessageReadRequest(const char *username, LONGLONG /*msgId*/, LONGLONG msgTimestamp) :
+ MarkMessageReadRequest(const char *username, int64_t msgTimestamp) :
AsyncHttpRequest(REQUEST_PUT, HOST_DEFAULT)
{
m_szUrl.AppendFormat("/users/ME/conversations/%s/properties?name=consumptionhorizon", mir_urlEncode(username).c_str());
JSONNode node(JSON_NODE);
- node << CHAR_PARAM("consumptionhorizon", CMStringA(::FORMAT, "%lld000;%lld000;%lld000", msgTimestamp, time(NULL), msgTimestamp));
+ node << CHAR_PARAM("consumptionhorizon", CMStringA(::FORMAT, "%lld;%lld;%lld", msgTimestamp, msgTimestamp, msgTimestamp));
m_szParam = node.write().c_str();
}
};
|
