| 290 | } // namespace |
| 291 | |
| 292 | void CodesFeedString(SessionController *window, const QString &text) { |
| 293 | static const auto codes = GenerateCodes(); |
| 294 | static auto secret = QString(); |
| 295 | |
| 296 | secret += text.toLower(); |
| 297 | int size = secret.size(), from = 0; |
| 298 | while (size > from) { |
| 299 | auto piece = base::StringViewMid(secret,from); |
| 300 | auto found = false; |
| 301 | for (const auto &[key, method] : codes) { |
| 302 | if (piece == key) { |
| 303 | method(window); |
| 304 | from = size; |
| 305 | found = true; |
| 306 | break; |
| 307 | } |
| 308 | } |
| 309 | if (found) break; |
| 310 | |
| 311 | found = ranges::any_of(codes, [&](const auto &pair) { |
| 312 | return pair.first.startsWith(piece); |
| 313 | }); |
| 314 | if (found) break; |
| 315 | |
| 316 | ++from; |
| 317 | } |
| 318 | secret = (size > from) ? secret.mid(from) : QString(); |
| 319 | } |
| 320 | |
| 321 | } // namespace Settings |
no test coverage detected