mirror of
https://github.com/vale981/tdesktop
synced 2025-03-06 02:01:40 -05:00
No warning from verified peers.
This commit is contained in:
parent
811bef41b8
commit
b75442a10e
1 changed files with 17 additions and 8 deletions
|
@ -66,9 +66,18 @@ QString JoinStringList(const QStringList &list, const QString &separator) {
|
|||
return result;
|
||||
}
|
||||
|
||||
void LaunchWithWarning(const QString &name) {
|
||||
if (!Data::IsExecutableName(name)
|
||||
|| !Auth().settings().exeLaunchWarning()) {
|
||||
void LaunchWithWarning(const QString &name, HistoryItem *item) {
|
||||
const auto warn = [&] {
|
||||
if (!Data::IsExecutableName(name)) {
|
||||
return false;
|
||||
} else if (!Auth().settings().exeLaunchWarning()) {
|
||||
return false;
|
||||
} else if (item && item->history()->peer->isVerified()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}();
|
||||
if (!warn) {
|
||||
File::Launch(name);
|
||||
return;
|
||||
}
|
||||
|
@ -359,14 +368,14 @@ void DocumentOpenClickHandler::Open(
|
|||
Messenger::Instance().showDocument(data, context);
|
||||
}
|
||||
} else {
|
||||
LaunchWithWarning(location.name());
|
||||
LaunchWithWarning(location.name(), context);
|
||||
}
|
||||
location.accessDisable();
|
||||
} else {
|
||||
LaunchWithWarning(location.name());
|
||||
LaunchWithWarning(location.name(), context);
|
||||
}
|
||||
} else {
|
||||
LaunchWithWarning(location.name());
|
||||
LaunchWithWarning(location.name(), context);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -735,11 +744,11 @@ void DocumentData::performActionOnLoad() {
|
|||
if (showImage && QImageReader(loc.name()).canRead()) {
|
||||
Messenger::Instance().showDocument(this, item);
|
||||
} else {
|
||||
LaunchWithWarning(already);
|
||||
LaunchWithWarning(already, item);
|
||||
}
|
||||
loc.accessDisable();
|
||||
} else {
|
||||
LaunchWithWarning(already);
|
||||
LaunchWithWarning(already, item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue