summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-09-20 22:25:21 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-09-20 22:25:21 +0300
commit8635f4f728473b81a6f055813e25eaba3c4c5ce8 (patch)
tree289ae2168d3c7e473431a960804b24ae03fa8c66 /protocols
parent8d5867276a766c5447e4d4489f4649d7fb04ab72 (diff)
creepy crutch removed that was adding message ids after the binary zero in message text
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/proto.cpp9
-rwxr-xr-xprotocols/JabberG/src/jabber_proto.cpp8
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp10
-rw-r--r--protocols/VKontakte/src/vk_feed.cpp3
-rw-r--r--protocols/VKontakte/src/vk_history.cpp6
-rw-r--r--protocols/VKontakte/src/vk_messages.cpp9
6 files changed, 23 insertions, 22 deletions
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())