From 7be7fb12f4a9c1d25b29044cc6f6eebebc49b23e Mon Sep 17 00:00:00 2001 From: mjentsch Date: Thu, 30 Jul 2015 21:02:22 +0200 Subject: [PATCH] Fix video and audio file names --- tgp-ft.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tgp-ft.c b/tgp-ft.c index 13b8728..42817cf 100644 --- a/tgp-ft.c +++ b/tgp-ft.c @@ -35,12 +35,20 @@ static char *tgp_strdup_determine_filename (const char *mime, const char *captio if (caption) { return g_strdup (caption); } - const char *type = NULL; if (mime) { - type = tgp_mime_to_filetype (mime); + if (flags & TGLDF_VIDEO) { + // video message + type = "mp4"; + } else if (flags & TGLDF_AUDIO) { + // audio message + type = "ogg"; + } else { + // document message + type = tgp_mime_to_filetype (mime); + } } - if (!type) { + if (! str_not_empty(type)) { if (flags & TGLDF_IMAGE) { type = "png"; } else if (flags & TGLDF_AUDIO) {