From ab3d423b1dc514e9db61c170ca14bab49e5280cb Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 26 Jan 2024 23:34:30 +0300 Subject: major atavism, PROTORECVEVENT, died with its own set of constants --- include/delphi/m_protosvc.inc | 10 ---------- include/m_protoint.h | 6 +++--- include/m_protosvc.h | 32 ++++---------------------------- 3 files changed, 7 insertions(+), 41 deletions(-) (limited to 'include') diff --git a/include/delphi/m_protosvc.inc b/include/delphi/m_protosvc.inc index de4c151296..a8650ebfe5 100644 --- a/include/delphi/m_protosvc.inc +++ b/include/delphi/m_protosvc.inc @@ -176,16 +176,6 @@ type // they put there will be retained by anyone trying to save this structure. end; - PPROTORECVEVENT = ^TPROTORECVEVENT; - TPROTORECVEVENT = record - flags : dword; - timestamp : dword; - szMessage : TChar; - lParam : LPARAM; - szUserId : PAnsiChar; // user id of event - szReplyId : PAnsiChar; // reply id of event - end; - const { wParam : PFLAGNUM_* (see above) diff --git a/include/m_protoint.h b/include/m_protoint.h index a3df748937..0bf9f73a62 100644 --- a/include/m_protoint.h +++ b/include/m_protoint.h @@ -217,7 +217,7 @@ public: virtual int Authorize(MEVENT hDbEvent); virtual int AuthDeny(MEVENT hDbEvent, const wchar_t *szReason); - virtual int AuthRecv(MCONTACT hContact, PROTORECVEVENT *); + virtual int AuthRecv(MCONTACT hContact, DB::EventInfo &dbei); virtual int AuthRequest(MCONTACT hContact, const wchar_t *szMessage); virtual HANDLE FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *szPath); @@ -234,9 +234,9 @@ public: virtual HANDLE SearchAdvanced(MWindow owner); virtual MWindow CreateExtendedSearchUI(MWindow owner); - virtual int RecvContacts(MCONTACT hContact, PROTORECVEVENT *); + virtual int RecvContacts(MCONTACT hContact, DB::EventInfo &dbei); virtual MEVENT RecvFile(MCONTACT hContact, DB::FILE_BLOB &blob, DB::EventInfo &dbei); - virtual MEVENT RecvMsg(MCONTACT hContact, PROTORECVEVENT *); + virtual MEVENT RecvMsg(MCONTACT hContact, DB::EventInfo &dbei); virtual int SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList); virtual HANDLE SendFile(MCONTACT hContact, const wchar_t *szDescription, wchar_t **ppszFiles); diff --git a/include/m_protosvc.h b/include/m_protosvc.h index a1f1a6a193..64d31b6aa8 100644 --- a/include/m_protosvc.h +++ b/include/m_protosvc.h @@ -666,42 +666,18 @@ struct PROTOFILERESUME // just want to know the final result should hook. // In all cases, the database should store what the user read/wrote. -// An instant message has been received -// wParam = 0 -// lParam = (LPARAM)(PROTORECVEVENT*)&pre -// DB event: EVENTTYPE_MESSAGE, blob contains szMessage without 0 terminator -// Return 0 - success, other failure - -#define PREF_CREATEREAD 1 // create the database event with the 'read' flag set -#define PREF_RTL 4 // 0.5+ addition: support for right-to-left messages -#define PREF_SENT 16 // message will be created with the DBEF_SENT flag -#define PREF_ENCRYPTED 32 // message is encrypted -#define PREF_ENCRYPTED_STRONG 64 // message is encrypted with verified key - -struct PROTORECVEVENT -{ - uint32_t flags; // combination of PREF_* - uint32_t timestamp; // unix time - char* szMessage; // message body in utf8 - LPARAM lParam; // extra space for the network level protocol module - const char* szMsgId; // server message id, optional, should be NULL otherwise - // ignored for protocols without PF4_SERVERMSGID in GetCaps() - const char *szUserId; // user id, for group chats stored in the database - const char *szReplyId; // this message is a reply to a message with that server id -}; - /////////////////////////////////////////////////////////////////////////////// // Proto/RecvMessage -// Copies a message from a PROTORECVEVENT event into the database +// Copies a message from a DB::EventInfo event into the database // wParam = 0 (unused) // lParam = CCSDATA* // Returns the result of db_event_add() #define PSR_MESSAGE "/RecvMessage" -__forceinline INT_PTR ProtoChainRecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) +__forceinline INT_PTR ProtoChainRecvMsg(MCONTACT hContact, const DB::EventInfo &dbei) { - CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)pre }; + CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)&dbei }; return Proto_ChainRecv(0, &ccs); } @@ -715,7 +691,7 @@ __forceinline INT_PTR ProtoChainRecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) #define PSR_AUTH "/RecvAuth" // adds the standard EVENTTYPE_AUTHREQUEST event to the database -EXTERN_C MIR_APP_DLL(MEVENT) Proto_AuthRecv(const char *szProtoName, PROTORECVEVENT *pcre); +EXTERN_C MIR_APP_DLL(MEVENT) Proto_AuthRecv(const char *szProtoName, DB::EventInfo &dbei); /////////////////////////////////////////////////////////////////////////////// // File(s) have been received -- cgit v1.2.3