summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-07-13 17:58:06 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-07-13 17:58:06 +0000
commitceae4e57634e4ff9efe506e3e937006d16f4787f (patch)
treebaaa841c9bd72fce5a295ad29a9cd20784c9f069
parenta39bed945be56898d2eee18830ee3060f71b8ccd (diff)
SkypeWeb: big refactoring
git-svn-id: http://svn.miranda-ng.org/main/trunk@14551 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/SkypeWeb/src/requests/poll.h2
-rw-r--r--protocols/SkypeWeb/src/skype_db.cpp48
-rw-r--r--protocols/SkypeWeb/src/skype_events.cpp93
-rw-r--r--protocols/SkypeWeb/src/skype_history_sync.cpp78
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp77
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h4
-rw-r--r--protocols/SkypeWeb/src/skype_trouter.cpp2
-rw-r--r--protocols/SkypeWeb/src/stdafx.h4
8 files changed, 114 insertions, 194 deletions
diff --git a/protocols/SkypeWeb/src/requests/poll.h b/protocols/SkypeWeb/src/requests/poll.h
index 9bbf936ace..8efecb21d0 100644
--- a/protocols/SkypeWeb/src/requests/poll.h
+++ b/protocols/SkypeWeb/src/requests/poll.h
@@ -24,7 +24,7 @@ public:
PollRequest(const char *regToken, const char *server = SKYPE_ENDPOINTS_HOST) :
HttpRequest(REQUEST_POST, FORMAT, "%s/v1/users/ME/endpoints/SELF/subscriptions/0/poll", server)
{
- timeout = INFINITE;
+ timeout = 60000;
flags |= NLHRF_PERSISTENT;
Headers
<< CHAR_VALUE("Connection", "keep-alive")
diff --git a/protocols/SkypeWeb/src/skype_db.cpp b/protocols/SkypeWeb/src/skype_db.cpp
index 87a067b3f1..eead114f49 100644
--- a/protocols/SkypeWeb/src/skype_db.cpp
+++ b/protocols/SkypeWeb/src/skype_db.cpp
@@ -52,44 +52,18 @@ MEVENT CSkypeProto::GetMessageFromDb(MCONTACT hContact, const char *messageId, L
return NULL;
}
-MEVENT CSkypeProto::AddMessageToDb(MCONTACT hContact, DWORD timestamp, DWORD flags, const char *messageId, char *content, int emoteOffset)
+MEVENT CSkypeProto::AddDbEvent(WORD type, MCONTACT hContact, DWORD timestamp, DWORD flags, const char *content, const char *uid)
{
- if (MEVENT hDbEvent = GetMessageFromDb(hContact, messageId, timestamp))
- return hDbEvent;
- size_t messageLength = mir_strlen(&content[emoteOffset]) + 1;
- size_t messageIdLength = mir_strlen(messageId);
- size_t cbBlob = messageLength + messageIdLength;
- PBYTE pBlob = (PBYTE)mir_alloc(cbBlob);
- memcpy(pBlob, &content[emoteOffset], messageLength);
- memcpy(pBlob + messageLength, messageId, messageIdLength);
-
- 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))
+ if (MEVENT hDbEvent = GetMessageFromDb(hContact, uid, timestamp))
return hDbEvent;
size_t messageLength = mir_strlen(content) + 1;
- size_t messageIdLength = mir_strlen(messageId);
+ size_t messageIdLength = mir_strlen(uid);
size_t cbBlob = messageLength + messageIdLength;
PBYTE pBlob = (PBYTE)mir_alloc(cbBlob);
memcpy(pBlob, content, messageLength);
- memcpy(pBlob + messageLength, messageId, messageIdLength);
+ memcpy(pBlob + messageLength, uid, 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);
- size_t messageLength = mir_strlen(gp) + 1;
- size_t cbBlob = messageLength + callIdLength;
- PBYTE pBlob = (PBYTE)mir_alloc(cbBlob);
- memcpy(pBlob, gp, messageLength);
- memcpy(pBlob + messageLength, callId, callIdLength);
-
- return AddEventToDb(hContact, SKYPE_DB_EVENT_TYPE_INCOMING_CALL, timestamp, flags, (DWORD)cbBlob, pBlob);
+ return AddEventToDb(hContact, type, timestamp, flags, (DWORD)cbBlob, pBlob);
}
MEVENT CSkypeProto::AddEventToDb(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob)
@@ -102,16 +76,4 @@ MEVENT CSkypeProto::AddEventToDb(MCONTACT hContact, WORD type, DWORD timestamp,
dbei.pBlob = pBlob;
dbei.flags = flags;
return db_event_add(hContact, &dbei);
-}
-
-time_t CSkypeProto::GetLastMessageTime(MCONTACT hContact)
-{
- MEVENT hDbEvent = db_event_last(hContact);
- if (hDbEvent != NULL)
- {
- DBEVENTINFO dbei = { sizeof(dbei) };
- db_event_get(hDbEvent, &dbei);
- return dbei.timestamp;
- }
- return 0;
} \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp
index bad357df93..99dd4a2b5e 100644
--- a/protocols/SkypeWeb/src/skype_events.cpp
+++ b/protocols/SkypeWeb/src/skype_events.cpp
@@ -22,7 +22,86 @@ INT_PTR CSkypeProto::GetCallEventText(WPARAM, LPARAM lParam)
DBEVENTGETTEXT *pEvent = (DBEVENTGETTEXT *)lParam;
INT_PTR nRetVal = 0;
- char *pszText = Translate("Incoming call");
+
+ ptrA pszText;
+
+ switch (pEvent->dbei->eventType)
+ {
+ case SKYPE_DB_EVENT_TYPE_CALL_INFO:
+ {
+ CMStringA text;
+ HXML xml = xmlParseString(ptrT(mir_utf8decodeT((char*)pEvent->dbei->pBlob)), 0, _T("partlist"));
+ if (xml != NULL)
+ {
+ ptrA type(mir_t2a(xmlGetAttrValue(xml, _T("type"))));
+ bool bType = (!mir_strcmpi(type, "started")) ? 1 : 0;
+
+ for (int i = 0; i < xmlGetChildCount(xml); i++)
+ {
+ HXML xmlPart = xmlGetNthChild(xml, _T("part"), i);
+ if (xmlPart != NULL)
+ {
+ HXML xmlName = xmlGetChildByPath(xmlPart, _T("name"), 0);
+ if (xmlName != NULL)
+ {
+ text.AppendFormat(Translate("%s %s this call. \n"), mir_t2a(xmlGetText(xmlName)), bType ? Translate("enter") : Translate("left"));
+ xmlDestroyNode(xmlName);
+ }
+ xmlDestroyNode(xmlPart);
+ }
+ }
+ xmlDestroyNode(xml);
+ }
+ pszText = mir_strdup(text.GetBuffer());
+ break;
+ }
+ case SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO:
+ {
+ CMStringA text;
+ HXML xml = xmlParseString(ptrT(mir_utf8decodeT((char*)pEvent->dbei->pBlob)), 0, _T("files"));
+ if (xml != NULL)
+ {
+ for (int i = 0; i < xmlGetChildCount(xml); i++)
+ {
+ size_t fileSize = 0;
+ HXML xmlNode = xmlGetNthChild(xml, _T("file"), i);
+ if (xmlNode != NULL)
+ {
+ fileSize = _ttoi(xmlGetAttrValue(xmlNode, _T("size")));
+ ptrA fileName(mir_utf8encodeT(xmlGetText(xmlNode)));
+ if (fileName == NULL || fileSize == NULL)
+ continue;
+ CMStringA msg(FORMAT, "%s:\n\t%s: %s\n\t%s: %d %s", Translate("File transfer"), Translate("File name"), fileName, Translate("Size"), fileSize, Translate("bytes"));
+ text.AppendFormat("%s\n", msg);
+ }
+ }
+ }
+ pszText = mir_strdup(text.GetBuffer());
+ break;
+ }
+ case SKYPE_DB_EVENT_TYPE_URIOBJ:
+ {
+ CMStringA text;
+ HXML xml = xmlParseString(ptrT(mir_utf8decodeT((char*)pEvent->dbei->pBlob)), 0, _T("URIObject"));
+ if (xml != NULL)
+ {
+ text.Append(mir_t2a(xmlGetText(xml)));
+ }
+ pszText = mir_strdup(text.GetBuffer());
+ break;
+
+ }
+ case SKYPE_DB_EVENT_TYPE_INCOMING_CALL:
+ {
+ pszText = Translate("Incoming call.");
+ break;
+ }
+ default:
+ {
+ pszText = mir_strdup((char*)pEvent->dbei->pBlob);
+ }
+ }
+
if (pEvent->datatype == DBVT_TCHAR)
{
@@ -31,7 +110,7 @@ INT_PTR CSkypeProto::GetCallEventText(WPARAM, LPARAM lParam)
}
else if (pEvent->datatype == DBVT_ASCIIZ)
- nRetVal = (INT_PTR)mir_strdup(Translate(pszText));
+ nRetVal = (INT_PTR)mir_strdup(pszText);
return nRetVal;
}
@@ -71,6 +150,7 @@ void CSkypeProto::InitDBEvents()
dbEventType.module = m_szModuleName;
dbEventType.flags = DETF_HISTORY | DETF_MSGWINDOW;
dbEventType.iconService = MODULE"/GetEventIcon";
+ dbEventType.textService = MODULE"/GetCallText";
dbEventType.eventType = SKYPE_DB_EVENT_TYPE_ACTION;
dbEventType.descr = Translate("Action");
@@ -80,9 +160,16 @@ void CSkypeProto::InitDBEvents()
dbEventType.descr = Translate("Call information.");
CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
+ dbEventType.eventType = SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO;
+ dbEventType.descr = Translate("File transfer information.");
+ CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
+
+ dbEventType.eventType = SKYPE_DB_EVENT_TYPE_URIOBJ;
+ dbEventType.descr = Translate("Uri object.");
+ CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
+
dbEventType.eventType = SKYPE_DB_EVENT_TYPE_INCOMING_CALL;
dbEventType.descr = Translate("Incoming call");
- dbEventType.textService = MODULE"/GetCallText";
dbEventType.flags |= DETF_NONOTIFY;
CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
}
diff --git a/protocols/SkypeWeb/src/skype_history_sync.cpp b/protocols/SkypeWeb/src/skype_history_sync.cpp
index 9638e278a8..060855f72a 100644
--- a/protocols/SkypeWeb/src/skype_history_sync.cpp
+++ b/protocols/SkypeWeb/src/skype_history_sync.cpp
@@ -95,90 +95,24 @@ void CSkypeProto::OnGetServerHistory(const NETLIBHTTPREQUEST *response)
CMStringA msg(FORMAT, "%s\n%s %s:\n%s", mir_utf8decodeA(dbMsgText), Translate("Edited at"), T2Utf(time), mir_utf8decodeA(message));
db_event_delete(hContact, dbevent);
- AddMessageToDb(hContact, dbEventTimestamp, flags, clientMsgId.c_str(), mir_utf8encode(msg.GetBuffer()), emoteOffset);
+ AddDbEvent(EVENTTYPE_MESSAGE, hContact, dbEventTimestamp, flags, mir_utf8encode(&msg.GetBuffer()[emoteOffset]), clientMsgId.c_str());
}
- else AddMessageToDb(hContact, timestamp, flags, clientMsgId.c_str(), message, emoteOffset);
+ else AddDbEvent(EVENTTYPE_MESSAGE, hContact, timestamp, flags, &message[emoteOffset], clientMsgId.c_str());
}
else if (!mir_strcmpi(messageType.c_str(), "Event/Call"))
{
- //content=<partlist type="ended" alt=""><part identity="username"><name>user name</name><duration>6</duration></part>
- //<part identity="echo123"><name>Echo / Sound Test Service</name><duration>6</duration></part></partlist>
-
- //content=<partlist type="started" alt=""><part identity="username"><name>user name</name></part></partlist>
- int iType = 3, iDuration = 0;
- CMStringA skypename(ContactUrlToName(from.c_str()));
- HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("partlist"));
- if (xml != NULL)
- {
-
- ptrA type(mir_t2a(xmlGetAttrValue(xml, _T("type"))));
-
- if (!mir_strcmpi(type, "ended")) iType = 0;
- else if (!mir_strcmpi(type, "started")) iType = 1;
- HXML xmlNode = xmlGetChildByPath(xml, _T("part"), 0);
- HXML duration = xmlNode == NULL ? NULL : xmlGetChildByPath(xmlNode, _T("duration"), 0);
- iDuration = duration != NULL ? atoi(mir_t2a(xmlGetText(duration))) : NULL;
-
- xmlDestroyNode(xml);
- }
- CMStringA text = "";
- if (iType == 1)
- text.Append(Translate("Call started"));
- else if (iType == 0)
- {
- CMStringA chours = "", cmins = "", csec = "";
- int hours = 0, mins = 0, sec = 0;
- if (iDuration != NULL)
- {
- hours = iDuration / 3600;
- mins = ((iDuration / 60) - (hours * 60));
- sec = iDuration % 60;
- }
- else
- hours = mins = sec = 0;
-
- chours.AppendFormat(hours < 10 ? "0%d" : "%d", hours);
- cmins.AppendFormat(mins < 10 ? "0%d" : "%d", mins);
- csec.AppendFormat(sec < 10 ? "0%d" : "%d", sec);
- text.AppendFormat("%s\n%s: %s:%s:%s", Translate("Call ended"), Translate("Duration"), chours, cmins, csec);
- }
- AddCallInfoToDb(hContact, timestamp, flags, clientMsgId.c_str(), text.GetBuffer());
+ AddDbEvent(SKYPE_DB_EVENT_TYPE_CALL_INFO, hContact, timestamp, DBEF_UTF, content.c_str(), clientMsgId.c_str());
}
else if (!mir_strcmpi(messageType.c_str(), "RichText/Files"))
{
- //content=<files alt="отправил (-а) файл &quot;run.bat&quot;"><file size="97" index="0" tid="4197760077">run.bat</file></files>
- HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("files"));
- if (xml != NULL)
- {
- for (int i = 0; i < xmlGetChildCount(xml); i++)
- {
- int fileSize; CMStringA msg = "";
- HXML xmlNode = xmlGetNthChild(xml, L"file", i);
- if (xmlNode == NULL)
- break;
- fileSize = atoi(_T2A(xmlGetAttrValue(xmlNode, L"size")));
- ptrA fileName(mir_t2a(xmlGetText(xmlNode)));
- if (fileName == NULL || fileSize == NULL)
- continue;
-
- msg.Empty();
- msg.AppendFormat("%s:\n\t%s: %s\n\t%s: %d %s", Translate("File transfer"), Translate("File name"), fileName, Translate("Size"), fileSize, Translate("bytes"));
- AddMessageToDb(hContact, timestamp, flags, clientMsgId.c_str(), msg.GetBuffer());
- }
- }
+ AddDbEvent(SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO, hContact, timestamp, DBEF_UTF, content.c_str(), clientMsgId.c_str());
}
else if (!mir_strcmpi(messageType.c_str(), "RichText/UriObject"))
{
//content=<URIObject type="Picture.1" uri="https://api.asm.skype.com/v1//objects/0-weu-d1-262f0a1ee256d03b8e4b8360d9208834" url_thumbnail="https://api.asm.skype.com/v1//objects/0-weu-d1-262f0a1ee256d03b8e4b8360d9208834/views/imgt1"><Title></Title><Description></Description>Для просмотра этого общего фото перейдите по ссылке: https://api.asm.skype.com/s/i?0-weu-d1-262f0a1ee256d03b8e4b8360d9208834<meta type="photo" originalName="ysd7ZE4BqOg.jpg"/><OriginalName v="ysd7ZE4BqOg.jpg"/></URIObject>
- HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("URIObject"));
- if (xml != NULL)
- {
- CMStringA object(ParseUrl(_T2A(xmlGetAttrValue(xml, L"uri")), "/objects/"));
- CMStringA data(FORMAT, "%s: https://api.asm.skype.com/s/i?%s", Translate("Image"), object.c_str());
+ AddDbEvent(SKYPE_DB_EVENT_TYPE_URIOBJ, hContact, timestamp, DBEF_UTF, content.c_str(), clientMsgId.c_str());
- AddMessageToDb(hContact, timestamp, flags, clientMsgId.c_str(), data.GetBuffer());
- }
- } //Picture
+ }
}
else if (conversationLink.find("/19:") != -1)
{
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
index 7d39add241..5dbfbb78e0 100644
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ b/protocols/SkypeWeb/src/skype_messages.cpp
@@ -171,7 +171,7 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node)
int hMessage = atoi(clientMsgId.c_str());
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)hMessage, 0);
debugLogA(__FUNCTION__" timestamp = %d clientmsgid = %s", timestamp, clientMsgId);
- AddMessageToDb(hContact, timestamp, DBEF_UTF | DBEF_SENT, clientMsgId.c_str(), message, emoteOffset);
+ AddDbEvent(emoteOffset == 0 ? EVENTTYPE_MESSAGE : SKYPE_DB_EVENT_TYPE_ACTION, hContact, timestamp, DBEF_UTF | DBEF_SENT, &content.c_str()[emoteOffset], clientMsgId.c_str());
return;
}
CallService(MS_PROTO_CONTACTISTYPING, hContact, PROTOTYPE_CONTACTTYPING_OFF);
@@ -198,7 +198,7 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node)
msg.AppendFormat("%s\n%s %s:\n%s", mir_utf8decodeA(dbMsgText), Translate("Edited at"), T2Utf(time), mir_utf8decodeA(message));
db_event_delete(hContact, dbevent);
- AddMessageToDb(hContact, dbEventTimestamp, DBEF_UTF, skypeEditedId.c_str(), ptrA(mir_utf8encode(msg.GetBuffer())));
+ AddDbEvent(EVENTTYPE_MESSAGE, hContact, dbEventTimestamp, DBEF_UTF, ptrA(mir_utf8encode(msg.GetBuffer())), skypeEditedId.c_str());
}
else OnReceiveMessage(clientMsgId.c_str(), conversationLink.c_str(), timestamp, message, emoteOffset);
}
@@ -208,83 +208,20 @@ void CSkypeProto::OnPrivateMessageEvent(const JSONNode &node)
//content=<partlist type="ended" alt=""><part identity="username"><name>user name</name><duration>6</duration></part>
//<part identity="echo123"><name>Echo / Sound Test Service</name><duration>6</duration></part></partlist>
//content=<partlist type="started" alt=""><part identity="username"><name>user name</name></part></partlist>
- int iType = 3, iDuration = 0;
- HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("partlist"));
- if (xml != NULL)
- {
-
- ptrA type(mir_t2a(xmlGetAttrValue(xml, _T("type"))));
-
- if (!mir_strcmpi(type, "ended")) iType = 0;
- else if (!mir_strcmpi(type, "started")) iType = 1;
-
- HXML xmlNode = xmlGetChildByPath(xml, _T("part"), 0);
- HXML duration = xmlNode == NULL ? NULL : xmlGetChildByPath(xmlNode, _T("duration"), 0);
- iDuration = duration != NULL ? atoi(mir_t2a(xmlGetText(duration))) : NULL;
-
- xmlDestroyNode(xml);
- }
- CMStringA text = "";
- if (iType == 1)
- text.Append(Translate("Call started"));
- else if (iType == 0)
- {
- CMStringA chours = "", cmins = "", csec = "";
- int hours = 0, mins = 0, sec = 0;
-
- if (iDuration != NULL)
- {
- hours = iDuration / 3600;
- mins = ((iDuration / 60) - (hours * 60));
- sec = iDuration % 60;
- }
- else
- hours = mins = sec = 0;
-
- chours.AppendFormat(hours < 10 ? "0%d" : "%d", hours);
- cmins.AppendFormat(mins < 10 ? "0%d" : "%d", mins);
- csec.AppendFormat(sec < 10 ? "0%d" : "%d", sec);
- text.AppendFormat("%s\n%s: %s:%s:%s", Translate("Call ended"), Translate("Duration"), chours, cmins, csec);
- }
-
- int flags = DBEF_UTF;
- if (IsMe(from)) flags |= DBEF_SENT;
-
- AddCallInfoToDb(hContact, timestamp, flags, clientMsgId.c_str(), text.GetBuffer());
+ AddDbEvent(SKYPE_DB_EVENT_TYPE_CALL_INFO, hContact, timestamp, DBEF_UTF, content.c_str(), clientMsgId.c_str());
}
else if (!mir_strcmpi(messageType.c_str(), "RichText/Files"))
{
+
//content=<files alt="отправил (-а) файл &quot;run.bat&quot;"><file size="97" index="0" tid="4197760077">run.bat</file></files>
- HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("files"));
- if (xml != NULL)
- {
- for (int i = 0; i < xmlGetChildCount(xml); i++)
- {
- int fileSize;
- HXML xmlNode = xmlGetNthChild(xml, _T("file"), i);
- if (xmlNode == NULL)
- break;
- fileSize = _ttoi(xmlGetAttrValue(xmlNode, _T("size")));
- ptrA fileName(mir_utf8encodeT(xmlGetText(xmlNode)));
- if (fileName == NULL || fileSize == NULL)
- continue;
-
- CMStringA msg(FORMAT, "%s:\n\t%s: %s\n\t%s: %d %s", Translate("File transfer"), Translate("File name"), fileName, Translate("Size"), fileSize, Translate("bytes"));
- AddMessageToDb(hContact, timestamp, DBEF_UTF | DBEF_READ, clientMsgId.c_str(), msg.GetBuffer());
- }
- }
+
+ AddDbEvent(SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO, hContact, timestamp, DBEF_UTF, content.c_str(), clientMsgId.c_str());
}
else if (!mir_strcmpi(messageType.c_str(), "RichText/Location")) {}
else if (!mir_strcmpi(messageType.c_str(), "RichText/UriObject"))
{
//content=<URIObject type="Picture.1" uri="https://api.asm.skype.com/v1//objects/0-weu-d1-262f0a1ee256d03b8e4b8360d9208834" url_thumbnail="https://api.asm.skype.com/v1//objects/0-weu-d1-262f0a1ee256d03b8e4b8360d9208834/views/imgt1"><Title></Title><Description></Description>Для просмотра этого общего фото перейдите по ссылке: https://api.asm.skype.com/s/i?0-weu-d1-262f0a1ee256d03b8e4b8360d9208834<meta type="photo" originalName="ysd7ZE4BqOg.jpg"/><OriginalName v="ysd7ZE4BqOg.jpg"/></URIObject>
- HXML xml = xmlParseString(ptrT(mir_a2t(content.c_str())), 0, _T("URIObject"));
- if (xml != NULL)
- {
- CMStringA object(ParseUrl(_T2A(xmlGetAttrValue(xml, L"uri")), "/objects/"));
- CMStringA data(FORMAT, "%s: https://api.asm.skype.com/s/i?%s", Translate("Image"), object.c_str());
- AddMessageToDb(hContact, timestamp, DBEF_UTF, clientMsgId.c_str(), data.GetBuffer());
- }
+ AddDbEvent(SKYPE_DB_EVENT_TYPE_URIOBJ, hContact, timestamp, DBEF_UTF, content.c_str(), clientMsgId.c_str());
}
else if (!mir_strcmpi(messageType.c_str(), "RichText/Contacts")) {}
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index d6b3fbc021..166d6fa3a8 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -240,9 +240,7 @@ private:
mir_cs messageSyncLock;
MEVENT GetMessageFromDb(MCONTACT hContact, const char *messageId, LONGLONG timestamp = 0);
- MEVENT AddMessageToDb(MCONTACT hContact, DWORD timestamp, DWORD flags, const char *messageId, char *content, int emoteOffset = 0);
- MEVENT AddCallToDb(MCONTACT hContact, DWORD timestamp, DWORD flags, const char *callId, const char *gp);
- MEVENT AddCallInfoToDb(MCONTACT hContact, DWORD timestamp, DWORD flags, const char *messageId, char *content);
+ MEVENT AddDbEvent(WORD type, MCONTACT hContact, DWORD timestamp, DWORD flags, const char *content, const char *uid);
int OnReceiveMessage(const char *messageId, const char *url, time_t timestamp, char *content, int emoteOffset = 0, bool isRead = false);
int OnSendMessage(MCONTACT hContact, int flags, const char *message);
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp
index bc3003336b..ca4931d6e0 100644
--- a/protocols/SkypeWeb/src/skype_trouter.cpp
+++ b/protocols/SkypeWeb/src/skype_trouter.cpp
@@ -191,7 +191,7 @@ void CSkypeProto::OnTrouterEvent(const JSONNode &body, const JSONNode &)
{
MCONTACT hContact = AddContact(uid.c_str(), true);
- MEVENT hEvent = AddCallToDb(hContact, time(NULL), DBEF_READ, callId.c_str(), gp.c_str());
+ MEVENT hEvent = AddDbEvent(SKYPE_DB_EVENT_TYPE_INCOMING_CALL, hContact, time(NULL), DBEF_READ, gp.c_str(), callId.c_str());
SkinPlaySound("skype_inc_call");
CLISTEVENT cle = { sizeof(cle) };
diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h
index c5256b9dc0..195aa83deb 100644
--- a/protocols/SkypeWeb/src/stdafx.h
+++ b/protocols/SkypeWeb/src/stdafx.h
@@ -100,7 +100,9 @@ enum SKYPE_DB_EVENT_TYPE
{
SKYPE_DB_EVENT_TYPE_ACTION = 10001,
SKYPE_DB_EVENT_TYPE_INCOMING_CALL,
- SKYPE_DB_EVENT_TYPE_CALL_INFO
+ SKYPE_DB_EVENT_TYPE_CALL_INFO,
+ SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO,
+ SKYPE_DB_EVENT_TYPE_URIOBJ
};
#define SKYPE_SETTINGS_ID "Skypename"