Improvements for linking to events
- Fixes scrolling to an event not being reliable - Adds new /goto command that can open URLs, go to events, or go to message indexes. - Refactored ChatPage::handleMatrixUri() to contain the handling originally in Nheko::openLink(), and makes it return a boolean based on whether the URL was handled internally or not.
This commit is contained in:
parent
5bff9df4ae
commit
1d5bf56cf9
6 changed files with 101 additions and 56 deletions
|
|
@ -630,6 +630,23 @@ InputBar::command(QString command, QString args)
|
|||
notice(args, false);
|
||||
} else if (command == "rainbownotice") {
|
||||
notice(args, true);
|
||||
} else if (command == "goto") {
|
||||
// Goto has three different modes:
|
||||
// 1 - Going directly to a given event ID
|
||||
if (args[0] == '$') {
|
||||
room->showEvent(args);
|
||||
return;
|
||||
}
|
||||
// 2 - Going directly to a given message index
|
||||
if (args[0] >= '0' && args[0] <= '9') {
|
||||
room->showEvent(args);
|
||||
return;
|
||||
}
|
||||
// 3 - Matrix URI handler, as if you clicked the URI
|
||||
if (ChatPage::instance()->handleMatrixUri(args)) {
|
||||
return;
|
||||
}
|
||||
nhlog::net()->error("Could not resolve goto: {}", args.toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue