Commit Graph

731 Commits

Author SHA1 Message Date
Charles Kerr
21874392a9 refactor: string-utils, file-utils, env (#8417)
* refactor: add libtransmission/string-utils

* refactor: add libtransmission/file-utils

* refactor: add libtransmission/env

* build: update Xcode
2026-02-11 11:21:45 -06:00
Yat Ho
2e65935bbc build: wrap fmt::fmt-header-only with transmission::fmt-header-only (#8370) 2026-02-05 07:50:11 -06:00
Berbe
d8a46d9e98 Fix: #8202 (refactor: use fewer raw C strings) (#8365) 2026-02-04 16:39:01 -06:00
Yat Ho
59939ad4e3 build: improve building with system libevent (#8223)
* build: improve building with system libevent

* chore: remove legacy `tr_add_external_auto_library` macro
2026-02-04 13:36:04 -06:00
Charles Kerr
554cc56bdf refactor: rename our namespace to tr (#8256)
tr and tr::app are less cluttered than libtransmission:: and transmission::app
2026-01-28 18:11:34 -06:00
Yat Ho
2362afd113 refactor: remove tr_isDirection() (#8213) 2026-01-26 10:00:02 -06:00
Charles Kerr
03fdb6f48e refactor: migrate C strings to std::string_view in libtransmission/file.h (#8220)
* refactor: tr_sys_file_open() now takes a std::string_view arg

* refactor: tr_sys_path_copy() now takes a std::string_view arg

* refactor: tr_blocklistSetContent() now takes a std::string_view arg

* refactor: tr_sys_path_remove() now takes a std::string_view arg

* refactor: tr_sys_path_exists() now takes a std::string_view arg

* refactor: tr_sys_dir_create() now takes a std::string_view arg

* refactor: add private stat_sv(), lstat_sv() helpers in file-posix.cc

* refactor: tr_sys_path_is_same() now takes a std::string_view arg

* refactor: tr_sys_path_rename() now takes a std::string_view arg
2026-01-25 18:39:50 -06:00
Charles Kerr
cccef8e2a6 refactor: use fewer raw C strings (#8202)
* refactor: tr_ctorGetDownloadDir() returns a std::optional<std::string>

* refactor: tr_sessionGetConfigDir() now returns a std::string

* refactor: tr_sessionGetDownloadDir() now returns a std::string

* refactor: tr_sessionGetIncompleteDir() now returns a std::string

* refactor: tr_sessionGetRPCWhitelist() now returns a std::string

* refactor: tr_sessionGetRPCPassword() now returns a std::string

* refactor: tr_sessionGetRPCUsername() now returns a std::string

* refactor: tr_sessionGetScript() now returns a std::string

* refactor: tr_blocklistGetURL() now returns a std::string

* refactor: tr_ctorGetSourceFile() now returns a std::optional<std::string>

* refactor: tr_torrentFile() now returns a std::string
2026-01-22 22:36:24 -06:00
Charles Kerr
e7129cfd54 refactor: use fewer raw C strings (#8201)
* refactor: tr_blocklistSetURL() takes a string_view

* refactor: tr_ctorSetMetainfoFromFile() takes a string_view

* refactor: tr_ctorSetMetainfoFromMagnetLink() takes a string_view

* refactor: tr_torrentSetDownloadDir() takes a string_view

* refactor: tr_ctorSetDownloadDir() takes a string_view

* refactor: tr_ctorSetIncompleteDir() takes a string_view

* refactor: tr_torrentSetTrackerList() takes a string_view

* refactor: tr_torrentRenamePath() now takes a std::string_view

* refactor: tr_torrentFindFromMagnetLink() takes a string_view
2026-01-22 16:31:08 -06:00
Charles Kerr
f6e9027da7 refactor: use fewer raw C strings (#8200)
* refactor: tr_sessionSaveSettings() takes a string_view

* refactor: tr_sessionSetDownloadDir() takes a string_view

* refactor: tr_sessionSetIncompleteDir() takes a string_view

* refactor: tr_sessionSetRPCCWhitelist() takes a string_view

* refactor: tr_sessionSetRPCPassword() takes a string_view

* refactor: tr_sessionSetRPCUsername() takes a string_view

* refactor: tr_sessionSetDefaultTrackers() takes a string_view

* refactor: tr_sessionSetScript() takes a string_view
2026-01-22 14:38:20 -06:00
Charles Kerr
140958a8a1 refactor: no macros in transmission.h (#8099)
* refactor: replace TR_RPC_SESSION_ID_HEADER macro with TrRpcSessionIdHeader constant

refactor: replace TR_RPC_RPC_VERSION_HEADER macro with TrRpcVersionHeader constant

* refactor: remove macro TR_DEFAULT_RPC_PORT_STR

* refactor: remove macro TR_DEFAULT_PEER_PORT_STR

* refactor: remove macro TR_DEFAULT_PEER_LIMIT_GLOBAL_STR

* refactor: remove macro TR_DEFAULT_PEER_LIMIT_TORRENT_STR

* refactor: remove macro TR_DEFAULT_PEER_SOCKET_TOS_STR

* refactor: replace DEFAULT_BLOCKLIST_FILENAME macro with TrDefaultBlocklistFilename constant

* refactor: rename TrHttpServerDefaultBasePath to TrDefaultHttpServerBasePath for consistency with other defaults

* refactor: group constants together near the top of transmission.h

* refactor: hardcode string lengths to avoid FTBFS on older C++17 compilers

* refactor: move macros to the tr_getopt clients

* refactor: explicitly specify the parameter index to avoid passing in TrRpcSessionIdHeader twice

* refactor: add an error message to new static_asserts
2026-01-14 07:52:57 -06:00
Charles Kerr
8dea0e863f fix: several CI errors (#8124)
* Revert "build(cmake): support building with (almost) all system 3rd-party libraries (#7554)"

This reverts commit a89ca4f2c9.

* fixup! refactor: use a map of getters, setters for `session_get` and `session_set` properties (#8024)

fix: capture-by-reference error in session_accessors()

* fix: 'Qt depends on a UTF-8 locale' CI warning

* fix: 'qt.qpa.xcb: could not connect to display' CI error
2026-01-13 13:16:40 -06:00
Yat Ho
a89ca4f2c9 build(cmake): support building with (almost) all system 3rd-party libraries (#7554)
* build: overhaul tr_add_external_auto_library

* build: use package-provided CMake config file libevent

* build: use package-provided CMake config file miniupnpc

* build: update libutp find module

* build: make LIBNAME an optional parameter

* build: use package-provided CMake config file libdeflate

* build: update libb64 find module

* build: update libnatpmp find module

* build: update libpsl find module

* build: support system fast_float library

* chore: reformat long brew commands

* build: support system fmt library

* build: support system rapidjson library

* build: support system small library

* build: support system library utf8cpp

* build: support system library WideInteger

* build: support system library gtest

* fix: incorrectly labeled test suites

* build: remove unused parameters from tr_add_external_auto_library

* build: update crc32c cmake script

* fix: dht system library

* fix: add libutp interface target

* code review: move TrGtest.cmake

* code review: move tr_get_fmt_version into Findfmt.cmake

* code review: use option() for gtest

* code review: move find_package(PkgConfig) out of loop

* build: delete FindCrc32c.cmake

Impossible to parse package version from distributed source files.

* code review: Finddht.cmake

* build: delete FindFastFloat.cmake

Impossible to parse package version from distributed source files.

* code review: Findfmt.cmake

* code review: Findlibb64.cmake

* code review: Findlibdeflate.cmake

* code review: Findlibevent.cmake

* code review: Findlibnatpmp.cmake

* code review: Findlibpsl.cmake

* code review: Findlibutp.cmake

* code review: Findlibminiupnpc.cmake

* code review: FindRapidJSON.cmake

* build: delete FindSmall.cmake

Impossible to parse package version from distributed source files.

* build: only accept cmake config package for utf8cpp

Impossible to parse package version from distributed source files.

* build: delete FindWideInteger.cmake

Impossible to parse package version from distributed source files.

* build: add `USE_SYSTEM_DEFAULT`

* ci: drop Fedora 40 and adopt Fedora 43

* ci: try to silence system header warnings

* ci: use `cmake --install`

* Revert "build: only accept cmake config package for utf8cpp"

This reverts commit 2158d631fd.

* build: harden utf8cpp find module

* chore: bump wide-integer

Pick up bf9398f9da and bcc726a30f

* refactor: gtest should be included with angled brackets

Now that gtest is built as a system library, it should be included with angled brackets instead of quotes.

* code review: fixup libutp variables before `find_package_handle_standard_args`

* code review: define `WIDE_INTEGER_HAS_LIMB_TYPE_UINT64` only for targets depending on WideInteger

* chore: bump wide-integer

Pickup 4b2258acac so that wide-integer tests won't run in Transmission project.
2026-01-12 09:04:47 -06:00
Yat Ho
dbd4ea5be8 fix(daemon): missing break statement in switch (#7991) 2025-12-23 13:13:32 -06:00
Yat Ho
dcd516b673 feat: update daemon args for preferred_transports (#7988)
* feat: add `--preferred-transports` to daemon

* chore: deprecate `--(no-)utp` in daemon

* fix: `--(no-)utp` args in daemon
2025-12-22 23:11:41 -06:00
Charles Kerr
1a18462691 refactor: make tr_sessionInit() config_dir arg a string_view (#7939) 2025-12-18 23:06:23 -06:00
Charles Kerr
fcd1e2ff8a refactor: simplify tr_sessionLoadSettings() args (#7935)
* refactor: remove unused appname arg from tr_sessionLoadSettings()

* refactor: swap order of arguments to tr_sessionLoadSettings()
  so way the optional arg can go at the end
2025-12-15 13:44:38 -06:00
Yat Ho
9dd9aab902 build: bump clang tools to 20 (#7573)
* build: bump to clang-format-20

* build: bump to clang-tidy-20

* chore: revert edc59ba5d8
2025-12-01 23:18:02 -06:00
Yat Ho
8d25484cdb refactor: use new tr_variant API in daemon (#7103) 2025-11-12 13:04:55 -06:00
Yat Ho
648c65868c feat: use Type=notify-reload in daemon service (#7570)
* feat: use `Type=notify-reload` in daemon service

* build: keep systemd names consistent

---------

Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-10-29 09:04:04 -05:00
Managor
3f7e1e4309 Update transmission-daemon.1 (#7559) 2025-10-16 08:45:27 -05:00
Yat Ho
9c14fa58d8 feat: allow optional arguments in tr_getopt() (#7510)
* feat: allow optional arguments in `tr_getopt()`

* test: new tests for optional arg

* code review: `using Arg = tr_option::Arg`

* refactor: static assert option array size

* test: add new tests for missing arguments in the middle

* test: static auto constexpr
2025-10-15 12:08:11 -05:00
Yat Ho
c215de34d5 chore: move away from fmt/core.h (#7557) 2025-05-06 01:01:12 -05:00
Yat Ho
cf7ac07a6c build: support different install prefixes for daemon service file (#7571)
* build: support different install prefixes for daemon service file

* code review: add `@ONLY`
2025-05-01 15:09:49 +01:00
Yat Ho
7b83c7d625 refactor: rename unreleased quarks to snake_case (#7483)
* refactor: rename `sequentialDownload` to `sequential_download`

* refactor: rename `beginPiece` to `begin_piece`

* refactor: rename `endPiece` to `end_piece`

* refactor: rename `ipProtocol` to `ip_protocol`

* refactor: rename `preferred-transport` to `preferred_transport`
2025-03-10 17:30:19 -05:00
Yat Ho
86e904d1a2 feat: sequential download cmdline options in remote and daemon (#7048)
* feat: add seq option in remote

* feat: print session sequential download setting in remote

* refactor: assert options torrent size in daemon

* feat: add seq option in daemon
2025-03-10 16:16:25 -05:00
Dzmitry Neviadomski
7e87adcd91 Fix building transmission with C++23 (#6832)
* fix: operator== should return bool in tr_strbuf

Fixes build error with C++20/C++23

error: return type 'auto' of selected 'operator==' function for rewritten '!=' comparison is not 'bool'

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* fix: explicitly specify Blocklist::size() return type as size_t

Fixes building with C++20/C++23
error: no matching function for call to 'size'
function 'size' with deduced return type cannot be used before it is defined

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* fix: wrap runtime format strings with fmt::runtime in library, daemon and cli

fmt::format_string ctor is consteval with C++20
See https://github.com/fmtlib/fmt/issues/2438

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* fix: wrap runtime format strings with fmt::runtime for GTK client

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* fix: allow to override C and CXX standard via cmdline or env

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* fix: add job to check if transmission compiles with C++23

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* Address code review by mikedld

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* fix new found fmt build errors

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* Address code review by tearfur

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* fix: make tr_net_init_mgr singleton buildable with C++23

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>

---------

Signed-off-by: Dzmitry Neviadomski <nevack.d@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2025-03-10 13:08:57 -05:00
Yat Ho
131caa1239 refactor: convert tr_net_init_mgr to singleton (#6914) 2024-12-30 09:32:11 -06:00
Yat Ho
2c82f3d83d fix: add missing settings.json docs and app defaults (#7218)
* docs: `trash-can-enabled` gtk only

* fix: add `pidfile` to daemon app defaults

* perf: don't copy string literal to variant
2024-10-31 22:14:44 -05:00
Yat Ho
819d7f4136 fix: check tr_num_parse result in daemon (#7181) 2024-10-20 23:52:52 -05:00
luk1337
ed2c6c4085 fix: Use non-lib64 systemd system unit dir path (#7115)
This is a common path across Linux distros.

Checked distros:
* Arch Linux
* Fedora
* Gentoo
* openSUSE
* Ubuntu
2024-09-24 00:32:25 +01:00
Yat Ho
04c115f79c fix: accurate timestamp in daemon logs (#7009)
* fix: accurate timestamp in daemon logs

* fix: gtk build errors

* fixup! fix: gtk build errors

* code review: use system_clock typedefs

* code review: use the full buffer for string view

* fixup! fix: accurate timestamp in daemon logs

* code review: limit exposure of `using`
2024-08-13 23:57:52 +01:00
niol
be67b33f42 systemd service documentation key (#6781)
Co-authored-by: Barak A. Pearlmutter <barak+git@pearlmutter.net>
2024-05-25 11:51:51 -05:00
Cœur
460ce7c302 Add start_paused to settings file and daemon (#6728)
* Add daemon-startPaused to settings file

* code review: naming

* "Predefined quarks must be sorted by their string value"

* code review: replacing paused_ with tr_variantDictAddBool/tr_variantDictFindBool

* code review: doc

* Update docs/Editing-Configuration-Files.md

Co-authored-by: Yat Ho <lagoho7@gmail.com>

---------

Co-authored-by: Eugen Beck <beck@cs.rwth-aachen.de>
Co-authored-by: Yat Ho <lagoho7@gmail.com>
2024-03-30 16:39:44 -05:00
Charles Kerr
1855cdb731 refactor: replace tr_sys_file_write_line() with fmt::print("...\n") (#6619)
* refactor: use fmt::print in log.cc

https://github.com/fmtlib/fmt/issues/428#issuecomment-395442159
> You can use fmt::print("...\n") on Windows as well.

Use this mechanism instead of tr_sys_file_write_line()

* refactor: use FILE* in daemon

* refactor: remove unused tr_sys_file_flush_possible()

* refactor: remove unused tr_sys_file_write_line()

* refactor: remove unused tr_sys_file_get_std()

* refactor: remove unused tr_std_sys_file_t
2024-02-25 16:12:08 -06:00
Yat Ho
8b8e9f5c6d fixup! fix: include daemon-specific options in app defaults (#6505)
* fixup! fix: include daemon-specific options in app defaults (#6499)

* fix: windows build failure

* Revert "fixup! fix: include daemon-specific options in app defaults (#6499)"

This reverts commit 92c2106cc607df36aca4ba28e8c20bd96fa87688.

* refactor: define daemon-specific quarks in libtransmission
2024-01-11 13:20:22 +00:00
Yat Ho
7fd29d2d46 fix: include daemon-specific options in app defaults (#6499) 2024-01-07 11:12:31 -06:00
Charles Kerr
3f6969217c chore: remove FMT_STRING macros (#6497) 2024-01-06 14:05:18 -06:00
Yat Ho
4bb9eab0d0 fix: app defaults should override libtransmission defaults (#6495) 2024-01-06 10:10:14 -06:00
Charles Kerr
646883174b chore: fix misc-use-anonymous-namespace warnings from clang-tidy (#6488) 2024-01-04 23:12:51 -06:00
Mike Gelfand
9c4d28dd08 fix: a couple of logging format issues (#6463)
* Fix swapped log args in `do_log_system_error()`

* Fix invalid fmt use in `tr_rpc_server::load()` logging
2023-12-30 08:56:34 -06:00
LaserEyess
b562983cbd Harden systemd service (#6391)
This commit includes strict, but still compatible, service hardening for
transmission-daemon.service. The main goal is a defense-in-depth
strategy that protects users from unknown vulnerabilities in
transmission.

In practice, transmission does not use any of the features that are
blocked in this hardening. However, this is still a network facing
daemon that, by design, accepts connections from unknown peers. So
better safe than sorry.

This commit also installs the service via CMake

Co-authored-by: LaserEyess <LaserEyess@users.noreply.github.com>
2023-12-24 20:48:18 -06:00
Charles Kerr
e14806c409 refactor: c++ify libtransmission's tr_ctor struct (#6295) 2023-11-26 15:43:37 -06:00
Charles Kerr
2e32789193 refactor: add libtransmission::Values (#6215) 2023-11-09 08:39:06 -06:00
Charles Kerr
a952a0731f refactor: remove the tr_error** idiom (#6198)
* refactor: remove the tr_error** idiom

* fix: tr_error::message() is only constexpr in c++20 and up

* chore: silence a couple of g++-12 Wshadow warnings
2023-11-04 11:39:41 -05:00
Yat Ho
a2b547fb50 chore: iwyu (#6201) 2023-11-03 12:03:26 -05:00
Julien
8ac323d5d6 chore: removed copyright timespans in headers (#4850) 2023-11-01 16:11:11 -05:00
Rafe S
94aeff9bc2 docs: update log-level in transmission-daemon.1 manpage (#6059)
Add entry for log-level, mark log-error, log-info, and log-debud as deprecated.
2023-10-01 18:21:14 -05:00
Charles Kerr
6ead147620 refactor: use new tr_variant API in tr_session (#6006) 2023-09-16 08:23:35 -05:00
Charles Kerr
ebb1b775af refactor: public tr_session settings API now returns tr_variants (#5983) 2023-09-07 19:05:16 -05:00