summaryrefslogtreecommitdiff
path: root/protocols/Discord/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Discord/src')
-rw-r--r--protocols/Discord/src/dispatch.cpp6
-rw-r--r--protocols/Discord/src/proto.cpp10
2 files changed, 6 insertions, 10 deletions
diff --git a/protocols/Discord/src/dispatch.cpp b/protocols/Discord/src/dispatch.cpp
index 4f2d25d35d..6cdef5e4de 100644
--- a/protocols/Discord/src/dispatch.cpp
+++ b/protocols/Discord/src/dispatch.cpp
@@ -390,9 +390,8 @@ void CDiscordProto::OnCommandMessage(const JSONNode &pRoot, bool bIsNew)
if (!bIsNew) {
MEVENT hOldEvent = db_event_getById(m_szModuleName, szMsgId);
if (hOldEvent) {
- DBEVENTINFO dbei = {};
- dbei.cbBlob = db_event_getBlobSize(hOldEvent);
- dbei.pBlob = (BYTE*)mir_alloc(dbei.cbBlob);
+ DB::EventInfo dbei;
+ dbei.cbBlob = -1;
if (!db_event_get(hOldEvent, &dbei)) {
ptrW wszOldText(DbEvent_GetTextW(&dbei, CP_UTF8));
if (wszOldText)
@@ -400,7 +399,6 @@ void CDiscordProto::OnCommandMessage(const JSONNode &pRoot, bool bIsNew)
if (dbei.flags & DBEF_SENT)
bOurMessage = true;
}
- mir_free(dbei.pBlob);
}
}
diff --git a/protocols/Discord/src/proto.cpp b/protocols/Discord/src/proto.cpp
index c8304b6375..e5a62df682 100644
--- a/protocols/Discord/src/proto.cpp
+++ b/protocols/Discord/src/proto.cpp
@@ -374,9 +374,8 @@ int CDiscordProto::AuthRecv(MCONTACT, PROTORECVEVENT *pre)
int CDiscordProto::Authorize(MEVENT hDbEvent)
{
- DBEVENTINFO dbei = {};
- if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1)) return 1;
- if ((dbei.pBlob = (PBYTE)alloca(dbei.cbBlob)) == nullptr) return 1;
+ DB::EventInfo dbei;
+ dbei.cbBlob = -1;
if (db_event_get(hDbEvent, &dbei)) return 1;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return 1;
if (mir_strcmp(dbei.szModule, m_szModuleName)) return 1;
@@ -390,9 +389,8 @@ int CDiscordProto::Authorize(MEVENT hDbEvent)
int CDiscordProto::AuthDeny(MEVENT hDbEvent, const wchar_t*)
{
- DBEVENTINFO dbei = {};
- if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1)) return 1;
- if ((dbei.pBlob = (PBYTE)alloca(dbei.cbBlob)) == nullptr) return 1;
+ DB::EventInfo dbei;
+ dbei.cbBlob = -1;
if (db_event_get(hDbEvent, &dbei)) return 1;
if (dbei.eventType != EVENTTYPE_AUTHREQUEST) return 1;
if (mir_strcmp(dbei.szModule, m_szModuleName)) return 1;