diff options
author | George Hazan <george.hazan@gmail.com> | 2024-11-04 13:51:08 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-11-04 13:51:08 +0300 |
commit | 9fc362a30518fc1f504c58b01269c72cd0eaa8f9 (patch) | |
tree | a011f02b5195d26b4f3c1d90310721daa67059fd | |
parent | d6c0257fa35c82768c50e215cd688d9d9122a6e3 (diff) |
fixes #4775 (Telegram: добавить поддержку кружков с видео)
-rw-r--r-- | protocols/Telegram/src/server.cpp | 31 | ||||
-rw-r--r-- | protocols/Telegram/src/utils.cpp | 27 |
2 files changed, 46 insertions, 12 deletions
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"));
|