diff options
author | George Hazan <george.hazan@gmail.com> | 2023-06-07 19:24:47 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2023-06-07 19:24:47 +0300 |
commit | 06d7b7d0fd02af55b5c5183cc04a9c2ac04a4163 (patch) | |
tree | 67d930f48950572ee31fc441fdde710114163108 /protocols/Telegram | |
parent | 65082d3cc4f7fe8e2f25b3ef367ab7c6a002b4cb (diff) |
#3542 (Telegram: исходящие картинки показываются как входящие)
Diffstat (limited to 'protocols/Telegram')
-rw-r--r-- | protocols/Telegram/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Telegram/src/utils.cpp | 19 |
2 files changed, 11 insertions, 10 deletions
diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index 3142f65826..0e397eca0d 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -246,7 +246,7 @@ class CTelegramProto : public PROTO<CTelegramProto> void ProcessSuperGroup(TD::updateSupergroup *pObj); void ProcessUser(TD::updateUser *pObj); - bool GetMessageFile(TG_FILE_REQUEST::Type, TG_USER *pUser, const TD::file *pFile, const char *pszFileName, const std::string &caption, const char *szId, const char *szUser, time_t); + bool GetMessageFile(TG_FILE_REQUEST::Type, TG_USER *pUser, const TD::file *pFile, const char *pszFileName, const std::string &caption, const char *szId, const char *szUser, const TD::message *pMsg); CMStringA GetMessageSticker(const TD::file *pFile, const char *pwszExtension); CMStringA GetMessageText(TG_USER *pUser, const TD::message *pMsg); diff --git a/protocols/Telegram/src/utils.cpp b/protocols/Telegram/src/utils.cpp index 5aedf57407..17286c3649 100644 --- a/protocols/Telegram/src/utils.cpp +++ b/protocols/Telegram/src/utils.cpp @@ -277,7 +277,7 @@ bool CTelegramProto::GetMessageFile( const std::string &caption,
const char *pszId,
const char *pszUserId,
- time_t timestamp)
+ const TD::message *pMsg)
{
if (pFile->get_id() != TD::file::ID) {
debugLogA("Document contains unsupported type %d, exiting", pFile->get_id());
@@ -293,16 +293,17 @@ bool CTelegramProto::GetMessageFile( }
PROTORECVFILE pre = {};
- pre.dwFlags = PRFF_UTF | PRFF_SILENT;
+ pre.dwFlags = PRFF_UTF | PRFF_SILENT | PRFF_READ;
pre.fileCount = 1;
- pre.timestamp = timestamp;
+ pre.timestamp = pMsg->date_;
pre.files.a = &pszFileName;
pre.lParam = (LPARAM)pRequest;
pre.szId = pszId;
pre.szUserId = pszUserId;
-
if (!caption.empty())
pre.descr.a = caption.c_str();
+ if (pMsg->is_outgoing_)
+ pre.dwFlags = PRFF_SENT;
ProtoChainRecvFile(pUser->hContact, &pre);
return true;
}
@@ -358,7 +359,7 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg }
CMStringA fileName(FORMAT, "%s (%d x %d)", TranslateU("Picture"), pPhoto->width_, pPhoto->height_);
- GetMessageFile(TG_FILE_REQUEST::PICTURE, pUser, pPhoto->photo_.get(), fileName, pDoc->caption_->text_, szId, pszUserId, pMsg->date_);
+ GetMessageFile(TG_FILE_REQUEST::PICTURE, pUser, pPhoto->photo_.get(), fileName, pDoc->caption_->text_, szId, pszUserId, pMsg);
}
break;
@@ -372,7 +373,7 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg caption += " ";
caption += pDoc->caption_->text_;
}
- GetMessageFile(TG_FILE_REQUEST::VIDEO, pUser, pVideo->video_.get(), pVideo->file_name_.c_str(), caption, szId, pszUserId, pMsg->date_);
+ GetMessageFile(TG_FILE_REQUEST::VIDEO, pUser, pVideo->video_.get(), pVideo->file_name_.c_str(), caption, szId, pszUserId, pMsg);
}
break;
@@ -386,7 +387,7 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg caption += " ";
caption += pDoc->caption_->text_;
}
- GetMessageFile(TG_FILE_REQUEST::VIDEO, pUser, pVideo->animation_.get(), pVideo->file_name_.c_str(), caption, szId, pszUserId, pMsg->date_);
+ GetMessageFile(TG_FILE_REQUEST::VIDEO, pUser, pVideo->animation_.get(), pVideo->file_name_.c_str(), caption, szId, pszUserId, pMsg);
}
break;
@@ -394,14 +395,14 @@ CMStringA CTelegramProto::GetMessageText(TG_USER *pUser, const TD::message *pMsg {
auto *pDoc = (TD::messageVoiceNote *)pBody;
CMStringA fileName(FORMAT, "%s (%d %s)", TranslateU("Voice message"), pDoc->voice_note_->duration_, TranslateU("seconds"));
- GetMessageFile(TG_FILE_REQUEST::VOICE, pUser, pDoc->voice_note_->voice_.get(), fileName, pDoc->caption_->text_, szId, pszUserId, pMsg->date_);
+ GetMessageFile(TG_FILE_REQUEST::VOICE, pUser, pDoc->voice_note_->voice_.get(), fileName, pDoc->caption_->text_, szId, pszUserId, pMsg);
}
break;
case TD::messageDocument::ID:
{
auto *pDoc = (TD::messageDocument *)pBody;
- GetMessageFile(TG_FILE_REQUEST::FILE, pUser, pDoc->document_->document_.get(), pDoc->document_->file_name_.c_str(), pDoc->caption_->text_, szId, pszUserId, pMsg->date_);
+ GetMessageFile(TG_FILE_REQUEST::FILE, pUser, pDoc->document_->document_.get(), pDoc->document_->file_name_.c_str(), pDoc->caption_->text_, szId, pszUserId, pMsg);
}
break;
|