diff options
-rw-r--r-- | include/m_protosvc.h | 2 | ||||
-rw-r--r-- | protocols/Discord/src/proto.cpp | 9 | ||||
-rwxr-xr-x | protocols/JabberG/src/jabber_proto.cpp | 8 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_messages.cpp | 10 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_feed.cpp | 3 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_history.cpp | 6 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 9 | ||||
-rw-r--r-- | src/mir_app/src/proto_utils.cpp | 8 |
8 files changed, 23 insertions, 32 deletions
diff --git a/include/m_protosvc.h b/include/m_protosvc.h index 562c77c0e6..2cfe9c4b21 100644 --- a/include/m_protosvc.h +++ b/include/m_protosvc.h @@ -774,8 +774,6 @@ struct PROTORECVEVENT DWORD timestamp; // unix time
char *szMessage; // message body in utf8
LPARAM lParam; // extra space for the network level protocol module
- void *pCustomData;
- DWORD cbCustomDataSize;
};
#define PREF_CREATEREAD 1 // create the database event with the 'read' flag set
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp index 61ed2237bf..b9acdbf101 100644 --- a/protocols/Discord/src/proto.cpp +++ b/protocols/Discord/src/proto.cpp @@ -355,10 +355,11 @@ MCONTACT CDiscordProto::AddToList(int flags, PROTOSEARCHRESULT *psr) MEVENT CDiscordProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *evt) { - T2Utf szResUtf((const wchar_t*)evt->lParam); - evt->pCustomData = (char*)szResUtf; - evt->cbCustomDataSize = (DWORD)mir_strlen(szResUtf); - return CSuper::RecvMsg(hContact, evt); + MEVENT hDbEvent = CSuper::RecvMsg(hContact, evt); + if (hDbEvent && evt->lParam) + db_event_setId(m_szModuleName, hDbEvent, T2Utf((const wchar_t*)evt->lParam)); + + return hDbEvent; } //////////////////////////////////////////////////////////////////////////////////////// diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index 30c33ed266..48575d97d9 100755 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -809,10 +809,10 @@ HANDLE CJabberProto::SearchByName(const wchar_t *nick, const wchar_t *firstName, MEVENT CJabberProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *evt)
{
- T2Utf szResUtf((const wchar_t *)evt->lParam);
- evt->pCustomData = (char*)szResUtf;
- evt->cbCustomDataSize = (DWORD)mir_strlen(szResUtf);
- return CSuper::RecvMsg(hContact, evt);
+ MEVENT hDbEvent = CSuper::RecvMsg(hContact, evt);
+ if (hDbEvent != 0 && evt->lParam)
+ db_event_setId(m_szModuleName, hDbEvent, T2Utf((const wchar_t *)evt->lParam));
+ return hDbEvent;
}
////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp index 9ca334c122..b5df2ffea4 100644 --- a/protocols/SkypeWeb/src/skype_messages.cpp +++ b/protocols/SkypeWeb/src/skype_messages.cpp @@ -22,16 +22,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. // incoming message flow
int CSkypeProto::OnReceiveMessage(MCONTACT hContact, const char *szContent, const char *szMessageId, time_t timestamp, int emoteOffset, bool isRead)
{
- PROTORECVEVENT recv = { 0 };
+ PROTORECVEVENT recv = {};
recv.timestamp = timestamp;
recv.szMessage = mir_strdup(szContent);
recv.lParam = emoteOffset;
- recv.pCustomData = (void*)mir_strdup(szMessageId);
- recv.cbCustomDataSize = (DWORD)mir_strlen(szMessageId);
if (isRead)
recv.flags |= PREF_CREATEREAD;
- return ProtoChainRecvMsg(hContact, &recv);
+ MEVENT hDbEvent = ProtoChainRecvMsg(hContact, &recv);
+ if (hDbEvent)
+ db_event_setId(m_szModuleName, hDbEvent, szMessageId);
+
+ return hDbEvent;
}
/* MESSAGE SENDING */
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp index 06656e43ad..5d1715779a 100644 --- a/protocols/VKontakte/src/vk_feed.cpp +++ b/protocols/VKontakte/src/vk_feed.cpp @@ -57,9 +57,6 @@ void CVkProto::AddFeedEvent(CVKNewsItem& vkNewsItem) PROTORECVEVENT recv = { 0 };
recv.timestamp = vkNewsItem.tDate;
recv.szMessage = pszBody;
- recv.lParam = 0;
- recv.pCustomData = nullptr;
- recv.cbCustomDataSize = 0;
if (m_vkOptions.bUseNonStandardNotifications) {
recv.flags = PREF_CREATEREAD;
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index c18fcd86af..cfeea5fbfa 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -293,9 +293,9 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque recv.timestamp = datetime;
recv.szMessage = pszBody;
recv.lParam = isOut;
- recv.pCustomData = szMid;
- recv.cbCustomDataSize = (int)mir_strlen(szMid);
- ProtoChainRecvMsg(hContact, &recv);
+ MEVENT hDbEvent = ProtoChainRecvMsg(hContact, &recv);
+ if (hDbEvent)
+ db_event_setId(m_szModuleName, hDbEvent, szMid);
if (isRead && isOut && datetime > tLastReadMessageTime)
tLastReadMessageTime = datetime;
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 62d6168b67..4e45bf7c3b 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -335,15 +335,14 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe recv.timestamp = bEdited ? datetime : (m_vkOptions.bUseLocalTime ? time(0) : datetime);
recv.szMessage = pszBody;
recv.lParam = isOut;
- recv.pCustomData = szMid;
- recv.cbCustomDataSize = (int)mir_strlen(szMid);
Sleep(100);
debugLogA("CVkProto::OnReceiveMessages mid = %d, datetime = %d, isOut = %d, isRead = %d, uid = %d", mid, datetime, isOut, isRead, uid);
+ MEVENT hDbEvent = 0;
if (!CheckMid(m_sendIds, mid)) {
debugLogA("CVkProto::OnReceiveMessages ProtoChainRecvMsg");
- ProtoChainRecvMsg(hContact, &recv);
+ hDbEvent = ProtoChainRecvMsg(hContact, &recv);
if (mid > getDword(hContact, "lastmsgid", -1))
setDword(hContact, "lastmsgid", mid);
if (!isOut)
@@ -353,8 +352,10 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe T2Utf pszAttach(wszAttachmentDescr);
recv.timestamp = time(0); // only local time
recv.szMessage = pszAttach;
- ProtoChainRecvMsg(hContact, &recv);
+ hDbEvent = ProtoChainRecvMsg(hContact, &recv);
}
+ if (hDbEvent)
+ db_event_setId(m_szModuleName, hDbEvent, szMid);
}
if (!mids.IsEmpty())
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index 92c4d14e51..a09fb63ec6 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -509,14 +509,6 @@ MEVENT PROTO_INTERFACE::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) dbei.cbBlob = (DWORD)mir_strlen(pre->szMessage) + 1;
dbei.pBlob = (PBYTE)pre->szMessage;
- if (pre->cbCustomDataSize != 0) {
- pszBlob = (PBYTE)mir_alloc(dbei.cbBlob + pre->cbCustomDataSize);
- memcpy(pszBlob, dbei.pBlob, dbei.cbBlob);
- memcpy((PBYTE)pszBlob + dbei.cbBlob, pre->pCustomData, pre->cbCustomDataSize);
- dbei.pBlob = pszBlob;
- dbei.cbBlob += pre->cbCustomDataSize;
- }
-
if (pre->flags & PREF_CREATEREAD)
dbei.flags |= DBEF_READ;
if (pre->flags & PREF_SENT)
|