summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-01-26 23:34:30 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-01-26 23:34:30 +0300
commitab3d423b1dc514e9db61c170ca14bab49e5280cb (patch)
treef8c76c7b8cb5ad8804aff7222960126e9180d66c /src
parent395ecbc7e8f02c0ea659a598e5f9bab8995f3451 (diff)
major atavism, PROTORECVEVENT, died with its own set of constants
Diffstat (limited to 'src')
-rw-r--r--src/core/stdmsg/src/cmdlist.cpp2
-rw-r--r--src/core/stdmsg/src/msgs.cpp2
-rw-r--r--src/mir_app/src/db_events.cpp3
-rw-r--r--src/mir_app/src/mir_app.def6
-rw-r--r--src/mir_app/src/mir_app64.def6
-rw-r--r--src/mir_app/src/proto_chains.cpp2
-rw-r--r--src/mir_app/src/proto_interface.cpp36
-rw-r--r--src/mir_app/src/proto_internal.cpp12
-rw-r--r--src/mir_app/src/protocols.cpp16
9 files changed, 32 insertions, 53 deletions
diff --git a/src/core/stdmsg/src/cmdlist.cpp b/src/core/stdmsg/src/cmdlist.cpp
index 40aeeb1fb1..ab90a67a1f 100644
--- a/src/core/stdmsg/src/cmdlist.cpp
+++ b/src/core/stdmsg/src/cmdlist.cpp
@@ -91,7 +91,7 @@ void msgQueue_processack(MCONTACT hContact, int id, BOOL success, LPARAM lParam)
DBEVENTINFO dbei = {};
dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.flags = DBEF_SENT | DBEF_UTF | (p->flags & PREF_RTL ? DBEF_RTL : 0);
+ dbei.flags = DBEF_SENT | DBEF_UTF | (p->flags & DBEF_RTL ? DBEF_RTL : 0);
dbei.szModule = Proto_GetBaseAccountName(hContact);
dbei.timestamp = time(0);
dbei.cbBlob = (uint32_t)(mir_strlen(p->szMsg) + 1);
diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp
index 7e084916fa..88d2beccff 100644
--- a/src/core/stdmsg/src/msgs.cpp
+++ b/src/core/stdmsg/src/msgs.cpp
@@ -36,7 +36,7 @@ int SendMessageDirect(MCONTACT hContact, MEVENT hEvent, const wchar_t *szMsg)
int flags = 0;
if (Utils_IsRtl(szMsg))
- flags |= PREF_RTL;
+ flags |= DBEF_RTL;
T2Utf sendBuffer(szMsg);
if (!mir_strlen(sendBuffer))
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp
index f8e34191de..45936d8900 100644
--- a/src/mir_app/src/db_events.cpp
+++ b/src/mir_app/src/db_events.cpp
@@ -264,7 +264,8 @@ DB::EventInfo::EventInfo() :
DB::EventInfo::~EventInfo()
{
- mir_free(pBlob);
+ if (bValid)
+ mir_free(pBlob);
}
bool DB::EventInfo::fetch(MEVENT hEvent, bool bFetchBlob)
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 7ebde24f72..42d8f60e6c 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -34,7 +34,7 @@ Button_SetSkin_IcoLib @24
?AddToList@PROTO_INTERFACE@@UAEIHPAUPROTOSEARCHRESULT@@@Z @34 NONAME
?AddToListByEvent@PROTO_INTERFACE@@UAEIHHI@Z @35 NONAME
?AuthDeny@PROTO_INTERFACE@@UAEHIPB_W@Z @36 NONAME
-?AuthRecv@PROTO_INTERFACE@@UAEHIPAUPROTORECVEVENT@@@Z @37 NONAME
+?AuthRecv@PROTO_INTERFACE@@UAEHIAAVEventInfo@DB@@@Z @37 NONAME
?AuthRequest@PROTO_INTERFACE@@UAEHIPB_W@Z @38 NONAME
?Authorize@PROTO_INTERFACE@@UAEHI@Z @39 NONAME
?CreateExtendedSearchUI@PROTO_INTERFACE@@UAEPAUHWND__@@PAU2@@Z @40 NONAME
@@ -53,9 +53,9 @@ Button_SetSkin_IcoLib @24
?OnProtoCheckOnline@CProtoIntDlgBase@@MAEXIJ@Z @54 NONAME
?OnProtoRefresh@CProtoIntDlgBase@@MAEXIJ@Z @55 NONAME
?ProtoBroadcastAck@PROTO_INTERFACE@@QAEHIHHPAXJ@Z @56 NONAME
-?RecvContacts@PROTO_INTERFACE@@UAEHIPAUPROTORECVEVENT@@@Z @58 NONAME
+?RecvContacts@PROTO_INTERFACE@@UAEHIAAVEventInfo@DB@@@Z @57 NONAME
?RecvFile@PROTO_INTERFACE@@UAEIIAAVFILE_BLOB@DB@@AAVEventInfo@3@@Z @59 NONAME
-?RecvMsg@PROTO_INTERFACE@@UAEIIPAUPROTORECVEVENT@@@Z @60 NONAME
+?RecvMsg@PROTO_INTERFACE@@UAEIIAAVEventInfo@DB@@@Z @60 NONAME
?SearchAdvanced@PROTO_INTERFACE@@UAEPAXPAUHWND__@@@Z @62 NONAME
?SearchBasic@PROTO_INTERFACE@@UAEPAXPB_W@Z @63 NONAME
?SearchByEmail@PROTO_INTERFACE@@UAEPAXPB_W@Z @64 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 6de004a53d..7274527130 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -34,7 +34,7 @@ Button_SetSkin_IcoLib @24
?AddToList@PROTO_INTERFACE@@UEAAIHPEAUPROTOSEARCHRESULT@@@Z @34 NONAME
?AddToListByEvent@PROTO_INTERFACE@@UEAAIHHI@Z @35 NONAME
?AuthDeny@PROTO_INTERFACE@@UEAAHIPEB_W@Z @36 NONAME
-?AuthRecv@PROTO_INTERFACE@@UEAAHIPEAUPROTORECVEVENT@@@Z @37 NONAME
+?AuthRecv@PROTO_INTERFACE@@UEAAHIAEAVEventInfo@DB@@@Z @37 NONAME
?AuthRequest@PROTO_INTERFACE@@UEAAHIPEB_W@Z @38 NONAME
?Authorize@PROTO_INTERFACE@@UEAAHI@Z @39 NONAME
?CreateExtendedSearchUI@PROTO_INTERFACE@@UEAAPEAUHWND__@@PEAU2@@Z @40 NONAME
@@ -53,9 +53,9 @@ Button_SetSkin_IcoLib @24
?OnProtoCheckOnline@CProtoIntDlgBase@@MEAAX_K_J@Z @54 NONAME
?OnProtoRefresh@CProtoIntDlgBase@@MEAAX_K_J@Z @55 NONAME
?ProtoBroadcastAck@PROTO_INTERFACE@@QEAA_JIHHPEAX_J@Z @56 NONAME
-?RecvContacts@PROTO_INTERFACE@@UEAAHIPEAUPROTORECVEVENT@@@Z @58 NONAME
+?RecvContacts@PROTO_INTERFACE@@UEAAHIAEAVEventInfo@DB@@@Z @57 NONAME
?RecvFile@PROTO_INTERFACE@@UEAAIIAEAVFILE_BLOB@DB@@AEAVEventInfo@3@@Z @59 NONAME
-?RecvMsg@PROTO_INTERFACE@@UEAAIIPEAUPROTORECVEVENT@@@Z @60 NONAME
+?RecvMsg@PROTO_INTERFACE@@UEAAIIAEAVEventInfo@DB@@@Z @60 NONAME
?SearchAdvanced@PROTO_INTERFACE@@UEAAPEAXPEAUHWND__@@@Z @62 NONAME
?SearchBasic@PROTO_INTERFACE@@UEAAPEAXPEB_W@Z @63 NONAME
?SearchByEmail@PROTO_INTERFACE@@UEAAPEAXPEB_W@Z @64 NONAME
diff --git a/src/mir_app/src/proto_chains.cpp b/src/mir_app/src/proto_chains.cpp
index 315ad6ff2b..cd937f23fc 100644
--- a/src/mir_app/src/proto_chains.cpp
+++ b/src/mir_app/src/proto_chains.cpp
@@ -62,7 +62,7 @@ MIR_APP_DLL(INT_PTR) Proto_ChainSend(int iOrder, CCSDATA *ccs)
for (int i = iOrder; i < g_arFilters.getCount(); i++) {
if ((ret = CallProtoService(g_arFilters[i]->szName, ccs->szProtoService, i + 1, LPARAM(ccs))) != CALLSERVICE_NOTFOUND) {
- //chain was started, exit
+ // chain was started, exit
return ret;
}
}
diff --git a/src/mir_app/src/proto_interface.cpp b/src/mir_app/src/proto_interface.cpp
index 76b7b17778..83c4f994f1 100644
--- a/src/mir_app/src/proto_interface.cpp
+++ b/src/mir_app/src/proto_interface.cpp
@@ -134,7 +134,7 @@ int PROTO_INTERFACE::AuthDeny(MEVENT, const wchar_t*)
return 1; // error
}
-int PROTO_INTERFACE::AuthRecv(MCONTACT, PROTORECVEVENT*)
+int PROTO_INTERFACE::AuthRecv(MCONTACT, DB::EventInfo&)
{
return 1; // error
}
@@ -199,7 +199,7 @@ MWindow PROTO_INTERFACE::CreateExtendedSearchUI(MWindow)
return nullptr; // error
}
-int PROTO_INTERFACE::RecvContacts(MCONTACT, PROTORECVEVENT*)
+int PROTO_INTERFACE::RecvContacts(MCONTACT, DB::EventInfo &)
{
return 1; // error
}
@@ -209,37 +209,19 @@ MEVENT PROTO_INTERFACE::RecvFile(MCONTACT hContact, DB::FILE_BLOB &blob, DB::Eve
return Proto_RecvFile(hContact, blob, dbei);
}
-MEVENT PROTO_INTERFACE::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
+MEVENT PROTO_INTERFACE::RecvMsg(MCONTACT hContact, DB::EventInfo &dbei)
{
- if (pre->szMessage == nullptr)
- return 0;
-
- DBEVENTINFO dbei = {};
- dbei.flags = DBEF_UTF;
+ dbei.flags |= DBEF_UTF;
dbei.szModule = Proto_GetBaseAccountName(hContact);
- dbei.timestamp = pre->timestamp;
dbei.eventType = EVENTTYPE_MESSAGE;
- dbei.cbBlob = (uint32_t)mir_strlen(pre->szMessage) + 1;
- dbei.pBlob = pre->szMessage;
- dbei.szUserId = pre->szUserId;
- dbei.szReplyId = pre->szReplyId;
-
- if (pre->flags & PREF_CREATEREAD)
- dbei.flags |= DBEF_READ;
- if (pre->flags & PREF_SENT)
- dbei.flags |= DBEF_SENT;
- if (pre->flags & PREF_ENCRYPTED)
- dbei.flags |= DBEF_SECURE;
- if (pre->flags & PREF_ENCRYPTED_STRONG)
- dbei.flags |= DBEF_STRONG;
+ dbei.cbBlob = (uint32_t)mir_strlen(dbei.pBlob) + 1;
// if it's possible to find an existing event by its id, do that
- if ((GetCaps(PFLAGNUM_4) & PF4_SERVERMSGID) && pre->szMsgId != nullptr) {
- MEVENT hDbEvent = db_event_getById(m_szModuleName, pre->szMsgId);
- if (hDbEvent == 0 || db_event_edit(hDbEvent, &dbei)) {
- dbei.szId = pre->szMsgId;
+ if ((GetCaps(PFLAGNUM_4) & PF4_SERVERMSGID) && dbei.szId != nullptr) {
+ MEVENT hDbEvent = db_event_getById(m_szModuleName, dbei.szId);
+ if (hDbEvent == 0 || db_event_edit(hDbEvent, &dbei))
hDbEvent = db_event_add(hContact, &dbei);
- }
+
return hDbEvent;
}
diff --git a/src/mir_app/src/proto_internal.cpp b/src/mir_app/src/proto_internal.cpp
index d70491b902..50fa594489 100644
--- a/src/mir_app/src/proto_internal.cpp
+++ b/src/mir_app/src/proto_internal.cpp
@@ -58,9 +58,9 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return (int)ProtoCallService(m_szModuleName, PS_AUTHDENY, hDbEvent, _T2A(szReason));
}
- int AuthRecv(MCONTACT hContact, PROTORECVEVENT *evt) override
+ int AuthRecv(MCONTACT hContact, DB::EventInfo &dbei) override
{
- CCSDATA ccs = { hContact, PSR_AUTH, 0, (LPARAM)evt };
+ CCSDATA ccs = { hContact, PSR_AUTH, 0, (LPARAM)&dbei };
return (int)ProtoCallService(m_szModuleName, PSR_AUTH, 0, (LPARAM)&ccs);
}
@@ -169,9 +169,9 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return (HWND)ProtoCallService(m_szModuleName, PS_CREATEADVSEARCHUI, 0, (LPARAM)owner);
}
- int RecvContacts(MCONTACT hContact, PROTORECVEVENT* evt) override
+ int RecvContacts(MCONTACT hContact, DB::EventInfo &dbei) override
{
- CCSDATA ccs = { hContact, PSR_CONTACTS, 0, (LPARAM)evt };
+ CCSDATA ccs = { hContact, PSR_CONTACTS, 0, (LPARAM)&dbei };
return (int)ProtoCallService(m_szModuleName, PSR_CONTACTS, 0, (LPARAM)&ccs);
}
@@ -181,9 +181,9 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return ProtoCallService(m_szModuleName, PSR_FILE, 0, (LPARAM)&ccs);
}
- MEVENT RecvMsg(MCONTACT hContact, PROTORECVEVENT* evt) override
+ MEVENT RecvMsg(MCONTACT hContact, DB::EventInfo &dbei) override
{
- CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)evt };
+ CCSDATA ccs = { hContact, PSR_MESSAGE, 0, (LPARAM)&dbei };
INT_PTR res = ProtoCallService(m_szModuleName, PSR_MESSAGE, 0, (LPARAM)&ccs);
return (res == CALLSERVICE_NOTFOUND) ? -1 : (int)res;
}
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp
index 0bf7bcf8da..563d9272e7 100644
--- a/src/mir_app/src/protocols.cpp
+++ b/src/mir_app/src/protocols.cpp
@@ -169,18 +169,14 @@ MIR_APP_DLL(const char*) Proto_GetUniqueId(const char *szModuleName)
/////////////////////////////////////////////////////////////////////////////////////////
// Basic core services
-MIR_APP_DLL(MEVENT) Proto_AuthRecv(const char *szProtoName, PROTORECVEVENT *pcre)
+MIR_APP_DLL(MEVENT) Proto_AuthRecv(const char *szProtoName, DB::EventInfo &dbei)
{
- if (szProtoName == nullptr || pcre == nullptr)
+ if (szProtoName == nullptr)
return 0;
- DBEVENTINFO dbei = {};
dbei.szModule = (char*)szProtoName;
- dbei.timestamp = pcre->timestamp;
- dbei.flags = DBEF_UTF | pcre->flags & (PREF_CREATEREAD ? DBEF_READ : 0);
+ dbei.flags |= DBEF_UTF;
dbei.eventType = EVENTTYPE_AUTHREQUEST;
- dbei.cbBlob = pcre->lParam;
- dbei.pBlob = pcre->szMessage;
return db_event_add(0, &dbei);
}
@@ -390,7 +386,7 @@ INT_PTR CallContactServiceInt(MCONTACT hContact, const char *szModule, const cha
case 2: return (INT_PTR)ppi->AddToListByEvent(LOWORD(wParam), HIWORD(wParam), (MEVENT)lParam);
case 3: return (INT_PTR)ppi->Authorize((MEVENT)wParam);
case 4: return (INT_PTR)ppi->AuthDeny((MEVENT)wParam, (wchar_t *)lParam);
- case 5: return (INT_PTR)ppi->AuthRecv(hContact, (PROTORECVEVENT *)lParam);
+ case 5: return (INT_PTR)ppi->AuthRecv(hContact, *(DB::EventInfo*)lParam);
case 6: return (INT_PTR)ppi->AuthRequest(hContact, (wchar_t *)lParam);
case 8: return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (wchar_t *)lParam);
case 9: return (INT_PTR)ppi->FileCancel(hContact, (HANDLE)wParam);
@@ -413,9 +409,9 @@ INT_PTR CallContactServiceInt(MCONTACT hContact, const char *szModule, const cha
}
case 18: return (INT_PTR)ppi->SearchAdvanced((HWND)lParam);
case 19: return (INT_PTR)ppi->CreateExtendedSearchUI((HWND)lParam);
- case 20: return (INT_PTR)ppi->RecvContacts(hContact, (PROTORECVEVENT *)lParam);
+ case 20: return (INT_PTR)ppi->RecvContacts(hContact, *(DB::EventInfo *)lParam);
case 21: return (INT_PTR)ppi->RecvFile(hContact, *(DB::FILE_BLOB *)wParam, *(DB::EventInfo *)lParam);
- case 22: return (INT_PTR)ppi->RecvMsg(hContact, (PROTORECVEVENT *)lParam);
+ case 22: return (INT_PTR)ppi->RecvMsg(hContact, *(DB::EventInfo *)lParam);
case 23: return (INT_PTR)ppi->SendContacts(hContact, LOWORD(wParam), HIWORD(wParam), (MCONTACT *)lParam);
case 24: return (INT_PTR)ppi->SendFile(hContact, (wchar_t *)wParam, (wchar_t **)lParam);
case 25: