summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-08-06 12:09:45 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-08-06 12:09:45 +0300
commit739955c81588319e5bc24c5efb96162bbadc13cd (patch)
tree58090fb4dfecf549ccbec42483393db9c1cadf85
parentb41249cfae3de49321d23af9e098224a06113796 (diff)
SkypeWeb: fix for apostrophes in fetched history
-rw-r--r--protocols/SkypeWeb/src/skype_history_sync.cpp14
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp19
2 files changed, 17 insertions, 16 deletions
diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp
index 5d141174e3..b858b3afce 100644
--- a/protocols/SkypeWeb/src/skype_history_sync.cpp
+++ b/protocols/SkypeWeb/src/skype_history_sync.cpp
@@ -74,18 +74,18 @@ void CSkypeProto::OnGetServerHistory(MHttpResponse *response, AsyncHttpRequest *
dbei.flags |= DBEF_SENT;
CMStringW wszContent = message["content"].as_mstring();
- T2Utf szMsg(wszContent);
if (messageType == "RichText/UriObject") {
- ProcessFileRecv(hContact, szMsg, dbei);
- return;
+ ProcessFileRecv(hContact, T2Utf(wszContent), dbei);
+ continue;
}
if (messageType == "RichText/Contacts") {
- ProcessContactRecv(hContact, szMsg, dbei);
- return;
+ ProcessContactRecv(hContact, T2Utf(wszContent), dbei);
+ continue;
}
if (messageType == "Text" || messageType == "RichText") {
- CMStringW szMessage(messageType == "RichText" ? RemoveHtml(wszContent) : wszContent);
+ if (messageType == "RichText")
+ wszContent = RemoveHtml(wszContent);
dbei.eventType = (emoteOffset == 0) ? EVENTTYPE_MESSAGE : SKYPE_DB_EVENT_TYPE_ACTION;
}
else if (messageType == "Event/Call") {
@@ -96,11 +96,13 @@ void CSkypeProto::OnGetServerHistory(MHttpResponse *response, AsyncHttpRequest *
}
else if (messageType == "RichText/Media_Album") {
// do nothing
+ continue;
}
else {
dbei.eventType = SKYPE_DB_EVENT_TYPE_UNKNOWN;
}
+ T2Utf szMsg(wszContent);
dbei.cbBlob = (uint32_t)mir_strlen(szMsg);
dbei.pBlob = szMsg;
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
index 86c21930c1..5f1619d8e0 100644
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ b/protocols/SkypeWeb/src/skype_messages.cpp
@@ -96,18 +96,18 @@ void CSkypeProto::ProcessNewMessage(const JSONNode &node)
CMStringA szConversationName(UrlToSkypeId(node["conversationLink"].as_string().c_str()));
CMStringA szFromSkypename(UrlToSkypeId(node["from"].as_mstring()));
- time_t timestamp = time(0); // fuck the server time, we need to place events in the order of our local time
-
int nEmoteOffset = node["skypeemoteoffset"].as_int();
MCONTACT hContact = AddContact(szConversationName, nullptr, true);
+ time_t timestamp = time(0); // fuck the server time, we need to place events in the order of our local time
if (m_bHistorySynced)
setDword(hContact, "LastMsgTime", timestamp);
- uint32_t dwFlags = DBEF_UTF;
- if (IsMe(szFromSkypename))
- dwFlags |= DBEF_SENT;
+ if (iUserType == 19) {
+ OnChatEvent(node);
+ return;
+ }
std::string strMessageType = node["messagetype"].as_string();
if (strMessageType == "Control/Typing") {
@@ -118,12 +118,15 @@ void CSkypeProto::ProcessNewMessage(const JSONNode &node)
CallService(MS_PROTO_CONTACTISTYPING, hContact, PROTOTYPE_CONTACTTYPING_OFF);
return;
}
-
+
CMStringW wszContent = node["content"].as_mstring();
DB::EventInfo dbei(db_event_getById(m_szModuleName, szMessageId));
dbei.timestamp = timestamp;
dbei.szId = szMessageId;
+ dbei.flags = DBEF_UTF;
+ if (IsMe(szFromSkypename))
+ dbei.flags |= DBEF_SENT;
if (iUserType == 19)
dbei.szUserId = szFromSkypename;
@@ -166,10 +169,6 @@ void CSkypeProto::ProcessNewMessage(const JSONNode &node)
else if (strMessageType == "RichText/Media_Album") {
// do nothing
}
- else if (iUserType == 19) {
- OnChatEvent(node);
- return;
- }
else {
dbei.eventType = SKYPE_DB_EVENT_TYPE_UNKNOWN;
}