Report preparation rejection and release abandoned owned sources
This commit is contained in:
1 parent
3b0609fe76
commit
f2ff3ee5ab
2 files changed
+20
-10
No files matched your search
+12
-4
@@ -620,16 +620,24 @@ static void dm_source_cleanup(void* arg) {
|
||||
}
|
||||
|
||||
static void dm_source_cleaned(void* arg, int error) {
|
||||
if (error) DEBUG_WARN(DEBUG_CATEGORY_DM, "dm_media: source cleanup cancelled error=%d", error);
|
||||
if (error) {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_DM, "dm_media: source cleanup cancelled error=%d", error);
|
||||
dm_source_cleanup(arg);
|
||||
}
|
||||
u_free(arg);
|
||||
}
|
||||
|
||||
void dm_send_file_trampoline(void* arg) {
|
||||
struct dm_file_req* req = arg;
|
||||
if (!req) return;
|
||||
if (dm_send_file(req->inst, req->conv, req->path, &req->info, req->remove_source) && req->remove_source) {
|
||||
media_async_submit(req->inst->media_async, req->inst->ua, dm_source_cleanup, req, dm_source_cleaned, req);
|
||||
return;
|
||||
if (dm_send_file(req->inst, req->conv, req->path, &req->info, req->remove_source)) {
|
||||
const uint8_t rejected[16] = {0};
|
||||
chat_event_attachment(req->inst, 1, req->conv, rejected, 2);
|
||||
if (req->remove_source) {
|
||||
media_async_submit(req->inst ? req->inst->media_async : NULL, req->inst ? req->inst->ua : NULL,
|
||||
dm_source_cleanup, req, dm_source_cleaned, req);
|
||||
return;
|
||||
}
|
||||
}
|
||||
u_free(req);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user