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 --- plugins/Scriver/src/globals.cpp | 2 +- plugins/Scriver/src/msgdialog.cpp | 6 +++--- plugins/Scriver/src/msglog.cpp | 42 +++++++++++++++++++-------------------- plugins/Scriver/src/msgs.cpp | 4 ++-- plugins/Scriver/src/msgutils.cpp | 12 +++++------ 5 files changed, 33 insertions(+), 33 deletions(-) (limited to 'plugins/Scriver/src') diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 33d1f88998..1055ecf6fb 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -129,7 +129,7 @@ static int ackevent(WPARAM, LPARAM lParam) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_UTF | DBEF_SENT | (item->flags & DBEF_RTL); dbei.szModule = Proto_GetBaseAccountName(hContact); - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.cbBlob = (int)mir_strlen(item->sendBuffer) + 1; dbei.pBlob = item->sendBuffer; dbei.szId = (char *)pAck->lParam; diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 8e2132d2c3..81149e2582 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -187,8 +187,8 @@ bool CMsgDialog::OnInitDialog() while (MEVENT hdbEvent = pCursor.FetchNext()) { DBEVENTINFO dbei = {}; db_event_get(hdbEvent, &dbei); - if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) { - m_lastMessage = dbei.timestamp; + if (dbei.eventType == EVENTTYPE_MESSAGE && !dbei.bSent) { + m_lastMessage = dbei.getUnixtime(); break; } } @@ -783,7 +783,7 @@ INT_PTR CMsgDialog::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) m_hDbUnreadEventFirst = 0; while (hDbEvent != 0) { DB::EventInfo dbei(hDbEvent, false); - if (!(dbei.flags & DBEF_SENT) && dbei.isSrmm()) + if (!dbei.bSent && dbei.isSrmm()) Clist_RemoveEvent(-1, hDbEvent); hDbEvent = db_event_next(m_hContact, hDbEvent); } diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 9cfc82d963..f3729e9629 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -384,7 +384,7 @@ public: if ((gdat->flags.bGroupMessages) && dbei.flags == LOWORD(m_lastEventType) && dbei.eventType == EVENTTYPE_MESSAGE && HIWORD(m_lastEventType) == EVENTTYPE_MESSAGE && - (isSameDate(dbei.timestamp, m_lastEventTime)) && ((((int)dbei.timestamp < m_startTime) == (m_lastEventTime < m_startTime)) || !(dbei.flags & DBEF_READ))) { + (isSameDate(dbei.getUnixtime(), m_lastEventTime)) && ((((int)dbei.getUnixtime() < m_startTime) == (m_lastEventTime < m_startTime)) || !dbei.bRead)) { isGroupBreak = FALSE; } @@ -393,7 +393,7 @@ public: // test contact if (streamData->dbei == 0) { - if (dbei.flags & DBEF_SENT) + if (dbei.bSent) wszNick = Contact::GetInfo(CNF_DISPLAY, 0, m_pDlg.m_szProto); else wszNick = mir_wstrdup(Clist_GetContactDisplayName(m_pDlg.m_hContact)); @@ -401,7 +401,7 @@ public: if (!m_pDlg.m_bUseRtl && Utils_IsRtl(wszText)) bIsRtl = true; } - else wszNick = mir_wstrdup((dbei.flags & DBEF_SENT) ? TranslateT("Me") : TranslateT("My contact")); + else wszNick = mir_wstrdup(dbei.bSent ? TranslateT("Me") : TranslateT("My contact")); if (!streamData->isFirst && !m_isMixed) { if (isGroupBreak || gdat->flags.bMarkFollowups) @@ -419,7 +419,7 @@ public: buf.Append(bIsRtl ? "\\rtlpar" : "\\ltrpar"); if (dbei.eventType == EVENTTYPE_MESSAGE) - highlight = fontOptionsListSize + 2 + ((dbei.flags & DBEF_SENT) ? 1 : 0); + highlight = fontOptionsListSize + 2 + (dbei.bSent ? 1 : 0); else highlight = fontOptionsListSize + 1; @@ -444,7 +444,7 @@ public: case EVENTTYPE_MESSAGE: if (dbei.flags & (DBEF_SECURE | DBEF_STRONG)) i = (dbei.flags & DBEF_SECURE) ? LOGICON_MSG_SECURE : LOGICON_MSG_STRONG; - else if (dbei.flags & DBEF_SENT) + else if (dbei.bSent) i = LOGICON_MSG_OUT; else i = LOGICON_MSG_IN; @@ -466,29 +466,29 @@ public: if (gdat->flags.bGroupMessages && dbei.eventType == EVENTTYPE_MESSAGE) { if (isGroupBreak) { if (!gdat->flags.bMarkFollowups) - timestampString = TimestampToString(gdat->flags, dbei.timestamp, 0); + timestampString = TimestampToString(gdat->flags, dbei.getUnixtime(), 0); else if (gdat->flags.bShowDate) - timestampString = TimestampToString(gdat->flags, dbei.timestamp, 1); + timestampString = TimestampToString(gdat->flags, dbei.getUnixtime(), 1); } else if (gdat->flags.bMarkFollowups) - timestampString = TimestampToString(gdat->flags, dbei.timestamp, 2); + timestampString = TimestampToString(gdat->flags, dbei.getUnixtime(), 2); } - else timestampString = TimestampToString(gdat->flags, dbei.timestamp, 0); + else timestampString = TimestampToString(gdat->flags, dbei.getUnixtime(), 0); if (timestampString != nullptr) { - buf.AppendFormat("%s ", SetToStyle(dbei.flags & DBEF_SENT ? MSGFONTID_MYTIME : MSGFONTID_YOURTIME)); + buf.AppendFormat("%s ", SetToStyle(dbei.bSent ? MSGFONTID_MYTIME : MSGFONTID_YOURTIME)); AppendUnicodeToBuffer(buf, timestampString); } if (dbei.eventType != EVENTTYPE_MESSAGE) - buf.AppendFormat("%s: ", SetToStyle(dbei.flags & DBEF_SENT ? MSGFONTID_MYCOLON : MSGFONTID_YOURCOLON)); + buf.AppendFormat("%s: ", SetToStyle(dbei.bSent ? MSGFONTID_MYCOLON : MSGFONTID_YOURCOLON)); showColon = 1; } if ((!(gdat->flags.bHideNames) && dbei.eventType == EVENTTYPE_MESSAGE && isGroupBreak) || dbei.eventType == EVENTTYPE_JABBER_CHATSTATES || dbei.eventType == EVENTTYPE_JABBER_PRESENCE) { if (dbei.eventType == EVENTTYPE_MESSAGE) { if (showColon) - buf.AppendFormat(" %s ", SetToStyle(dbei.flags & DBEF_SENT ? MSGFONTID_MYNAME : MSGFONTID_YOURNAME)); + buf.AppendFormat(" %s ", SetToStyle(dbei.bSent ? MSGFONTID_MYNAME : MSGFONTID_YOURNAME)); else - buf.AppendFormat("%s ", SetToStyle(dbei.flags & DBEF_SENT ? MSGFONTID_MYNAME : MSGFONTID_YOURNAME)); + buf.AppendFormat("%s ", SetToStyle(dbei.bSent ? MSGFONTID_MYNAME : MSGFONTID_YOURNAME)); } else buf.AppendFormat("%s ", SetToStyle(MSGFONTID_NOTICE)); @@ -505,15 +505,15 @@ public: } if (gdat->flags.bShowTime && gdat->flags.bGroupMessages && gdat->flags.bMarkFollowups && dbei.eventType == EVENTTYPE_MESSAGE && isGroupBreak) { - buf.AppendFormat(" %s ", SetToStyle(dbei.flags & DBEF_SENT ? MSGFONTID_MYTIME : MSGFONTID_YOURTIME)); - AppendUnicodeToBuffer(buf, TimestampToString(gdat->flags, dbei.timestamp, 2)); + buf.AppendFormat(" %s ", SetToStyle(dbei.bSent ? MSGFONTID_MYTIME : MSGFONTID_YOURTIME)); + AppendUnicodeToBuffer(buf, TimestampToString(gdat->flags, dbei.getUnixtime(), 2)); showColon = 1; } if (showColon && dbei.eventType == EVENTTYPE_MESSAGE) { if (bIsRtl) - buf.AppendFormat("\\~%s: ", SetToStyle(dbei.flags & DBEF_SENT ? MSGFONTID_MYCOLON : MSGFONTID_YOURCOLON)); + buf.AppendFormat("\\~%s: ", SetToStyle(dbei.bSent ? MSGFONTID_MYCOLON : MSGFONTID_YOURCOLON)); else - buf.AppendFormat("%s: ", SetToStyle(dbei.flags & DBEF_SENT ? MSGFONTID_MYCOLON : MSGFONTID_YOURCOLON)); + buf.AppendFormat("%s: ", SetToStyle(dbei.bSent ? MSGFONTID_MYCOLON : MSGFONTID_YOURCOLON)); } switch (dbei.eventType) { case EVENTTYPE_JABBER_CHATSTATES: @@ -528,7 +528,7 @@ public: break; } - if (dbei.flags & DBEF_SENT) + if (dbei.bSent) AppendUnicodeToBuffer(buf, TranslateT("File sent")); else AppendUnicodeToBuffer(buf, TranslateT("File received")); @@ -544,7 +544,7 @@ public: if (gdat->flags.bMsgOnNewline && showColon) buf.Append("\\line"); - style = dbei.flags & DBEF_SENT ? MSGFONTID_MYMSG : MSGFONTID_YOURMSG; + style = dbei.bSent ? MSGFONTID_MYMSG : MSGFONTID_YOURMSG; AppendWithCustomLinks(dbei, style, buf); break; } @@ -552,7 +552,7 @@ public: if (m_isMixed) buf.Append("\\par"); - m_lastEventTime = dbei.timestamp; + m_lastEventTime = dbei.getUnixtime(); m_lastEventType = MAKELONG(dbei.flags, dbei.eventType); return true; } @@ -810,7 +810,7 @@ void StreamInTestEvents(CDlgBase *pDlg, GlobalMessageData *gdat) DB::EventInfo dbei; dbei.flags = DBEF_UTF; dbei.eventType = EVENTTYPE_MESSAGE; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.szModule = SRMM_MODULE; auto *pLog = new CLogWindow(*(CMsgDialog*)pDlg); diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 599fefe9a7..47f692d0a4 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -121,10 +121,10 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) if (!dbei) return 0; - if (dbei.eventType == EVENTTYPE_MESSAGE && (dbei.flags & DBEF_READ)) + if (dbei.eventType == EVENTTYPE_MESSAGE && dbei.bRead) return 0; - if (dbei.flags & DBEF_SENT || !dbei.isSrmm()) + if (dbei.bSent || !dbei.isSrmm()) return 0; Utils_InvokeAsync(new CAutoPpopup(hContact, hDbEvent)); diff --git a/plugins/Scriver/src/msgutils.cpp b/plugins/Scriver/src/msgutils.cpp index 05159ea6ba..89a5b817d2 100644 --- a/plugins/Scriver/src/msgutils.cpp +++ b/plugins/Scriver/src/msgutils.cpp @@ -84,7 +84,7 @@ void CMsgDialog::EventAdded(MEVENT hDbEvent, const DB::EventInfo &dbei) /* store the event when the container is hidden so that clist notifications can be removed */ if (!IsWindowVisible(m_hwndParent) && m_hDbUnreadEventFirst == 0) m_hDbUnreadEventFirst = hDbEvent; - m_lastMessage = dbei.timestamp; + m_lastMessage = dbei.getUnixtime(); UpdateStatusBar(); if (bIsActive) Skin_PlaySound("RecvMsgActive"); @@ -101,7 +101,7 @@ void CMsgDialog::EventAdded(MEVENT hDbEvent, const DB::EventInfo &dbei) else RemakeLog(); - if (!(dbei.flags & DBEF_SENT) && !dbei.isCustom(DETF_MSGWINDOW)) { + if (!dbei.bSent && !dbei.isCustom(DETF_MSGWINDOW)) { if (!bIsActive) { m_iShowUnread = 1; UpdateIcon(); @@ -122,7 +122,7 @@ bool CMsgDialog::GetFirstEvent() m_hDbEventFirst = db_event_firstUnread(m_hContact); if (m_hDbEventFirst != 0) { DB::EventInfo dbei(m_hDbEventFirst, false); - if (dbei.isSrmm() && !(dbei.flags & DBEF_READ) && !(dbei.flags & DBEF_SENT)) + if (dbei.isSrmm() && !dbei.bRead && !dbei.bSent) notifyUnread = true; } @@ -147,11 +147,11 @@ bool CMsgDialog::GetFirstEvent() case LOADHISTORY_TIME: if (m_hDbEventFirst == 0) - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); else db_event_get(m_hDbEventFirst, &dbei); - uint32_t firstTime = dbei.timestamp - 60 * g_plugin.iLoadTime; + uint32_t firstTime = dbei.getUnixtime() - 60 * g_plugin.iLoadTime; for (;;) { hPrevEvent = pCursor.FetchNext(); if (hPrevEvent == 0) @@ -159,7 +159,7 @@ bool CMsgDialog::GetFirstEvent() dbei.cbBlob = 0; db_event_get(hPrevEvent, &dbei); - if (dbei.timestamp < firstTime) + if (dbei.getUnixtime() < firstTime) break; if (DbEventIsShown(dbei)) m_hDbEventFirst = hPrevEvent; -- cgit v1.2.3