|
|
|
|
@ -66,6 +66,7 @@ static void attachment_publish(struct attachment_send_req* req, int error) {
|
|
|
|
|
if (error || req->error || attachment_validate(&req->info)) { |
|
|
|
|
chat_event_attachment(req->inst, req->is_dm, req->target, req->id, 2); |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_MEDIA, "attachment: preparation failed target=%s error=%d worker=%d", req->target, error, req->error); |
|
|
|
|
chat_event_submitted(req->inst, req->request_id, 0); |
|
|
|
|
if (remove(req->output) && errno != ENOENT) DEBUG_WARN(DEBUG_CATEGORY_MEDIA, "attachment: output cleanup failed path=%s", req->output); |
|
|
|
|
u_free(req); return; |
|
|
|
|
} |
|
|
|
|
@ -92,6 +93,7 @@ static void attachment_publish(struct attachment_send_req* req, int error) {
|
|
|
|
|
struct chat_msg_submit* message = u_calloc(1, sizeof(*message) + length); |
|
|
|
|
if (message) { |
|
|
|
|
message->inst = req->inst; |
|
|
|
|
memcpy(message->reply_to, req->reply_to, 32); message->request_id = req->request_id; |
|
|
|
|
snprintf(message->channel_id, sizeof(message->channel_id), "%s", req->target); |
|
|
|
|
snprintf(message->content_type, sizeof(message->content_type), "%s", attachment_content_type(req->info.kind)); |
|
|
|
|
snprintf(message->media_src, sizeof(message->media_src), "%s", req->output); |
|
|
|
|
@ -101,6 +103,7 @@ static void attachment_publish(struct attachment_send_req* req, int error) {
|
|
|
|
|
chat_core_submit_trampoline(message); |
|
|
|
|
} else { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_MEDIA, "attachment: channel dispatch allocation failed"); |
|
|
|
|
chat_event_submitted(req->inst, req->request_id, 0); |
|
|
|
|
chat_event_attachment(req->inst, req->is_dm, req->target, req->id, 2); |
|
|
|
|
if (remove(req->output)) DEBUG_WARN(DEBUG_CATEGORY_MEDIA, "attachment: rejected output cleanup failed"); |
|
|
|
|
} |
|
|
|
|
|