summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-08-15 19:23:04 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-08-15 19:23:04 +0000
commitef92e3ef473fd0e3bea04af6179678e615b1813f (patch)
treec5b54d5fbffc54c9bc7f91e534b0976ffb31c73a /protocols/SkypeWeb/src
parentbfa87af56480a56464b448541b321e5fe1a86303 (diff)
SkypeWeb: Server time for outgoing messages. Option "Local time for incoming messages" removed
git-svn-id: http://svn.miranda-ng.org/main/trunk@14962 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src')
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp23
-rw-r--r--protocols/SkypeWeb/src/skype_options.cpp2
-rw-r--r--protocols/SkypeWeb/src/skype_options.h1
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h2
4 files changed, 24 insertions, 4 deletions
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
index 29e9a4e2aa..ba3c7eb5aa 100644
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ b/protocols/SkypeWeb/src/skype_messages.cpp
@@ -81,6 +81,15 @@ void CSkypeProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg)
{
if (m_OutMessages.getIndex(hMessage) != -1)
{
+ if (response->pData != NULL)
+ {
+ JSONNode jRoot = JSONNode::parse(response->pData);
+ auto it = m_mpOutMessages.find(hMessage);
+ if (it == m_mpOutMessages.end())
+ {
+ m_mpOutMessages[hMessage] = jRoot["OriginalArrivalTime"].as_int();
+ }
+ }
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, hMessage, 0);
m_OutMessages.remove(hMessage);
}
@@ -129,6 +138,13 @@ int CSkypeProto::OnPreCreateMessage(WPARAM, LPARAM lParam)
memcpy(&evt->dbei->pBlob[evt->dbei->cbBlob], messageId, messageId.GetLength());
evt->dbei->cbBlob += messageId.GetLength();
+ auto it = m_mpOutMessages.find((HANDLE)evt->seq);
+ if (it != m_mpOutMessages.end())
+ {
+ evt->dbei->timestamp = it->second;
+ m_mpOutMessages.erase(it);
+ }
+
return 0;
}
@@ -145,7 +161,7 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node)
ptrA szClearedContent(RemoveHtml(strContent.c_str()));
bool bEdited = node["skypeeditedid"];
- time_t timestamp = getByte("UseLocalTime", 0) ? time(NULL) : IsoToUnixTime(node["composetime"].as_string().c_str());
+ time_t timestamp = IsoToUnixTime(node["composetime"].as_string().c_str());
int nEmoteOffset = node["skypeemoteoffset"].as_int();
@@ -169,6 +185,11 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node)
HANDLE hMessage = (HANDLE)atol(szMessageId);
if (m_OutMessages.getIndex(hMessage) != -1)
{
+ auto it = m_mpOutMessages.find(hMessage);
+ if (it == m_mpOutMessages.end())
+ {
+ m_mpOutMessages[hMessage] = timestamp;
+ }
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, hMessage, 0);
m_OutMessages.remove(hMessage);
}
diff --git a/protocols/SkypeWeb/src/skype_options.cpp b/protocols/SkypeWeb/src/skype_options.cpp
index d2339df840..5e565a6755 100644
--- a/protocols/SkypeWeb/src/skype_options.cpp
+++ b/protocols/SkypeWeb/src/skype_options.cpp
@@ -24,14 +24,12 @@ CSkypeOptionsMain::CSkypeOptionsMain(CSkypeProto *proto, int idDialog)
m_group(this, IDC_GROUP),
m_place(this, IDC_PLACE),
m_autosync(this, IDC_AUTOSYNC),
- m_localtime(this, IDC_LOCALTIME),
m_allasunread(this, IDC_MESASUREAD),
m_usehostname(this, IDC_USEHOST),
m_usebb(this, IDC_BBCODES)
{
CreateLink(m_group, SKYPE_SETTINGS_GROUP, _T("Skype"));
CreateLink(m_autosync, "AutoSync", DBVT_BYTE, 1);
- CreateLink(m_localtime, "UseLocalTime", DBVT_BYTE, 0);
CreateLink(m_allasunread, "MarkMesUnread", DBVT_BYTE, 1);
CreateLink(m_place, "Place", _T(""));
CreateLink(m_usehostname, "UseHostName", DBVT_BYTE, 0);
diff --git a/protocols/SkypeWeb/src/skype_options.h b/protocols/SkypeWeb/src/skype_options.h
index 90d60ae138..f7bd9711da 100644
--- a/protocols/SkypeWeb/src/skype_options.h
+++ b/protocols/SkypeWeb/src/skype_options.h
@@ -26,7 +26,6 @@ private:
CCtrlEdit m_group;
CCtrlEdit m_place;
CCtrlCheck m_autosync;
- CCtrlCheck m_localtime;
CCtrlCheck m_allasunread;
CCtrlCheck m_usehostname;
CCtrlCheck m_usebb;
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index 366acb6c97..dc1a15cb5b 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -98,6 +98,8 @@ private:
bool isTerminated,
HistorySynced;
+ std::map<HANDLE, time_t> m_mpOutMessages;
+
std::map<std::string, std::string> cookies;
static std::map<std::tstring, std::tstring> languages;