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/AvatarHistory/src/AvatarDlg.cpp | 2 +- plugins/AvatarHistory/src/AvatarHistory.cpp | 2 +- plugins/BasicHistory/src/BinaryExport.cpp | 6 ++-- plugins/BasicHistory/src/DatExport.cpp | 4 +-- plugins/BasicHistory/src/EventList.cpp | 10 +++--- plugins/BasicHistory/src/Scheduler.cpp | 2 +- plugins/Boltun/src/actionQueue.cpp | 2 +- plugins/BuddyExpectator/src/BuddyExpectator.cpp | 2 +- plugins/BuddyPounce/src/main.cpp | 2 +- plugins/Clist_modern/src/modern_clc.cpp | 6 ++-- plugins/Clist_modern/src/modern_contact.cpp | 4 +-- plugins/Clist_nicer/src/clc.cpp | 6 ++-- plugins/Clist_nicer/src/contact.cpp | 12 +++---- plugins/CmdLine/src/mimcmd_handlers.cpp | 4 +-- plugins/ContactsPlus/src/send.cpp | 2 +- plugins/Db3x_mmap/src/dbevents.cpp | 6 ++-- plugins/Dbx_mdbx/src/dbevents.cpp | 10 +++--- plugins/Dbx_sqlite/src/dbevents.cpp | 14 ++++---- plugins/FTPFileYM/src/job_upload.cpp | 2 +- plugins/FavContacts/src/contact_cache.cpp | 4 +-- plugins/HistoryLinkListPlus/src/linklist_fct.cpp | 2 +- plugins/HistoryStats/src/mirandacontact.cpp | 26 +++++++------- plugins/HistoryStats/src/statistic.cpp | 2 +- .../src/historysweeperlight.cpp | 4 +-- plugins/IEHistory/src/dlgHandlers.cpp | 2 +- plugins/IEHistory/src/utils.cpp | 2 +- plugins/IEView/src/HTMLBuilder.cpp | 6 ++-- plugins/Import/src/dbrw/dbevents.cpp | 2 +- plugins/Import/src/import.cpp | 10 +++--- plugins/Import/src/mcontacts.cpp | 4 +-- plugins/Import/src/patterns.cpp | 6 ++-- plugins/Import/src/textjson.cpp | 18 +++++----- plugins/Jingle/src/account.cpp | 2 +- plugins/KeyboardNotify/src/main.cpp | 4 +-- plugins/MessageState/src/messagestate.cpp | 2 +- plugins/MirFox/src/MirandaUtils.cpp | 2 +- plugins/MirLua/src/Modules/m_database.cpp | 4 +-- plugins/MirLua/src/Modules/m_message.cpp | 2 +- plugins/MirOTR/src/utils.cpp | 4 +-- plugins/MirandaG15/src/CAppletManager.cpp | 4 +-- plugins/Msg_Export/src/export.cpp | 4 +-- plugins/NewAwaySysMod/src/MsgEventAdded.cpp | 8 ++--- plugins/NewEventNotify/src/main.cpp | 4 +-- plugins/NewEventNotify/src/popup.cpp | 2 +- plugins/NewStory/src/history_array.cpp | 30 ++++++++-------- plugins/NewStory/src/history_control.cpp | 14 ++++---- plugins/NewStory/src/history_dlg.cpp | 8 ++--- plugins/NewStory/src/history_menus.cpp | 2 +- plugins/NewStory/src/options.cpp | 2 +- plugins/NewStory/src/templates.cpp | 10 +++--- plugins/NewXstatusNotify/src/main.cpp | 4 +-- plugins/NewXstatusNotify/src/xstatus.cpp | 2 +- plugins/New_GPG/src/messages.cpp | 2 +- plugins/New_GPG/src/utilities.cpp | 2 +- plugins/Nudge/src/main.cpp | 4 +-- plugins/PasteIt/src/PasteIt.cpp | 2 +- plugins/Popup/src/popup_wnd2.cpp | 2 +- plugins/QuickSearch/src/window_row.cpp | 2 +- plugins/RecentContacts/src/RecentContacts.cpp | 4 +-- 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 +++---- plugins/SecureIM/src/dbevent.cpp | 2 +- plugins/SendScreenshotPlus/src/CSend.cpp | 2 +- plugins/SimpleAR/src/Main.cpp | 2 +- plugins/StopSpamMod/src/utilities.cpp | 2 +- plugins/StopSpamPlus/src/events.cpp | 6 ++-- plugins/TabSRMM/src/globals.cpp | 2 +- plugins/TabSRMM/src/hotkeyhandler.cpp | 2 +- plugins/TabSRMM/src/mim.cpp | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 4 +-- plugins/TabSRMM/src/msgdlgother.cpp | 24 ++++++------- plugins/TabSRMM/src/msglog.cpp | 28 +++++++-------- plugins/TabSRMM/src/msgoptions.cpp | 2 +- plugins/TabSRMM/src/sendlater.cpp | 2 +- plugins/TabSRMM/src/sendqueue.cpp | 6 ++-- plugins/TipperYM/src/subst.cpp | 12 +++---- .../src/ex_import/classExImContactXML.cpp | 6 ++-- plugins/UserInfoEx/src/mir_db.cpp | 12 +++---- plugins/Variables/src/parse_miranda.cpp | 20 +++++------ plugins/YARelay/src/main.cpp | 4 +-- 83 files changed, 261 insertions(+), 263 deletions(-) (limited to 'plugins') diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index ef3548e0d0..6e8d42eed3 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -420,7 +420,7 @@ int FillAvatarListFromDB(HWND list, MCONTACT hContact) // Get time wchar_t date[64]; - TimeZone_ToStringW(dbei.timestamp, L"d s", date, _countof(date)); + TimeZone_ToStringW(dbei.getUnixtime(), L"d s", date, _countof(date)); // Get file in disk wchar_t path[MAX_PATH]; diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index ce2257fa7d..ac7993578b 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -205,7 +205,7 @@ static int AvatarChanged(WPARAM hContact, LPARAM lParam) DBEVENTINFO dbei = {}; dbei.szModule = Proto_GetBaseAccountName(hContact); dbei.flags = DBEF_READ | DBEF_UTF; - dbei.timestamp = (uint32_t)time(0); + dbei.iTimestamp = time(0); dbei.eventType = EVENTTYPE_AVATAR_CHANGE; dbei.cbBlob = (uint32_t)mir_strlen(blob) + 1; dbei.pBlob = blob; diff --git a/plugins/BasicHistory/src/BinaryExport.cpp b/plugins/BasicHistory/src/BinaryExport.cpp index 1eadefd459..8d716c7868 100644 --- a/plugins/BasicHistory/src/BinaryExport.cpp +++ b/plugins/BasicHistory/src/BinaryExport.cpp @@ -132,14 +132,14 @@ void BinaryExport::WriteGroup(bool, const std::wstring&, const std::wstring&, co void BinaryExport::WriteMessage(bool, const std::wstring&, const std::wstring&, const std::wstring&, const std::wstring &message, const DBEVENTINFO& dbei) { - if (dbei.timestamp >= lTime) { + if (dbei.getUnixtime() >= lTime) { BinaryFileMessageHeader header; header.eventType = dbei.eventType; header.flags = dbei.flags & (~(0x800)); - header.timestamp = dbei.timestamp; + header.timestamp = dbei.getUnixtime(); EXP_FILE.write((char*)&header, sizeof(BinaryFileMessageHeader)); WriteString(message); - lTime = dbei.timestamp; + lTime = dbei.getUnixtime(); } } diff --git a/plugins/BasicHistory/src/DatExport.cpp b/plugins/BasicHistory/src/DatExport.cpp index 9d11a75860..6ef9f857b9 100644 --- a/plugins/BasicHistory/src/DatExport.cpp +++ b/plugins/BasicHistory/src/DatExport.cpp @@ -97,7 +97,7 @@ void DatExport::WriteMessage(bool, const std::wstring&, const std::wstring&, con header.cbSize = sizeof(DBEVENTINFO86); header.eventType = dbei.eventType; header.flags = dbei.flags & (~(0x800)); - header.timestamp = dbei.timestamp; + header.timestamp = dbei.getUnixtime(); header.szModule = 0; header.pBlob = 0; if (dbei.flags & 0x800) { @@ -179,7 +179,7 @@ bool DatExport::GetEventList(std::vector& eventList) info.eventType = messageHeader.eventType; info.flags = messageHeader.flags; - info.timestamp = messageHeader.timestamp; + info.iTimestamp = messageHeader.timestamp; info.cbBlob = messageHeader.cbBlob; info.pBlob = (char *)memBuf.c_str(); HistoryEventList::GetObjectDescription(&info, _str, MAXSELECTSTR); diff --git a/plugins/BasicHistory/src/EventList.cpp b/plugins/BasicHistory/src/EventList.cpp index 7a5ba2f3b0..e4cf87a0ba 100644 --- a/plugins/BasicHistory/src/EventList.cpp +++ b/plugins/BasicHistory/src/EventList.cpp @@ -63,11 +63,11 @@ bool HistoryEventList::CanShowHistory(DBEVENTINFO* dbei) { if (m_deltaTime != 0) { if (m_deltaTime > 0) { - if (m_now - m_deltaTime < dbei->timestamp) + if (m_now - m_deltaTime < dbei->getUnixtime()) return false; } else { - if (m_now + m_deltaTime > dbei->timestamp) + if (m_now + m_deltaTime > dbei->getUnixtime()) return false; } } @@ -501,7 +501,7 @@ void HistoryEventList::MargeMessages(const std::vector if (it->isExternal) { IImport::ExternalMessage& msg = m_importedMessages[it->exIdx]; dbei.flags |= DBEF_READ; - dbei.timestamp = msg.timestamp; + dbei.iTimestamp = msg.timestamp; // For now I do not convert event data from string to blob, and event type must be message to handle it properly dbei.eventType = EVENTTYPE_MESSAGE; UINT cp = dbei.flags & DBEF_UTF ? CP_UTF8 : CP_ACP; @@ -532,7 +532,7 @@ bool HistoryEventList::GetEventData(const EventIndex& ev, EventData& data) if (db_event_get(ev.hEvent, &m_dbei) == 0) { data.isMe = (m_dbei.flags & DBEF_SENT) != 0; data.eventType = m_dbei.eventType; - data.timestamp = m_dbei.timestamp; + data.timestamp = m_dbei.getUnixtime(); return true; } } @@ -552,7 +552,7 @@ void HistoryEventList::GetExtEventDBei(const EventIndex& ev) IImport::ExternalMessage& em = m_importedMessages[ev.exIdx]; m_dbei.flags = em.flags | 0x800; m_dbei.eventType = em.eventType; - m_dbei.timestamp = em.timestamp; + m_dbei.iTimestamp = em.timestamp; } HICON HistoryEventList::GetEventCoreIcon(const EventIndex& ev) diff --git a/plugins/BasicHistory/src/Scheduler.cpp b/plugins/BasicHistory/src/Scheduler.cpp index 98202c2382..e778f152a4 100644 --- a/plugins/BasicHistory/src/Scheduler.cpp +++ b/plugins/BasicHistory/src/Scheduler.cpp @@ -1278,7 +1278,7 @@ void DoError(const TaskOptions& to, const std::wstring _error) DBEVENTINFO dbei = {}; dbei.szModule = MODULENAME; dbei.flags = DBEF_UTF | DBEF_READ; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); // For now I do not convert event data from string to blob, and event type must be message to handle it properly dbei.eventType = EVENTTYPE_MESSAGE; int len = (int)error.length() + 1; diff --git a/plugins/Boltun/src/actionQueue.cpp b/plugins/Boltun/src/actionQueue.cpp index edc37f2194..41235cbe5a 100644 --- a/plugins/Boltun/src/actionQueue.cpp +++ b/plugins/Boltun/src/actionQueue.cpp @@ -92,7 +92,7 @@ static void TimerAnswer(MCONTACT hContact, const TalkBot::MessageInfo* info) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = BOLTUN_NAME; - dbei.timestamp = (uint32_t)time(0); + dbei.iTimestamp = (uint32_t)time(0); db_event_add(hContact, &dbei); bot->AnswerGiven(hContact, *info); diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index 641af4fbaf..ca43b1bfd3 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -85,7 +85,7 @@ time_t getLastInputMsg(MCONTACT hContact) DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) - return dbei.timestamp; + return dbei.getUnixtime(); } return -1; } diff --git a/plugins/BuddyPounce/src/main.cpp b/plugins/BuddyPounce/src/main.cpp index f6a8ea1c9c..8c5828171d 100644 --- a/plugins/BuddyPounce/src/main.cpp +++ b/plugins/BuddyPounce/src/main.cpp @@ -49,7 +49,7 @@ int MsgAck(WPARAM, LPARAM lParam) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_UTF | DBEF_SENT; dbei.szModule = (char*)ack->szModule; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.cbBlob = (int)mir_strlen(pszUtf) + 1; dbei.pBlob = pszUtf; db_event_add(ack->hContact, &dbei); diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index 6e7ae2bf0d..a0627e6f14 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -159,11 +159,11 @@ static int clcHookDbEventAdded(WPARAM hContact, LPARAM hDbEvent) if (hContact && hDbEvent) { DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); - if ((dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE) && !(dbei.flags & DBEF_SENT)) { - g_plugin.setDword(hContact, "mf_lastmsg", dbei.timestamp); + if ((dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE) && !dbei.bSent) { + g_plugin.setDword(hContact, "mf_lastmsg", dbei.getUnixtime()); ClcCacheEntry *pdnce = Clist_GetCacheEntry(hContact); if (pdnce) { - pdnce->dwLastMsgTime = dbei.timestamp; + pdnce->dwLastMsgTime = dbei.getUnixtime(); if (g_CluiData.hasSort(SORTBY_LASTMSG)) Clist_Broadcast(CLM_AUTOREBUILD, hContact, 0); } diff --git a/plugins/Clist_modern/src/modern_contact.cpp b/plugins/Clist_modern/src/modern_contact.cpp index 707e47604f..9fcbb96c19 100644 --- a/plugins/Clist_modern/src/modern_contact.cpp +++ b/plugins/Clist_modern/src/modern_contact.cpp @@ -66,8 +66,8 @@ uint32_t CompareContacts2_getLMTime(MCONTACT hContact) while (MEVENT hDbEvent = pCursor.FetchNext()) { DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); - if ((dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE) && !(dbei.flags & DBEF_SENT)) - return dbei.timestamp; + if ((dbei.eventType == EVENTTYPE_MESSAGE || dbei.eventType == EVENTTYPE_FILE) && !dbei.bSent) + return dbei.getUnixtime(); } return 0; } diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 1110a3a3ff..afa208600c 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -72,17 +72,17 @@ static int ClcEventAdded(WPARAM hContact, LPARAM lParam) if (hContact && lParam) { DBEVENTINFO dbei = {}; db_event_get(lParam, &dbei); - if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) { + if (dbei.eventType == EVENTTYPE_MESSAGE && !dbei.bSent) { uint32_t firstTime = g_plugin.getDword(hContact, "mf_firstEvent"); uint32_t count = g_plugin.getDword(hContact, "mf_count"); count++; - new_freq = count ? (dbei.timestamp - firstTime) / count : 0x7fffffff; + new_freq = count ? (dbei.getUnixtime() - firstTime) / count : 0x7fffffff; g_plugin.setDword(hContact, "mf_freq", new_freq); g_plugin.setDword(hContact, "mf_count", count); TExtraCache *p = cfg::getCache(hContact, nullptr); if (p) { - p->dwLastMsgTime = dbei.timestamp; + p->dwLastMsgTime = dbei.getUnixtime(); if (new_freq) p->msgFrequency = new_freq; Clist_Broadcast(INTM_FORCESORT, 0, 1); diff --git a/plugins/Clist_nicer/src/contact.cpp b/plugins/Clist_nicer/src/contact.cpp index 4b760f933a..f1ed1e3131 100644 --- a/plugins/Clist_nicer/src/contact.cpp +++ b/plugins/Clist_nicer/src/contact.cpp @@ -73,10 +73,10 @@ static void MF_CalcFrequency(MCONTACT hContact, uint32_t dwCutoffDays, int doSle db_event_get(hEvent, &dbei); // record time of last event - if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) + if (dbei.eventType == EVENTTYPE_MESSAGE && !dbei.bSent) eventCount++; - if (eventCount >= 100 || dbei.timestamp < curTime - (dwCutoffDays * 86400)) + if (eventCount >= 100 || dbei.getUnixtime() < curTime - (dwCutoffDays * 86400)) break; if (doSleep && mf_updatethread_running == FALSE) @@ -90,8 +90,8 @@ static void MF_CalcFrequency(MCONTACT hContact, uint32_t dwCutoffDays, int doSle g_plugin.setDword(hContact, "mf_firstEvent", curTime - (dwCutoffDays * 86400)); } else { - frequency = (curTime - dbei.timestamp) / eventCount; - g_plugin.setDword(hContact, "mf_firstEvent", dbei.timestamp); + frequency = (curTime - dbei.getUnixtime()) / eventCount; + g_plugin.setDword(hContact, "mf_firstEvent", dbei.getUnixtime()); } g_plugin.setDword(hContact, "mf_freq", frequency); @@ -139,8 +139,8 @@ uint32_t INTSORT_GetLastMsgTime(MCONTACT hContact) while (MEVENT hDbEvent = cursor.FetchNext()) { DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); - if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) - return dbei.timestamp; + if (dbei.eventType == EVENTTYPE_MESSAGE && !dbei.bSent) + return dbei.getUnixtime(); } return 0; } diff --git a/plugins/CmdLine/src/mimcmd_handlers.cpp b/plugins/CmdLine/src/mimcmd_handlers.cpp index 4259f9226b..d7cdb6a9e4 100644 --- a/plugins/CmdLine/src/mimcmd_handlers.cpp +++ b/plugins/CmdLine/src/mimcmd_handlers.cpp @@ -708,7 +708,7 @@ void HandleMessageCommand(PCommand command, TArgument *argv, int argc, PReply re dbei.pBlob = szMessage.get(); dbei.cbBlob = (uint32_t)mir_strlen(szMessage) + 1; dbei.szModule = ack->szModule; - dbei.timestamp = (uint32_t)time(0); + dbei.iTimestamp = (uint32_t)time(0); db_event_add(ack->hContact, &dbei); } else szReply.AppendFormat(TranslateT("Message to '%s' was marked as sent but the account seems to be offline"), contact); @@ -1220,7 +1220,7 @@ void HandleContactsCommand(PCommand command, TArgument *argv, int argc, PReply r void AddHistoryEvent(DBEVENTINFO *dbEvent, wchar_t *contact, PReply reply) { char timestamp[256]; - TimeZone_ToString(dbEvent->timestamp, "D, s", timestamp, _countof(timestamp)); + TimeZone_ToString(dbEvent->getUnixtime(), "D, s", timestamp, _countof(timestamp)); wchar_t *sender = (dbEvent->flags & DBEF_SENT) ? TranslateT("[me]") : contact; wchar_t *message = DbEvent_GetText(dbEvent); diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp index f1efc7edb4..0ba2732d43 100644 --- a/plugins/ContactsPlus/src/send.cpp +++ b/plugins/ContactsPlus/src/send.cpp @@ -399,7 +399,7 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara dbei.szModule = Proto_GetBaseAccountName(ackData->hContact); dbei.eventType = EVENTTYPE_CONTACTS; dbei.flags = DBEF_SENT | DBEF_UTF; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); //make blob TCTSend* maSend = (TCTSend*)_alloca(ackData->nContacts*sizeof(TCTSend)); memset(maSend, 0, (ackData->nContacts * sizeof(TCTSend))); diff --git a/plugins/Db3x_mmap/src/dbevents.cpp b/plugins/Db3x_mmap/src/dbevents.cpp index dad9d9000f..9a41a5ace2 100644 --- a/plugins/Db3x_mmap/src/dbevents.cpp +++ b/plugins/Db3x_mmap/src/dbevents.cpp @@ -33,7 +33,7 @@ int CDb3Mmap::GetEventCount(MCONTACT contactID) MEVENT CDb3Mmap::AddEvent(MCONTACT contactID, const DBEVENTINFO *dbei) { if (dbei == nullptr) return 0; - if (dbei->timestamp == 0) return 0; + if (dbei->getUnixtime() == 0) return 0; DBEvent dbe; dbe.signature = DBEVENT_SIGNATURE; @@ -60,7 +60,7 @@ MEVENT CDb3Mmap::AddEvent(MCONTACT contactID, const DBEVENTINFO *dbei) if (NotifyEventHooks(g_hevEventFiltered, contactNotifyID, (LPARAM)dbei)) return 0; - dbe.timestamp = dbei->timestamp; + dbe.timestamp = dbei->getUnixtime(); dbe.flags = dbei->flags; dbe.wEventType = dbei->eventType; dbe.cbBlob = dbei->cbBlob; @@ -289,7 +289,7 @@ BOOL CDb3Mmap::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) return 1; dbei->szModule = GetModuleNameByOfs(dbe->ofsModuleName); - dbei->timestamp = dbe->timestamp; + dbei->iTimestamp = dbe->timestamp; dbei->flags = dbe->flags; dbei->eventType = dbe->wEventType; diff --git a/plugins/Dbx_mdbx/src/dbevents.cpp b/plugins/Dbx_mdbx/src/dbevents.cpp index b7c7373955..e844e034c2 100644 --- a/plugins/Dbx_mdbx/src/dbevents.cpp +++ b/plugins/Dbx_mdbx/src/dbevents.cpp @@ -37,7 +37,7 @@ int CDbxMDBX::GetEventCount(MCONTACT contactID) MEVENT CDbxMDBX::AddEvent(MCONTACT contactID, const DBEVENTINFO *dbei) { if (dbei == nullptr) return 0; - if (dbei->timestamp == 0) return 0; + if (dbei->iTimestamp == 0) return 0; MEVENT dwEventId = InterlockedIncrement(&m_dwMaxEventId); if (!EditEvent(contactID, dwEventId, dbei, true)) @@ -140,7 +140,7 @@ BOOL CDbxMDBX::DeleteEvent(MEVENT hDbEvent) BOOL CDbxMDBX::EditEvent(MEVENT hDbEvent, const DBEVENTINFO *dbei) { if (dbei == nullptr) return 1; - if (dbei->timestamp == 0) return 1; + if (dbei->iTimestamp == 0) return 1; DBEVENTINFO tmp = *dbei; @@ -149,7 +149,7 @@ BOOL CDbxMDBX::EditEvent(MEVENT hDbEvent, const DBEVENTINFO *dbei) return 1; DBEvent *dbe = (DBEvent*)data.iov_base; - tmp.timestamp = dbe->timestamp; + tmp.iTimestamp = dbe->timestamp; return !EditEvent(dbe->dwContactID, hDbEvent, &tmp, false); } @@ -184,7 +184,7 @@ bool CDbxMDBX::EditEvent(MCONTACT hContact, MEVENT hDbEvent, const DBEVENTINFO * if (NotifyEventHooks(g_hevEventFiltered, contactNotifyID, (LPARAM)dbei)) return false; - dbe.timestamp = dbei->timestamp; + dbe.timestamp = dbei->getUnixtime(); dbe.flags = dbei->flags; dbe.wEventType = dbei->eventType; dbe.cbBlob = dbei->cbBlob; @@ -306,7 +306,7 @@ BOOL CDbxMDBX::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) } dbei->szModule = GetModuleName(dbe->iModuleId); - dbei->timestamp = dbe->timestamp; + dbei->iTimestamp = dbe->timestamp; dbei->flags = dbe->flags; dbei->eventType = dbe->wEventType; diff --git a/plugins/Dbx_sqlite/src/dbevents.cpp b/plugins/Dbx_sqlite/src/dbevents.cpp index a376f9e8ca..2eb93ce7de 100644 --- a/plugins/Dbx_sqlite/src/dbevents.cpp +++ b/plugins/Dbx_sqlite/src/dbevents.cpp @@ -85,7 +85,7 @@ MEVENT CDbxSQLite::AddEvent(MCONTACT hContact, const DBEVENTINFO *dbei) if (dbei == nullptr) return 0; - if (dbei->timestamp == 0) + if (dbei->iTimestamp == 0) return 0; MCONTACT hNotifyContact = hContact; @@ -100,7 +100,7 @@ MEVENT CDbxSQLite::AddEvent(MCONTACT hContact, const DBEVENTINFO *dbei) return 0; // set default sub to the event's source - if (!(dbei->flags & DBEF_SENT)) + if (!dbei->bSent) db_mc_setDefault(cc->contactID, hContact, false); if (db_mc_isEnabled()) hNotifyContact = cc->contactID; // and add an event to a metahistory @@ -140,7 +140,7 @@ MEVENT CDbxSQLite::AddEvent(MCONTACT hContact, const DBEVENTINFO *dbei) "VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", qEvAdd); sqlite3_bind_int64(stmt, 1, hContact); sqlite3_bind_text(stmt, 2, tmp.szModule, (int)mir_strlen(tmp.szModule), nullptr); - sqlite3_bind_int64(stmt, 3, tmp.timestamp); + sqlite3_bind_int64(stmt, 3, tmp.iTimestamp); sqlite3_bind_int(stmt, 4, tmp.eventType); sqlite3_bind_int64(stmt, 5, tmp.flags); sqlite3_bind_blob(stmt, 6, tmp.pBlob, tmp.cbBlob, nullptr); @@ -154,7 +154,7 @@ MEVENT CDbxSQLite::AddEvent(MCONTACT hContact, const DBEVENTINFO *dbei) MEVENT hDbEvent = sqlite3_last_insert_rowid(m_db); - int64_t tsSort = (int64_t)tmp.timestamp * 1000; + int64_t tsSort = tmp.bMsec ? tmp.iTimestamp : tmp.iTimestamp * 1000; AddEventSrt(hDbEvent, cc->contactID, tsSort); cc->m_count++; @@ -261,7 +261,7 @@ BOOL CDbxSQLite::EditEvent(MEVENT hDbEvent, const DBEVENTINFO *dbei) if (dbei == nullptr) return 1; - if (dbei->timestamp == 0) + if (dbei->iTimestamp == 0) return 1; DBEVENTINFO tmp = *dbei; @@ -288,7 +288,7 @@ BOOL CDbxSQLite::EditEvent(MEVENT hDbEvent, const DBEVENTINFO *dbei) int i = 1; sqlite3_bind_text(stmt, i++, tmp.szModule, (int)mir_strlen(tmp.szModule), nullptr); - sqlite3_bind_int64(stmt, i++, tmp.timestamp); + sqlite3_bind_int64(stmt, i++, tmp.iTimestamp); sqlite3_bind_int(stmt, i++, tmp.eventType); sqlite3_bind_int64(stmt, i++, tmp.flags); if (tmp.pBlob) @@ -436,7 +436,7 @@ BOOL CDbxSQLite::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) if (dbei->szModule == nullptr) return 1; - dbei->timestamp = sqlite3_column_int64(stmt, 1); + dbei->iTimestamp = sqlite3_column_int64(stmt, 1); dbei->eventType = sqlite3_column_int(stmt, 2); dbei->flags = sqlite3_column_int64(stmt, 3); dbei->hContact = sqlite3_column_int(stmt, 9); diff --git a/plugins/FTPFileYM/src/job_upload.cpp b/plugins/FTPFileYM/src/job_upload.cpp index 6e4fbc29b3..9d71c41312 100644 --- a/plugins/FTPFileYM/src/job_upload.cpp +++ b/plugins/FTPFileYM/src/job_upload.cpp @@ -88,7 +88,7 @@ void UploadJob::autoSend() dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT; dbei.szModule = szProto; - dbei.timestamp = (uint32_t)time(0); + dbei.iTimestamp = (uint32_t)time(0); dbei.cbBlob = (uint32_t)mir_strlen(m_szFileLink) + 1; dbei.pBlob = m_szFileLink; db_event_add(m_hContact, &dbei); diff --git a/plugins/FavContacts/src/contact_cache.cpp b/plugins/FavContacts/src/contact_cache.cpp index 12dabbb2d0..161b3f2d8f 100644 --- a/plugins/FavContacts/src/contact_cache.cpp +++ b/plugins/FavContacts/src/contact_cache.cpp @@ -30,7 +30,7 @@ int __cdecl CContactCache::OnDbEventAdded(WPARAM hContact, LPARAM hEvent) if (dbei.eventType != EVENTTYPE_MESSAGE) return 0; - float weight = GetEventWeight(time(0) - dbei.timestamp); + float weight = GetEventWeight(time(0) - dbei.getUnixtime()); float q = GetTimeWeight(time(0) - m_lastUpdate); m_lastUpdate = time(0); if (!weight) @@ -88,7 +88,7 @@ void CContactCache::Rebuild() while (MEVENT hEvent = cursor.FetchNext()) { DBEVENTINFO dbei = {}; if (!db_event_get(hEvent, &dbei)) { - if (float weight = GetEventWeight(timestamp - dbei.timestamp)) { + if (float weight = GetEventWeight(timestamp - dbei.getUnixtime())) { if (dbei.eventType == EVENTTYPE_MESSAGE) info->rate += weight; } diff --git a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp index e413ea1fe3..7b29de550a 100644 --- a/plugins/HistoryLinkListPlus/src/linklist_fct.cpp +++ b/plugins/HistoryLinkListPlus/src/linklist_fct.cpp @@ -147,7 +147,7 @@ int ExtractURI(DBEVENTINFO *dbei, MEVENT hEvent, LISTELEMENT *listStart) wcsncpy_s(link, word, LINK_MAX); } - TimeZone_ToStringW(dbei->timestamp, L"d-t", dbdate, _countof(dbdate)); + TimeZone_ToStringW(dbei->getUnixtime(), L"d-t", dbdate, _countof(dbdate)); date_ptr = wcstok_s(dbdate, L"-", &tok_ctx); time_ptr = wcstok_s(nullptr, L"-", &tok_ctx); wcsncpy_s(date, date_ptr, _TRUNCATE); diff --git a/plugins/HistoryStats/src/mirandacontact.cpp b/plugins/HistoryStats/src/mirandacontact.cpp index f0e20dcc76..cd666d9419 100644 --- a/plugins/HistoryStats/src/mirandacontact.cpp +++ b/plugins/HistoryStats/src/mirandacontact.cpp @@ -162,14 +162,14 @@ void MirandaContactTolerantMerge::fillQueue() // assume that items with +/- 30 seconds may be equal static const int timestampTol = 30; - while (!m_CIs.empty() && (m_EIs.size() < 2 || (m_EIs.back().dbe.timestamp - m_EIs.front().dbe.timestamp) <= timestampTol)) { + while (!m_CIs.empty() && (m_EIs.size() < 2 || (m_EIs.back().dbe.getUnixtime() - m_EIs.front().dbe.getUnixtime()) <= timestampTol)) { // find oldest next event in chains int nNext = 0; - uint32_t timestampFirst = m_CIs.front().ei.dbe.timestamp; + uint32_t timestampFirst = m_CIs.front().ei.dbe.getUnixtime(); for (int i = 1; i < m_CIs.size(); ++i) { - if (m_CIs[i].ei.dbe.timestamp < timestampFirst) { - timestampFirst = m_CIs[i].ei.dbe.timestamp; + if (m_CIs[i].ei.dbe.getUnixtime() < timestampFirst) { + timestampFirst = m_CIs[i].ei.dbe.getUnixtime(); nNext = i; } } @@ -183,7 +183,7 @@ void MirandaContactTolerantMerge::fillQueue() iter_each_(std::list, j, m_EIs) { EventInfo& j_ei = *j; - int timestampDelta = j_ei.dbe.timestamp - ci.ei.dbe.timestamp; + int timestampDelta = j_ei.dbe.getUnixtime() - ci.ei.dbe.getUnixtime(); if (timestampDelta > 0) { insPos = j; @@ -227,14 +227,14 @@ void MirandaContactStrictMerge::fillQueue() // assume that items with +/- 30 seconds may be equal static const int timestampTol = 0; - while (!m_CIs.empty() && (m_EIs.size() < 2 || (m_EIs.back().dbe.timestamp - m_EIs.front().dbe.timestamp) <= timestampTol)) { + while (!m_CIs.empty() && (m_EIs.size() < 2 || (m_EIs.back().dbe.getUnixtime() - m_EIs.front().dbe.getUnixtime()) <= timestampTol)) { // find oldest next event in chains int nNext = 0; - uint32_t timestampFirst = m_CIs.front().ei.dbe.timestamp; + uint32_t timestampFirst = m_CIs.front().ei.dbe.getUnixtime(); for (int i = 1; i < m_CIs.size(); ++i) { - if (m_CIs[i].ei.dbe.timestamp < timestampFirst) { - timestampFirst = m_CIs[i].ei.dbe.timestamp; + if (m_CIs[i].ei.dbe.getUnixtime() < timestampFirst) { + timestampFirst = m_CIs[i].ei.dbe.getUnixtime(); nNext = i; } } @@ -248,7 +248,7 @@ void MirandaContactStrictMerge::fillQueue() iter_each_(std::list, j, m_EIs) { EventInfo& j_ei = *j; - int timestampDelta = j_ei.dbe.timestamp - ci.ei.dbe.timestamp; + int timestampDelta = j_ei.dbe.getUnixtime() - ci.ei.dbe.getUnixtime(); if (timestampDelta > 0) insPos = j; @@ -291,11 +291,11 @@ void MirandaContactNoMerge::fillQueue() while (!m_CIs.empty() && m_EIs.size() < 1) { // find oldest next event in chains int nNext = 0; - uint32_t timestampFirst = m_CIs.front().ei.dbe.timestamp; + uint32_t timestampFirst = m_CIs.front().ei.dbe.getUnixtime(); for (int i = 1; i < m_CIs.size(); ++i) { - if (m_CIs[i].ei.dbe.timestamp < timestampFirst) { - timestampFirst = m_CIs[i].ei.dbe.timestamp; + if (m_CIs[i].ei.dbe.getUnixtime() < timestampFirst) { + timestampFirst = m_CIs[i].ei.dbe.getUnixtime(); nNext = i; } } diff --git a/plugins/HistoryStats/src/statistic.cpp b/plugins/HistoryStats/src/statistic.cpp index 37da089c20..f3cbb0a4d9 100644 --- a/plugins/HistoryStats/src/statistic.cpp +++ b/plugins/HistoryStats/src/statistic.cpp @@ -407,7 +407,7 @@ bool Statistic::stepReadDB() // filter logged status messages from tabSRMM if (dbei.eventType == etMessage) { // convert to local time (everything in this plugin is done in local time) - uint32_t localTimestamp = TimeZone_ToLocal(dbei.timestamp); + uint32_t localTimestamp = TimeZone_ToLocal(dbei.getUnixtime()); if (localTimestamp >= m_TimeMin && localTimestamp <= m_TimeMax) { if (dbei.flags & DBEF_UTF) { diff --git a/plugins/HistorySweeperLight/src/historysweeperlight.cpp b/plugins/HistorySweeperLight/src/historysweeperlight.cpp index 5ed98ea385..e9fedbc0e2 100644 --- a/plugins/HistorySweeperLight/src/historysweeperlight.cpp +++ b/plugins/HistorySweeperLight/src/historysweeperlight.cpp @@ -160,7 +160,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke // should we stop processing? // lPolicy == 1 - for time criterion, lPolicy == 2 - keep N last events, lPolicy == 3 - delete all events - if ((lPolicy == 1 && (unsigned)Criteria.time < dbei.timestamp) || (lPolicy == 2 && Criteria.keep > --eventsCnt)) break; + if ((lPolicy == 1 && (unsigned)Criteria.time < dbei.getUnixtime()) || (lPolicy == 2 && Criteria.keep > --eventsCnt)) break; bool doDelete = true; if (!(dbei.flags & (DBEF_SENT | DBEF_READ)) && keepUnread) @@ -169,7 +169,7 @@ void SweepHistoryFromContact(MCONTACT hContact, CriteriaStruct Criteria, BOOL ke if (bookcnt != 0) { // keep bookmarks ev.hDBEvent = hDBEvent; item = (BEventData*)bsearch(&ev, books, bookcnt, sizeof(BEventData), CompareBookmarks); - if (item != nullptr && item->Timestamp == dbei.timestamp) { + if (item != nullptr && item->Timestamp == dbei.getUnixtime()) { doDelete = FALSE; btshift = (--bookcnt - (item - books)) * sizeof(BEventData); if (btshift) diff --git a/plugins/IEHistory/src/dlgHandlers.cpp b/plugins/IEHistory/src/dlgHandlers.cpp index 967444332f..72c6436484 100644 --- a/plugins/IEHistory/src/dlgHandlers.cpp +++ b/plugins/IEHistory/src/dlgHandlers.cpp @@ -131,7 +131,7 @@ void FillIEViewInfo(IEVIEWEVENTDATA *fillData, DBEVENTINFO dbInfo, uint8_t *blob fillData->szNick.a = ""; fillData->bIsMe = (dbInfo.flags & DBEF_SENT); fillData->dwFlags = (dbInfo.flags & DBEF_SENT) ? IEEDF_SENT : 0; - fillData->time = dbInfo.timestamp; + fillData->time = dbInfo.getUnixtime(); int len = (int)mir_strlen((char *)blob) + 1; uint8_t *pos; diff --git a/plugins/IEHistory/src/utils.cpp b/plugins/IEHistory/src/utils.cpp index 8508918230..8ad76b8a8b 100644 --- a/plugins/IEHistory/src/utils.cpp +++ b/plugins/IEHistory/src/utils.cpp @@ -152,7 +152,7 @@ SearchResult SearchHistory(MCONTACT contact, MEVENT hFirstEvent, void *searchDat { SYSTEMTIME time; TimeSearchData *data = (TimeSearchData *)searchData; - UnixTimeToSystemTime((time_t)dbEvent.timestamp, &time); + UnixTimeToSystemTime(dbEvent.getUnixtime(), &time); found = ((data->flags & TSDF_DATE_SET) || (data->flags & TSDF_TIME_SET)) ? true : false; if (data->flags & TSDF_DATE_SET) found = ((time.wYear == data->time.wYear) && (time.wMonth == data->time.wMonth) && (time.wDay == data->time.wDay)); diff --git a/plugins/IEView/src/HTMLBuilder.cpp b/plugins/IEView/src/HTMLBuilder.cpp index 802998a5cb..30882781f7 100644 --- a/plugins/IEView/src/HTMLBuilder.cpp +++ b/plugins/IEView/src/HTMLBuilder.cpp @@ -214,13 +214,13 @@ void HTMLBuilder::appendEventOld(IEView *view, IEVIEWEVENT *event) IEVIEWEVENTDATA *eventData = new IEVIEWEVENTDATA; eventData->dwFlags = IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK | - (dbei.flags & DBEF_READ ? IEEDF_READ : 0) | (dbei.flags & DBEF_SENT ? IEEDF_SENT : 0) | (dbei.flags & DBEF_RTL ? IEEDF_RTL : 0); + (dbei.bRead ? IEEDF_READ : 0) | (dbei.bSent ? IEEDF_SENT : 0) | (dbei.bRtl ? IEEDF_RTL : 0); if (event->dwFlags & IEEF_RTL) eventData->dwFlags |= IEEDF_RTL; - eventData->time = dbei.timestamp; + eventData->time = dbei.getUnixtime(); eventData->szNick.a = eventData->szText.a = nullptr; - if (dbei.flags & DBEF_SENT) { + if (dbei.bSent) { eventData->szNick.w = getContactName(NULL, szProto); eventData->bIsMe = TRUE; } diff --git a/plugins/Import/src/dbrw/dbevents.cpp b/plugins/Import/src/dbrw/dbevents.cpp index 605dc3683f..86eccc1712 100644 --- a/plugins/Import/src/dbrw/dbevents.cpp +++ b/plugins/Import/src/dbrw/dbevents.cpp @@ -80,7 +80,7 @@ STDMETHODIMP_(BOOL) CDbxSQLite::GetEvent(MEVENT hDbEvent, DBEVENTINFO *dbei) if (sql_step(stmt) == SQLITE_ROW) { const void *blob = sqlite3_column_blob(stmt, 4); - dbei->timestamp = (uint32_t)sqlite3_column_int(stmt, 1); + dbei->iTimestamp = sqlite3_column_int64(stmt, 1); dbei->flags = (uint32_t)sqlite3_column_int(stmt, 2); dbei->eventType = (uint16_t)sqlite3_column_int(stmt, 3); dbei->szModule = mir_strdup((char*)sqlite3_column_text(stmt, 7)); diff --git a/plugins/Import/src/import.cpp b/plugins/Import/src/import.cpp index 82109692f1..3ab25a43f6 100644 --- a/plugins/Import/src/import.cpp +++ b/plugins/Import/src/import.cpp @@ -867,9 +867,7 @@ void CImportBatch::ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int // custom filtering if (!bSkipThis) { - bool bIsSent = (dbei.flags & DBEF_SENT) != 0; - - if (dbei.timestamp < (uint32_t)m_dwSinceDate) + if (dbei.getUnixtime() < (uint32_t)m_dwSinceDate) bSkipThis = true; if (!bSkipThis) { @@ -877,15 +875,15 @@ void CImportBatch::ImportHistory(MCONTACT hContact, PROTOACCOUNT **protocol, int bSkipThis = 1; switch (dbei.eventType) { case EVENTTYPE_MESSAGE: - if ((bIsSent ? IOPT_MSGSENT : IOPT_MSGRECV) & m_iOptions) + if ((dbei.bSent ? IOPT_MSGSENT : IOPT_MSGRECV) & m_iOptions) bSkipThis = false; break; case EVENTTYPE_FILE: - if ((bIsSent ? IOPT_FILESENT : IOPT_FILERECV) & m_iOptions) + if ((dbei.bSent ? IOPT_FILESENT : IOPT_FILERECV) & m_iOptions) bSkipThis = false; break; default: - if ((bIsSent ? IOPT_OTHERSENT : IOPT_OTHERRECV) & m_iOptions) + if ((dbei.bSent ? IOPT_OTHERSENT : IOPT_OTHERRECV) & m_iOptions) bSkipThis = false; break; } diff --git a/plugins/Import/src/mcontacts.cpp b/plugins/Import/src/mcontacts.cpp index 3340b3af77..db0a673f67 100644 --- a/plugins/Import/src/mcontacts.cpp +++ b/plugins/Import/src/mcontacts.cpp @@ -212,7 +212,7 @@ public: dbei->eventType = hdr.eventType; cbLen = hdr.cbBlob; dbei->flags = hdr.flags; - dbei->timestamp = hdr.timestamp; + dbei->iTimestamp = hdr.timestamp; } else if (dwSize == sizeof(MC_MsgHeader64)) { MC_MsgHeader64 hdr; @@ -223,7 +223,7 @@ public: dbei->eventType = hdr.eventType; cbLen = hdr.cbBlob; dbei->flags = hdr.flags; - dbei->timestamp = hdr.timestamp; + dbei->iTimestamp = hdr.timestamp; } else return 1; diff --git a/plugins/Import/src/patterns.cpp b/plugins/Import/src/patterns.cpp index 27d8787088..c64cbad570 100644 --- a/plugins/Import/src/patterns.cpp +++ b/plugins/Import/src/patterns.cpp @@ -564,8 +564,8 @@ public: dbei->flags = DBEF_READ | DBEF_UTF; if (pMsg[0x1A] != 0) dbei->flags |= DBEF_SENT; - dbei->timestamp = RLInteger(&pMsg[0x12]); - dbei->timestamp -= TimeZone_ToLocal(dbei->timestamp) - dbei->timestamp; // deduct time zone offset from timestamp + dbei->iTimestamp = RLInteger(&pMsg[0x12]); + dbei->iTimestamp -= TimeZone_ToLocal(dbei->getUnixtime()) - dbei->getUnixtime(); // deduct time zone offset from timestamp dbei->cbBlob = RLWord(&pMsg[m_iMsgHeaderSize - 2]); dbei->pBlob = (char *)mir_alloc(dbei->cbBlob + 1); memcpy(dbei->pBlob, pMsg + m_iMsgHeaderSize, dbei->cbBlob); @@ -631,7 +631,7 @@ public: st.tm_hour = str2int(substrings[pPattern->iHours]); st.tm_min = str2int(substrings[pPattern->iMinutes]); st.tm_sec = (pPattern->iSeconds) ? str2int(substrings[pPattern->iSeconds]) : 0; - dbei->timestamp = mktime(&st); + dbei->iTimestamp = mktime(&st); if (pPattern->iDirection) if (pPattern->wszOutgoing == substrings[pPattern->iDirection]) diff --git a/plugins/Import/src/textjson.cpp b/plugins/Import/src/textjson.cpp index 3cfa254c8f..c78e031099 100644 --- a/plugins/Import/src/textjson.cpp +++ b/plugins/Import/src/textjson.cpp @@ -112,7 +112,7 @@ public: auto &node = *pNode; dbei->eventType = node["type"].as_int(); - dbei->timestamp = 0; + dbei->iTimestamp = 0; std::string szTime = node["time"].as_string(); if (!szTime.empty()) { char c; @@ -123,7 +123,7 @@ public: st.tm_year -= 1900; time_t tm = mktime(&st); if (tm != -1) - dbei->timestamp = tm; + dbei->iTimestamp = tm; } } else { @@ -136,13 +136,13 @@ public: st.tm_year -= 1900; time_t tm = _mkgmtime(&st); if (tm != -1) - dbei->timestamp = tm; + dbei->iTimestamp = tm; } } } - if (dbei->timestamp == 0) - dbei->timestamp = node["timeStamp"].as_int(); + if (dbei->iTimestamp == 0) + dbei->iTimestamp = node["timeStamp"].as_int(); dbei->flags = 0; std::string szFlags = node["flags"].as_string(); @@ -343,16 +343,16 @@ public: if (mir_strcmp(dbei.szModule, szProto)) pRoot.push_back(JSONNode("module", dbei.szModule)); - pRoot.push_back(JSONNode("timestamp", dbei.timestamp)); + pRoot.push_back(JSONNode("timestamp", dbei.getUnixtime())); wchar_t szTemp[500]; - TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, dbei.timestamp, L"I", szTemp, _countof(szTemp), 0); + TimeZone_PrintTimeStamp(UTC_TIME_HANDLE, dbei.getUnixtime(), L"I", szTemp, _countof(szTemp), 0); pRoot.push_back(JSONNode("isotime", T2Utf(szTemp).get())); std::string flags; - if (dbei.flags & DBEF_SENT) + if (dbei.bSent) flags += "m"; - if (dbei.flags & DBEF_READ) + if (dbei.bRead) flags += "r"; pRoot.push_back(JSONNode("flags", flags)); diff --git a/plugins/Jingle/src/account.cpp b/plugins/Jingle/src/account.cpp index 2e92e967bf..7a3ac68481 100644 --- a/plugins/Jingle/src/account.cpp +++ b/plugins/Jingle/src/account.cpp @@ -130,7 +130,7 @@ static BOOL OnProcessJingle(struct IJabberInterface *api, const TiXmlElement *no // Save this event to history DB::EventInfo dbei; - dbei.timestamp = (uint32_t)time(0); + dbei.iTimestamp = (uint32_t)time(0); dbei.pBlob = "** A call while we were busy **"; ProtoChainRecvMsg(api->ContactFromJID(from), dbei); reason = "busy"; diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index f4c1ac3e61..ff8cf7c196 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -334,7 +334,7 @@ BOOL checkMsgTimestamp(MCONTACT hContact, MEVENT hEventCurrent, uint32_t timesta for (MEVENT hEvent = db_event_prev(hContact, hEventCurrent); hEvent; hEvent = db_event_prev(hContact, hEvent)) { DBEVENTINFO einfo = {}; if (!db_event_get(hEvent, &einfo)) { - if ((einfo.timestamp + wSecondsOlder) <= timestampCurrent) + if ((einfo.getUnixtime() + wSecondsOlder) <= timestampCurrent) return TRUE; if (einfo.eventType == EVENTTYPE_MESSAGE) return FALSE; @@ -396,7 +396,7 @@ static int PluginMessageEventHook(WPARAM hContact, LPARAM hEvent) //get DBEVENTINFO without pBlob DBEVENTINFO einfo = {}; if (!db_event_get(hEvent, &einfo) && !(einfo.flags & DBEF_SENT)) - if ((einfo.eventType == EVENTTYPE_MESSAGE && bFlashOnMsg && checkOpenWindow(hContact) && checkMsgTimestamp(hContact, hEvent, einfo.timestamp)) || + if ((einfo.eventType == EVENTTYPE_MESSAGE && bFlashOnMsg && checkOpenWindow(hContact) && checkMsgTimestamp(hContact, hEvent, einfo.getUnixtime())) || (einfo.eventType == EVENTTYPE_FILE && bFlashOnFile) || (einfo.eventType != EVENTTYPE_MESSAGE && einfo.eventType != EVENTTYPE_FILE && bFlashOnOther)) { diff --git a/plugins/MessageState/src/messagestate.cpp b/plugins/MessageState/src/messagestate.cpp index 2dbe670043..40d1d867ad 100644 --- a/plugins/MessageState/src/messagestate.cpp +++ b/plugins/MessageState/src/messagestate.cpp @@ -86,7 +86,7 @@ static int OnEventDelivered(WPARAM hContact, LPARAM) static int OnEventFilterAdd(WPARAM hContact, LPARAM lParam) { DBEVENTINFO *dbei = (DBEVENTINFO *)lParam; - if ((dbei->flags & DBEF_SENT) && CheckProtoSupport(dbei->szModule)) { + if (dbei->bSent && CheckProtoSupport(dbei->szModule)) { time_t dwTime = time(0); FindContact(hContact)->setSent(dwTime); if (db_mc_isSub(hContact)) diff --git a/plugins/MirFox/src/MirandaUtils.cpp b/plugins/MirFox/src/MirandaUtils.cpp index 83db70a709..12ae993190 100644 --- a/plugins/MirFox/src/MirandaUtils.cpp +++ b/plugins/MirFox/src/MirandaUtils.cpp @@ -295,7 +295,7 @@ void MirandaUtils::addMessageToDB(MCONTACT hContact, char* msgBuffer, std::size_ dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = targetHandleSzProto; - dbei.timestamp = (uint32_t)time(0); + dbei.iTimestamp = (uint32_t)time(0); dbei.cbBlob = (uint32_t)bufSize; dbei.pBlob = msgBuffer; db_event_add(hContact, &dbei); diff --git a/plugins/MirLua/src/Modules/m_database.cpp b/plugins/MirLua/src/Modules/m_database.cpp index e3f4922643..a7e8f43960 100644 --- a/plugins/MirLua/src/Modules/m_database.cpp +++ b/plugins/MirLua/src/Modules/m_database.cpp @@ -294,7 +294,7 @@ void MakeDbEvent(lua_State *L, DBEVENTINFO &dbei) lua_pop(L, 1); lua_getfield(L, -1, "Timestamp"); - dbei.timestamp = lua_tonumber(L, -1); + dbei.iTimestamp = lua_tonumber(L, -1); lua_pop(L, 1); lua_getfield(L, -1, "Flags"); @@ -692,7 +692,7 @@ LUAMOD_API int luaopen_m_database(lua_State *L) MT(L, MT_DBEVENTINFO) .Field(&DBEVENTINFO::szModule, "Module", LUA_TSTRINGA) - .Field(&DBEVENTINFO::timestamp, "Timestamp", LUA_TINTEGER) + .Field(&DBEVENTINFO::iTimestamp, "Timestamp", LUA_TINTEGER) .Field(&DBEVENTINFO::eventType, "Type", LUA_TINTEGER) .Field(&DBEVENTINFO::flags, "Flags", LUA_TINTEGER); diff --git a/plugins/MirLua/src/Modules/m_message.cpp b/plugins/MirLua/src/Modules/m_message.cpp index 1425771a14..be10f333ab 100644 --- a/plugins/MirLua/src/Modules/m_message.cpp +++ b/plugins/MirLua/src/Modules/m_message.cpp @@ -36,7 +36,7 @@ static int message_Send(lua_State *L) else if ((res = ProtoChainSend(hContact, PSS_MESSAGE, 0, (LPARAM)message)) != ACKRESULT_FAILED) { DBEVENTINFO dbei = {}; dbei.szModule = MODULENAME; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.eventType = EVENTTYPE_MESSAGE; dbei.cbBlob = (uint32_t)mir_strlen(message); dbei.pBlob = mir_strdup(message); diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp index af6c8eb928..fd118f41d6 100644 --- a/plugins/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/src/utils.cpp @@ -216,7 +216,7 @@ void ShowMessageInline(const MCONTACT hContact, const wchar_t *msg) T2Utf utf(buff); DB::EventInfo dbei; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.pBlob = utf; dbei.flags = PREF_BYPASS_OTR; ProtoChainRecvMsg(hContact, dbei); @@ -228,7 +228,7 @@ void ShowMessageInlineUtf(const MCONTACT hContact, const char *msg) mir_snprintf(buff, "%s%s", LANG_INLINE_PREFIX, msg); DB::EventInfo dbei; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.pBlob = buff; dbei.flags = PREF_BYPASS_OTR; ProtoChainRecvMsg(hContact, dbei); diff --git a/plugins/MirandaG15/src/CAppletManager.cpp b/plugins/MirandaG15/src/CAppletManager.cpp index 3ef8bca1c4..4ecd78fe06 100644 --- a/plugins/MirandaG15/src/CAppletManager.cpp +++ b/plugins/MirandaG15/src/CAppletManager.cpp @@ -649,7 +649,7 @@ void CAppletManager::FinishMessageJob(SMessageJob *pJob) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = szProto; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); // Check if protocoll is valid if (dbei.szModule == nullptr) return; @@ -795,7 +795,7 @@ bool CAppletManager::TranslateDBEvent(CEvent *pEvent, WPARAM hContact, LPARAM hd pEvent->hContact = hContact; pEvent->hValue = hdbevent; - time_t timestamp = (time_t)dbei.timestamp; + time_t timestamp = (time_t)dbei.getUnixtime(); localtime_s(&pEvent->Time, ×tamp); pEvent->bTime = true; diff --git a/plugins/Msg_Export/src/export.cpp b/plugins/Msg_Export/src/export.cpp index ff38216e11..d62e537175 100644 --- a/plugins/Msg_Export/src/export.cpp +++ b/plugins/Msg_Export/src/export.cpp @@ -308,10 +308,10 @@ static bool ExportDBEventInfo(MCONTACT hContact, HANDLE hFile, const wstring &sF // Get time stamp CMStringW output; - output.AppendFormat(L"%-*s", (int)nFirstColumnWidth, dbei.flags & DBEF_SENT ? sLocalUser.c_str() : sRemoteUser.c_str()); + output.AppendFormat(L"%-*s", (int)nFirstColumnWidth, dbei.bSent ? sLocalUser.c_str() : sRemoteUser.c_str()); { wchar_t buf[100]; - TimeZone_ToStringW(dbei.timestamp, g_sTimeFormat.c_str(), buf, _countof(buf)); + TimeZone_ToStringW(dbei.getUnixtime(), g_sTimeFormat.c_str(), buf, _countof(buf)); output.Append(buf); } diff --git a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp index 8262b848bc..11809f5d3c 100644 --- a/plugins/NewAwaySysMod/src/MsgEventAdded.cpp +++ b/plugins/NewAwaySysMod/src/MsgEventAdded.cpp @@ -70,7 +70,7 @@ void __cdecl AutoreplyDelayThread(CAutoreplyData *ad) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = szProto; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.cbBlob = ReplyLen; dbei.pBlob = pszReply; db_event_add(ad->hContact, &dbei); @@ -112,7 +112,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) if (dbei->flags & DBEF_SENT || (dbei->eventType != EVENTTYPE_MESSAGE && dbei->eventType != EVENTTYPE_FILE)) return 0; - if (time(0) - dbei->timestamp > MAX_REPLY_TIMEDIFF) // don't reply to offline messages + if (time(0) - dbei->getUnixtime() > MAX_REPLY_TIMEDIFF) // don't reply to offline messages return 0; char *szProto = Proto_GetBaseAccountName(hContact); @@ -139,7 +139,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) // we compare only event timestamps, and do not look at the message itself. it's unlikely that there'll be two events from a contact at the same second, so it's a trade-off between speed and reliability for (i = MetacontactEvents.GetSize() - 1; i >= 0; i--) { - if (MetacontactEvents[i].timestamp == dbei->timestamp && MetacontactEvents[i].hMetaContact == hMetaContact) { + if (MetacontactEvents[i].timestamp == dbei->getUnixtime() && MetacontactEvents[i].hMetaContact == hMetaContact) { bMsgWindowIsOpen = MetacontactEvents[i].bMsgWindowIsOpen; break; } @@ -159,7 +159,7 @@ int MsgEventAdded(WPARAM hContact, LPARAM lParam) MetacontactEvents.RemoveElem(i); // add the new event and wait for a subcontact's event - MetacontactEvents.AddElem(CMetacontactEvent(hContact, dbei->timestamp, IsSRMsgWindowOpen(hContact))); + MetacontactEvents.AddElem(CMetacontactEvent(hContact, dbei->getUnixtime(), IsSRMsgWindowOpen(hContact))); return 0; } diff --git a/plugins/NewEventNotify/src/main.cpp b/plugins/NewEventNotify/src/main.cpp index ad633f4da5..5333916d84 100644 --- a/plugins/NewEventNotify/src/main.cpp +++ b/plugins/NewEventNotify/src/main.cpp @@ -80,11 +80,11 @@ int HookedNewEvent(WPARAM hContact, LPARAM hDbEvent) return 0; // if event was allready read don't show it - if (g_plugin.bReadCheck && (dbei.flags & DBEF_READ)) + if (g_plugin.bReadCheck && dbei.bRead) return 0; // is it an event sent by the user? -> don't show - if (dbei.flags & DBEF_SENT) { + if (dbei.bSent) { // JK, only message event, do not influence others auto *pdata = PU_GetByContact(hContact, dbei.eventType); if (g_plugin.bHideSend && pdata) diff --git a/plugins/NewEventNotify/src/popup.cpp b/plugins/NewEventNotify/src/popup.cpp index a33b7f5f4c..dc8e7d0502 100644 --- a/plugins/NewEventNotify/src/popup.cpp +++ b/plugins/NewEventNotify/src/popup.cpp @@ -444,7 +444,7 @@ int PopupUpdate(PLUGIN_DATA &pdata, MEVENT hEvent) wszFormat.Append(L"%H:%M"); if (!wszFormat.IsEmpty()) { wchar_t timestamp[MAX_DATASIZE]; - time_t localTime = dbe.timestamp; + time_t localTime = dbe.getUnixtime(); wcsftime(timestamp, _countof(timestamp), wszFormat, localtime(&localTime)); wszText.AppendFormat(L"[b][i]%s[/i][/b]\n", timestamp); } diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp index 3e979fec62..d10a6218f0 100644 --- a/plugins/NewStory/src/history_array.cpp +++ b/plugins/NewStory/src/history_array.cpp @@ -25,7 +25,7 @@ bool Filter::check(ItemData *item) const { if (!item) return false; if (!(flags & EVENTONLY)) { - if (item->dbe.flags & DBEF_SENT) { + if (item->dbe.bSent) { if (!(flags & OUTGOING)) return false; } @@ -92,9 +92,9 @@ static bool isEqual(const ItemData *p1, const ItemData *p2) return false; if (p1->dbe.eventType != p2->dbe.eventType) return false; - if ((p1->dbe.flags & DBEF_SENT) != (p2->dbe.flags & DBEF_SENT)) + if (p1->dbe.bSent != p2->dbe.bSent) return false; - if (p1->dbe.timestamp / 86400 != p2->dbe.timestamp / 86400) + if (p1->dbe.getUnixtime() / 86400 != p2->dbe.getUnixtime() / 86400) return false; return true; } @@ -165,7 +165,7 @@ static bool isEqualGC(const ItemData *p1, const ItemData *p2) if (wcscmp(p1->wszNick, p2->wszNick)) return false; - if (p1->dbe.timestamp / 86400 != p2->dbe.timestamp / 86400) + if (p1->dbe.getUnixtime() / 86400 != p2->dbe.getUnixtime() / 86400) return false; return true; } @@ -316,13 +316,13 @@ void ItemData::getFontColor(int &fontId, int &colorId) const { switch (dbe.eventType) { case EVENTTYPE_MESSAGE: - fontId = !(dbe.flags & DBEF_SENT) ? FONT_INMSG : FONT_OUTMSG; - colorId = !(dbe.flags & DBEF_SENT) ? COLOR_INMSG : COLOR_OUTMSG; + fontId = !dbe.bSent ? FONT_INMSG : FONT_OUTMSG; + colorId = !dbe.bSent ? COLOR_INMSG : COLOR_OUTMSG; break; case EVENTTYPE_FILE: - fontId = !(dbe.flags & DBEF_SENT) ? FONT_INFILE : FONT_OUTFILE; - colorId = !(dbe.flags & DBEF_SENT) ? COLOR_INFILE : COLOR_OUTFILE; + fontId = !dbe.bSent ? FONT_INFILE : FONT_OUTFILE; + colorId = !dbe.bSent ? COLOR_INFILE : COLOR_OUTFILE; break; case EVENTTYPE_STATUSCHANGE: @@ -341,13 +341,13 @@ void ItemData::getFontColor(int &fontId, int &colorId) const break; case EVENTTYPE_JABBER_PRESENCE: - fontId = !(dbe.flags & DBEF_SENT) ? FONT_INOTHER : FONT_OUTOTHER; - colorId = !(dbe.flags & DBEF_SENT) ? COLOR_INOTHER : COLOR_OUTOTHER; + fontId = !dbe.bSent ? FONT_INOTHER : FONT_OUTOTHER; + colorId = !dbe.bSent ? COLOR_INOTHER : COLOR_OUTOTHER; break; default: - fontId = !(dbe.flags & DBEF_SENT) ? FONT_INOTHER : FONT_OUTOTHER; - colorId = !(dbe.flags & DBEF_SENT) ? COLOR_INOTHER : COLOR_OUTOTHER; + fontId = !dbe.bSent ? FONT_INOTHER : FONT_OUTOTHER; + colorId = !dbe.bSent ? COLOR_INOTHER : COLOR_OUTOTHER; break; } } @@ -444,11 +444,11 @@ void ItemData::load(bool bLoadAlways) CMStringW str, wszNick; wchar_t wszTime[100]; - TimeZone_PrintTimeStamp(0, dbei.timestamp, L"D t", wszTime, _countof(wszTime), 0); + TimeZone_PrintTimeStamp(0, dbei.getUnixtime(), L"D t", wszTime, _countof(wszTime), 0); if (Contact::IsGroupChat(dbe.hContact) && dbei.szUserId) wszNick = Utf2T(dbei.szUserId); - else if (dbei.flags & DBEF_SENT) { + else if (dbei.bSent) { if (char *szProto = Proto_GetBaseAccountName(dbe.hContact)) wszNick = ptrW(Contact::GetInfo(CNF_DISPLAY, 0, szProto)); else @@ -523,7 +523,7 @@ void HistoryArray::addChatEvent(NewstoryListData *pOwner, SESSION_INFO *si, cons p.wtext = wszText.Detach(); p.m_bLoaded = true; p.m_bHighlighted = lin->bIsHighlighted; - p.dbe.timestamp = lin->time; + p.dbe.iTimestamp = lin->time; if (lin->bIsMe) p.dbe.flags |= DBEF_SENT; diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index d651658e94..ac0753693d 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -267,7 +267,7 @@ void NewstoryListData::BeginEditItem() mir_subclassWindow(hwndEditBox, HistoryEditWndProc); SendMessage(hwndEditBox, WM_SETFONT, (WPARAM)g_fontTable[fontid].hfnt, 0); SendMessage(hwndEditBox, EM_SETMARGINS, EC_RIGHTMARGIN, 100); - if (item->dbe.eventType != EVENTTYPE_MESSAGE || !(item->dbe.flags & DBEF_SENT)) + if (item->dbe.eventType != EVENTTYPE_MESSAGE || !item->dbe.bSent) SendMessage(hwndEditBox, EM_SETREADONLY, TRUE, 0); ShowWindow(hwndEditBox, SW_SHOW); @@ -408,7 +408,7 @@ void NewstoryListData::DeleteItems(void) for (int i = totalCount - 1; i >= 0; i--) { auto *pItem = GetItem(i); if (pItem->m_bSelected) { - if ((pItem->dbe.flags & DBEF_SENT) == 0) + if (!pItem->dbe.bSent) bIncoming = true; nSelected++; } @@ -459,7 +459,7 @@ void NewstoryListData::DeliverEvent(MCONTACT hContact, MEVENT hEvent) for (int i = totalCount - 1; i >= 0; i--) { auto *pItem = GetItem(i); - if (pItem->dbe.hContact != hContact || !(pItem->dbe.flags & DBEF_SENT)) + if (pItem->dbe.hContact != hContact || !pItem->dbe.bSent) continue; if (pItem->dbe.getEvent() == hEvent) @@ -822,7 +822,7 @@ void NewstoryListData::Paint(simpledib::dib &dib) // Direction icon if (g_plugin.bShowDirection) { - if (pItem->dbe.flags & DBEF_SENT) + if (pItem->dbe.bSent) hIcon = g_plugin.getIcon(IDI_MSGOUT); else hIcon = g_plugin.getIcon(IDI_MSGIN); @@ -964,7 +964,7 @@ void NewstoryListData::RemoteRead(MCONTACT hContact, MEVENT hEvent) if (!pItem->m_bLoaded) pItem->fetch(); - if (pItem->dbe.hContact != hContact || !(pItem->dbe.flags & DBEF_SENT)) + if (pItem->dbe.hContact != hContact || !pItem->dbe.bSent) continue; if (pItem->dbe.getEvent() == hEvent) @@ -1115,7 +1115,7 @@ void NewstoryListData::TryUp(int iCount) for (int j = 0; j < i + 1; j++) if (auto *pItem = GetItem(j)) { pItem->fetch(); - if (pItem->dbe.flags & DBEF_SENT) + if (pItem->dbe.bSent) pItem->m_bRemoteRead = hasRead; pPrev = pItem->checkNext(pPrev); } @@ -1310,7 +1310,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM int eventCount = data->totalCount; for (int i = 0; i < eventCount; i++) { auto *p = data->GetItem(i); - if (p->dbe.timestamp >= wParam) { + if (p->dbe.getUnixtime() >= wParam) { data->SetSelection(i, i); data->SetCaret(i); break; diff --git a/plugins/NewStory/src/history_dlg.cpp b/plugins/NewStory/src/history_dlg.cpp index 3520e117c6..487d9f07d2 100644 --- a/plugins/NewStory/src/history_dlg.cpp +++ b/plugins/NewStory/src/history_dlg.cpp @@ -165,7 +165,7 @@ class CHistoryDlg : public CDlgBase CharLowerW(pwszText); if (wcsstr(pwszText, pwszPattern)) - m_arResults.insert(new SearchResult(hContact, hDbEvent, dbei.timestamp)); + m_arResults.insert(new SearchResult(hContact, hDbEvent, dbei.getUnixtime())); } } @@ -302,11 +302,11 @@ class CHistoryDlg : public CDlgBase if (!pItem->fetch()) continue; - if (pItem->dbe.timestamp == 0) + if (pItem->dbe.iTimestamp == 0) continue; struct tm ts = { 0 }; - time_t timestamp = pItem->dbe.timestamp; + time_t timestamp = pItem->dbe.getUnixtime(); errno_t err = localtime_s(&ts, ×tamp); /* statically alloced, local time correction */ if (err != 0) return; @@ -1157,7 +1157,7 @@ public: case UM_LOCATETIME: if (m_dwOptions & WND_OPT_TIMETREE) if (auto *pItem = m_histCtrl->GetItem(wParam)) - LocateDateTime(pItem->dbe.timestamp); + LocateDateTime(pItem->dbe.getUnixtime()); break; case UM_UPDATE_WINDOW: diff --git a/plugins/NewStory/src/history_menus.cpp b/plugins/NewStory/src/history_menus.cpp index 46de0469d4..c7eba2135b 100644 --- a/plugins/NewStory/src/history_menus.cpp +++ b/plugins/NewStory/src/history_menus.cpp @@ -61,7 +61,7 @@ HMENU NSMenu_Build(NewstoryListData *data, ItemData *item) else if (mir_strlen(item->getUrl())) Menu_ShowItem(hmiCopyUrl, true); - bEditable = (item->dbe.flags & DBEF_SENT) != 0; + bEditable = item->dbe.bSent; bShowEventActions = item->dbe.getEvent() != 0; DB::EventInfo dbei(item->dbe.getEvent()); diff --git a/plugins/NewStory/src/options.cpp b/plugins/NewStory/src/options.cpp index ba682a6b76..5c2b4c1238 100644 --- a/plugins/NewStory/src/options.cpp +++ b/plugins/NewStory/src/options.cpp @@ -148,7 +148,7 @@ public: m_tempItem->dbe.flags = DBEF_TEMPORARY | DBEF_BOOKMARK; m_tempItem->dbe.szModule = MODULENAME; m_tempItem->dbe.eventType = EVENTTYPE_MESSAGE; - m_tempItem->dbe.timestamp = time(0); + m_tempItem->dbe.iTimestamp = time(0); m_histCtrl->totalCount++; HTREEITEM hGroup = 0, hFirst = 0; diff --git a/plugins/NewStory/src/templates.cpp b/plugins/NewStory/src/templates.cpp index f6b27fcf77..fc7d59f3f0 100644 --- a/plugins/NewStory/src/templates.cpp +++ b/plugins/NewStory/src/templates.cpp @@ -236,7 +236,7 @@ CMStringW ItemData::formatHtml(const wchar_t *pwszStr) wchar_t szFont[100]; str.AppendFormat(L"body {margin: 0px; text-align: left; %s; color: NSText; overflow: auto;}\n", font2html(F.lf, szFont)); - str.AppendFormat(L".nick {color: #%06X }\n", color2html(g_colorTable[(dbe.flags & DBEF_SENT) ? COLOR_OUTNICK : COLOR_INNICK].cl)); + str.AppendFormat(L".nick {color: #%06X }\n", color2html(g_colorTable[dbe.bSent ? COLOR_OUTNICK : COLOR_INNICK].cl)); str.AppendFormat(L".link {color: #%06X }\n", color2html(g_colorTable[COLOR_LINK].cl)); str.AppendFormat(L".quote {border-left: 4px solid #%06X; padding-left: 8px; }\n", color2html(g_colorTable[COLOR_QUOTE].cl)); @@ -409,7 +409,7 @@ CMStringA NewstoryListData::GatherSelectedRtf() buf.AppendFormat("{\\uc1\\pard \\cb%d\\cf%d\\f%d\\b0\\i0\\fs%d ", COLOR_BACK + 7, colorID+COLOR_COUNT+7, fontID, GetFontHeight(g_fontTable[fontID].lf)); CMStringW wszText(p->formatString()); wszText.Replace(L"[c0]", CMStringW(FORMAT, L"[c%d]", colorID + COLOR_COUNT + 7)); - wszText.Replace(L"[c1]", CMStringW(FORMAT, L"[c%d]", 7 + ((p->dbe.flags & DBEF_SENT) ? COLOR_OUTNICK : COLOR_INNICK))); + wszText.Replace(L"[c1]", CMStringW(FORMAT, L"[c%d]", 7 + (p->dbe.bSent ? COLOR_OUTNICK : COLOR_INNICK))); AppendUnicodeToBuffer(buf, wszText); buf.Append("\\par }"); } @@ -540,7 +540,7 @@ void vfEvent(TemplateVars *vars, MCONTACT, ItemData *pItem) wchar_t buf[100]; // %N: Nickname - if (!pItem->m_bIsResult && (pItem->dbe.flags & DBEF_SENT)) { + if (!pItem->m_bIsResult && pItem->dbe.bSent) { if (!pItem->wszNick) { char *proto = Proto_GetBaseAccountName(pItem->dbe.hContact); ptrW nick(Contact::GetInfo(CNF_DISPLAY, 0, proto)); @@ -554,14 +554,14 @@ void vfEvent(TemplateVars *vars, MCONTACT, ItemData *pItem) } // %D: direction symbol - if (pItem->dbe.flags & DBEF_SENT) + if (pItem->dbe.bSent) vars->SetVar('D', L"<<", false); else vars->SetVar('D', L">>", false); // %t: timestamp SYSTEMTIME st; - if (!TimeZone_GetSystemTime(nullptr, pItem->dbe.timestamp, &st, 0)) { + if (!TimeZone_GetSystemTime(nullptr, pItem->dbe.getUnixtime(), &st, 0)) { int iLocale = Langpack_GetDefaultLocale(); GetDateFormatW(iLocale, 0, &st, L"dd.MM.yyyy, ", buf, _countof(buf)); diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 5b947b20a8..43dc3e60cd 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -275,7 +275,7 @@ void LogSMsgToDB(STATUSMSGINFO *smi, const wchar_t *tmplt) dbei.pBlob = blob; dbei.eventType = EVENTTYPE_STATUSCHANGE; dbei.flags = DBEF_READ | DBEF_UTF; - dbei.timestamp = (uint32_t)time(0); + dbei.iTimestamp = (uint32_t)time(0); dbei.szModule = MODULENAME; MEVENT hDBEvent = db_event_add(smi->hContact, &dbei); @@ -358,7 +358,7 @@ int ContactStatusChanged(MCONTACT hContact, uint16_t oldStatus, uint16_t newStat dbei.pBlob = blob; dbei.eventType = EVENTTYPE_STATUSCHANGE; dbei.flags = DBEF_READ | DBEF_UTF; - dbei.timestamp = (uint32_t)time(0); + dbei.iTimestamp = (uint32_t)time(0); dbei.szModule = MODULENAME; MEVENT hDBEvent = db_event_add(hContact, &dbei); diff --git a/plugins/NewXstatusNotify/src/xstatus.cpp b/plugins/NewXstatusNotify/src/xstatus.cpp index 8000ad64fe..f5e5e97b86 100644 --- a/plugins/NewXstatusNotify/src/xstatus.cpp +++ b/plugins/NewXstatusNotify/src/xstatus.cpp @@ -283,7 +283,7 @@ void LogChangeToDB(XSTATUSCHANGE *xsc) dbei.pBlob = blob; dbei.eventType = EVENTTYPE_STATUSCHANGE; dbei.flags = DBEF_READ | DBEF_UTF; - dbei.timestamp = (uint32_t)time(0); + dbei.iTimestamp = (uint32_t)time(0); dbei.szModule = MODULENAME; MEVENT hDBEvent = db_event_add(xsc->hContact, &dbei); diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index 498aac0b95..3fad7df8d1 100644 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -497,7 +497,7 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) if (!strstr(msg, "-----BEGIN PGP MESSAGE-----")) return Proto_ChainRecv(w, ccs); - mir_forkThread(RecvMsgSvc_func, new RecvParams(ccs->hContact, str, msg, dbei->timestamp)); + mir_forkThread(RecvMsgSvc_func, new RecvParams(ccs->hContact, str, msg, dbei->getUnixtime())); return 0; } diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index b38019b1b3..60c7139104 100644 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -474,7 +474,7 @@ void HistoryLog(MCONTACT hContact, const char *msg, uint32_t _time, uint32_t fla DBEVENTINFO dbei = {}; dbei.szModule = MODULENAME; dbei.flags = DBEF_UTF | flags; - dbei.timestamp = (_time) ? _time : (uint32_t)time(0); + dbei.iTimestamp = (_time) ? _time : (uint32_t)time(0); dbei.cbBlob = (uint32_t)mir_strlen(msg) + 1; dbei.pBlob = (char *)msg; db_event_add(hContact, &dbei); diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index 3ca4812eaf..f2cdd3aafc 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -285,7 +285,7 @@ void Nudge_SentStatus(CNudgeElement *n, MCONTACT hContact) DBEVENTINFO dbei = {}; dbei.szModule = MODULENAME; dbei.flags = DBEF_SENT | DBEF_UTF; - dbei.timestamp = (uint32_t)time(0); + dbei.iTimestamp = (uint32_t)time(0); dbei.eventType = 1; dbei.cbBlob = (uint32_t)mir_strlen(buff) + 1; dbei.pBlob = buff; @@ -300,7 +300,7 @@ void Nudge_ShowStatus(CNudgeElement *n, MCONTACT hContact, uint32_t timestamp) dbei.szModule = MODULENAME; dbei.eventType = 1; dbei.flags = DBEF_UTF; - dbei.timestamp = timestamp; + dbei.iTimestamp = timestamp; dbei.cbBlob = (uint32_t)mir_strlen(buff) + 1; dbei.pBlob = buff; db_event_add(hContact, &dbei); diff --git a/plugins/PasteIt/src/PasteIt.cpp b/plugins/PasteIt/src/PasteIt.cpp index 2ae89ff3f9..2b398222ec 100644 --- a/plugins/PasteIt/src/PasteIt.cpp +++ b/plugins/PasteIt/src/PasteIt.cpp @@ -116,7 +116,7 @@ static void PasteIt(MCONTACT hContact, int mode) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT; dbei.szModule = szProto; - dbei.timestamp = (uint32_t)time(0); + dbei.iTimestamp = (uint32_t)time(0); dbei.cbBlob = (uint32_t)mir_strlen(pasteToWeb->szFileLink) + 1; dbei.pBlob = pasteToWeb->szFileLink; db_event_add(hContact, &dbei); diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index e02ab97999..3511e67e2f 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -796,7 +796,7 @@ void AddMessageToDB(MCONTACT hContact, char *msg) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = Proto_GetBaseAccountName(hContact); - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.cbBlob = (int)mir_strlen(msg) + 1; dbei.pBlob = msg; db_event_add(hContact, &dbei); diff --git a/plugins/QuickSearch/src/window_row.cpp b/plugins/QuickSearch/src/window_row.cpp index d5fac4247b..1745495d51 100644 --- a/plugins/QuickSearch/src/window_row.cpp +++ b/plugins/QuickSearch/src/window_row.cpp @@ -156,7 +156,7 @@ void CRowItem::Val::LoadOneItem(MCONTACT hContact, const ColumnItem &pCol, QSMai if (MEVENT hDbEvent = db_event_last(hContact)) { DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); - data = dbei.timestamp; + data = dbei.getUnixtime(); text = TimeToStrW(data); } else text = 0; diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index 656434f9c2..80004c646d 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -386,8 +386,8 @@ INT_PTR OnMenuCommandShowList(WPARAM, LPARAM) break; } if (curEvent != NULL) - if (curTime == -1 || (__time64_t)dbe.timestamp > curTime) - curTime = (__time64_t)dbe.timestamp; + if (curTime == -1 || (__time64_t)dbe.getUnixtime() > curTime) + curTime = (__time64_t)dbe.getUnixtime(); } if (curTime != -1) 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; diff --git a/plugins/SecureIM/src/dbevent.cpp b/plugins/SecureIM/src/dbevent.cpp index 66921acadc..8e6bce3f02 100644 --- a/plugins/SecureIM/src/dbevent.cpp +++ b/plugins/SecureIM/src/dbevent.cpp @@ -5,7 +5,7 @@ void HistoryLog(MCONTACT hContact, LPCSTR szText) DBEVENTINFO dbei = {}; dbei.szModule = Proto_GetBaseAccountName(hContact); dbei.flags = DBEF_SENT | DBEF_READ; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.eventType = EVENTTYPE_MESSAGE; dbei.cbBlob = (int)mir_strlen(szText) + 1; dbei.pBlob = (char *)szText; diff --git a/plugins/SendScreenshotPlus/src/CSend.cpp b/plugins/SendScreenshotPlus/src/CSend.cpp index 623d7348ae..c18b247f92 100644 --- a/plugins/SendScreenshotPlus/src/CSend.cpp +++ b/plugins/SendScreenshotPlus/src/CSend.cpp @@ -323,7 +323,7 @@ void CSend::DB_EventAdd(uint16_t EventType) dbei.szModule = m_pszProto; dbei.eventType = EventType; dbei.flags = DBEF_SENT; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.flags |= DBEF_UTF; dbei.cbBlob = m_cbEventMsg; dbei.pBlob = m_szEventMsg.GetBuffer(); diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index 450ed5dfdd..c50fd5dc38 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -207,7 +207,7 @@ INT addEvent(WPARAM hContact, LPARAM hDBEvent) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_UTF | DBEF_SENT; dbei.szModule = pszProto; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.cbBlob = (int)mir_strlen(pszUtf) + 1; dbei.pBlob = pszUtf; db_event_add(hContact, &dbei); diff --git a/plugins/StopSpamMod/src/utilities.cpp b/plugins/StopSpamMod/src/utilities.cpp index 95581f9b47..7de5e6b749 100644 --- a/plugins/StopSpamMod/src/utilities.cpp +++ b/plugins/StopSpamMod/src/utilities.cpp @@ -260,7 +260,7 @@ void HistoryLog(MCONTACT hContact, char *data, int event_type, int flags) Event.szModule = MODULENAME; Event.eventType = event_type; Event.flags = flags | DBEF_UTF; - Event.timestamp = (uint32_t)time(0); + Event.iTimestamp = (uint32_t)time(0); Event.cbBlob = (uint32_t)mir_strlen(data) + 1; Event.pBlob = _strdup(data); db_event_add(hContact, &Event); diff --git a/plugins/StopSpamPlus/src/events.cpp b/plugins/StopSpamPlus/src/events.cpp index 57fe106521..067be9ac76 100644 --- a/plugins/StopSpamPlus/src/events.cpp +++ b/plugins/StopSpamPlus/src/events.cpp @@ -15,7 +15,7 @@ int OnDbEventAdded(WPARAM, LPARAM lParam) return 0; // event is an auth request - if (!(dbei.flags & DBEF_SENT) && !(dbei.flags & DBEF_READ) && dbei.eventType == EVENTTYPE_AUTHREQUEST) { + if (!dbei.bSent && !dbei.bRead && dbei.eventType == EVENTTYPE_AUTHREQUEST) { MCONTACT hContact = DbGetAuthEventContact(&dbei); // if request is from unknown or not marked Answered contact @@ -49,10 +49,10 @@ int OnDbEventFilterAdd(WPARAM w, LPARAM l) return 0; // ...let the event go its way // if event is not a message, or if the message has been read or sent... - if (dbei->eventType != EVENTTYPE_MESSAGE || (dbei->flags & DBEF_READ) != 0) + if (dbei->eventType != EVENTTYPE_MESSAGE || dbei->bRead) return 0; - if (dbei->flags & DBEF_SENT) { + if (dbei->bSent) { g_plugin.setByte(hContact, DB_KEY_HASSENT, 1); return 0; } diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 16bee8adfd..f46d7b6fdd 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -509,7 +509,7 @@ void CGlobals::logStatusChange(WPARAM wParam, const CContactCache *c) dbei.cbBlob = (int)mir_strlen(szUtf); dbei.flags = DBEF_UTF | DBEF_READ; dbei.eventType = EVENTTYPE_STATUSCHANGE; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.szModule = (char *)c->getProto(); dat->LogEvent(dbei); } diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 85918bcd04..553e000912 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -224,7 +224,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!AutoCreateWindow(0, wParam) && lParam) { // no window created, simply add an unread event to contact list DB::EventInfo dbei(lParam, false); - if (dbei && !(dbei.flags & DBEF_READ)) { + if (dbei && !dbei.bRead) { AddUnreadContact(wParam); Srmm_AddEvent(wParam, lParam); } diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 38c39e84af..fb54eab03f 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -446,7 +446,7 @@ int CMimAPI::MessageEventAdded(WPARAM hContact, LPARAM hDbEvent) nowindowcreate: // for tray support, we add the event to the tray menu. otherwise we send it back to // the contact list for flashing - if (!(dbei.flags & DBEF_READ)) { + if (!dbei.bRead) { AddUnreadContact(hContact); Srmm_AddEvent(hContact, hDbEvent); } diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 56ee17a4bc..af9b6cfd5b 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -576,8 +576,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(); DM_UpdateLastMessage(); break; } diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index 2652a42e00..1bf3dde416 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -298,13 +298,13 @@ void CMsgDialog::EventAdded(MEVENT hDbEvent, const DB::EventInfo &dbei) bool bAlertable = dbei.isAlertable(); bool bIsStatusChangeEvent = IsStatusEvent(dbei.eventType); - bool bDisableNotify = (bAlertable && (dbei.flags & DBEF_READ)); + bool bDisableNotify = (bAlertable && dbei.bRead); if (!DbEventIsShown(dbei)) return; - if (bAlertable && !(dbei.flags & DBEF_SENT)) { - m_lastMessage = dbei.timestamp; + if (bAlertable && !dbei.bSent) { + m_lastMessage = dbei.getUnixtime(); m_wszStatusBar[0] = 0; if (m_bShowTyping) { m_nTypeSecs = 0; @@ -318,7 +318,7 @@ void CMsgDialog::EventAdded(MEVENT hDbEvent, const DB::EventInfo &dbei) // set the message log divider to mark new (maybe unseen) messages, if the container has // been minimized or in the background. - if (!(dbei.flags & DBEF_SENT) && !bIsStatusChangeEvent) { + if (!dbei.bSent && !bIsStatusChangeEvent) { if (g_plugin.bDividersUsePopupConfig && g_plugin.bUseDividers) { if (!MessageWindowOpened(m_hContact, nullptr)) DM_AddDivider(); @@ -342,7 +342,7 @@ void CMsgDialog::EventAdded(MEVENT hDbEvent, const DB::EventInfo &dbei) // handle tab flashing if (!bDisableNotify && !bIsStatusChangeEvent) - if ((TabCtrl_GetCurSel(m_hwndParent) != m_iTabID) && !(dbei.flags & DBEF_SENT)) { + if ((TabCtrl_GetCurSel(m_hwndParent) != m_iTabID) && !dbei.bSent) { switch (dbei.eventType) { case EVENTTYPE_MESSAGE: m_iFlashIcon = PluginConfig.g_IconMsgEvent; @@ -364,7 +364,7 @@ void CMsgDialog::EventAdded(MEVENT hDbEvent, const DB::EventInfo &dbei) // autoswitch tab if option is set AND container is minimized (otherwise, we never autoswitch) // never switch for status changes... - if (!(dbei.flags & DBEF_SENT) && !bIsStatusChangeEvent) { + if (!dbei.bSent && !bIsStatusChangeEvent) { if (g_plugin.bAutoSwitchTabs && m_pContainer->m_hwndActive != m_hwnd) { if ((IsIconic(m_pContainer->m_hwnd) && !IsZoomed(m_pContainer->m_hwnd)) || (g_plugin.bHideOnClose && !IsWindowVisible(m_pContainer->m_hwnd))) { int iItem = GetTabIndexFromHWND(GetParent(m_hwnd), m_hwnd); @@ -381,7 +381,7 @@ void CMsgDialog::EventAdded(MEVENT hDbEvent, const DB::EventInfo &dbei) // flash window if it is not focused if (!bDisableNotify && !bIsStatusChangeEvent) - if (!IsActive() && !(dbei.flags & DBEF_SENT)) { + if (!IsActive() && !dbei.bSent) { if (!m_pContainer->cfg.flags.m_bNoFlash && !m_pContainer->IsActive()) m_pContainer->FlashContainer(1, 0); m_pContainer->SetIcon(this, Skin_LoadIcon(SKINICON_EVENT_MESSAGE)); @@ -389,7 +389,7 @@ void CMsgDialog::EventAdded(MEVENT hDbEvent, const DB::EventInfo &dbei) } // play a sound - if (!bDisableNotify && bAlertable && !(dbei.flags & DBEF_SENT)) + if (!bDisableNotify && bAlertable && !dbei.bSent) PlayIncomingSound(); if (m_pWnd) @@ -435,16 +435,16 @@ 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.getWord(SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME); + uint32_t firstTime = dbei.getUnixtime() - 60 * g_plugin.getWord(SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME); while (MEVENT hPrevEvent = pCursor.FetchNext()) { dbei.cbBlob = 0; db_event_get(hPrevEvent, &dbei); - if (dbei.timestamp < firstTime) + if (dbei.getUnixtime() < firstTime) break; m_hDbEventFirst = hPrevEvent; } @@ -493,7 +493,7 @@ int CMsgDialog::FindRTLLocale() void CMsgDialog::FlashOnClist(MEVENT hEvent, const DB::EventInfo &dbei) { m_dwTickLastEvent = GetTickCount(); - bool bSent = dbei.flags & DBEF_SENT; + bool bSent = dbei.bSent; if ((GetForegroundWindow() != m_pContainer->m_hwnd || m_pContainer->m_hwndActive != m_hwnd) && !bSent) { m_dwUnread++; diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index d4cb88232e..1c0085df3f 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -568,8 +568,8 @@ bool CLogWindow::CreateRtfEvent(RtfLogStreamData *streamData, DB::EventInfo &dbe if (dbei.eventType == EVENTTYPE_MESSAGE && !dbei.markedRead()) dat->m_cache->updateStats(TSessionStats::SET_LAST_RCV, mir_strlen((char *)dbei.pBlob)); - BOOL isSent = (dbei.flags & DBEF_SENT); - BOOL bIsStatusChangeEvent = IsStatusEvent(dbei.eventType); + bool isSent = dbei.bSent; + bool bIsStatusChangeEvent = IsStatusEvent(dbei.eventType); if (!isSent && bIsStatusChangeEvent) dbei.wipeNotify(); @@ -596,7 +596,7 @@ bool CLogWindow::CreateRtfEvent(RtfLogStreamData *streamData, DB::EventInfo &dbe uint32_t dwEffectiveFlags = dat->m_dwFlags; - dat->m_bIsHistory = (dbei.timestamp < dat->m_cache->getSessionStart() && dbei.markedRead()); + dat->m_bIsHistory = (dbei.getUnixtime() < dat->m_cache->getSessionStart() && dbei.markedRead()); int iFontIDOffset = dat->m_bIsHistory ? 8 : 0; // offset into the font table for either history (old) or new events... (# of fonts per configuration set) g_groupBreak = TRUE; @@ -610,9 +610,9 @@ bool CLogWindow::CreateRtfEvent(RtfLogStreamData *streamData, DB::EventInfo &dbe dat->m_bDividerWanted = false; } - if (dwEffectiveFlags & MWF_LOG_GROUPMODE && ((dbei.flags & (DBEF_SENT | DBEF_READ | DBEF_RTL)) == LOWORD(dat->m_iLastEventType)) && dbei.eventType == EVENTTYPE_MESSAGE && HIWORD(dat->m_iLastEventType) == EVENTTYPE_MESSAGE && (dbei.timestamp - dat->m_lastEventTime) < 86400) { + if (dwEffectiveFlags & MWF_LOG_GROUPMODE && ((dbei.flags & (DBEF_SENT | DBEF_READ | DBEF_RTL)) == LOWORD(dat->m_iLastEventType)) && dbei.eventType == EVENTTYPE_MESSAGE && HIWORD(dat->m_iLastEventType) == EVENTTYPE_MESSAGE && (dbei.getUnixtime() - dat->m_lastEventTime) < 86400) { g_groupBreak = FALSE; - if ((time_t)dbei.timestamp > today && dat->m_lastEventTime < today) + if ((time_t)dbei.getUnixtime() > today && dat->m_lastEventTime < today) g_groupBreak = TRUE; } @@ -642,7 +642,7 @@ bool CLogWindow::CreateRtfEvent(RtfLogStreamData *streamData, DB::EventInfo &dbe // templated code starts here if (dwEffectiveFlags & MWF_LOG_SHOWTIME) { hTimeZone = ((dat->m_dwFlags & MWF_LOG_LOCALTIME) && !isSent) ? dat->m_hTimeZone : nullptr; - time_t local_time = TimeZone_UtcToLocal(hTimeZone, dbei.timestamp); + time_t local_time = TimeZone_UtcToLocal(hTimeZone, dbei.getUnixtime()); event_time = *gmtime(&local_time); } @@ -765,14 +765,14 @@ bool CLogWindow::CreateRtfEvent(RtfLogStreamData *streamData, DB::EventInfo &dbe break; case 'D': // long date if (showTime && showDate) { - wchar_t *szFinalTimestamp = Template_MakeRelativeDate(hTimeZone, dbei.timestamp, 'D'); + wchar_t *szFinalTimestamp = Template_MakeRelativeDate(hTimeZone, dbei.getUnixtime(), 'D'); AppendTimeStamp(szFinalTimestamp, isSent, str, skipFont, dat, iFontIDOffset); } else skipToNext = true; break; case 'E': // short date... if (showTime && showDate) { - wchar_t *szFinalTimestamp = Template_MakeRelativeDate(hTimeZone, dbei.timestamp, 'E'); + wchar_t *szFinalTimestamp = Template_MakeRelativeDate(hTimeZone, dbei.getUnixtime(), 'E'); AppendTimeStamp(szFinalTimestamp, isSent, str, skipFont, dat, iFontIDOffset); } else skipToNext = true; @@ -871,7 +871,7 @@ bool CLogWindow::CreateRtfEvent(RtfLogStreamData *streamData, DB::EventInfo &dbe case 'R': case 'r': // long date if (showTime && showDate) { - wchar_t *szFinalTimestamp = Template_MakeRelativeDate(hTimeZone, dbei.timestamp, cc); + wchar_t *szFinalTimestamp = Template_MakeRelativeDate(hTimeZone, dbei.getUnixtime(), cc); AppendTimeStamp(szFinalTimestamp, isSent, str, skipFont, dat, iFontIDOffset); } else skipToNext = true; @@ -879,7 +879,7 @@ bool CLogWindow::CreateRtfEvent(RtfLogStreamData *streamData, DB::EventInfo &dbe case 't': case 'T': if (showTime) { - wchar_t *szFinalTimestamp = Template_MakeRelativeDate(hTimeZone, dbei.timestamp, (wchar_t)((dwEffectiveFlags & MWF_LOG_SHOWSECONDS) ? cc : (wchar_t)'t')); + wchar_t *szFinalTimestamp = Template_MakeRelativeDate(hTimeZone, dbei.getUnixtime(), (wchar_t)((dwEffectiveFlags & MWF_LOG_SHOWSECONDS) ? cc : (wchar_t)'t')); AppendTimeStamp(szFinalTimestamp, isSent, str, skipFont, dat, iFontIDOffset); } else skipToNext = true; @@ -1116,7 +1116,7 @@ skip: str.Append("\\par"); dat->m_iLastEventType = MAKELONG((dbei.flags & (DBEF_SENT | DBEF_READ | DBEF_RTL)), dbei.eventType); - dat->m_lastEventTime = dbei.timestamp; + dat->m_lastEventTime = dbei.getUnixtime(); return true; } @@ -1205,12 +1205,12 @@ void CLogWindow::LogEvents(MEVENT hDbEventFirst, int count, bool fAppend, DB::Ev m_pDlg.m_bLastParaDeleted = true; } - BOOL isSent; + bool isSent; if (streamData.dbei != nullptr) - isSent = (streamData.dbei->flags & DBEF_SENT) != 0; + isSent = streamData.dbei->bSent; else { DB::EventInfo dbei(hDbEventFirst, false); - isSent = (dbei.flags & DBEF_SENT) != 0; + isSent = dbei.bSent; } ReplaceIcons(startAt, fAppend, isSent); diff --git a/plugins/TabSRMM/src/msgoptions.cpp b/plugins/TabSRMM/src/msgoptions.cpp index 2c4f020055..382af9cd11 100644 --- a/plugins/TabSRMM/src/msgoptions.cpp +++ b/plugins/TabSRMM/src/msgoptions.cpp @@ -625,7 +625,7 @@ public: DB::EventInfo dbei; dbei.szModule = m_szProto; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.eventType = (iIndex == 6) ? EVENTTYPE_STATUSCHANGE : EVENTTYPE_MESSAGE; dbei.eventType = (iIndex == 7) ? EVENTTYPE_ERRMSG : dbei.eventType; if (dbei.eventType == EVENTTYPE_ERRMSG) diff --git a/plugins/TabSRMM/src/sendlater.cpp b/plugins/TabSRMM/src/sendlater.cpp index d1d3ec9186..d48b975f39 100644 --- a/plugins/TabSRMM/src/sendlater.cpp +++ b/plugins/TabSRMM/src/sendlater.cpp @@ -792,7 +792,7 @@ HANDLE SendLater::processAck(const ACKDATA *ack) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = Proto_GetBaseAccountName((p->hContact)); - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.cbBlob = (int)mir_strlen(p->sendBuffer) + 1; dbei.pBlob = p->sendBuffer; db_event_add(p->hContact, &dbei); diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index e2206515d6..6698e6c563 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -357,7 +357,7 @@ void SendQueue::logError(CMsgDialog *dat, int iSendJobIndex, const wchar_t *szEr dbei.flags = DBEF_SENT | DBEF_UTF; dbei.cbBlob = (int)iMsgLen; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.szModule = (char *)szErrMsg; dat->LogEvent(dbei); @@ -461,7 +461,7 @@ int SendQueue::ackMessage(CMsgDialog *dat, WPARAM wParam, LPARAM lParam) dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = Proto_GetBaseAccountName(job.hContact); - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.cbBlob = (int)mir_strlen(job.szSendBuffer) + 1; if (dat) @@ -548,7 +548,7 @@ int SendQueue::doSendLater(int iJobIndex, CMsgDialog *dat, MCONTACT hContact, bo dbei.eventType = EVENTTYPE_MESSAGE; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.szModule = Proto_GetBaseAccountName(dat->m_hContact); - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.pBlob = szUtf; dbei.cbBlob = (int)mir_strlen(szUtf); dat->LogEvent(dbei); diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index bdc900221e..7bdbcbe36f 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -124,8 +124,8 @@ uint32_t LastMessageTimestamp(MCONTACT hContact, bool received) for (MEVENT hDbEvent = db_event_last(hContact); hDbEvent; hDbEvent = db_event_prev(hContact, hDbEvent)) { DBEVENTINFO dbei = {}; db_event_get(hDbEvent, &dbei); - if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT) == received) - return dbei.timestamp; + if (dbei.eventType == EVENTTYPE_MESSAGE && dbei.bSent != received) + return dbei.getUnixtime(); } return 0; @@ -166,7 +166,7 @@ wchar_t* GetLastMessageText(MCONTACT hContact, bool received) { for (MEVENT hDbEvent = db_event_last(hContact); hDbEvent; hDbEvent = db_event_prev(hContact, hDbEvent)) { DB::EventInfo dbei(hDbEvent); - if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT) == received) { + if (dbei.eventType == EVENTTYPE_MESSAGE && dbei.bSent != received) { wchar_t *swzMsg = dbei.getText(); StripBBCodesInPlace(swzMsg); return swzMsg; @@ -367,9 +367,9 @@ bool GetSysSubstText(MCONTACT hContact, wchar_t *swzRawSpec, wchar_t *buff, int DBEVENTINFO dbei = {}; if (!db_event_get(dbe, &dbei)) { if (dbei.eventType == EVENTTYPE_MESSAGE) { - dwNewTs = max(dwNewTs, dbei.timestamp); - if (dbei.timestamp > dwLastTs) { - if (dbei.flags & DBEF_SENT) dwCountOut++; + dwNewTs = max(dwNewTs, dbei.getUnixtime()); + if (dbei.getUnixtime() > dwLastTs) { + if (dbei.bSent) dwCountOut++; else dwCountIn++; } else break; diff --git a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp index e26522981f..1f27050971 100644 --- a/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp +++ b/plugins/UserInfoEx/src/ex_import/classExImContactXML.cpp @@ -401,7 +401,7 @@ uint8_t CExImContactXML::ExportEvents() TiXmlElement *xmlEvent = _xmlDoc.NewElement("evt"); if (xmlEvent) { xmlEvent->SetAttribute("type", dbei.eventType); - xmlEvent->SetAttribute("time", (int)dbei.timestamp); + xmlEvent->SetAttribute("time", (int)dbei.getUnixtime()); xmlEvent->SetAttribute("flag", (int)dbei.flags); TiXmlText *xmlText = _xmlDoc.NewText(pBase64Data); @@ -914,8 +914,8 @@ int CExImContactXML::ImportEvent(LPCSTR pszModule, const TiXmlElement *xmlEvent) // timestamp must be valid DBEVENTINFO dbei = {}; - dbei.timestamp = xmlEvent->IntAttribute("time"); - if (dbei.timestamp == 0) + dbei.iTimestamp = xmlEvent->IntAttribute("time"); + if (dbei.iTimestamp == 0) return ERROR_INVALID_TIMESTAMP; LPCSTR tmp = xmlEvent->GetText(); diff --git a/plugins/UserInfoEx/src/mir_db.cpp b/plugins/UserInfoEx/src/mir_db.cpp index c6a1a05ca5..9afb7811f8 100644 --- a/plugins/UserInfoEx/src/mir_db.cpp +++ b/plugins/UserInfoEx/src/mir_db.cpp @@ -44,7 +44,7 @@ uint32_t WhenAdded(uint32_t dwUIN, LPCSTR) memcpy(&dwEvtUIN, dbei.pBlob, sizeof(uint32_t)); MIR_FREE(dbei.pBlob); if (dwEvtUIN == dwUIN) - return dbei.timestamp; + return dbei.getUnixtime(); } } } @@ -522,7 +522,7 @@ uint32_t TimeOf(MEVENT hEvent) { DBEVENTINFO dbei; if (!GetInfo(hEvent, &dbei)) - return dbei.timestamp; + return dbei.getUnixtime(); return 0; } @@ -541,7 +541,7 @@ uint32_t TimeOf(MEVENT hEvent) bool __forceinline IsEqual(const DBEVENTINFO *d1, const DBEVENTINFO *d2, bool Data) { bool res = d1 && d2 && - (d1->timestamp == d2->timestamp) && + (d1->getUnixtime() == d2->getUnixtime()) && (d1->eventType == d2->eventType) && (d1->cbBlob == d2->cbBlob) && (!d1->szModule || !d2->szModule || !_stricmp(d1->szModule, d2->szModule)); @@ -574,7 +574,7 @@ bool Exists(MCONTACT hContact, MEVENT& hDbExistingEvent, DBEVENTINFO *dbei) hDbExistingEvent = db_event_first(hContact); if (hDbExistingEvent) { if (!GetInfo(hDbExistingEvent, &edbei)) { - if ((dbei->timestamp < edbei.timestamp)) + if ((dbei->getUnixtime() < edbei.getUnixtime())) return false; if (IsEqual(dbei, &edbei, false)) { @@ -596,7 +596,7 @@ bool Exists(MCONTACT hContact, MEVENT& hDbExistingEvent, DBEVENTINFO *dbei) } if (hDbExistingEvent) { MEVENT sdbe = hDbExistingEvent; - for (MEVENT edbe = sdbe; edbe && !GetInfo(edbe, &edbei) && (dbei->timestamp <= edbei.timestamp); edbe = db_event_prev(hContact, edbe)) { + for (MEVENT edbe = sdbe; edbe && !GetInfo(edbe, &edbei) && (dbei->getUnixtime() <= edbei.getUnixtime()); edbe = db_event_prev(hContact, edbe)) { hDbExistingEvent = edbe; //compare without data (faster) if ( result = IsEqual(dbei, &edbei, false)) { @@ -612,7 +612,7 @@ bool Exists(MCONTACT hContact, MEVENT& hDbExistingEvent, DBEVENTINFO *dbei) } /*end for*/ if (!result) { - for (MEVENT edbe = db_event_next(hContact, sdbe); edbe && !GetInfo(edbe, &edbei) && (dbei->timestamp >= edbei.timestamp); edbe = db_event_next(hContact, edbe)) { + for (MEVENT edbe = db_event_next(hContact, sdbe); edbe && !GetInfo(edbe, &edbei) && (dbei->getUnixtime() >= edbei.getUnixtime()); edbe = db_event_next(hContact, edbe)) { hDbExistingEvent = edbe; //compare without data (faster) if (result = IsEqual(dbei, &edbei, false)) { diff --git a/plugins/Variables/src/parse_miranda.cpp b/plugins/Variables/src/parse_miranda.cpp index 845dfc33ae..7e87c23ec5 100644 --- a/plugins/Variables/src/parse_miranda.cpp +++ b/plugins/Variables/src/parse_miranda.cpp @@ -442,9 +442,9 @@ static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags) hSearchEvent = findDbEvent(hSearchContact, NULL, flags); dbe.cbBlob = 0; if (!db_event_get(hSearchEvent, &dbe)) { - if ((dbe.timestamp < matchTimestamp) || (matchTimestamp == 0)) { + if ((dbe.getUnixtime() < matchTimestamp) || (matchTimestamp == 0)) { hMatchEvent = hSearchEvent; - matchTimestamp = dbe.timestamp; + matchTimestamp = dbe.getUnixtime(); } } } @@ -455,9 +455,9 @@ static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags) hSearchEvent = findDbEvent(hSearchContact, NULL, flags); dbe.cbBlob = 0; if (!db_event_get(hSearchEvent, &dbe)) { - if ((dbe.timestamp > matchTimestamp) || (matchTimestamp == 0)) { + if ((dbe.getUnixtime() > matchTimestamp) || (matchTimestamp == 0)) { hMatchEvent = hSearchEvent; - matchTimestamp = dbe.timestamp; + matchTimestamp = dbe.getUnixtime(); } } } @@ -466,14 +466,14 @@ static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags) else if (flags & DBE_NEXT) { dbe.cbBlob = 0; if (!db_event_get(hDbEvent, &dbe)) { - priorTimestamp = dbe.timestamp; + priorTimestamp = dbe.getUnixtime(); for (auto &hSearchContact : Contacts()) { hSearchEvent = findDbEvent(hSearchContact, hDbEvent, flags); dbe.cbBlob = 0; if (!db_event_get(hSearchEvent, &dbe)) { - if (((dbe.timestamp < matchTimestamp) || (matchTimestamp == 0)) && (dbe.timestamp > priorTimestamp)) { + if (((dbe.getUnixtime() < matchTimestamp) || (matchTimestamp == 0)) && (dbe.getUnixtime() > priorTimestamp)) { hMatchEvent = hSearchEvent; - matchTimestamp = dbe.timestamp; + matchTimestamp = dbe.getUnixtime(); } } } @@ -482,14 +482,14 @@ static MEVENT findDbEvent(MCONTACT hContact, MEVENT hDbEvent, int flags) } else if (flags & DBE_PREV) { if (!db_event_get(hDbEvent, &dbe)) { - priorTimestamp = dbe.timestamp; + priorTimestamp = dbe.getUnixtime(); for (auto &hSearchContact : Contacts()) { hSearchEvent = findDbEvent(hSearchContact, hDbEvent, flags); dbe.cbBlob = 0; if (!db_event_get(hSearchEvent, &dbe)) { - if (((dbe.timestamp > matchTimestamp) || (matchTimestamp == 0)) && (dbe.timestamp < priorTimestamp)) { + if (((dbe.getUnixtime() > matchTimestamp) || (matchTimestamp == 0)) && (dbe.getUnixtime() < priorTimestamp)) { hMatchEvent = hSearchEvent; - matchTimestamp = dbe.timestamp; + matchTimestamp = dbe.getUnixtime(); } } } diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp index 75ead98cc7..876f6a30a0 100644 --- a/plugins/YARelay/src/main.cpp +++ b/plugins/YARelay/src/main.cpp @@ -65,7 +65,7 @@ int ProtoAck(WPARAM,LPARAM lparam) DBEVENTINFO dbei = {}; dbei.szModule = MODULENAME; - dbei.timestamp = ltime; + dbei.iTimestamp = ltime; dbei.flags = DBEF_SENT | DBEF_UTF; dbei.eventType = EVENTTYPE_MESSAGE; dbei.cbBlob = (uint32_t)mir_strlen(p->msgText) + 1; @@ -118,7 +118,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM hDBEvent) return 0; // get time and date - time_t tTime = dbei.timestamp; + time_t tTime = dbei.getUnixtime(); tm *tm_time = gmtime(&tTime); // build a message -- cgit v1.2.3