refactor: intern RPC method names (#7892)

* refactor: add quarks for the RPC method names

* update tr_quark_convert() to handle RPC method names

* refactor: use interned keys for RPC method names

* test: add torrentGetLegacy test

* refactor: use interned keys for RPC method names in tr-qt

* refactor: use interned keys for RPC method names in tr-remote

* refactor: use interned keys for RPC method names in tests

* refactor: use interned keys for RPC method names in tr-gtk

* chore: fix readability-identifier-naming regression
This commit is contained in:
Charles Kerr
2025-12-09 11:48:09 -06:00
committed by GitHub
parent 095bad6568
commit 0979bbcc3f
11 changed files with 255 additions and 109 deletions

View File

@@ -1481,7 +1481,7 @@ void Application::Impl::start_all_torrents()
tr_variant request;
tr_variantInitDict(&request, 1);
tr_variantDictAddStrView(&request, TR_KEY_method, "torrent-start"sv);
tr_variantDictAddStrView(&request, TR_KEY_method, tr_quark_get_string_view(TR_KEY_torrent_start_kebab));
tr_rpc_request_exec(session, request, {});
}
@@ -1491,7 +1491,7 @@ void Application::Impl::pause_all_torrents()
tr_variant request;
tr_variantInitDict(&request, 1);
tr_variantDictAddStrView(&request, TR_KEY_method, "torrent-stop"sv);
tr_variantDictAddStrView(&request, TR_KEY_method, tr_quark_get_string_view(TR_KEY_torrent_stop_kebab));
tr_rpc_request_exec(session, request, {});
}
@@ -1564,6 +1564,7 @@ void Application::Impl::actions_handler(Glib::ustring const& action_name)
}
}
else if (
// TODO: migrate from _kebab
action_name == "torrent-start" || action_name == "torrent-start-now" || action_name == "torrent-stop" ||
action_name == "torrent-reannounce" || action_name == "torrent-verify" || action_name == "queue-move-top" ||
action_name == "queue-move-up" || action_name == "queue-move-down" || action_name == "queue-move-bottom")