summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_messages.cpp
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-05-06 13:22:54 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-05-06 13:22:54 +0000
commitd1b31445c6f4a53627a025b43afb24603bc12dc2 (patch)
tree3f95d2e9a488e068b9ae4457bd806566ce50eb02 /protocols/SkypeWeb/src/skype_messages.cpp
parentd44364a07a1213424fe0a6b14d948b43768137df (diff)
SkypeWeb: Rework writing calls info to db. Sync fix.
git-svn-id: http://svn.miranda-ng.org/main/trunk@13460 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_messages.cpp')
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
index 8191308b85..76bce319aa 100644
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ b/protocols/SkypeWeb/src/skype_messages.cpp
@@ -38,7 +38,7 @@ MEVENT CSkypeProto::GetMessageFromDb(MCONTACT hContact, const char *messageId, L
dbei.pBlob = blob;
db_event_get(hDbEvent, &dbei);
- if (dbei.eventType != EVENTTYPE_MESSAGE && dbei.eventType != SKYPE_DB_EVENT_TYPE_ACTION)
+ if (dbei.eventType != EVENTTYPE_MESSAGE && dbei.eventType != SKYPE_DB_EVENT_TYPE_ACTION && dbei.eventType != SKYPE_DB_EVENT_TYPE_CALL_INFO)
continue;
size_t cbLen = strlen((char*)dbei.pBlob);
@@ -66,6 +66,20 @@ MEVENT CSkypeProto::AddMessageToDb(MCONTACT hContact, DWORD timestamp, DWORD fla
return AddEventToDb(hContact, emoteOffset == 0 ? EVENTTYPE_MESSAGE : SKYPE_DB_EVENT_TYPE_ACTION, timestamp, flags, (DWORD)cbBlob, pBlob);
}
+MEVENT CSkypeProto::AddCallInfoToDb(MCONTACT hContact, DWORD timestamp, DWORD flags, const char *messageId, char *content)
+{
+ if (MEVENT hDbEvent = GetMessageFromDb(hContact, messageId, timestamp))
+ return hDbEvent;
+ size_t messageLength = mir_strlen(content) + 1;
+ size_t messageIdLength = mir_strlen(messageId);
+ size_t cbBlob = messageLength + messageIdLength;
+ PBYTE pBlob = (PBYTE)mir_alloc(cbBlob);
+ memcpy(pBlob, content, messageLength);
+ memcpy(pBlob + messageLength, messageId, messageIdLength);
+
+ return AddEventToDb(hContact,SKYPE_DB_EVENT_TYPE_CALL_INFO, timestamp, flags, (DWORD)cbBlob, pBlob);
+}
+
MEVENT CSkypeProto::AddCallToDb(MCONTACT hContact, DWORD timestamp, DWORD flags, const char *callId, const char *gp)
{
size_t callIdLength = mir_strlen(callId);
@@ -321,10 +335,11 @@ void CSkypeProto::OnPrivateMessageEvent(JSONNODE *node)
csec.AppendFormat(sec < 10 ? "0%d" : "%d", sec);
text.AppendFormat("%s\n%s: %s:%s:%s", Translate("Call ended"), Translate("Duration"), chours, cmins, csec);
}
- if (IsMe(from))
- AddMessageToDb(hContact, timestamp, DBEF_UTF | DBEF_SENT, clientMsgId, text.GetBuffer());
- else
- OnReceiveMessage(clientMsgId, conversationLink, timestamp, text.GetBuffer());
+
+ int flags = DBEF_UTF;
+ if (IsMe(from)) flags |= DBEF_SENT;
+
+ AddCallInfoToDb(hContact, timestamp, flags, clientMsgId, text.GetBuffer());
}
else if (!mir_strcmpi(messageType, "RichText/Files"))
{