From 010952c5c2dde278a024f6876e8189b949ea5dcf Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 19 Jan 2024 15:44:57 +0300 Subject: the ancient atavism extincted: PROTORECVFILE structure with its own set of flags --- include/m_database.h | 4 ++++ include/m_protoint.h | 2 +- include/m_protosvc.h | 26 +++----------------------- 3 files changed, 8 insertions(+), 24 deletions(-) (limited to 'include') diff --git a/include/m_database.h b/include/m_database.h index 7620c8b07d..55e24ff97e 100644 --- a/include/m_database.h +++ b/include/m_database.h @@ -712,14 +712,17 @@ namespace DB ptrW m_wszFileName, m_wszDescription, m_wszLocalName; ptrA m_szProtoString; int64_t m_iFileSize = -1, m_iTransferred = -1; + void *m_pUserInfo = 0; public: + explicit FILE_BLOB(void *pUserInfo, const char *pszName, const char *pszDescr = nullptr, bool bUtf = true); explicit FILE_BLOB(const wchar_t *pwszName, const wchar_t *pwszDescr = nullptr); explicit FILE_BLOB(const EventInfo &dbei); ~FILE_BLOB(); void write(EventInfo &dbei); + __forceinline void* getUserInfo() const { return m_pUserInfo; } __forceinline const char* getUrl() const { return m_szProtoString; } __forceinline const wchar_t* getLocalName() const { return m_wszLocalName; } __forceinline const wchar_t* getName() const { return m_wszFileName; } @@ -736,6 +739,7 @@ namespace DB __forceinline void setName(const wchar_t *pszFileName) { m_wszFileName = mir_wstrdup(pszFileName); } __forceinline void setSize(int64_t iSize) { m_iFileSize = iSize; } __forceinline void setLocalName(const wchar_t *pszFileName) { m_wszLocalName = mir_wstrdup(pszFileName); } + __forceinline void setUserInfo(void *pUserInfo) { m_pUserInfo = pUserInfo; } }; ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/include/m_protoint.h b/include/m_protoint.h index 51eb352f22..09f31ef992 100644 --- a/include/m_protoint.h +++ b/include/m_protoint.h @@ -235,7 +235,7 @@ public: virtual MWindow CreateExtendedSearchUI(MWindow owner); virtual int RecvContacts(MCONTACT hContact, PROTORECVEVENT *); - virtual MEVENT RecvFile(MCONTACT hContact, PROTORECVFILE *); + virtual MEVENT RecvFile(MCONTACT hContact, DB::FILE_BLOB &blob, DB::EventInfo &dbei); virtual MEVENT RecvMsg(MCONTACT hContact, PROTORECVEVENT *); virtual int SendContacts(MCONTACT hContact, int flags, int nContacts, MCONTACT *hContactsList); diff --git a/include/m_protosvc.h b/include/m_protosvc.h index 74626d3c0c..01eae97a2c 100644 --- a/include/m_protosvc.h +++ b/include/m_protosvc.h @@ -31,6 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_PROTOSVC_H__ #define M_PROTOSVC_H__ 1 +#include "m_database.h" #include "m_protocols.h" #include "m_utils.h" @@ -759,33 +760,12 @@ EXTERN_C MIR_APP_DLL(MEVENT) Proto_AuthRecv(const char *szProtoName, PROTORECVEV /////////////////////////////////////////////////////////////////////////////// // File(s) have been received -// wParam = 0 -// lParam = (LPARAM)(PROTORECVFILE*)&prf - -#define PRFF_UNICODE 0x0001 // in all MAllCStrings .w is valid -#define PRFF_UTF 0x0002 // in all MAllCStrings .a contains text in UTF8 -#define PRFF_SILENT 0x0004 // do not show file send/receive dialog -#define PRFF_SENT 0x0008 // this is an outgoing file -#define PRFF_READ 0x0010 // this event is marked read - -struct PROTORECVFILE -{ - uint32_t dwFlags; // PRFF_* - uint32_t timestamp; // unix time - MAllCStrings descr; // file description - int fileCount; // number of files being transferred - MAllCStringArray files; // array of file names - void *pUserInfo; // extra space for the network level protocol module - const char *szId; // server message id - const char *szUserId; // groupchat user id - const char *szReplyId; // this message is a reply to a message with that server id -}; #define PSR_FILE "/RecvFile" -__forceinline INT_PTR ProtoChainRecvFile(MCONTACT hContact, PROTORECVFILE *pre) +__forceinline INT_PTR ProtoChainRecvFile(MCONTACT hContact, const DB::FILE_BLOB &blob, const DB::EventInfo &dbei) { - CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)pre }; + CCSDATA ccs = { hContact, PSR_FILE, (WPARAM)&blob, (LPARAM)&dbei }; return Proto_ChainRecv(0, &ccs); } -- cgit v1.2.3