mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Improve updates build script.
This commit is contained in:
@@ -9,6 +9,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "dialogs/dialogs_key.h"
|
||||
#include "data/data_drafts.h"
|
||||
#include "data/data_forum.h"
|
||||
#include "data/data_forum_topic.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_session.h"
|
||||
#include "data/data_changes.h"
|
||||
@@ -555,6 +557,7 @@ QString InterpretSendPath(
|
||||
f.close();
|
||||
const auto lines = content.split('\n');
|
||||
auto toId = PeerId(0);
|
||||
auto topicRootId = MsgId(0);
|
||||
auto filePath = QString();
|
||||
auto caption = QString();
|
||||
for (const auto &line : lines) {
|
||||
@@ -570,6 +573,11 @@ QString InterpretSendPath(
|
||||
line,
|
||||
u"channel: "_q.size()).toULongLong();
|
||||
toId = peerFromChannel(channelId);
|
||||
} else if (line.startsWith(u"topic: "_q)) {
|
||||
const auto topicId = base::StringViewMid(
|
||||
line,
|
||||
u"topic: "_q.size()).toULongLong();
|
||||
topicRootId = MsgId(topicId);
|
||||
} else if (line.startsWith(u"file: "_q)) {
|
||||
const auto path = line.mid(u"file: "_q.size());
|
||||
if (!QFile(path).exists()) {
|
||||
@@ -585,21 +593,33 @@ QString InterpretSendPath(
|
||||
}
|
||||
}
|
||||
const auto history = window->session().data().historyLoaded(toId);
|
||||
const auto sendTo = [=](not_null<Data::Thread*> thread) {
|
||||
window->showThread(thread);
|
||||
const auto premium = thread->session().user()->isPremium();
|
||||
thread->session().api().sendFiles(
|
||||
Storage::PrepareMediaList(
|
||||
QStringList(filePath),
|
||||
st::sendMediaPreviewSize,
|
||||
premium),
|
||||
SendMediaType::File,
|
||||
{ caption },
|
||||
nullptr,
|
||||
Api::SendAction(thread));
|
||||
};
|
||||
if (!history) {
|
||||
return "App Error: Could not find channel with id: "
|
||||
+ QString::number(peerToChannel(toId).bare);
|
||||
} else if (const auto forum = history->asForum()) {
|
||||
forum->requestTopic(topicRootId, [=] {
|
||||
if (const auto forum = history->asForum()) {
|
||||
if (const auto topic = forum->topicFor(topicRootId)) {
|
||||
sendTo(topic);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (!topicRootId) {
|
||||
sendTo(history);
|
||||
}
|
||||
window->showPeerHistory(history);
|
||||
const auto premium = window->session().user()->isPremium();
|
||||
history->session().api().sendFiles(
|
||||
Storage::PrepareMediaList(
|
||||
QStringList(filePath),
|
||||
st::sendMediaPreviewSize,
|
||||
premium),
|
||||
SendMediaType::File,
|
||||
{ caption },
|
||||
nullptr,
|
||||
Api::SendAction(history));
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user