From e943879c50b415a74fa31481d3024e75906f609c Mon Sep 17 00:00:00 2001 From: evgeny Date: Thu, 29 Oct 2026 09:33:48 +0100 Subject: [PATCH] Carry Android photo and video request IDs through PM preparation --- src/media_async/attachment_send.h | 2 +- tools/chatgui-android/libutun_lite/photo_sender.c | 3 ++- tools/chatgui-android/libutun_lite/video_sender.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/media_async/attachment_send.h b/src/media_async/attachment_send.h index 4d47a5c7..e641d65f 100644 --- a/src/media_async/attachment_send.h +++ b/src/media_async/attachment_send.h @@ -27,7 +27,7 @@ struct attachment_send_req { uint64_t dm_generation; /* Поколение беседы до подготовки; 0 → захват в trampoline. Удалённое поколение не публикуется. */ unsigned dm_paths_held; /* Внутренние holds output/source; caller оставляет 0. */ uint8_t reply_to[32]; /* Оригинал канального ответа, зафиксированный до подготовки. */ - uint64_t request_id; /* Только канал: CHAT_EVT_MSG_SUBMITTED после публикации либо ошибки. Для DM — 0. */ + uint64_t request_id; /* CHAT_EVT_MSG_SUBMITTED после локального commit либо ошибки; 0=без подтверждения. */ struct attachment_info info; /* kind обязателен; пустое name заменяется UUID.opus/mp4; для copy нужны готовые метаданные. */ uint8_t id[16]; /* Внутренний UUID подготовки для attachment-событий; не UUID конечного media_index/DM. */ char source[1024], output[1024]; /* source задаёт caller; output — внутреннее случайное назначение задачи. */ diff --git a/tools/chatgui-android/libutun_lite/photo_sender.c b/tools/chatgui-android/libutun_lite/photo_sender.c index 9451899d..07f12bfe 100644 --- a/tools/chatgui-android/libutun_lite/photo_sender.c +++ b/tools/chatgui-android/libutun_lite/photo_sender.c @@ -48,7 +48,8 @@ int photo_send(const char* channel_id, const char* src_file_path, const char* db snprintf(req->source, sizeof(req->source), "%s", src_file_path); snprintf(req->info.name, sizeof(req->info.name), "%s", name); if (attachment_validate(&req->info)) { u_free(req); u_free(post); return -1; } - if (!req->is_dm) { memcpy(req->reply_to, reply_to, 32); req->request_id = request_id; } + req->request_id = request_id; + if (!req->is_dm) memcpy(req->reply_to, reply_to, 32); DEBUG_INFO(DEBUG_CATEGORY_MEDIA, "photo_send: target=%s mime=%s dimensions=%dx%d bytes=%lld generation=%llu", channel_id, content_type, width, height, (long long)st.st_size, (unsigned long long)generation); post->callback = attachment_send_trampoline; post->arg = req; diff --git a/tools/chatgui-android/libutun_lite/video_sender.c b/tools/chatgui-android/libutun_lite/video_sender.c index 5db96cb4..94b55085 100644 --- a/tools/chatgui-android/libutun_lite/video_sender.c +++ b/tools/chatgui-android/libutun_lite/video_sender.c @@ -21,7 +21,8 @@ int video_send(const char* channel_id, const char* src_file_path, const char* db if (!req || !post) { DEBUG_ERROR(DEBUG_CATEGORY_MEDIA, "video send: allocation failed"); u_free(req); u_free(post); return -1; } req->dm_generation = generation; req->inst = instance_lite_get_instance(); req->is_dm = !strncmp(channel_id, "dm:", 3); - if (!req->is_dm) { memcpy(req->reply_to, reply_to, sizeof(req->reply_to)); req->request_id = request_id; } + req->request_id = request_id; + if (!req->is_dm) memcpy(req->reply_to, reply_to, sizeof(req->reply_to)); snprintf(req->target, sizeof(req->target), "%s", channel_id + (req->is_dm ? 3 : 0)); snprintf(req->source, sizeof(req->source), "%s", src_file_path); req->info.kind = ATTACHMENT_VIDEO; req->info.duration_ms = (uint32_t)duration_ms;