diff options
author | George Hazan <george.hazan@gmail.com> | 2024-05-12 16:23:20 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-05-12 16:23:20 +0300 |
commit | 59c6a809e3137b088062f244f2f114e150bedd5a (patch) | |
tree | be0a1644b9a65ad3ba8299769fcabba5a684809b /src/mir_app | |
parent | ae5c72cf0e6e7b287d7cf77fb83cacd017ee2b58 (diff) |
merge commit
Diffstat (limited to 'src/mir_app')
-rw-r--r-- | src/mir_app/src/chat_svc.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/db_events.cpp | 25 | ||||
-rw-r--r-- | src/mir_app/src/mir_app.def | 2 | ||||
-rw-r--r-- | src/mir_app/src/mir_app64.def | 2 |
4 files changed, 26 insertions, 5 deletions
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index 68a50b8fc3..f644cdbeaf 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -442,8 +442,6 @@ static void AddUser(SESSION_INFO *si, GCEVENT &gce) if (gce.bIsMe)
si->pMe = ui;
- ui->Status = status;
- ui->Status |= si->pStatuses->iStatus;
if (si->pDlg)
si->pDlg->UpdateNickList();
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index 992f4422f2..a3a22b56bf 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -272,6 +272,8 @@ DB::EventInfo& DB::EventInfo::operator=(MEVENT hEvent) DB::EventInfo::~EventInfo()
{
+ delete m_json;
+
if (m_bValid)
mir_free(pBlob);
}
@@ -280,7 +282,12 @@ bool DB::EventInfo::fetch(bool bFetchBlob) {
if (bFetchBlob)
cbBlob = -1;
- return m_bValid = ::db_event_get(m_hEvent, this) == 0;
+
+ if (m_bValid = ::db_event_get(m_hEvent, this) == 0)
+ if ((flags & DBEF_JSON) && pBlob)
+ m_json = new JSONNode(JSONNode::parse((const char *)pBlob));
+
+ return m_bValid;
}
void DB::EventInfo::unload()
@@ -341,6 +348,18 @@ wchar_t* DB::EventInfo::getString(const char *str) const return mir_a2u(str);
}
+JSONNode& DB::EventInfo::setJson()
+{
+ if (!(flags & DBEF_JSON)) {
+ if (m_json == nullptr)
+ m_json = new JSONNode(JSONNode::parse((const char*)pBlob));
+
+ flags |= DBEF_JSON;
+ }
+
+ return *m_json;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// File blob helper
@@ -357,8 +376,8 @@ DB::FILE_BLOB::FILE_BLOB(const wchar_t *pwszName, const wchar_t *pwszDescr) : DB::FILE_BLOB::FILE_BLOB(const DB::EventInfo &dbei)
{
- JSONNode root = JSONNode::parse((const char *)dbei.pBlob);
- if (root) {
+ auto &root = dbei.getJson();
+ if (&root) {
m_wszFileName = root["f"].as_mstring().Detach();
m_wszDescription = root["d"].as_mstring().Detach();
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 33fdcbda22..3b8d298865 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -971,3 +971,5 @@ _Netlib_DownloadFile@20 @1099 NONAME ?GetPreviewPath@PROTO_INTERFACE@@QBE?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@XZ @1107 NONAME
g_hevEventDelivered @1108 NONAME
g_hevEventSetJson @1109 NONAME
+?getJson@EventInfo@DB@@QBEAAVJSONNode@@XZ @1110 NONAME
+?setJson@EventInfo@DB@@QAEAAVJSONNode@@XZ @1111 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 567e6bc7c0..69c96d691b 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -971,3 +971,5 @@ Netlib_DownloadFile @1093 NONAME ?GetPreviewPath@PROTO_INTERFACE@@QEBA?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@XZ @1101 NONAME
g_hevEventDelivered @1102 NONAME
g_hevEventSetJson @1103 NONAME
+?getJson@EventInfo@DB@@QEBAAEAVJSONNode@@XZ @1104 NONAME
+?setJson@EventInfo@DB@@QEAAAEAVJSONNode@@XZ @1105 NONAME
|