summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-05-12 19:48:38 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-05-12 19:48:38 +0300
commitf13d9cfc576f434c4c3b30ad26a8aad4f133c732 (patch)
treefd551d4ad6915b72bab5a4a8c024e5247d536ddf /src/mir_app
parentb7e7695a016663f8ec0f8fa57de9e2d3dfd466a2 (diff)
DbEvent_GetTextW: fix to extract event's text correctly
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/db_events.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp
index 502c02882f..45cbdc9022 100644
--- a/src/mir_app/src/db_events.cpp
+++ b/src/mir_app/src/db_events.cpp
@@ -179,6 +179,20 @@ static INT_PTR DbEventGetTextWorker(const DB::EventInfo *dbei, int codepage, int
return 0;
}
+ if (dbei->flags & DBEF_JSON) {
+ JSONNode json = dbei->getJson();
+ std::string str = json["b"].as_string();
+ switch (datatype) {
+ case DBVT_WCHAR:
+ return (INT_PTR)mir_utf8decodeW(str.c_str());
+ case DBVT_ASCIIZ:
+ char *msg = mir_strdup(str.c_str());
+ mir_utf8decodecp(msg, codepage, nullptr);
+ return (INT_PTR)msg;
+ }
+ return 0;
+ }
+
// by default treat an event's blob as a string
if (datatype == DBVT_WCHAR) {
char *str = (char*)alloca(dbei->cbBlob + 1);