fix: voice message display and playback — complete flow
- db_manager: getMessagesSince() now parses m.contentType from JSON (was missing) - messagelist: setVoiceMessageRoles uses data directly as payload, not re-parsed as JSON (data is already the 'd' field value extracted by db_manager)
This commit is contained in:
1 parent
fd3b125ecb
commit
324d285145
2 files changed
+3
-1
No files matched your search
@@ -212,6 +212,8 @@ QList<MessageRow> DbManager::getMessagesSince(const QString& chId, qint64 sinceI
|
||||
m.id = sqlite3_column_int64(stmt, 0);
|
||||
m.authorNodeId = (quint64)sqlite3_column_int64(stmt, 1);
|
||||
QByteArray jdata = colBlob(stmt, 2);
|
||||
m.contentType = QString::fromUtf8(parseJsonField(jdata, "ct"));
|
||||
if (m.contentType.isEmpty()) m.contentType = "text/plain";
|
||||
m.data = parseJsonField(jdata, "d");
|
||||
m.timestamp = sqlite3_column_int64(stmt, 3);
|
||||
m.datahash = 0;
|
||||
|
||||
@@ -94,7 +94,7 @@ static void setVoiceMessageRoles(QStandardItem* item, const QByteArray& data,
|
||||
item->setData(ct, MsgContentTypeRole);
|
||||
|
||||
if (ct == "audio/opus") {
|
||||
QString raw = parseJsonField(data, "d");
|
||||
QString raw = QString::fromUtf8(data);
|
||||
int pipe = raw.indexOf('|');
|
||||
QString fname = pipe >= 0 ? raw.left(pipe) : raw;
|
||||
QString dur = pipe >= 0 ? raw.mid(pipe + 1) : QString();
|
||||
|
||||
Reference in new issue
Block a user