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/server.cpp | 31 ++++++++++++++++++++++++++++++- protocols/Telegram/src/utils.cpp | 27 ++++++++++++++++----------- 2 files changed, 46 insertions(+), 12 deletions(-) (limited to 'protocols/Telegram/src') diff --git a/protocols/Telegram/src/server.cpp b/protocols/Telegram/src/server.cpp index 575287087f..cd6cb15f0f 100644 --- a/protocols/Telegram/src/server.cpp +++ b/protocols/Telegram/src/server.cpp @@ -627,9 +627,38 @@ void CTelegramProto::ProcessChatAction(TD::updateChatAction *pObj) return; } + auto hContact = GetRealContact(pChat); switch (pObj->action_->get_id()) { + case TD::chatActionRecordingVideo::ID: + Srmm_SetStatusText(hContact, TranslateT("Recording video...")); + break; + case TD::chatActionRecordingVideoNote::ID: + Srmm_SetStatusText(hContact, TranslateT("Recording video note...")); + break; + case TD::chatActionRecordingVoiceNote::ID: + Srmm_SetStatusText(hContact, TranslateT("Recording voice note...")); + break; + case TD::chatActionUploadingDocument::ID: + Srmm_SetStatusText(hContact, TranslateT("Uploading file...")); + break; + case TD::chatActionUploadingPhoto::ID: + Srmm_SetStatusText(hContact, TranslateT("Uploading photo...")); + break; + case TD::chatActionUploadingVideo::ID: + Srmm_SetStatusText(hContact, TranslateT("Uploading video...")); + break; + case TD::chatActionUploadingVideoNote::ID: + Srmm_SetStatusText(hContact, TranslateT("Uploading video note...")); + break; + case TD::chatActionUploadingVoiceNote::ID: + Srmm_SetStatusText(hContact, TranslateT("Uploading voice note...")); + break; case TD::chatActionTyping::ID: - CallService(MS_PROTO_CONTACTISTYPING, pChat->hContact, 1); + CallService(MS_PROTO_CONTACTISTYPING, pChat->hContact, 30); + break; + case TD::chatActionCancel::ID: + Srmm_SetStatusText(hContact, 0); + CallService(MS_PROTO_CONTACTISTYPING, pChat->hContact, PROTOTYPE_CONTACTTYPING_OFF); break; } } 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