From 3d30ed65f9e226b7b183b23ce5dba435ec491f0b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 10 Jan 2025 18:28:28 +0300 Subject: DBEVENTINFO::timestamp to become 64-bit integer --- protocols/JabberG/src/jabber_archive.cpp | 8 ++++---- protocols/JabberG/src/jabber_file.cpp | 2 +- protocols/JabberG/src/jabber_ft.cpp | 4 ++-- protocols/JabberG/src/jabber_iq_handlers.cpp | 2 +- protocols/JabberG/src/jabber_misc.cpp | 6 +++--- protocols/JabberG/src/jabber_omemo.cpp | 2 +- protocols/JabberG/src/jabber_rc.cpp | 4 ++-- protocols/JabberG/src/jabber_thread.cpp | 6 +++--- 8 files changed, 17 insertions(+), 17 deletions(-) (limited to 'protocols/JabberG/src') diff --git a/protocols/JabberG/src/jabber_archive.cpp b/protocols/JabberG/src/jabber_archive.cpp index 994f48a840..dde2369d4e 100644 --- a/protocols/JabberG/src/jabber_archive.cpp +++ b/protocols/JabberG/src/jabber_archive.cpp @@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. bool operator==(const DBEVENTINFO &ev1, const DBEVENTINFO &ev2) { - return ev1.timestamp == ev2.timestamp && ev1.eventType == ev2.eventType && ev1.cbBlob == ev2.cbBlob && (ev1.flags & DBEF_SENT) == (ev2.flags & DBEF_SENT); + return ev1.iTimestamp == ev2.iTimestamp && ev1.eventType == ev2.eventType && ev1.cbBlob == ev2.cbBlob && ev1.bSent == ev2.bSent; } void CJabberProto::EnableArchive(bool bEnable) @@ -117,9 +117,9 @@ void CJabberProto::OnIqResultGetCollection(const TiXmlElement *iqNode, CJabberIq msg.process(); - tmStart = msg.dbei.timestamp; - if (msg.dbei.timestamp > tmLast) - tmLast = msg.dbei.timestamp; + tmStart = msg.dbei.getUnixtime(); + if (msg.dbei.getUnixtime() > tmLast) + tmLast = msg.dbei.getUnixtime(); } if (tmLast != 0) diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp index bd04905ccd..c43f1509d7 100644 --- a/protocols/JabberG/src/jabber_file.cpp +++ b/protocols/JabberG/src/jabber_file.cpp @@ -177,7 +177,7 @@ void CJabberProto::FileProcessHttpDownload(MCONTACT hContact, const char *jid, c DB::EventInfo dbei; dbei.flags = DBEF_TEMPORARY; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); ProtoChainRecvFile(ft->std.hContact, DB::FILE_BLOB(ft, szName, pszDescr), dbei); } diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp index da6cd6425f..97299e6b5d 100644 --- a/protocols/JabberG/src/jabber_ft.cpp +++ b/protocols/JabberG/src/jabber_ft.cpp @@ -467,7 +467,7 @@ void CJabberProto::FtHandleSiRequest(const TiXmlElement *iqNode) ft->std.totalBytes = ft->std.currentFileSize = filesize; DB::EventInfo dbei; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); ProtoChainRecvFile(ft->std.hContact, DB::FILE_BLOB(ft, filename, XmlGetChildText(fileNode, "desc")), dbei); return; } @@ -874,7 +874,7 @@ bool CJabberProto::FtTryInlineFile(filetransfer *ft) DB::EventInfo dbei; dbei.flags = DBEF_READ | DBEF_SENT; dbei.pBlob = szMsg.GetBuffer(); - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); ProtoChainRecvMsg(ft->std.hContact, dbei); return true; } diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp index d99cabebd4..ede6e546a1 100644 --- a/protocols/JabberG/src/jabber_iq_handlers.cpp +++ b/protocols/JabberG/src/jabber_iq_handlers.cpp @@ -324,7 +324,7 @@ bool CJabberProto::OnIqRequestOOB(const TiXmlElement*, CJabberIqInfo *pInfo) str2 = ft->httpPath; DB::EventInfo dbei; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); ProtoChainRecvFile(ft->std.hContact, DB::FILE_BLOB(ft, str2, desc), dbei); } else { // reject diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp index d841716ab2..b50829a943 100644 --- a/protocols/JabberG/src/jabber_misc.cpp +++ b/protocols/JabberG/src/jabber_misc.cpp @@ -53,7 +53,7 @@ void CJabberProto::DBAddAuthRequest(const char *jid, const char *nick) DB::AUTH_BLOB blob(hContact, nick, nullptr, nullptr, jid, nullptr); DB::EventInfo dbei; - dbei.timestamp = (uint32_t)time(0); + dbei.iTimestamp = (uint32_t)time(0); dbei.cbBlob = blob.size(); dbei.pBlob = blob; ProtoChainRecv(hContact, PSR_AUTH, 0, (LPARAM)&dbei); @@ -126,7 +126,7 @@ bool CJabberProto::AddDbPresenceEvent(MCONTACT hContact, uint8_t btEventType) dbei.cbBlob = sizeof(btEventType); dbei.eventType = EVENTTYPE_JABBER_PRESENCE; dbei.flags = DBEF_READ; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.szModule = m_szModuleName; db_event_add(hContact, &dbei); return true; @@ -500,7 +500,7 @@ void CJabberProto::OnGetBob(const TiXmlElement *node, CJabberIqInfo *pReq) wszFileName.Insert(0, L"[img]"); wszFileName.Append(L"[/img]"); T2Utf szMsg(wszFileName); DB::EventInfo dbei; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.pBlob = szMsg; ProtoChainRecvMsg(pReq->GetHContact(), dbei); } diff --git a/protocols/JabberG/src/jabber_omemo.cpp b/protocols/JabberG/src/jabber_omemo.cpp index c9956dda17..e87414d68f 100644 --- a/protocols/JabberG/src/jabber_omemo.cpp +++ b/protocols/JabberG/src/jabber_omemo.cpp @@ -1405,7 +1405,7 @@ bool CJabberProto::OmemoHandleMessage(XmppMsg *msg, const TiXmlElement *node, co DBEVENTINFO dbei = {}; dbei.szModule = Proto_GetBaseAccountName(hContact); - dbei.timestamp = msgTime; + dbei.iTimestamp = msgTime; dbei.eventType = EVENTTYPE_FILE; if (trusted) dbei.flags = DBEF_SECURE; diff --git a/protocols/JabberG/src/jabber_rc.cpp b/protocols/JabberG/src/jabber_rc.cpp index 7e9800b1c2..e273d169fe 100644 --- a/protocols/JabberG/src/jabber_rc.cpp +++ b/protocols/JabberG/src/jabber_rc.cpp @@ -450,7 +450,7 @@ int CJabberProto::RcGetUnreadEventsCount() for (MEVENT hDbEvent = db_event_firstUnread(hContact); hDbEvent; hDbEvent = db_event_next(hContact, hDbEvent)) { DB::EventInfo dbei(hDbEvent); - if (dbei && dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) { + if (dbei && dbei.eventType == EVENTTYPE_MESSAGE && !dbei.bRead && !dbei.bSent) { ptrW szEventText(dbei.getText()); if (szEventText) nEventsSent++; @@ -549,7 +549,7 @@ int CJabberProto::AdhocForwardHandler(const TiXmlElement*, CJabberIqInfo *pInfo, addressesNode << XCHILD("address") << XATTR("type", "ofrom") << XATTR("jid", szOFrom); addressesNode << XCHILD("address") << XATTR("type", "oto") << XATTR("jid", m_ThreadInfo->fullJID); - time_t ltime = (time_t)dbei.timestamp; + time_t ltime = dbei.getUnixtime(); struct tm *gmt = gmtime(<ime); char stime[512]; mir_snprintf(stime, "%.4i-%.2i-%.2iT%.2i:%.2i:%.2iZ", gmt->tm_year + 1900, gmt->tm_mon + 1, gmt->tm_mday, diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp index 3dd0b1d547..12106c3552 100644 --- a/protocols/JabberG/src/jabber_thread.cpp +++ b/protocols/JabberG/src/jabber_thread.cpp @@ -1021,7 +1021,7 @@ uint32_t JabberGetLastContactMessageTime(MCONTACT hContact) return 0; DB::EventInfo dbei(hDbEvent, false); - return (dbei) ? dbei.timestamp : 0; + return (dbei) ? dbei.getUnixtime() : 0; } MCONTACT CJabberProto::CreateTemporaryContact(const char *szJid, JABBER_LIST_ITEM *chatItem) @@ -1175,7 +1175,7 @@ void CJabberProto::XmppMsg::handle_chatstates() _dbei.cbBlob = 1; _dbei.eventType = EVENTTYPE_JABBER_CHATSTATES; _dbei.flags = DBEF_READ; - _dbei.timestamp = time(0); + _dbei.iTimestamp = time(0); _dbei.szModule = m_proto->m_szModuleName; db_event_add(hContact, &_dbei); } @@ -1463,7 +1463,7 @@ void CJabberProto::XmppMsg::add_to_db() if (bWasSent) dbei.flags |= DBEF_SENT; - dbei.timestamp = (uint32_t)msgTime; + dbei.iTimestamp = (uint32_t)msgTime; dbei.pBlob = szMessage.GetBuffer(); dbei.szId = szMamMsgId; -- cgit v1.2.3