schema: rm is_dm, rename name→userinfo (json_flat), fix join_msg format

- Remove is_dm column from channels table (dm detection by member count)
- Rename member name column to userinfo — extensible json_flat format
- Add json_flat.c/h library for compact JSON serialization
- Fix join_sig message format: use ch_x25519+ch_ed25519 instead of channel_id string
- Remove name from join_msg body (now in userinfo via json_flat)
- Update chat_core, chat_sync, member_sync, db_manager to new format
- Add topo_strategy.txt — архитектурные заметки по топологии
This commit is contained in:
Evgeny committed 2026-07-21 00:11:50 +03:00
1 parent 88d51349ea
commit 3dda701c67
26 files changed
+494 -325

No files matched your search

+9 -10
View File
@@ -95,7 +95,7 @@ QByteArray DbManager::colBlob(sqlite3_stmt* stmt, int col) {
QList<ChannelRow> DbManager::getChannels() const {
QList<ChannelRow> list;
sqlite3_stmt* stmt = prepareOrNull(
"SELECT channel_id, name, owner_node_id, is_dm,"
"SELECT channel_id, name, owner_node_id,"
" x25519_pubkey, x25519_privkey, ed25519_pubkey, ed25519_privkey, signature,"
" last_read_msg_id, last_pos_msg_id, created_at"
" FROM channels ORDER BY created_at ASC");
@@ -105,15 +105,14 @@ QList<ChannelRow> DbManager::getChannels() const {
r.channelId = colText(stmt, 0);
r.name = colText(stmt, 1);
r.ownerNodeId = (quint64)sqlite3_column_int64(stmt, 2);
r.isDm = sqlite3_column_int(stmt, 3) != 0;
r.x25519_pubkey = colBlob(stmt, 4);
r.x25519_privkey = colBlob(stmt, 5);
r.ed25519_pubkey = colBlob(stmt, 6);
r.ed25519_privkey = colBlob(stmt, 7);
r.signature = colBlob(stmt, 8);
r.lastReadMsgId = sqlite3_column_int64(stmt, 9);
r.lastPosMsgId = sqlite3_column_int64(stmt, 10);
r.createdAt = sqlite3_column_int64(stmt, 11);
r.x25519_pubkey = colBlob(stmt, 3);
r.x25519_privkey = colBlob(stmt, 4);
r.ed25519_pubkey = colBlob(stmt, 5);
r.ed25519_privkey = colBlob(stmt, 6);
r.signature = colBlob(stmt, 7);
r.lastReadMsgId = sqlite3_column_int64(stmt, 8);
r.lastPosMsgId = sqlite3_column_int64(stmt, 9);
r.createdAt = sqlite3_column_int64(stmt, 10);
list.append(r);
}
sqlite3_finalize(stmt);