diff options
-rw-r--r-- | include/m_database.h | 3 | ||||
-rw-r--r-- | libs/win32/mir_app.lib | bin | 292492 -> 292758 bytes | |||
-rw-r--r-- | libs/win64/mir_app.lib | bin | 292264 -> 292538 bytes | |||
-rw-r--r-- | plugins/NewStory/src/history_array.cpp | 14 | ||||
-rw-r--r-- | plugins/NewStory/src/history_array.h | 1 | ||||
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 28 | ||||
-rw-r--r-- | plugins/NewStory/src/history_dlg.cpp | 4 | ||||
-rw-r--r-- | plugins/NewStory/src/history_menus.cpp | 4 | ||||
-rw-r--r-- | plugins/NewStory/src/history_svc.cpp | 6 | ||||
-rw-r--r-- | src/mir_app/src/db_events.cpp | 16 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 5 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 5 |
12 files changed, 49 insertions, 37 deletions
diff --git a/include/m_database.h b/include/m_database.h index e29b04fa2e..75c34d2dbb 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -693,9 +693,10 @@ namespace DB public:
explicit EventInfo();
explicit EventInfo(MEVENT hEvent, bool bFetchBlob = true);
+ EventInfo& operator=(MEVENT hEvent);
~EventInfo();
- bool fetch(MEVENT hEvent, bool bFetchBlob = true);
+ bool fetch(bool bFetchBlob = true);
void unload();
void wipeNotify();
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib Binary files differindex 0f146c19c9..30ceb3cc3d 100644 --- a/libs/win32/mir_app.lib +++ b/libs/win32/mir_app.lib diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib Binary files differindex aacd437f12..059d20b51c 100644 --- a/libs/win64/mir_app.lib +++ b/libs/win64/mir_app.lib diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp index 6e9aa1f8df..7eb13d31fa 100644 --- a/plugins/NewStory/src/history_array.cpp +++ b/plugins/NewStory/src/history_array.cpp @@ -254,11 +254,11 @@ bool ItemData::isLinkChar(HWND hwnd, int idx) const bool ItemData::fetch(void)
{
// if this event is virtual (for example, in group chats), don't try to laod it
- if (!hEvent)
+ if (!dbe.getEvent())
return false;
if (!dbe) {
- if (!dbe.fetch(hEvent))
+ if (!dbe.fetch())
return false;
if (dbe.szReplyId)
@@ -520,7 +520,7 @@ void HistoryArray::addChatEvent(SESSION_INFO *si, const LOGINFO *lin) p.hContact = si->hContact;
if (si->pMI->bDatabase && lin->hEvent) {
- p.hEvent = lin->hEvent;
+ p.dbe = lin->hEvent;
checkGC(p, si);
}
else {
@@ -583,7 +583,7 @@ bool HistoryArray::addEvent(MCONTACT hContact, MEVENT hEvent, int count) if (count == 1) {
auto &p = allocateItem();
p.hContact = hContact;
- p.hEvent = hEvent;
+ p.dbe = hEvent;
if (si) {
checkGC(p, si);
pPrev = p.checkPrevGC(pPrev, hwndOwner);
@@ -599,7 +599,7 @@ bool HistoryArray::addEvent(MCONTACT hContact, MEVENT hEvent, int count) auto &p = allocateItem();
p.hContact = hContact;
- p.hEvent = hEvent;
+ p.dbe = hEvent;
if (si) {
checkGC(p, si);
pPrev = p.checkPrevGC(pPrev, hwndOwner);
@@ -628,7 +628,7 @@ void HistoryArray::addResults(const OBJLIST<SearchResult> &pArray) for (auto &it : pArray) {
auto &p = allocateItem();
p.hContact = it->hContact;
- p.hEvent = it->hEvent;
+ p.dbe = it->hEvent;
p.m_bIsResult = true;
pPrev = p.checkPrev(pPrev, hwndOwner);
}
@@ -664,7 +664,7 @@ int HistoryArray::find(MEVENT hEvent) int i = 0;
for (auto &it : pages)
for (auto &p : it->data) {
- if (p.hEvent == hEvent)
+ if (p.dbe.getEvent() == hEvent)
return i;
i++;
}
diff --git a/plugins/NewStory/src/history_array.h b/plugins/NewStory/src/history_array.h index 04e7469b50..3806062859 100644 --- a/plugins/NewStory/src/history_array.h +++ b/plugins/NewStory/src/history_array.h @@ -13,7 +13,6 @@ CMStringW TplFormatString(int tpl, MCONTACT hContact, ItemData *item); struct ItemData
{
MCONTACT hContact;
- MEVENT hEvent;
bool m_bSelected, m_bHighlighted;
bool m_bLoaded, m_bIsResult;
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index e5108cc7d3..09a9c36319 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -294,7 +294,7 @@ void NewstoryListData::CopyPath() {
if (auto *pItem = GetItem(caret))
if (pItem->completed()) {
- DB::EventInfo dbei(pItem->hEvent);
+ DB::EventInfo dbei(pItem->dbe.getEvent());
DB::FILE_BLOB blob(dbei);
Utils_ClipboardCopy(MClipUnicode(blob.getLocalName()));
}
@@ -303,7 +303,7 @@ void NewstoryListData::CopyPath() void NewstoryListData::CopyUrl()
{
if (auto *pItem = GetItem(caret))
- Srmm_DownloadOfflineFile(pItem->hContact, pItem->hEvent, OFD_COPYURL);
+ Srmm_DownloadOfflineFile(pItem->hContact, pItem->dbe.getEvent(), OFD_COPYURL);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -385,8 +385,8 @@ void NewstoryListData::DeleteItems(void) if (!p->m_bSelected)
continue;
- if (p->hEvent)
- db_event_delete(p->hEvent, flags);
+ if (p->dbe.getEvent())
+ db_event_delete(p->dbe.getEvent(), flags);
items.remove(i);
totalCount--;
firstSel = i;
@@ -406,7 +406,7 @@ void NewstoryListData::DeleteItems(void) void NewstoryListData::Download(int options)
{
if (auto *p = LoadItem(caret))
- Srmm_DownloadOfflineFile(p->hContact, p->hEvent, options);
+ Srmm_DownloadOfflineFile(p->hContact, p->dbe.getEvent(), options);
}
void NewstoryListData::EndEditItem(bool bAccept)
@@ -424,13 +424,13 @@ void NewstoryListData::EndEditItem(bool bAccept) GetWindowTextW(hwndEditBox, pItem->wtext, iTextLen+1);
pItem->wtext[iTextLen] = 0;
- if (pItem->hContact && pItem->hEvent) {
+ if (pItem->hContact && pItem->dbe.getEvent()) {
DBEVENTINFO dbei = pItem->dbe;
ptrA szUtf(mir_utf8encodeW(pItem->wtext));
dbei.cbBlob = (int)mir_strlen(szUtf) + 1;
dbei.pBlob = szUtf.get();
- db_event_edit(pItem->hEvent, &dbei);
+ db_event_edit(pItem->dbe.getEvent(), &dbei);
}
MTextDestroy(pItem->data); pItem->data = 0;
@@ -628,7 +628,7 @@ void NewstoryListData::OpenFolder() {
if (auto *pItem = GetItem(caret)) {
if (pItem->completed()) {
- DB::EventInfo dbei(pItem->hEvent);
+ DB::EventInfo dbei(pItem->dbe.getEvent());
DB::FILE_BLOB blob(dbei);
CMStringW wszFile(blob.getLocalName());
int idx = wszFile.ReverseFind('\\');
@@ -818,7 +818,7 @@ void NewstoryListData::Reply() {
if (pMsgDlg)
if (auto *pItem = GetItem(caret))
- pMsgDlg->SetQuoteEvent(pItem->hEvent);
+ pMsgDlg->SetQuoteEvent(pItem->dbe.getEvent());
}
void NewstoryListData::ScheduleDraw()
@@ -888,7 +888,7 @@ void NewstoryListData::ToggleBookmark() p->dbe.flags &= ~DBEF_BOOKMARK;
else
p->dbe.flags |= DBEF_BOOKMARK;
- db_event_edit(p->hEvent, &p->dbe);
+ db_event_edit(p->dbe.getEvent(), &p->dbe);
p->setText(m_hwnd);
}
@@ -918,18 +918,18 @@ void NewstoryListData::TryUp(int iCount) auto *pTop = GetItem(0);
MCONTACT hContact = pTop->hContact;
- if (pTop->hEvent == 0 || hContact == 0)
+ if (pTop->dbe.getEvent() == 0 || hContact == 0)
return;
int i;
for (i = 0; i < iCount; i++) {
- MEVENT hPrev = db_event_prev(hContact, pTop->hEvent);
+ MEVENT hPrev = db_event_prev(hContact, pTop->dbe.getEvent());
if (hPrev == 0)
break;
auto *p = items.insert(0);
p->hContact = hContact;
- p->hEvent = hPrev;
+ p->dbe = hPrev;
totalCount++;
}
@@ -1413,7 +1413,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM pt.y -= pItem->savedTop;
if (pItem->m_bOfflineFile) {
- Srmm_DownloadOfflineFile(pItem->hContact, pItem->hEvent, OFD_DOWNLOAD | OFD_RUN);
+ Srmm_DownloadOfflineFile(pItem->hContact, pItem->dbe.getEvent(), OFD_DOWNLOAD | OFD_RUN);
return 0;
}
diff --git a/plugins/NewStory/src/history_dlg.cpp b/plugins/NewStory/src/history_dlg.cpp index 0ace485a79..e7818893e6 100644 --- a/plugins/NewStory/src/history_dlg.cpp +++ b/plugins/NewStory/src/history_dlg.cpp @@ -895,7 +895,7 @@ public: for (int i = 0; i < iCount; i++) {
auto *pItem = arItems.get(i);
if (pItem->m_bSelected) {
- DB::EventInfo dbei(pItem->hEvent);
+ DB::EventInfo dbei(pItem->dbe.getEvent());
if (dbei)
pDB->ExportEvent(dbei);
iDone++;
@@ -906,7 +906,7 @@ public: if (iDone == 0)
for (int i = 0; i < iCount; i++) {
auto *pItem = arItems.get(i);
- DB::EventInfo dbei(pItem->hEvent);
+ DB::EventInfo dbei(pItem->dbe.getEvent());
if (dbei)
pDB->ExportEvent(dbei);
}
diff --git a/plugins/NewStory/src/history_menus.cpp b/plugins/NewStory/src/history_menus.cpp index d5249817e9..4fcb785562 100644 --- a/plugins/NewStory/src/history_menus.cpp +++ b/plugins/NewStory/src/history_menus.cpp @@ -60,9 +60,9 @@ HMENU NSMenu_Build(NewstoryListData *data, ItemData *item) }
bEditable = (item->dbe.flags & DBEF_SENT) != 0;
- bShowEventActions = item->hEvent != 0;
+ bShowEventActions = item->dbe;
- DB::EventInfo dbei(item->hEvent);
+ DB::EventInfo dbei(item->dbe.getEvent());
NotifyEventHooks(hEventPreBuildMenu, item->hContact, (LPARAM)&dbei);
if (data->pMsgDlg) {
diff --git a/plugins/NewStory/src/history_svc.cpp b/plugins/NewStory/src/history_svc.cpp index db05f3da04..3010db5a81 100644 --- a/plugins/NewStory/src/history_svc.cpp +++ b/plugins/NewStory/src/history_svc.cpp @@ -22,7 +22,7 @@ static INT_PTR SvcGetCurrent(WPARAM wParam, LPARAM) {
if (auto *pData = (NewstoryListData *)wParam)
if (auto *p = pData->GetItem(pData->caret))
- return p->hEvent;
+ return p->dbe.getEvent();
return 0;
}
@@ -41,11 +41,11 @@ static INT_PTR SvcGetSelection(WPARAM wParam, LPARAM lParam) for (int i = pData->totalCount; i >= 0; i--)
if (auto *p = pData->items.get(i))
if (p->m_bSelected)
- pRet->push_back(p->hEvent);
+ pRet->push_back(p->dbe.getEvent());
if (pRet->empty() && pData->caret != -1)
if (auto *p = pData->GetItem(pData->caret))
- pRet->push_back(p->hEvent);
+ pRet->push_back(p->dbe.getEvent());
}
return 0;
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index 3b44ee5280..901b48709c 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -250,11 +250,11 @@ MIR_APP_DLL(HICON) DbEvent_GetIcon(DBEVENTINFO *dbei, int flags) /////////////////////////////////////////////////////////////////////////////////////////
-DB::EventInfo::EventInfo(MEVENT hEvent, bool bFetchBlob) :
- m_hEvent(hEvent)
+DB::EventInfo::EventInfo(MEVENT hEvent, bool bFetchBlob)
{
memset(this, 0, sizeof(*this));
- fetch(hEvent, bFetchBlob);
+ m_hEvent = hEvent;
+ fetch(bFetchBlob);
}
DB::EventInfo::EventInfo() :
@@ -263,15 +263,21 @@ DB::EventInfo::EventInfo() : memset(this, 0, sizeof(*this));
}
+DB::EventInfo& DB::EventInfo::operator=(MEVENT hEvent)
+{
+ m_hEvent = hEvent;
+ m_bValid = false;
+ return *this;
+}
+
DB::EventInfo::~EventInfo()
{
if (m_bValid)
mir_free(pBlob);
}
-bool DB::EventInfo::fetch(MEVENT hEvent, bool bFetchBlob)
+bool DB::EventInfo::fetch(bool bFetchBlob)
{
- m_hEvent = hEvent;
if (bFetchBlob)
cbBlob = -1;
return m_bValid = ::db_event_get(m_hEvent, this) == 0;
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index bd6d09c773..e76bce77d3 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -902,7 +902,7 @@ Clist_GroupSaveExpanded @1003 NONAME ?addButton@CMPluginBase@@QAEPAXPBUBBButton@@@Z @1032 NONAME
?SetQuoteEvent@CSrmmBaseDialog@@QAEXI@Z @1033 NONAME
?onClick_CloseQuote@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @1034 NONAME
-?fetch@EventInfo@DB@@QAE_NI_N@Z @1035 NONAME
+?fetch@EventInfo@DB@@QAE_N_N@Z @1035 NONAME
?unload@EventInfo@DB@@QAEXXZ @1036 NONAME
?isAlertable@EventInfo@DB@@QBE_NXZ @1037 NONAME
?Send@File@@YGPAUHWND__@@IQAPA_W@Z @1038 NONAME
@@ -965,3 +965,6 @@ _Netlib_DownloadFile@20 @1099 NONAME ?getUserInfo@FILE_BLOB@DB@@QBEPAXXZ @1101 NONAME
?setUserInfo@FILE_BLOB@DB@@QAEXPAX@Z @1102 NONAME
?Chat_Find@@YGPAUSESSION_INFO@@IPBD@Z @1103 NONAME
+??4EventInfo@DB@@QAEAAV01@I@Z @1104 NONAME
+?MarkEventRead@CSrmmBaseDialog@@QAEXABVEventInfo@DB@@@Z @1105 NONAME
+?getEvent@EventInfo@DB@@QBEIXZ @1106 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index bdb810338c..e2f633c5e8 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -902,7 +902,7 @@ Clist_GroupSaveExpanded @1003 NONAME ?addButton@CMPluginBase@@QEAAPEAXPEBUBBButton@@@Z @1032 NONAME
?SetQuoteEvent@CSrmmBaseDialog@@QEAAXI@Z @1033 NONAME
?onClick_CloseQuote@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @1034 NONAME
-?fetch@EventInfo@DB@@QEAA_NI_N@Z @1035 NONAME
+?fetch@EventInfo@DB@@QEAA_N_N@Z @1035 NONAME
?unload@EventInfo@DB@@QEAAXXZ @1036 NONAME
?isAlertable@EventInfo@DB@@QEBA_NXZ @1037 NONAME
?Send@File@@YAPEAUHWND__@@IQEAPEA_W@Z @1038 NONAME
@@ -965,3 +965,6 @@ Netlib_DownloadFile @1093 NONAME ?getUserInfo@FILE_BLOB@DB@@QEBAPEAXXZ @1095 NONAME
?setUserInfo@FILE_BLOB@DB@@QEAAXPEAX@Z @1096 NONAME
?Chat_Find@@YAPEAUSESSION_INFO@@IPEBD@Z @1097 NONAME
+??4EventInfo@DB@@QEAAAEAV01@I@Z @1098 NONAME
+?MarkEventRead@CSrmmBaseDialog@@QEAAXAEBVEventInfo@DB@@@Z @1099 NONAME
+?getEvent@EventInfo@DB@@QEBAIXZ @1100 NONAME
|