summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/ExternalAPI/delphi/m_ieview.inc2
-rw-r--r--plugins/ExternalAPI/m_ieview.h1
-rw-r--r--plugins/HistoryPlusPlus/hpp_external.pas1
-rw-r--r--plugins/HistoryPlusPlus/hpp_externalgrid.pas3
-rw-r--r--src/mir_app/src/chat_svc.cpp14
-rw-r--r--src/mir_app/src/srmm_log_hpp.cpp18
6 files changed, 28 insertions, 11 deletions
diff --git a/plugins/ExternalAPI/delphi/m_ieview.inc b/plugins/ExternalAPI/delphi/m_ieview.inc
index 23993ffe76..5b0a309f68 100644
--- a/plugins/ExternalAPI/delphi/m_ieview.inc
+++ b/plugins/ExternalAPI/delphi/m_ieview.inc
@@ -132,8 +132,8 @@ type
dwData :dword; // dword data e.g. status
bIsMe :bool; // TRUE if the event is related to the user
time :dword; // Time of the event
+ hEvent :TMEVENT; // Database event handle, if present
next :PtagIEVIEWEVENTDATA;
- Text2 :TChar; // Text, usage depends on type of event
end;
PIEVIEWEVENTDATA = PtagIEVIEWEVENTDATA;
TIEVIEWEVENTDATA = TtagIEVIEWEVENTDATA;
diff --git a/plugins/ExternalAPI/m_ieview.h b/plugins/ExternalAPI/m_ieview.h
index 6ab950b63e..563ce1542e 100644
--- a/plugins/ExternalAPI/m_ieview.h
+++ b/plugins/ExternalAPI/m_ieview.h
@@ -123,6 +123,7 @@ struct IEVIEWEVENTDATA
uint32_t dwData; // DWORD data e.g. status see IEEDD_* values
int bIsMe; // TRUE if the event is related to the user
uint32_t time; // Time of the event
+ MEVENT hEvent; // Database event handle, if present
IEVIEWEVENTDATA *next;
};
diff --git a/plugins/HistoryPlusPlus/hpp_external.pas b/plugins/HistoryPlusPlus/hpp_external.pas
index 53843d277f..cb81d72363 100644
--- a/plugins/HistoryPlusPlus/hpp_external.pas
+++ b/plugins/HistoryPlusPlus/hpp_external.pas
@@ -189,6 +189,7 @@ begin
CustomItem.Nick := AnsiToWideString(AnsiString(customEvent.Nick.a),UsedCodepage);
CustomItem.Sent := boolean(customEvent.bIsMe);
CustomItem.Time := customEvent.time;
+ CustomItem.hEvent := customEvent.hEvent;
ExtGrid.AddCustomEvent(event.hContact, CustomItem, UsedCodepage,
boolean(event.dwFlags and IEEF_RTL),
not boolean(event.dwFlags and IEEF_NO_SCROLLING));
diff --git a/plugins/HistoryPlusPlus/hpp_externalgrid.pas b/plugins/HistoryPlusPlus/hpp_externalgrid.pas
index c19a755f76..f21422393d 100644
--- a/plugins/HistoryPlusPlus/hpp_externalgrid.pas
+++ b/plugins/HistoryPlusPlus/hpp_externalgrid.pas
@@ -36,6 +36,7 @@ type
Text: String;
Sent: Boolean;
Time: DWord;
+ HEvent: TMEVENT;
end;
TExtItem = record
@@ -957,7 +958,7 @@ end;
procedure TExternalGrid.GridItemDelete(Sender: TObject; Index: Integer);
begin
- if (FGridState = gsDelete) and (Items[Index].hDBEvent <> 0) and (not Items[Index].Custom) then
+ if (FGridState = gsDelete) and (Items[Index].hDBEvent <> 0) then
db_event_delete(Items[Index].hDBEvent);
if Index <> High(Items) then
begin
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 64b05b018a..fc6e001881 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -854,6 +854,19 @@ static int OnContactDeleted(WPARAM hContact, LPARAM)
return 0;
}
+static int OnEventDeleted(WPARAM hContact, LPARAM hDbEvent)
+{
+ if (Contact::IsGroupChat(hContact))
+ if (auto *si = SM_FindSessionByContact(hContact))
+ for (auto &it : si->arEvents.rev_iter())
+ if (it->hEvent == hDbEvent) {
+ si->arEvents.removeItem(&it);
+ break;
+ }
+
+ return 0;
+}
+
static INT_PTR MuteChat(WPARAM hContact, LPARAM param)
{
Chat_Mute(hContact, param);
@@ -1020,6 +1033,7 @@ int LoadChatModule(void)
HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
HookEvent(ME_SYSTEM_PRESHUTDOWN, PreShutdown);
HookEvent(ME_DB_CONTACT_DELETED, OnContactDeleted);
+ HookEvent(ME_DB_EVENT_DELETED, OnEventDeleted);
HookEvent(ME_SKIN_ICONSCHANGED, IconsChanged);
HookEvent(ME_FONT_RELOAD, FontsChanged);
diff --git a/src/mir_app/src/srmm_log_hpp.cpp b/src/mir_app/src/srmm_log_hpp.cpp
index 7d696d40bb..969200d093 100644
--- a/src/mir_app/src/srmm_log_hpp.cpp
+++ b/src/mir_app/src/srmm_log_hpp.cpp
@@ -120,19 +120,11 @@ public:
IEVIEWEVENTDATA ied = {};
ied.dwFlags = IEEDF_UNICODE_NICK | IEEDF_UNICODE_TEXT;
-
- IEVIEWEVENT event = {};
- event.hwnd = m_hwnd;
- event.hContact = m_pDlg.m_hContact;
- event.codepage = CP_ACP;
- event.iType = IEE_LOG_MEM_EVENTS;
- event.eventData = &ied;
- event.count = 1;
-
ied.szNick.w = lin->ptszNick;
ied.szText.w = lin->ptszText;
ied.time = lin->time;
ied.bIsMe = lin->bIsMe;
+ ied.hEvent = lin->hEvent;
switch (lin->iType) {
case GC_EVENT_MESSAGE:
@@ -176,6 +168,14 @@ public:
ied.dwData |= g_Settings->bShowTime ? IEEDD_GC_SHOW_TIME : 0;
ied.dwData |= IEEDD_GC_SHOW_ICON;
ied.dwFlags = IEEDF_UNICODE_TEXT | IEEDF_UNICODE_NICK;
+
+ IEVIEWEVENT event = {};
+ event.hwnd = m_hwnd;
+ event.hContact = m_pDlg.m_hContact;
+ event.codepage = CP_ACP;
+ event.iType = IEE_LOG_MEM_EVENTS;
+ event.eventData = &ied;
+ event.count = 1;
CallService(MS_HPP_EG_EVENT, 0, (LPARAM)&event);
}