|
|
|
|
@ -356,10 +356,11 @@ static void dm_on_msg(struct dm_state* dm, const uint8_t* msg, size_t mlen) {
|
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_DM, "%s: no pubkeys for 0x%016llx", DM_ID, (unsigned long long)author); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
chat_core_get_node_name(dm->inst, author, c.peer_name, sizeof(c.peer_name)); |
|
|
|
|
dm_derive_content_key(dm->inst->my_keys.private_key, c.peer_x25519, c.content_key); |
|
|
|
|
dm_conv_save(dm, &c); |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_DM, "%s: auto-created conversation conv=%s peer=0x%016llx group=%llu", |
|
|
|
|
DM_ID, conv_id, (unsigned long long)author, (unsigned long long)c.group_id); |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_DM, "%s: auto-created conversation conv=%s peer=0x%016llx name=%s group=%llu", |
|
|
|
|
DM_ID, conv_id, (unsigned long long)author, c.peer_name, (unsigned long long)c.group_id); |
|
|
|
|
|
|
|
|
|
/* событие GUI: появилась новая беседа (чтобы GUI добавил её в список) */ |
|
|
|
|
{ |
|
|
|
|
@ -490,10 +491,11 @@ static void dm_on_hello(struct dm_state* dm, uint64_t conv_num, uint64_t from_pe
|
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_DM, "%s: hello no pubkeys for 0x%016llx", DM_ID, (unsigned long long)from_peer); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
chat_core_get_node_name(dm->inst, from_peer, c.peer_name, sizeof(c.peer_name)); |
|
|
|
|
dm_derive_content_key(dm->inst->my_keys.private_key, c.peer_x25519, c.content_key); |
|
|
|
|
dm_conv_save(dm, &c); |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_DM, "%s: hello auto-created conversation conv=%s peer=0x%016llx group=%llu", |
|
|
|
|
DM_ID, conv_id, (unsigned long long)from_peer, (unsigned long long)c.group_id); |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_DM, "%s: hello auto-created conversation conv=%s peer=0x%016llx name=%s group=%llu", |
|
|
|
|
DM_ID, conv_id, (unsigned long long)from_peer, c.peer_name, (unsigned long long)c.group_id); |
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
size_t cl = strlen(conv_id); |
|
|
|
|
@ -883,6 +885,12 @@ int dm_list_conversations_json(struct UTUN_INSTANCE* inst, char* buf, size_t buf
|
|
|
|
|
uint64_t last_ts = (uint64_t)sqlite3_column_int64(st, 3); |
|
|
|
|
uint64_t out_seq = (uint64_t)sqlite3_column_int64(st, 4); |
|
|
|
|
uint64_t in_seq = (uint64_t)sqlite3_column_int64(st, 5); |
|
|
|
|
char resolved[128]; |
|
|
|
|
if (!name || !name[0]) { |
|
|
|
|
resolved[0] = '\0'; |
|
|
|
|
chat_core_get_node_name(inst, peer, resolved, sizeof(resolved)); |
|
|
|
|
name = resolved; |
|
|
|
|
} |
|
|
|
|
char esc_name[512]; |
|
|
|
|
json_escape(name ? name : "", esc_name, sizeof(esc_name)); |
|
|
|
|
off += snprintf(buf + off, buf_size - (size_t)off, |
|
|
|
|
|