Verify invitation title delivery and one-line full-link actions

This commit is contained in:
evgeny committed 2026-10-04 18:09:41 +02:00
1 parent 6ad89a4f6a
commit f70d5c7460
2 files changed
+64

No files matched your search

+9
View File
@@ -172,6 +172,8 @@ int main(void) {
chat_core_create_channel_auto(nodes[0], "target");
CHECK(!scalar(nodes[0], "SELECT channel_id FROM channels WHERE name='target'", &target), "create different target group");
CHECK(target != source && !message_count(), "initial empty PM");
CHECK(sqlite3_exec(nodes[0]->topo_sqlite_db, "UPDATE channels SET name='target \"группа\"\n<>&' WHERE name='target'",
NULL, NULL, NULL) == SQLITE_OK, "group title with Unicode, quotes and newline");
char target_id[64]; snprintf(target_id, sizeof(target_id), "%llu", (unsigned long long)target);
for (int i = 0; i < 5; i++) {
char text[64]; snprintf(text, sizeof(text), "history before invitation %d", i);
@@ -215,6 +217,13 @@ int main(void) {
if (!dm_list_messages_json(nodes[1], conv, 10, 0, messages, sizeof(messages), &length)) link = strstr(messages, "utun://");
} while (!link && get_time_tb() < deadline);
CHECK(link, "invite delivered to B over source group's UDP route");
CHECK(strstr(messages, "\"ct\":\"invite\"") &&
strstr(messages, "\"tags\":{\"group_name\":\"target \\\"группа\\\"\\n<>&\"}"),
"encrypted group name survives delivery and JSON escaping without sender-language text");
char outgoing[8192]; size_t outgoing_len = 0;
CHECK(!dm_list_messages_json(nodes[0], conv, 10, 0, outgoing, sizeof(outgoing), &outgoing_len) &&
strstr(outgoing, "\"tags\":{\"group_name\":\"target \\\"группа\\\"\\n<>&\"}"),
"sender and recipient receive the same group-name tag");
char* end = strchr(link, '"'); CHECK(end, "complete invite text in PM"); *end = '\0';
struct InviteData received; char error[128];
CHECK(!invite_link_decode(link, strlen(link), &received, error, sizeof(error)) && received.channelId == target,