diff options
-rw-r--r-- | protocols/VKontakte/src/vk_history.cpp | 6 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_messages.cpp | 18 | ||||
-rw-r--r-- | protocols/VKontakte/src/vk_proto.h | 1 |
3 files changed, 15 insertions, 10 deletions
diff --git a/protocols/VKontakte/src/vk_history.cpp b/protocols/VKontakte/src/vk_history.cpp index cfeea5fbfa..9db577a853 100644 --- a/protocols/VKontakte/src/vk_history.cpp +++ b/protocols/VKontakte/src/vk_history.cpp @@ -292,10 +292,8 @@ void CVkProto::OnReceiveHistoryMessages(NETLIBHTTPREQUEST *reply, AsyncHttpReque recv.timestamp = datetime;
recv.szMessage = pszBody;
- recv.lParam = isOut;
- MEVENT hDbEvent = ProtoChainRecvMsg(hContact, &recv);
- if (hDbEvent)
- db_event_setId(m_szModuleName, hDbEvent, szMid);
+ recv.lParam = (LPARAM)szMid;
+ ProtoChainRecvMsg(hContact, &recv);
if (isRead && isOut && datetime > tLastReadMessageTime)
tLastReadMessageTime = datetime;
diff --git a/protocols/VKontakte/src/vk_messages.cpp b/protocols/VKontakte/src/vk_messages.cpp index 97d4c3418e..7142de4056 100644 --- a/protocols/VKontakte/src/vk_messages.cpp +++ b/protocols/VKontakte/src/vk_messages.cpp @@ -17,6 +17,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
+MEVENT CVkProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *evt)
+{
+ MEVENT hDbEvent = CSuper::RecvMsg(hContact, evt);
+ if (hDbEvent && evt->lParam)
+ db_event_setId(m_szModuleName, hDbEvent, (char*)evt->lParam);
+
+ return hDbEvent;
+}
+
//////////////////////////////////////////////////////////////////////////////
void CVkProto::SendMsgAck(void *param)
@@ -334,15 +343,14 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe T2Utf pszBody(wszBody);
recv.timestamp = bEdited ? datetime : (m_vkOptions.bUseLocalTime ? time(0) : datetime);
recv.szMessage = pszBody;
- recv.lParam = isOut;
+ recv.lParam = (LPARAM)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");
- hDbEvent = ProtoChainRecvMsg(hContact, &recv);
+ ProtoChainRecvMsg(hContact, &recv);
if (mid > getDword(hContact, "lastmsgid", -1))
setDword(hContact, "lastmsgid", mid);
if (!isOut)
@@ -352,10 +360,8 @@ void CVkProto::OnReceiveMessages(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pRe T2Utf pszAttach(wszAttachmentDescr);
recv.timestamp = time(0); // only local time
recv.szMessage = pszAttach;
- hDbEvent = ProtoChainRecvMsg(hContact, &recv);
+ ProtoChainRecvMsg(hContact, &recv);
}
- if (hDbEvent)
- db_event_setId(m_szModuleName, hDbEvent, szMid);
}
if (!mids.IsEmpty())
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index 2a3542b6a7..a81a509b4a 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -61,6 +61,7 @@ struct CVkProto : public PROTO<CVkProto> HANDLE SearchBasic(const wchar_t *id) override;
HANDLE SearchByEmail(const wchar_t *email) override;
HANDLE SearchByName(const wchar_t *nick, const wchar_t *firstName, const wchar_t *lastName) override;
+ MEVENT RecvMsg(MCONTACT hContact, PROTORECVEVENT*) override;
int SendMsg(MCONTACT hContact, int flags, const char *msg) override;
HANDLE SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles) override;
int SetStatus(int iNewStatus) override;
|