From 9fc362a30518fc1f504c58b01269c72cd0eaa8f9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 4 Nov 2024 13:51:08 +0300 Subject: =?UTF-8?q?fixes=20#4775=20(Telegram:=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=B8=D1=82=D1=8C=20=D0=BF=D0=BE=D0=B4=D0=B4=D0=B5=D1=80?= =?UTF-8?q?=D0=B6=D0=BA=D1=83=20=D0=BA=D1=80=D1=83=D0=B6=D0=BA=D0=BE=D0=B2?= =?UTF-8?q?=20=D1=81=20=D0=B2=D0=B8=D0=B4=D0=B5=D0=BE)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Telegram/src/utils.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'protocols/Telegram/src/utils.cpp') diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp index 8cbed517a3..bcb62ccf81 100644 --- a/protocols/Telegram/src/utils.cpp +++ b/protocols/Telegram/src/utils.cpp @@ -649,42 +649,47 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg case TD::messageAudio::ID: if (auto *pDoc = (TD::messageAudio *)pBody) { auto *pAudio = pDoc->audio_.get(); - CMStringA fileName(FORMAT, "%s (%d %s)", TranslateU("Audio"), pAudio->duration_, TranslateU("seconds")); - std::string caption = fileName.c_str(); + CMStringA caption(FORMAT, "%s (%d %s)", TranslateU("Audio"), pAudio->duration_, TranslateU("seconds")); if (!pDoc->caption_->text_.empty()) { caption += " "; - caption += pDoc->caption_->text_; + caption += pDoc->caption_->text_.c_str(); } - GetMessageFile(embed, TG_FILE_REQUEST::VIDEO, pAudio->audio_.get(), pAudio->file_name_.c_str(), caption.c_str()); + GetMessageFile(embed, TG_FILE_REQUEST::VIDEO, pAudio->audio_.get(), pAudio->file_name_.c_str(), caption); } break; case TD::messageVideo::ID: if (auto *pDoc = (TD::messageVideo *)pBody) { auto *pVideo = pDoc->video_.get(); - CMStringA fileName(FORMAT, "%s (%d x %d, %d %s)", TranslateU("Video"), pVideo->width_, pVideo->height_, pVideo->duration_, TranslateU("seconds")); - std::string caption = fileName.c_str(); + CMStringA caption(FORMAT, "%s (%d x %d, %d %s)", TranslateU("Video"), pVideo->width_, pVideo->height_, pVideo->duration_, TranslateU("seconds")); if (!pDoc->caption_->text_.empty()) { caption += " "; - caption += pDoc->caption_->text_; + caption += pDoc->caption_->text_.c_str(); } - GetMessageFile(embed, TG_FILE_REQUEST::VIDEO, pVideo->video_.get(), pVideo->file_name_.c_str(), caption.c_str()); + GetMessageFile(embed, TG_FILE_REQUEST::VIDEO, pVideo->video_.get(), pVideo->file_name_.c_str(), caption); } break; case TD::messageAnimation::ID: if (auto *pDoc = (TD::messageAnimation *)pBody) { auto *pVideo = pDoc->animation_.get(); - CMStringA fileName(FORMAT, "%s (%d x %d, %d %s)", TranslateU("Video"), pVideo->width_, pVideo->height_, pVideo->duration_, TranslateU("seconds")); - std::string caption = fileName.c_str(); + CMStringA caption(FORMAT, "%s (%d x %d, %d %s)", TranslateU("Video"), pVideo->width_, pVideo->height_, pVideo->duration_, TranslateU("seconds")); if (!pDoc->caption_->text_.empty()) { caption += " "; - caption += pDoc->caption_->text_; + caption += pDoc->caption_->text_.c_str(); } GetMessageFile(embed, TG_FILE_REQUEST::VIDEO, pVideo->animation_.get(), pVideo->file_name_.c_str(), caption.c_str()); } break; + case TD::messageVideoNote::ID: + if (auto *pDoc = (TD::messageVideoNote *)pBody) { + auto *pVideo = pDoc->video_note_.get(); + CMStringA fileName(FORMAT, "%s (%d %s)", TranslateU("Video note"), pVideo->duration_, TranslateU("seconds")); + GetMessageFile(embed, TG_FILE_REQUEST::VIDEO, pVideo->video_.get(), fileName, ""); + } + break; + case TD::messageVoiceNote::ID: if (auto *pDoc = (TD::messageVoiceNote *)pBody) { CMStringA fileName(FORMAT, "%s (%d %s)", TranslateU("Voice message"), pDoc->voice_note_->duration_, TranslateU("seconds")); -- cgit v1.2.3