Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-im/telegram-desktop/files/, net-im/telegram-desktop/
Date: Tue, 31 Mar 2020 08:33:41
Message-Id: 1585643394.d5f51442b433ba6fed96314a99307081148c9c41.gyakovlev@gentoo
1 commit: d5f51442b433ba6fed96314a99307081148c9c41
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Tue Mar 31 08:24:49 2020 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Tue Mar 31 08:29:54 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d5f51442
7
8 net-im/telegram-desktop: bump to 2.0.0
9
10 Package-Manager: Portage-2.3.96, Repoman-2.3.22
11 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
12
13 net-im/telegram-desktop/Manifest | 2 +-
14 net-im/telegram-desktop/files/2.0.0-fixes.patch | 410 +++++++++++++++++++++
15 ...1.9.22.ebuild => telegram-desktop-2.0.0.ebuild} | 4 +
16 3 files changed, 415 insertions(+), 1 deletion(-)
17
18 diff --git a/net-im/telegram-desktop/Manifest b/net-im/telegram-desktop/Manifest
19 index 2b515917de3..e0809eb234a 100644
20 --- a/net-im/telegram-desktop/Manifest
21 +++ b/net-im/telegram-desktop/Manifest
22 @@ -1,3 +1,3 @@
23 DIST tdesktop-1.9.14-full.tar.gz 25324084 BLAKE2B 45c071aa573541b6e483d2ae712b7f3b672c1294e8e7e624d9292f7176482f4d68069c35541019dc27fdb1c66134c29fb4d3667f1197e7085e4f8a80c8ca603c SHA512 56efa64048d23b280782b51319c0071c6cef833cb7e2584e52c6e45488577755beb85185ec9187029c425cc8d4c9c1887142687c744697e7731a15abe2846056
24 DIST tdesktop-1.9.21-full.tar.gz 25848026 BLAKE2B 503e22bcc83a64721aa4c4c6e8bca89c4c976703c338b1615c5ab1599098e98cbd220a94cffdbe24d9c305b44ffef7719ad1c2d2ad81f4ec6edc8377e1afa4ef SHA512 ea02fc69e88ed6244ed420516bb7a93827cb85efaa0a7e9af7562aa1bc29184c5a2102caca8693c976b25d374832e0deb2ccbf00144d5340b5ffacbdc9dcebf1
25 -DIST tdesktop-1.9.22-full.tar.gz 26103977 BLAKE2B 30f78225f7c1f96a9c96a777ee29e361452a0a4e3c74b3fb54eae003caa29118ff7ee38e7727997150f8d686e94618c387bd45c985e1a7ad8b12f396b3afb3cd SHA512 1fd9b04da02e648bf4e54cb3344b2490f5d7dc08d94e2dc0aa18f0402b96a8a923adaf9a1664393629bc8054ef91ef8ea20e8dd59222da52560a04eb5c541d0d
26 +DIST tdesktop-2.0.0-full.tar.gz 26106238 BLAKE2B 0634e66384b786cfaf6d3608bdf6f64985bc433a272d6eb86f4e787a9ee7e25dfaae89a6cb0a5aa2e73a2e1f3593a8a776d12457ab90f0a7c3ef6d0f254e254d SHA512 53ea3bb0e1d7cb1fc9d8c8725801295e89f8765b6560f046065dde89aef501d7ddb8aa268aa82f33e3674164a825506c4276cd07c0b59c242dd78ab59d659508
27
28 diff --git a/net-im/telegram-desktop/files/2.0.0-fixes.patch b/net-im/telegram-desktop/files/2.0.0-fixes.patch
29 new file mode 100644
30 index 00000000000..2040a9da668
31 --- /dev/null
32 +++ b/net-im/telegram-desktop/files/2.0.0-fixes.patch
33 @@ -0,0 +1,410 @@
34 +From 2f7563767dc7214ec3c9a4d0c4d4b50e62c5927f Mon Sep 17 00:00:00 2001
35 +From: John Preston <johnprestonmail@×××××.com>
36 +Date: Mon, 30 Mar 2020 21:04:49 +0400
37 +Subject: [PATCH 1/3] Fix crash in archive / pinned in folder management.
38 +
39 +---
40 + Telegram/SourceFiles/history/history.cpp | 16 ++++------------
41 + 1 file changed, 4 insertions(+), 12 deletions(-)
42 +
43 +diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp
44 +index d1d0bcb43c..fa69e0a9de 100644
45 +--- a/Telegram/SourceFiles/history/history.cpp
46 ++++ b/Telegram/SourceFiles/history/history.cpp
47 +@@ -1948,12 +1948,6 @@ void History::setFolderPointer(Data::Folder *folder) {
48 + const auto wasInList = inChatList();
49 + if (wasInList) {
50 + removeFromChatList(0, owner().chatsList(this->folder()));
51 +- for (const auto &filter : filters.list()) {
52 +- const auto id = filter.id();
53 +- if (inChatList(id)) {
54 +- removeFromChatList(id, filters.chatsList(id));
55 +- }
56 +- }
57 + }
58 + const auto was = _folder.value_or(nullptr);
59 + _folder = folder;
60 +@@ -1962,12 +1956,10 @@ void History::setFolderPointer(Data::Folder *folder) {
61 + }
62 + if (wasInList) {
63 + addToChatList(0, owner().chatsList(folder));
64 +- for (const auto &filter : filters.list()) {
65 +- if (filter.contains(this)) {
66 +- const auto id = filter.id();
67 +- addToChatList(id, filters.chatsList(id));
68 +- }
69 +- }
70 ++
71 ++ owner().chatsFilters().refreshHistory(this);
72 ++ updateChatListEntry();
73 ++
74 + owner().chatsListChanged(was);
75 + owner().chatsListChanged(folder);
76 + } else if (!wasKnown) {
77 +
78 +From c2ff27793a56241135fde194256a2ebf7bc5ec90 Mon Sep 17 00:00:00 2001
79 +From: John Preston <johnprestonmail@×××××.com>
80 +Date: Mon, 30 Mar 2020 23:34:07 +0400
81 +Subject: [PATCH 2/3] Try to use Ctrl+1..Ctrl+8 for folders.
82 +
83 +---
84 + Telegram/SourceFiles/core/shortcuts.cpp | 78 ++++++++++++-------
85 + Telegram/SourceFiles/core/shortcuts.h | 18 ++---
86 + .../dialogs/dialogs_inner_widget.cpp | 60 +++++++-------
87 + 3 files changed, 86 insertions(+), 70 deletions(-)
88 +
89 +diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp
90 +index 76bc4bd0d3..f8c10e4ee8 100644
91 +--- a/Telegram/SourceFiles/core/shortcuts.cpp
92 ++++ b/Telegram/SourceFiles/core/shortcuts.cpp
93 +@@ -113,7 +113,7 @@ class Manager {
94 + void fill();
95 + void clear();
96 +
97 +- std::optional<Command> lookup(int shortcutId) const;
98 ++ [[nodiscard]] std::vector<Command> lookup(int shortcutId) const;
99 + void toggleMedia(bool toggled);
100 + void toggleSupport(bool toggled);
101 +
102 +@@ -124,14 +124,14 @@ class Manager {
103 + void writeDefaultFile();
104 + bool readCustomFile();
105 +
106 +- void set(const QString &keys, Command command);
107 ++ void set(const QString &keys, Command command, bool replace = false);
108 + void remove(const QString &keys);
109 + void unregister(base::unique_qptr<QShortcut> shortcut);
110 +
111 + QStringList _errors;
112 +
113 + base::flat_map<QKeySequence, base::unique_qptr<QShortcut>> _shortcuts;
114 +- base::flat_map<int, Command> _commandByShortcutId;
115 ++ base::flat_multi_map<int, Command> _commandByShortcutId;
116 +
117 + base::flat_set<QShortcut*> _mediaShortcuts;
118 + base::flat_set<QShortcut*> _supportShortcuts;
119 +@@ -206,11 +206,14 @@ const QStringList &Manager::errors() const {
120 + return _errors;
121 + }
122 +
123 +-std::optional<Command> Manager::lookup(int shortcutId) const {
124 +- const auto i = _commandByShortcutId.find(shortcutId);
125 +- return (i != end(_commandByShortcutId))
126 +- ? base::make_optional(i->second)
127 +- : std::nullopt;
128 ++std::vector<Command> Manager::lookup(int shortcutId) const {
129 ++ auto result = std::vector<Command>();
130 ++ auto i = _commandByShortcutId.findFirst(shortcutId);
131 ++ const auto end = _commandByShortcutId.end();
132 ++ for (; i != end && (i->first == shortcutId); ++i) {
133 ++ result.push_back(i->second);
134 ++ }
135 ++ return result;
136 + }
137 +
138 + void Manager::toggleMedia(bool toggled) {
139 +@@ -278,7 +281,7 @@ bool Manager::readCustomFile() {
140 + const auto name = (*command).toString();
141 + const auto i = CommandByName.find(name);
142 + if (i != end(CommandByName)) {
143 +- set((*keys).toString(), i->second);
144 ++ set((*keys).toString(), i->second, true);
145 + } else {
146 + LOG(("Shortcut Warning: "
147 + "could not find shortcut command handler '%1'"
148 +@@ -343,7 +346,7 @@ void Manager::fillDefaults() {
149 + ranges::view::ints(1, ranges::unreachable));
150 +
151 + for (const auto [command, index] : folders) {
152 +- set(qsl("%1+shift+%2").arg(ctrl).arg(index > 9 ? 0 : index), command);
153 ++ set(qsl("%1+%2").arg(ctrl).arg(index), command);
154 + }
155 +
156 + set(qsl("%1+shift+down").arg(ctrl), Command::FolderNext);
157 +@@ -373,10 +376,12 @@ void Manager::writeDefaultFile() {
158 + shortcuts.push_back(version);
159 +
160 + for (const auto &[sequence, shortcut] : _shortcuts) {
161 +- const auto i = _commandByShortcutId.find(shortcut->id());
162 +- if (i != end(_commandByShortcutId)) {
163 ++ const auto shortcutId = shortcut->id();
164 ++ auto i = _commandByShortcutId.findFirst(shortcutId);
165 ++ const auto end = _commandByShortcutId.end();
166 ++ for (; i != end && i->first == shortcutId; ++i) {
167 + const auto j = CommandNames.find(i->second);
168 +- if (j != end(CommandNames)) {
169 ++ if (j != CommandNames.end()) {
170 + QJsonObject entry;
171 + entry.insert(qsl("keys"), sequence.toString().toLower());
172 + entry.insert(qsl("command"), j->second);
173 +@@ -390,7 +395,7 @@ void Manager::writeDefaultFile() {
174 + file.write(document.toJson(QJsonDocument::Indented));
175 + }
176 +
177 +-void Manager::set(const QString &keys, Command command) {
178 ++void Manager::set(const QString &keys, Command command, bool replace) {
179 + if (keys.isEmpty()) {
180 + return;
181 + }
182 +@@ -415,22 +420,25 @@ void Manager::set(const QString &keys, Command command) {
183 + if (isMediaShortcut || isSupportShortcut) {
184 + shortcut->setEnabled(false);
185 + }
186 +- const auto id = shortcut->id();
187 +- if (!id) {
188 +- _errors.push_back(qsl("Could not create shortcut '%1'!").arg(keys));
189 +- return;
190 +- }
191 ++ auto id = shortcut->id();
192 + auto i = _shortcuts.find(result);
193 + if (i == end(_shortcuts)) {
194 + i = _shortcuts.emplace(result, std::move(shortcut)).first;
195 +- } else {
196 ++ } else if (replace) {
197 + unregister(std::exchange(i->second, std::move(shortcut)));
198 ++ } else {
199 ++ shortcut = nullptr;
200 ++ id = i->second->id();
201 ++ }
202 ++ if (!id) {
203 ++ _errors.push_back(qsl("Could not create shortcut '%1'!").arg(keys));
204 ++ return;
205 + }
206 + _commandByShortcutId.emplace(id, command);
207 +- if (isMediaShortcut) {
208 ++ if (shortcut && isMediaShortcut) {
209 + _mediaShortcuts.emplace(i->second.get());
210 + }
211 +- if (isSupportShortcut) {
212 ++ if (shortcut && isSupportShortcut) {
213 + _supportShortcuts.emplace(i->second.get());
214 + }
215 + }
216 +@@ -465,11 +473,13 @@ Manager Data;
217 +
218 + } // namespace
219 +
220 +-Request::Request(Command command) : _command(command) {
221 ++Request::Request(std::vector<Command> commands)
222 ++: _commands(std::move(commands)) {
223 + }
224 +
225 + bool Request::check(Command command, int priority) {
226 +- if (_command == command && priority > _handlerPriority) {
227 ++ if (ranges::contains(_commands, command)
228 ++ && priority > _handlerPriority) {
229 + _handlerPriority = priority;
230 + return true;
231 + }
232 +@@ -481,12 +491,16 @@ bool Request::handle(FnMut<bool()> handler) {
233 + return true;
234 + }
235 +
236 +-FnMut<bool()> RequestHandler(Command command) {
237 +- auto request = Request(command);
238 ++FnMut<bool()> RequestHandler(std::vector<Command> commands) {
239 ++ auto request = Request(std::move(commands));
240 + RequestsStream.fire(&request);
241 + return std::move(request._handler);
242 + }
243 +
244 ++FnMut<bool()> RequestHandler(Command command) {
245 ++ return RequestHandler(std::vector<Command>{ command });
246 ++}
247 ++
248 + bool Launch(Command command) {
249 + if (auto handler = RequestHandler(command)) {
250 + return handler();
251 +@@ -494,6 +508,13 @@ bool Launch(Command command) {
252 + return false;
253 + }
254 +
255 ++bool Launch(std::vector<Command> commands) {
256 ++ if (auto handler = RequestHandler(std::move(commands))) {
257 ++ return handler();
258 ++ }
259 ++ return false;
260 ++}
261 ++
262 + rpl::producer<not_null<Request*>> Requests() {
263 + return RequestsStream.events();
264 + }
265 +@@ -509,10 +530,7 @@ const QStringList &Errors() {
266 + }
267 +
268 + bool HandleEvent(not_null<QShortcutEvent*> event) {
269 +- if (const auto command = Data.lookup(event->shortcutId())) {
270 +- return Launch(*command);
271 +- }
272 +- return false;
273 ++ return Launch(Data.lookup(event->shortcutId()));
274 + }
275 +
276 + void ToggleMediaShortcuts(bool toggled) {
277 +diff --git a/Telegram/SourceFiles/core/shortcuts.h b/Telegram/SourceFiles/core/shortcuts.h
278 +index fbce7c9ced..4bdf9bca44 100644
279 +--- a/Telegram/SourceFiles/core/shortcuts.h
280 ++++ b/Telegram/SourceFiles/core/shortcuts.h
281 +@@ -35,16 +35,14 @@ enum class Command {
282 + ChatPinned4,
283 + ChatPinned5,
284 +
285 ++ ShowAllChats,
286 + ShowFolder1,
287 + ShowFolder2,
288 + ShowFolder3,
289 + ShowFolder4,
290 + ShowFolder5,
291 + ShowFolder6,
292 +- ShowFolder7,
293 +- ShowFolder8,
294 +- ShowFolder9,
295 +- ShowFolder10,
296 ++ ShowFolderLast,
297 +
298 + FolderNext,
299 + FolderPrevious,
300 +@@ -63,16 +61,14 @@ enum class Command {
301 + };
302 +
303 + constexpr auto kShowFolder = {
304 ++ Command::ShowAllChats,
305 + Command::ShowFolder1,
306 + Command::ShowFolder2,
307 + Command::ShowFolder3,
308 + Command::ShowFolder4,
309 + Command::ShowFolder5,
310 + Command::ShowFolder6,
311 +- Command::ShowFolder7,
312 +- Command::ShowFolder8,
313 +- Command::ShowFolder9,
314 +- Command::ShowFolder10,
315 ++ Command::ShowFolderLast,
316 + };
317 +
318 + [[nodiscard]] FnMut<bool()> RequestHandler(Command command);
319 +@@ -83,13 +79,13 @@ class Request {
320 + bool handle(FnMut<bool()> handler);
321 +
322 + private:
323 +- explicit Request(Command command);
324 ++ explicit Request(std::vector<Command> commands);
325 +
326 +- Command _command;
327 ++ std::vector<Command> _commands;
328 + int _handlerPriority = -1;
329 + FnMut<bool()> _handler;
330 +
331 +- friend FnMut<bool()> RequestHandler(Command command);
332 ++ friend FnMut<bool()> RequestHandler(std::vector<Command> commands);
333 +
334 + };
335 +
336 +diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp
337 +index 6ad29fc53f..c1e30d385d 100644
338 +--- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp
339 ++++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp
340 +@@ -3008,6 +3008,27 @@ void InnerWidget::setupShortcuts() {
341 + return false;
342 + });
343 +
344 ++ const auto filters = &session().data().chatsFilters().list();
345 ++ if (const auto filtersCount = int(filters->size())) {
346 ++ auto &&folders = ranges::view::zip(
347 ++ Shortcuts::kShowFolder,
348 ++ ranges::view::ints(0, ranges::unreachable));
349 ++
350 ++ for (const auto [command, index] : folders) {
351 ++ const auto select = (command == Command::ShowFolderLast)
352 ++ ? filtersCount
353 ++ : std::clamp(index, 0, filtersCount);
354 ++ request->check(command) && request->handle([=] {
355 ++ if (select <= filtersCount) {
356 ++ _controller->setActiveChatsFilter((select > 0)
357 ++ ? (*filters)[select - 1].id()
358 ++ : 0);
359 ++ }
360 ++ return true;
361 ++ });
362 ++ }
363 ++ }
364 ++
365 + static const auto kPinned = {
366 + Command::ChatPinned1,
367 + Command::ChatPinned2,
368 +@@ -3036,42 +3057,23 @@ void InnerWidget::setupShortcuts() {
369 + });
370 + }
371 +
372 +- auto &&folders = ranges::view::zip(
373 +- Shortcuts::kShowFolder,
374 +- ranges::view::ints(0, ranges::unreachable));
375 +-
376 +- for (const auto [command, index] : folders) {
377 +- request->check(command) && request->handle([=, index = index] {
378 +- const auto list = &session().data().chatsFilters().list();
379 +- if (index >= list->size()) {
380 +- return false;
381 +- }
382 +- const auto filterId = list->at(index).id();
383 +- _controller->setActiveChatsFilter((filterId == _filterId)
384 +- ? 0
385 +- : filterId);
386 +- return true;
387 +- });
388 +- }
389 +-
390 + const auto nearFolder = [=](bool isNext) {
391 + const auto id = _controller->activeChatsFilterCurrent();
392 + const auto list = &session().data().chatsFilters().list();
393 +- const auto it = (id == 0)
394 +- ? begin(*list) - 1
395 +- : ranges::find(*list, id, &Data::ChatFilter::id);
396 +- if (it == end(*list) && id != 0) {
397 ++ const auto index = (id != 0)
398 ++ ? int(ranges::find(*list, id, &Data::ChatFilter::id)
399 ++ - begin(*list))
400 ++ : -1;
401 ++ if (index == list->size() && id != 0) {
402 + return false;
403 + }
404 +- const auto i = isNext ? 1 : -1;
405 +- const auto index = it - begin(*list) + i;
406 +- if (index >= (int)list->size() || index < -1) {
407 ++ const auto changed = index + (isNext ? 1 : -1);
408 ++ if (changed >= int(list->size()) || changed < -1) {
409 + return false;
410 + }
411 +- const auto filterId = (index == -1)
412 +- ? 0
413 +- : list->at(index).id();
414 +- _controller->setActiveChatsFilter(filterId);
415 ++ _controller->setActiveChatsFilter((changed >= 0)
416 ++ ? (*list)[changed].id()
417 ++ : 0);
418 + return true;
419 + };
420 +
421 +
422 +From 9ef41062d316be092fbd07a4aef05eb076622556 Mon Sep 17 00:00:00 2001
423 +From: John Preston <johnprestonmail@×××××.com>
424 +Date: Mon, 30 Mar 2020 23:53:10 +0400
425 +Subject: [PATCH 3/3] Ignore whitespaces in dice sending.
426 +
427 +---
428 + Telegram/SourceFiles/api/api_sending.cpp | 2 +-
429 + 1 file changed, 1 insertion(+), 1 deletion(-)
430 +
431 +diff --git a/Telegram/SourceFiles/api/api_sending.cpp b/Telegram/SourceFiles/api/api_sending.cpp
432 +index d0c5315ac0..eaac3957e7 100644
433 +--- a/Telegram/SourceFiles/api/api_sending.cpp
434 ++++ b/Telegram/SourceFiles/api/api_sending.cpp
435 +@@ -200,7 +200,7 @@ void SendExistingPhoto(
436 +
437 + bool SendDice(Api::MessageToSend &message) {
438 + static const auto kDiceString = QString::fromUtf8("\xF0\x9F\x8E\xB2");
439 +- if (message.textWithTags.text != kDiceString) {
440 ++ if (message.textWithTags.text.midRef(0).trimmed() != kDiceString) {
441 + return false;
442 + }
443 + const auto history = message.action.history;
444
445 diff --git a/net-im/telegram-desktop/telegram-desktop-1.9.22.ebuild b/net-im/telegram-desktop/telegram-desktop-2.0.0.ebuild
446 similarity index 98%
447 rename from net-im/telegram-desktop/telegram-desktop-1.9.22.ebuild
448 rename to net-im/telegram-desktop/telegram-desktop-2.0.0.ebuild
449 index c863829b60c..d84a55c83c3 100644
450 --- a/net-im/telegram-desktop/telegram-desktop-1.9.22.ebuild
451 +++ b/net-im/telegram-desktop/telegram-desktop-2.0.0.ebuild
452 @@ -75,6 +75,10 @@ REQUIRED_USE="|| ( alsa pulseaudio )
453
454 S="${WORKDIR}/${MY_P}"
455
456 +PATCHES=(
457 + "${FILESDIR}/2.0.0-fixes.patch"
458 +)
459 +
460 src_configure() {
461 local mycxxflags=(
462 -Wno-deprecated-declarations