Fix video and audio file names

This commit is contained in:
mjentsch 2015-07-30 21:02:22 +02:00
parent e8ceb21e64
commit 7be7fb12f4

View file

@ -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) {