summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2023-04-11 17:07:04 +0300
committerGeorge Hazan <ghazan@miranda.im>2023-04-11 17:07:04 +0300
commit8f9292d483fcf3a10d9284512359c4562f5311eb (patch)
tree3593ca1eb6a5a4c3b2ef454fa6b4944d4b8da8c4 /include
parent5f4f070347d20fc85b588138217aa744141e8053 (diff)
DB::FILE_BLOB - file events' access unification
Diffstat (limited to 'include')
-rw-r--r--include/m_database.h27
-rw-r--r--include/m_db_int.h6
2 files changed, 27 insertions, 6 deletions
diff --git a/include/m_database.h b/include/m_database.h
index 157046603f..59c0dacb82 100644
--- a/include/m_database.h
+++ b/include/m_database.h
@@ -294,7 +294,7 @@ EXTERN_C MIR_CORE_DLL(int) db_event_delete(MEVENT hDbEvent, bool bFromServer = f
// Edits an event in the database
// Returns 0 on success, or nonzero on error
-EXTERN_C MIR_CORE_DLL(int) db_event_edit(MCONTACT hContact, MEVENT hDbEvent, const DBEVENTINFO *dbei);
+EXTERN_C MIR_CORE_DLL(int) db_event_edit(MEVENT hDbEvent, const DBEVENTINFO *dbei);
// Tries to find an event by its id if present
// if an event is found, it's edited, otherwise a new event is added
@@ -694,11 +694,30 @@ namespace DB
};
/////////////////////////////////////////////////////////////////////////////////////////
- // Helper to process the auth req body
- // blob is: 0(uint32_t), hContact(uint32_t), nick(UTF8), firstName(UTF8), lastName(UTF8), email(UTF8), reason(UTF8)
+ // Helper for file transfer events
+ #pragma warning(push)
#pragma warning(disable : 4251)
+ class MIR_APP_EXPORT FILE_BLOB : public MNonCopyable
+ {
+ ptrW m_wszFileName, m_wszDescription;
+
+ public:
+ 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 const wchar_t* getName() const { return m_wszFileName; }
+ __forceinline const wchar_t* getDescr() const { return m_wszDescription; }
+ };
+
+ /////////////////////////////////////////////////////////////////////////////////////////
+ // Helper to process the auth req body
+ // blob is: 0(uint32_t), hContact(uint32_t), nick(UTF8), firstName(UTF8), lastName(UTF8), email(UTF8), reason(UTF8)
+
class MIR_APP_EXPORT AUTH_BLOB
{
MCONTACT m_hContact;
@@ -729,6 +748,8 @@ namespace DB
__forceinline void set_uin(uint32_t dwValue) { m_dwUin = dwValue; }
};
+ #pragma warning(pop)
+
/////////////////////////////////////////////////////////////////////////////////////////
// Event cursors
diff --git a/include/m_db_int.h b/include/m_db_int.h
index 661ad565f4..7c1e5f2461 100644
--- a/include/m_db_int.h
+++ b/include/m_db_int.h
@@ -122,7 +122,7 @@ interface MIR_APP_EXPORT MIDatabase
STDMETHOD_(int, GetEventCount)(MCONTACT contactID) PURE;
STDMETHOD_(MEVENT, AddEvent)(MCONTACT contactID, const DBEVENTINFO *dbe) PURE;
STDMETHOD_(BOOL, DeleteEvent)(MEVENT hDbEvent) PURE;
- STDMETHOD_(BOOL, EditEvent)(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO *dbe) PURE;
+ STDMETHOD_(BOOL, EditEvent)(MEVENT hDbEvent, const DBEVENTINFO *dbe) PURE;
STDMETHOD_(int, GetBlobSize)(MEVENT hDbEvent) PURE;
STDMETHOD_(BOOL, GetEvent)(MEVENT hDbEvent, DBEVENTINFO *dbe) PURE;
STDMETHOD_(BOOL, MarkEventRead)(MCONTACT contactID, MEVENT hDbEvent) PURE;
@@ -170,7 +170,7 @@ interface MIR_APP_EXPORT MIDatabase
/////////////////////////////////////////////////////////////////////////////////////////
#pragma warning(push)
-#pragma warning(disable:4275)
+#pragma warning(disable:4275 4251)
struct MICryptoEngine;
struct CRYPTO_PROVIDER;
@@ -284,7 +284,7 @@ public:
////////////////////////////////////////////////////////////////////////////////////////
STDMETHODIMP_(MEVENT) AddEvent(MCONTACT, const DBEVENTINFO*) override;
STDMETHODIMP_(BOOL) DeleteEvent(MEVENT) override;
- STDMETHODIMP_(BOOL) EditEvent(MCONTACT contactID, MEVENT hDbEvent, const DBEVENTINFO *dbe) override;
+ STDMETHODIMP_(BOOL) EditEvent(MEVENT hDbEvent, const DBEVENTINFO *dbe) override;
STDMETHODIMP_(int) GetBlobSize(MEVENT) override;
STDMETHODIMP_(BOOL) MarkEventRead(MCONTACT, MEVENT) override;
STDMETHODIMP_(MCONTACT) GetEventContact(MEVENT) override;