diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-09-01 12:00:50 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-09-01 12:00:50 +0000 |
commit | 039db3b302a3f7a3e78f89e430c8cb83efb12b5e (patch) | |
tree | 27a05aa06be93ed06e6050805f6c4d6f8cb2046f | |
parent | 4b2a0c3b6959c5691152af85b726b0f6a9398d3a (diff) |
SkypeWeb: clientmessageid = time in milliseconds (fix doubles in linux client)
git-svn-id: http://svn.miranda-ng.org/main/trunk@15134 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/SkypeWeb/src/requests/chatrooms.h | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/requests/messages.h | 8 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_chatrooms.cpp | 4 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 4 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 7 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/stdafx.h | 1 |
6 files changed, 19 insertions, 11 deletions
diff --git a/protocols/SkypeWeb/src/requests/chatrooms.h b/protocols/SkypeWeb/src/requests/chatrooms.h index 767bfb1eb4..68855cb9bf 100644 --- a/protocols/SkypeWeb/src/requests/chatrooms.h +++ b/protocols/SkypeWeb/src/requests/chatrooms.h @@ -40,7 +40,7 @@ public: class SendChatMessageRequest : public HttpRequest
{
public:
- SendChatMessageRequest(const char *to, time_t timestamp, const char *message, LoginInfo &li) :
+ SendChatMessageRequest(const char *to, ULONGLONG timestamp, const char *message, LoginInfo &li) :
HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/19:%s/messages", li.endpoint.szServer, to)
{
Headers
@@ -61,7 +61,7 @@ public: class SendChatActionRequest : public HttpRequest
{
public:
- SendChatActionRequest(const char *to, time_t timestamp, const char *message, LoginInfo &li) :
+ SendChatActionRequest(const char *to, ULONGLONG timestamp, const char *message, LoginInfo &li) :
HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/19:%s/messages", li.endpoint.szServer, to)
{
Headers
@@ -71,7 +71,7 @@ public: JSONNode node(JSON_NODE);
node
- << JSONNode("clientmessageid", (long)timestamp)
+ << JSONNode("clientmessageid", CMStringA(::FORMAT, "%llu", (ULONGLONG)timestamp))
<< JSONNode("messagetype", "RichText")
<< JSONNode("contenttype", "text")
<< JSONNode("content", message)
diff --git a/protocols/SkypeWeb/src/requests/messages.h b/protocols/SkypeWeb/src/requests/messages.h index 9750be58ad..ff706473df 100644 --- a/protocols/SkypeWeb/src/requests/messages.h +++ b/protocols/SkypeWeb/src/requests/messages.h @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. class SendMessageRequest : public HttpRequest
{
public:
- SendMessageRequest(const char *username, time_t timestamp, const char *message, LoginInfo &li) :
+ SendMessageRequest(const char *username, ULONGLONG timestamp, const char *message, LoginInfo &li) :
HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", li.endpoint.szServer, username)
{
Headers
@@ -31,7 +31,7 @@ public: JSONNode node;
node
- << JSONNode("clientmessageid", (long)timestamp)
+ << JSONNode("clientmessageid", CMStringA(::FORMAT, "%llu", (ULONGLONG)timestamp))
<< JSONNode("messagetype", "Text")
<< JSONNode("contenttype", "text")
<< JSONNode("content", message);
@@ -43,7 +43,7 @@ public: class SendActionRequest : public HttpRequest
{
public:
- SendActionRequest(const char *username, time_t timestamp, const char *message, LoginInfo &li) :
+ SendActionRequest(const char *username, ULONGLONG timestamp, const char *message, LoginInfo &li) :
HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/conversations/8:%s/messages", li.endpoint.szServer, username)
{
Headers
@@ -56,7 +56,7 @@ public: JSONNode node;
node
- << JSONNode("clientmessageid", (long)timestamp)
+ << JSONNode("clientmessageid", CMStringA(::FORMAT, "%llu", (ULONGLONG)timestamp))
<< JSONNode("messagetype", "RichText")
<< JSONNode("contenttype", "text")
<< JSONNode("content", content)
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp index 5cd6536814..7be0b232d8 100644 --- a/protocols/SkypeWeb/src/skype_chatrooms.cpp +++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp @@ -403,9 +403,9 @@ void CSkypeProto::OnSendChatMessage(const TCHAR *chat_id, const TCHAR * tszMessa ptrA szChatId(mir_t2a(chat_id));
ptrA szMessage(mir_utf8encodeT(tszMessage));
if (strncmp(szMessage, "/me ", 4) == 0)
- SendRequest(new SendChatActionRequest(szChatId, time(NULL), szMessage, li));
+ SendRequest(new SendChatActionRequest(szChatId, GenerateMessageId(), szMessage, li));
else
- SendRequest(new SendChatMessageRequest(szChatId, time(NULL), szMessage, li));
+ SendRequest(new SendChatMessageRequest(szChatId, GenerateMessageId(), szMessage, li));
}
void CSkypeProto::AddMessageToChat(const TCHAR *chat_id, const TCHAR *from, const char *content, bool isAction, int emoteOffset, time_t timestamp, bool isLoading)
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 78798c1432..ecf39013af 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -39,7 +39,7 @@ int CSkypeProto::OnReceiveMessage(MCONTACT hContact, const char *szContent, cons struct SendMessageParam
{
MCONTACT hContact;
- LONGLONG hMessage;
+ ULONGLONG hMessage;
};
// outcoming message flow
@@ -53,7 +53,7 @@ int CSkypeProto::OnSendMessage(MCONTACT hContact, int, const char *szMessage) SendMessageParam *param = new SendMessageParam();
param->hContact = hContact;
- param->hMessage = time(NULL);
+ param->hMessage = GenerateMessageId();
ptrA username(getStringA(hContact, "Skypename"));
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index be8ad8ef75..607c3f6e86 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -351,6 +351,13 @@ private: static void CALLBACK TimerProc(HWND, UINT, UINT_PTR, DWORD);
//---/
+ __inline ULONGLONG GenerateMessageId()
+ {
+ _timeb timeb;
+ _ftime(&timeb);
+ return (ULONGLONG)((timeb.time * 1000) + timeb.millitm);
+ }
+
time_t GetLastMessageTime(MCONTACT hContact);
CMString RunConfirmationCode();
CMString ChangeTopicForm();
diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h index 5f391969cc..37eb381157 100644 --- a/protocols/SkypeWeb/src/stdafx.h +++ b/protocols/SkypeWeb/src/stdafx.h @@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include <vector>
#include <regex>
#include <map>
+#include <sys/timeb.h>
#include <newpluginapi.h>
|