diff options
-rw-r--r-- | include/delphi/m_message.inc | 8 | ||||
-rw-r--r-- | include/m_message.h | 10 | ||||
-rw-r--r-- | plugins/Scriver/src/globals.cpp | 5 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.cpp | 2 | ||||
-rw-r--r-- | plugins/TabSRMM/src/sendqueue.cpp | 5 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgdialog.cpp | 4 | ||||
-rw-r--r-- | src/core/stdmsg/src/msgs.cpp | 2 |
8 files changed, 20 insertions, 18 deletions
diff --git a/include/delphi/m_message.inc b/include/delphi/m_message.inc index 662171f9ae..112e94ed01 100644 --- a/include/delphi/m_message.inc +++ b/include/delphi/m_message.inc @@ -121,10 +121,10 @@ const MS_MSG_GETWINDOWDATA:PAnsiChar = 'MessageAPI/GetWindowData';
{ wparam=0(unused)
- lparam=(pMessageWindowEvent) event written
- fired when SRMM writes an entered message into the database
+ lparam=(pMessageWindowEvent) event being written
+ fired before SRMM writes an entered message into the database
}
- ME_MSG_WRITEEVENT:PAnsiChar = 'MessageAPI/OnWriteEvent';
+ ME_MSG_PRECREATEEVENT:PAnsiChar = 'MessageAPI/PreCreateEvent';
{ wParam = 0
lParam = (MessageWindowPopupData *)&MessageWindowPopupData;
@@ -158,7 +158,7 @@ type cbSize :int;
seq :int; // number returned by PSS_MESSAGE
hContact :THANDLE;
- hDbEvent :THANDLE; // database event written on the basis of message sent
+ dbei :pDbEventInfo; // database event written on the basis of message sent
end;
// status icons
diff --git a/include/m_message.h b/include/m_message.h index 6d842ebc20..a8258aadfe 100644 --- a/include/m_message.h +++ b/include/m_message.h @@ -109,14 +109,14 @@ typedef struct { //wparam = 0 (unused)
//lparam = (MessageWindowEvent*)
-//fired when SRMM writes an entered message into the database
-#define ME_MSG_WRITEEVENT "MessageAPI/OnWriteEvent"
+//fired before SRMM writes an entered message into the database
+#define ME_MSG_PRECREATEEVENT "MessageAPI/PreCreateEvent"
typedef struct {
- int cbSize;
- int seq; // number returned by PSS_MESSAGE
+ int cbSize;
+ int seq; // number returned by PSS_MESSAGE
HANDLE hContact;
- HANDLE hDbEvent; // database event written on the basis of message sent
+ DBEVENTINFO *dbei; // database event written on the basis of message sent
} MessageWindowEvent;
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index c69337ff02..d9486bba85 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -453,11 +453,12 @@ static int ackevent(WPARAM wParam, LPARAM lParam) if ( !( item->flags & PREF_UTF ))
dbei.cbBlob *= sizeof(TCHAR) + 1;
dbei.pBlob = (PBYTE) item->sendBuffer;
- HANDLE hNewEvent = db_event_add(item->hContact, &dbei);
- MessageWindowEvent evt = { sizeof(evt), (int)item->hSendId, item->hContact, hNewEvent };
+ MessageWindowEvent evt = { sizeof(evt), (int)item->hSendId, item->hContact, &dbei };
NotifyEventHooks(hHookWinWrite, 0, (LPARAM)&evt);
+ db_event_add(item->hContact, &dbei);
+
if (item->hwndErrorDlg != NULL)
DestroyWindow(item->hwndErrorDlg);
diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index 85b8df532d..f98dc86fe8 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -536,7 +536,7 @@ int OnLoadModule(void) hHookWinEvt = CreateHookableEvent(ME_MSG_WINDOWEVENT);
hHookWinPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP);
- hHookWinWrite = CreateHookableEvent(ME_MSG_WRITEEVENT);
+ hHookWinWrite = CreateHookableEvent(ME_MSG_PRECREATEEVENT);
SkinAddNewSoundEx("RecvMsgActive", LPGEN("Instant messages"), LPGEN("Incoming (Focused Window)"));
SkinAddNewSoundEx("RecvMsgInactive", LPGEN("Instant messages"), LPGEN("Incoming (Unfocused Window)"));
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index fd7300789d..0cd43dcef5 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -540,7 +540,7 @@ static void TSAPI InitAPI() PluginConfig.m_event_MsgWin = CreateHookableEvent(ME_MSG_WINDOWEVENT);
PluginConfig.m_event_MsgPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP);
- PluginConfig.m_event_WriteEvent = CreateHookableEvent(ME_MSG_WRITEEVENT);
+ PluginConfig.m_event_WriteEvent = CreateHookableEvent(ME_MSG_PRECREATEEVENT);
}
int LoadSendRecvMessageModule(void)
diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index 62b31a6a57..b6041a8685 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -761,11 +761,12 @@ inform_and_discard: if (m_jobs[iFound].dwFlags & PREF_UTF)
dbei.flags |= DBEF_UTF;
dbei.pBlob = (PBYTE) m_jobs[iFound].sendBuffer;
- hNewEvent = db_event_add(m_jobs[iFound].hOwner, &dbei);
- MessageWindowEvent evt = { sizeof(evt), (int)m_jobs[iFound].hSendId, m_jobs[iFound].hOwner, hNewEvent };
+ MessageWindowEvent evt = { sizeof(evt), (int)m_jobs[iFound].hSendId, m_jobs[iFound].hOwner, &dbei };
NotifyEventHooks(PluginConfig.m_event_WriteEvent, 0, (LPARAM)&evt);
+ hNewEvent = db_event_add(m_jobs[iFound].hOwner, &dbei);
+
if (m_pContainer)
if (!nen_options.iNoSounds && !(m_pContainer->dwFlags & CNT_NOSOUND))
SkinPlaySound("SendMsg");
diff --git a/src/core/stdmsg/src/msgdialog.cpp b/src/core/stdmsg/src/msgdialog.cpp index 009e96b0e9..3caa33806f 100644 --- a/src/core/stdmsg/src/msgdialog.cpp +++ b/src/core/stdmsg/src/msgdialog.cpp @@ -128,11 +128,11 @@ HANDLE SendMessageDirect(const TCHAR *szMsg, HANDLE hContact, char *szProto) dbei.timestamp = (DWORD)time(NULL);
dbei.cbBlob = (DWORD)bufSize;
dbei.pBlob = (PBYTE)sendBuffer;
- HANDLE hNewEvent = db_event_add(hContact, &dbei);
- MessageWindowEvent evt = { sizeof(evt), sendId, hContact, hNewEvent };
+ MessageWindowEvent evt = { sizeof(evt), sendId, hContact, &dbei };
NotifyEventHooks(hHookWinWrite, 0, (LPARAM)&evt);
+ HANDLE hNewEvent = db_event_add(hContact, &dbei);
msgQueue_add(hContact, sendId, szMsg, hNewEvent);
mir_free(sendBuffer);
return hNewEvent;
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 969e049017..97de54f461 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -409,7 +409,7 @@ int LoadSendRecvMessageModule(void) hHookWinEvt = CreateHookableEvent(ME_MSG_WINDOWEVENT);
hHookWinPopup = CreateHookableEvent(ME_MSG_WINDOWPOPUP);
- hHookWinWrite = CreateHookableEvent(ME_MSG_WRITEEVENT);
+ hHookWinWrite = CreateHookableEvent(ME_MSG_PRECREATEEVENT);
SkinAddNewSoundEx("RecvMsgActive", LPGEN("Instant messages"), LPGEN("Incoming (Focused Window)"));
SkinAddNewSoundEx("RecvMsgInactive", LPGEN("Instant messages"), LPGEN("Incoming (Unfocused Window)"));
|