diff options
author | George Hazan <george.hazan@gmail.com> | 2024-03-10 14:39:18 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-03-10 14:39:18 +0300 |
commit | 33fcc371716d9cf61f5396eaaa1a31fbbd2cbbe8 (patch) | |
tree | 75f2d114d683c26af2784def985b1969e007ffb3 /plugins | |
parent | 315e30ceaec21a628df017db96c25d6a4d88ecc5 (diff) |
NewStory: no need to store hEvent twice, since there's one inside DB::EventInfo
Diffstat (limited to 'plugins')
-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 |
6 files changed, 28 insertions, 29 deletions
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;
|