Commit Graph

320 Commits

Author SHA1 Message Date
Charles Kerr 611d36ac84
refactor: decouple session settings from the session class (#4053) 2022-11-01 19:32:26 -05:00
Charles Kerr 210bb03f2f
fix: recent signed-unsigned comparison warnings (#4034) 2022-10-26 11:20:10 -05:00
A Cœur 12e564096b
fix: "Implicit conversion loses integer precision" warnings (#3960) 2022-10-25 11:14:42 -05:00
Mike Gelfand 70f623f32b
Add user data parameter for torrent removal callback (#4009) 2022-10-23 11:51:35 -05:00
Charles Kerr 4a359fd481
refactor: session private fields (#3961)
* refactor: make tr_session.private_peer_port a private field

chore: make tr_session.public_peer_port a private field

* refactor: make tr_session.web_ a private field

* refactor: make tr_session.lpd_ a private field

* refactor: make tr_session.bind_ipv4_ private

refactor: make tr_session.bind_ipv6_ private

* refactor: make tr_session.bandwidth_groups_ private; add const accessor

* refactor: make tr_session.port_forwarding_ private

* refactor: make tr_session.peerMgr private pt 1: add tr_session::addIncoming()

* refactor: make tr_session.peerMgr private pt 1: add tr_session::addTorrent()

* refactor: make tr_session.peer_mgr_ private

* refactor: make tr_session.setPeerPort() private
2022-10-13 21:25:02 -05:00
Mike Gelfand f1f55cc3df
Sync translations (#3939)
* Sync translations with code

* Sync translations with Transifex

* Remove Mac menu title that isn't displayed and shouldn't be translated

* Add context to logging level strings in GTK client

* Use "µTP" consistently in code

* Use ellipsis instead of three docs in Qt client strings

* Close HTML tags in blocklist-related strings

* Remove trailing space from a translatable string in Qt client

* Add missing plural forms for English strings in Qt client

* Fix spelling: metaInfo -> metainfo
2022-10-11 18:39:41 +03:00
Charles Kerr 1782dc6d7a
refactor: use readability-identifier-naming in clang-tidy (#3784) 2022-09-07 11:04:28 -05:00
Charles Kerr d17341d784
refactor: constify (#3780) 2022-09-06 12:52:58 -05:00
Charles Kerr 82212ff1d8
refactor: move the verify worker thread into a wrapper class (#3775) 2022-09-05 23:43:59 -05:00
Charles Kerr 6ca0ce683a
refactor: more constexpr (#3744)
Make more simple functions constexpr where possible.
2022-08-31 17:33:51 -05:00
Charles Kerr 291d2fcb9b
fix: when renaming local data files fails, set the torrent error and pause the torrent (#3717) 2022-08-26 18:57:44 -05:00
Charles Kerr 29f57bc296
chore: iwyu headers (#3661) 2022-08-17 11:08:36 -05:00
Charles Kerr e49747ab51
feat: add tr_strvToBuf() (#3657)
* feat: add tr_getDefaultConfigDirToBuf()

* feat: add tr_getDefaultDownloadDirToBuf()

* feat: add tr_strvToBuf()

* feat: add tr_torrentFindFileToBuf()

* feat: add tr_torrentGetMagnetLinkToBuf()

* refactor: remove unused makeString() from tests

* feat: add tr_torrentFilenameToBuf()

* feat: add tr_torrentGetTrackerListToBuf()

* chore: remove obsolete comment references to tr_free

* chore: remove unused tr_strdup()

* chore: remove unused forward declarations
2022-08-16 19:28:57 -05:00
Charles Kerr 0fbfed60b1
refactor: make tr_session.speed_limit_Bps_ private (#3645)
* refactor: make tr_session.speed_limit_Bps_ private

* refactor: make tr_session.is_utp_enabled_ private

* refactor: make tr_session.is_prefetch_enabled_ private

* refactor: make tr_session.is_ratio_limited_ private

* refactor: make tr_session.upload_slots_per_torrent_ private

* refactor: make tr_session.peer_id_ttl_hours_ private

* refactor: make tr_session.blocklists_ private

* refactor: make tr_session.umask_ private

* refactor: make tr_session.evdns_base_ private

* fixup! refactor: make tr_session.blocklists_ private

* refactor: make tr_session.default_trackers_ private

* refactor: make tr_session.idle_limit_minutes_ private

* refactor: make tr_session.WebMediator private

* refactor: make tr_session.session_id_ private

* refactor: make tr_session.peer_socket_tos_ private
2022-08-15 12:48:05 -05:00
Charles Kerr a4c1a23fae
refactor: make tr_session.is_incomplete_file_naming_enabled_ private (#3642)
* refactor: make tr_session.is_incomplete_file_naming_enabled_ private

* refactor: make session callback setters constexpr

* refactor: make tr_session.is_port_random_ private

* refactor: make tr_session.desired_ratio_ private

* refactor: make tr_session.is_pex_enabled_ private

* refactor: make tr_session.is_idle_limited_ private
2022-08-14 19:33:28 -05:00
Charles Kerr 44a291ca39
refactor: remove tr_session nonmember functions (#3641) 2022-08-14 14:41:57 -05:00
Charles Kerr 08ec882055
refactor: remove tr_isSession() (#3638) 2022-08-14 09:16:08 -05:00
Charles Kerr ed6ee619a6
refactor: make tr_session.queue fields private (#3634) 2022-08-13 14:56:10 -05:00
Charles Kerr 7c5862a5f5
refactor: remove tr_new, tr_free pt. 1 (#3626)
* refactor: tr_torrentGetMetadataPiece() returns an optional vector

* refactor: use tr_pathbuf in create_temp_path()

* refactor: use tr_pathbuf in win32 create_temp_path()

* refactor: use std::vector in isPeerInteresting()

* refactor: remove tr_new0 from tr_peerMgrPeerStats()

* refactor: remove tr_new0 from rechokeUploads()

* refactor: silence clang nullptr dereference warning

* refactor: make tr_natpmp a C++ class

* refactor: use std::string in tr_log_message
2022-08-11 19:59:58 -05:00
Charles Kerr 3ed6b187bb
refactor: iwyu utils.h (#3583) 2022-08-04 08:44:18 -05:00
Charles Kerr dab81c1af6
fix: readability-inconsistent-declaration-parameter-name warnings in libtransmission (#3572) 2022-08-03 01:15:37 -05:00
Charles Kerr f39826cc59
fix: clang-tidy-15 warnings (#3570)
* fix: bugprone-assignment-in-if-condition warning in tr_bitfield::countFlags()

* fix: bugprone-assignment-in-if-condition warning in tr_watchdir_generic_new()

* fix: bugprone-assignment-in-if-condition warning in torrentRenamePath()

* fix: bugprone-assignment-in-if-condition warning in tr_watchdir_inotify_on_event()

* fix: bugprone-assignment-in-if-condition warning in tr_variantWalk()

* fix: misc-const-correctness warning in TrackerDelegate::getText()

* fix: bugprone-assignment-in-if-condition warning in Session::updateStats()

* fix: performance-unnecessary-value-param warning in discoverThreadfunc()

* fix: clang-analyzer-core.UndefinedBinaryOperatorResult warning in tr_completion::setHasAll()

* fix: clang-analyzer-core.UndefinedBinaryOperatorResult warning in tr_torrentFileCompleted()

* fix: silence clang-analyzer-cplusplus.NewDelete warning when using QPointer

This appears to be a false positive; added NOLINT
2022-08-02 18:34:53 -05:00
Charles Kerr 18e2a04f88
refactor: make sha1, sha256 RAII safe (#3556) 2022-07-31 15:58:14 -05:00
Charles Kerr 78b24b594b
refactor: remove tr_runInEventThread() temp data structs (#3528)
* refactor: remove port_forwarding_data

* refactor: remove "struct rename_data"
2022-07-27 02:07:44 -05:00
Charles Kerr 4f7051fe7f
refactor: make tr_session's directory fields private (#3516) 2022-07-23 02:13:18 -05:00
Charles Kerr 47fe7c47d2
refactor: replace per-torrent callbacks with per-session ones. (#3495) 2022-07-23 01:04:34 -05:00
Charles Kerr 9bf2918ad0
refactor: remove tr_strvPath() (#3509) 2022-07-22 13:07:23 -05:00
Charles Kerr 0da1cbb6ec
fix: 3508 location invalidation (#3511)
* Revert "refactor: remove tr_sessionGetConfigDir() (#3506)"

This reverts commit c50da43ae0.

* Revert "fix: do not leak in tr_getWebClientDir() (#3502)"

This reverts commit 5a75e37033.
2022-07-22 00:52:48 -05:00
Charles Kerr c50da43ae0
refactor: remove tr_sessionGetConfigDir() (#3506)
* refactor: remove tr_sessionGetConfigDir() from GTK client

* refactor: remove tr_sessionGetConfigDir() from daemon

* refactor: remove tr_sessionGetConfigDir()

* refactor: remove tr_getTorrentDir()

* fixup! refactor: remove tr_sessionGetConfigDir()
2022-07-21 20:12:45 -05:00
Charles Kerr da032e3875
refactor: remove unused tr_stat fields (#3493) 2022-07-20 21:54:41 -05:00
Charles Kerr 8ea6b6f6d3
refactor: tr_swarm (#3368)
* refactor: simplify tr_swarmGetStats()

* refactor: make addStrike() a tr_swarm member function

* refactor: make updateEndgame() a tr_swarm member function

* refactor: limit scope of some constexpr values

* refactor: make tr_swarm.is_endgame private

* refactor: make tr_swarm.isAllSeeds() a member function
2022-06-28 01:22:34 -05:00
A Cœur 7f01ee52fe
Set torrent file's metainfo for magnets (#3322) 2022-06-21 16:47:57 -05:00
Charles Kerr 25fdb5805c
refactor: use tr_torrent_id_t (#3314)
* refactor: use semantic type tr_torrent_type_t in libtransmission

* refactor: use semantic type tr_torrent_type_t in gtk client

* refactor: use semantic type tr_torrent_type_t in qt client
2022-06-17 10:43:04 -05:00
Viacheslav Chimishuk 0397176c10
keep labels in order added, rather than alphabetically (#3271) 2022-06-16 17:08:42 -05:00
Charles Kerr 256b436023
fix: clang 15 warnings (#3172)
* fix modernize-macro-to-enum libtransmission warnings

* fix readability-simplify-boolean-expr libtransmission warnings

* fix bugprone-unchecked-optional-access libtransmission warnings
2022-06-01 11:56:59 -05:00
Charles Kerr c0bb2d40f1
refactor: add pathbuf and std::string-friendly helpers to tr_sys file and path funcs (#3118)
* refactor: add sv-friendly tr_sys_dir_create() variant

* refactor: add sv-friendly tr_sys_path_get_info() variant

* refactor: add sv-friendly tr_sys_path_exists() variant

* refactor: add sv-friendly tr_sys_path_remove() variant

* refactor: add sv-friendly tr_sys_path_rename() variant

* fixup! refactor: add sv-friendly tr_sys_path_rename() variant
2022-05-21 20:17:00 -05:00
A Cœur 2e25370cc5
Fix QuickLook (#3001)
* Fix QuickLook symbol not found; add file sort and filesize
2022-05-19 23:07:17 -05:00
Charles Kerr a28b07b390
Revert "refactor: move tr_torrent callbacks to tr_session (#3003)" (#3104)
This reverts commit 27fbfd8da6.

Fixes #3088.
2022-05-16 13:48:43 -05:00
Charles Kerr 27fbfd8da6
refactor: move tr_torrent callbacks to tr_session (#3003)
* refactor: move tr_torrent callbacks to tr_session

* Support tr_sessionSet* (#3044)

Co-authored-by: Antoine Cœur <coeur@gmx.fr>
2022-05-14 10:00:13 -05:00
Charles Kerr 88a0b292d9
fixup: fix fd regression in tr_open_files (#3036)
Fixes #3032.
2022-04-30 23:30:49 -05:00
Charles Kerr 5dbe1f4669
refactor: replace tr_fdlimit with tr_open_files (#3016) 2022-04-28 21:35:47 -05:00
Charles Kerr a400682247
refactor: remove unused tr_torrent fields (#3013)
* refactor: remove unused field tr_torrent.prefetchMagnetMetadata

* refactor: remove unused field tr_torrent.dhtAnnounce6InProgress

* refactor: remove unused field tr_torrent.dhtAnnounceInProgress

* refactor: fold etaULSpeed and etaDLSpeed into one field

* refactor: re-arrange fields to avoid padding
2022-04-28 11:52:07 -05:00
Charles Kerr 7c2477dddf
refactor: reduce field padding in some structs (#3006)
* refactor: use smaller integral types in tr_bandwidth

* refactor: re-arrange tr_torrent fields to avoid padding

* refactor: re-arrange tr_torrent fields to avoid padding

* refactor: re-arrange tr_announcer fields to avoid padding
2022-04-28 08:44:24 -05:00
Charles Kerr bf655a921d
refactor: use smaller integral types in some structs (#3005) 2022-04-27 20:06:51 -05:00
Charles Kerr 304fffa6b3
refactor: intern tr_torrent.bandwidth_group_ (#3000)
Most use cases involve either (a) using the default group or (b) sharing
a group with other torrents. In both cases, using a tr_quark is cheaper
than a std::string.
2022-04-27 10:41:28 -05:00
Charles Kerr ca13842c84
refactor: make tr_torrent::verify_state_ private (#2982) 2022-04-24 22:43:26 -05:00
Charles Kerr 1ebac744a5
build: re-enable cert-err33-c clang-tidy warning (#2968)
* refactor: re-enable cert-err33-c clang-tidy warning

* refactor: use fmt::chrono in transmission-remote

* refactor: use fmt::chrono in transmission-show

* refactor: use fmt::chrono in GTK details dialog

* refactor: use fmt::chrono in tr_session

* refactor: remove tr_localtime_r

* refactor: remove tr_gmtime_r
2022-04-22 14:56:54 -05:00
Charles Kerr 32f854a7cf
refactor: add a tr_port safety class (#2952) 2022-04-21 10:58:13 -05:00
Charles Kerr 345b71ffda
refactor: use std::vector for tr_torrents.removed_ (#2943) 2022-04-18 14:24:20 -05:00
Antoine Cœur 9c0038ac8e
Pause magnet download when "Start when added" is unchecked (#2902)
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2022-04-18 01:03:44 -05:00
Charles Kerr 18da7eb125
refactor: use std::vector<tr_quark> for torrent labels (#2942) 2022-04-18 00:53:48 -05:00
Charles Kerr af49e0f1af
fix: do not load magnet file resume files (#2940) 2022-04-17 21:55:20 -05:00
Charles Kerr 6cdc7e3828
refactor: remove tr_announce_list::tracker info.announce (#2931) 2022-04-16 15:41:51 -05:00
Charles Kerr 2866638e1b
refactor: add tr_torrent_files::move() and remove() (#2919) 2022-04-15 18:39:04 -05:00
Charles Kerr ec57d10954
refactor: tr_files::hasAnyLocalData() (#2911) 2022-04-13 21:41:06 -05:00
Charles Kerr 9f9f60f1e3
refactor: tr_block_info (#2908) 2022-04-13 20:22:59 -05:00
Charles Kerr 4a65956cc9
refactor: extract some file management into tr_files class (#2906) 2022-04-12 10:00:02 -05:00
Charles Kerr b256da02e3
refactor: remove unused macros (#2897)
* refactor: remove unused fu nction tr_lowerBound()

* refactor: tr_timerAdd() takes a reference, not a pointer

* refactor: tr_timerAddMsec() takes a reference, not a pointer

* refactor: tr_moveFile() takes a reference, not a pointer

* refactor: tr_wildmat() takes std::string_views

* refactor: remove unused macro TR_GNUC_NONNULL

* refactor: remove unused macro TR_GNUC_PRINTF

* refactor: remove unused macro TR_GNUC_NULL_TERMINATED

* refactor: remove unused macro TR_GNUC_HOT

* refactor: remove unused macro __has_feature

* refactor: remove unused macro __has_attribute

* refactor: remove unused macro TR_DEPRECATED

* refactor: remove unused macro TR_DISABLE_COPY_MOVE
2022-04-07 19:20:29 -05:00
Charles Kerr 31c65eec1f
refactor: remove tr_strvJoin() (#2896) 2022-04-07 17:26:59 -05:00
Charles Kerr 1cc9da26ba
fix: sonarcloud (#2865)
* refactor: implement FileTreeItem::children_ with a std::vector

* fix: std::move should not be called on forwarding reference

* fix: uninitialized scalar variable

* fix: unchecked return value from library

* fix: dereference before null check

* fix: unchecked return value from library

* fix: unchecked return value from library

* fixup! refactor: implement FileTreeItem::children_ with a std::vector

* fix: signed-unsigned comparison in libtransmission tests

* fix: avoid unnecessary copy by using const reference

* fix: function should be declared const

* refactor: use fmt::format to build log timestamps

* fix: use init-statement to reduce variable scope

* fixup! refactor: use fmt::format to build log timestamps

* fix: remove tau_tracker destructor for rule-of-zero

* fix: remove tr_peerIo destructor for rule-of-zero

* Revert "fix: dereference before null check"

This reverts commit cd78967815.

* fix: signed-unsigned comparison in libtransmission tests

* fix: use init-statement to reduce variable scope

* fix: extract nested code block into separate method

* fix: extract nested code block into separate method

* fix: extract nested code block into separate method

* fix: use init-statement to reduce variable scope

* fix: extract nested code block into separate method

* fix: signed-unsigned comparison in libtransmission tests

* fixup! fix: extract nested code block into separate method

* fix: mark possibly-unused as [[maybe_unused]]

* fix: invalid stack memory reference in tr_found_file_t

* fix: signed-unsigned comparison in libtransmission tests
2022-04-02 09:06:02 -05:00
Charles Kerr 46cc95f72e
refactor: remove unused functions (#2863)
* refactor: annotate nodiscard, constexpr, noexcept methods

* refactor: remove unused tr_blocklistFileExists()

* refactor: remove unused tr_blocklistFileIsEnabled()

* refactor: remove unused tr_ctorGetContents

* refactor: remove unused tr_error_is_set()

* refactor: remove unused tr_handshakeGetAddr()

* refactor: remove unused tr_ctorSetLabels()

* refactor: remove unused tr_http_escape_sha1()

* refactor: remove unused tr_lpdEnabled()

* refactor: remove unused tr_ptrArrayPop()

* refactor: remove unused tr_torrentClearIdleLimitHitCallback()

* refactor: remove unused tr_torrentFindFromHash()

* refactor: remove unused tr_sha1_to_string()

* refactor: remove unused tr_torrents::get()

* refactor: remove unused tr_isEncryptionMode()

* refactor: remove unused tr_isPreallocationMode()

* refactor: remove unused tr_ptrArrayBack()

* refactor: remove unused tr_ptrArrayClear()

* refactor: remove unused tr_torrents::get()

* refactor: remove unused Session::torrentSet()

* refactor: remove unused peer_atom comparison operators

* refactor: remove unused peer_atom::compare()

* refactor: remove unused Qt variantInit(tr_variant*, unsigned)
2022-04-01 21:55:30 -05:00
Charles Kerr f4afb76695
perf: replace tr_torrentFindFile2() with tr_torrrent.findFile() (#2839) 2022-03-30 13:25:41 -05:00
Charles Kerr 2f677aebb0
refactor: add tracer assertionf or bug #2727 (#2836) 2022-03-28 23:29:35 -05:00
Charles Kerr 2996e223dd
refactor: strbuf for metainfo files (#2833)
* refactor: tr_ctorSaveContents takes a string_view filename

* refactor: remove tr_ctorSaveMagnetContents

* refactor: announce_list::save takes a std::string_view

* refactor: magnet() takes an OutputIt arg

Generate the magnet link URL into an output iterator

* refactor: remove deprecated calls to tr_http_escape

* refactor: tr_torrent.torrentFile takes an OutputIterator

* refactor: tr_torrent.torrentFile returns a tr_pathbuf

* refactor: tr_torrent_metainfo.makeFilename returns a tr_pathbuf

* refactor: use tr_urlbuf in announcer-http
2022-03-28 17:13:32 -05:00
Charles Kerr 9d141ee2b1
refactor: add fmt::formatters (#2829)
* refactor: add fmt::formatters
2022-03-27 21:55:30 -05:00
Charles Kerr 71ad42b1ef
refactor: make err arg optional in tr_sys_* funcs (#2827) 2022-03-27 12:37:29 -05:00
Charles Kerr b8c3778cf4
fix: sonarcloud warnings (#2804)
* fix: break will never be executed

* refactor: compile the name fallback string

* fix: replace redundant type with auto

* fix: use init-statement to reduce variable scope

* fix: implicit conversion loses precision

* fix: use in-class initializer

* fix: make variable a pointer-to-const

* fix: local variable name shadows class variable

* fix: implicit conversion may lose precision
2022-03-24 00:18:41 -05:00
SweetPPro 791f59e8ba
fix for editing magnet link tracker list (#2793)
Co-authored-by: SweetPPro <sweetppro@users.noreply.github.com>
2022-03-23 10:18:06 -05:00
SweetPPro 6e1b89d9a7
fixes "no data found..." error on restart for paused torrents (#2797)
Co-authored-by: SweetPPro <sweetppro@users.noreply.github.com>
2022-03-21 16:15:53 -05:00
Charles Kerr 03ee0028d4
refactor: tr_sys_path_dirname returns a std::string (#2792) 2022-03-21 15:22:50 -05:00
Charles Kerr 44e30bf092
perf: avoid excess filesystem checks (#2786) 2022-03-18 16:31:25 -05:00
Charles Kerr 22499c677a
refactor: aggregate bandwidth objects (#2783) 2022-03-18 11:34:29 -05:00
Matan Ziv-Av c07bac4e19
Limit bandwidth used by a group of torrents (#2761)
* Add support for bandwidth groups. i.e. Bandwidth limit for a (user specified) group of torrents,
2022-03-18 08:11:59 -05:00
Charles Kerr 5df252d1e1
fix: calculate ratio as uploaded / sizeWhenDone (#2770) 2022-03-17 13:41:48 -05:00
Charles Kerr 54ef7341a2
refactor: fmt pt 4 (#2774)
Co-authored-by: Mike Gelfand <mikedld@mikedld.com>
2022-03-16 19:23:44 -05:00
Charles Kerr 0be920156b
refactor: fmt part 3 (#2773) 2022-03-15 19:51:36 -05:00
Charles Kerr 72a67054ea
refactor: fmt part 2 (#2771) 2022-03-15 09:52:16 -05:00
Charles Kerr af339a15ed
refactor: remove deep logging (#2749)
* refactor: remove "deep logging"
2022-03-09 23:51:14 -06:00
Charles Kerr 0ac8c6079a
refactor: remove redundant MAX_BLOCK_SIZE constant (#2740) 2022-03-04 23:35:22 -08:00
Charles Kerr cdd819772d
feat: tr_runInEventThread() now takes std::function, typesafe args (#2739) 2022-03-04 20:26:03 -08:00
Charles Kerr 0cd3eb26ff
fix: webseed assertion failures (#2735) 2022-03-04 12:00:42 -08:00
Charles Kerr 60ef1abadf
refactor: tr_torrents (#2722)
* refactor: add tr_torrents container
2022-03-01 15:06:29 -08:00
SweetPPro 943b57979f
support for resuming magnet links (#2702)
* support for resuming magnet links

magnet links are now saved as a text file the `Torrents` folder as `.magnet` files.
2022-02-24 15:52:29 -06:00
Charles Kerr 7238724318
refactor: webseed (#2689)
* refactor: reduce nested conditional webseed logic

* refactor: use tr_block_info::Location in webseed

* request larger chunks at a time from webseeds

* fix: CURLOPT_MAXREDIRS to safeguard against loops

Discussion at https://trac.transmissionbt.com/ticket/6110 .
Reported by @x190 and @cfpp2p a few years back.
2022-02-23 07:38:18 -06:00
Charles Kerr 81441706c1 fixup! fix: bitfield assertion failure on zero-byte file
chore: code style
2022-02-21 14:39:00 -06:00
Charles Kerr 4bf613804c fix: bitfield assertion failure on zero-byte file
Fixes #2667.
2022-02-21 14:20:35 -06:00
Charles Kerr f88f3c4b03
Feat: add tr_block_info::Location (#2649) 2022-02-18 17:17:19 -06:00
Charles Kerr 02b6cc76d1
feat: add tr_torrentSetTrackerList(), tr_torrentGetTrackerList() (#2642)
Add a getter/setter for torrent announce URLs as text that can be copied
and pasted: one URL per line, with a blank line between tiers.

C API: tr_torrentGetTrackerList() and tr_torrentSetTrackerList()
RPC APi: `trackerList` in `torrent-get` and `torrent-set`.

This deprecates `trackerAdd`, `trackerRemove`, and `trackerEdit`
from the RPC API.
2022-02-18 11:52:01 -06:00
Charles Kerr 3042ae5b76
fix: set torrent.doneDate when adding a new seed (#2634) 2022-02-16 17:04:06 -06:00
Charles Kerr f87d737e0f
feat: newly-added seeds skip the full verify step (#2626)
* feat: newly-added seeds skip the full verify step

This has been a much-requested feature but has also been contentious
because I want to ensure that Transmission never transmits unverified
data. See the GH pull request for context on how this works.
2022-02-14 13:17:51 -06:00
Charles Kerr 9f9b6cdaa2
feat: run script when done seeding (#2621)
* feat: add seeding-done script to core and rpc

* feat: add seeding-done script to gtk client

* feat: add seeding-done script to qt client

* feat: add seeding-done script to transmission-remote

* refactor: make Qt and GTK client text match

* test: update tests

Co-authored-by: Timothy Nibeaudeau <timothy.nibeaudeau@gmail.com>
2022-02-13 22:07:12 -06:00
Charles Kerr 31cbb3b708
feat: expose downloaded byte count to done script (#2619)
Fixes #1082. The use case is a torrent-done script that needs to know
if a torrent is done because it finished downloading or if it's done
because it's a newly-added seed.
2022-02-13 11:04:34 -06:00
Charles Kerr 7bdb6f777b
refactor: remove callback from tr_torrentVerify() public API (#2592) 2022-02-09 12:02:59 -06:00
Charles Kerr 318d60b72d
refactor: fix sonarcloud "use enum class" code smells (#2590)
* refactor: prefer constexpr over enum for GUI_PAD values

* refactor: prefer constexpr over enum for PrefsDialog values

* refactor: prefer constexpr over enum for StatsDialog values

* refactor: use enum class for GtrUnicode types

* refactor: prefer constexpr over enum for BT peer msg codes

* refactor: use enum class for TrMakemetaResult

* refactor: prefer constexpr over enum for BT metadata message types

* refactor: use enum class for AwaitingBt

* refactor: use enum class for EncryptionPreference

* refactor: use enum class for TrFormat in rpcimpl

* refactor: prefer constexpr over enum for QApp intervals

* refactor: prefer constexpr over enum for tr_resume bitfields

* refactor: prefer constexpr over enum for Qt/TrFileModel bitfields

* refactor: remove obsolete TODO comment in announce-list
2022-02-08 20:25:19 -06:00
Charles Kerr ba14ffa74c
refactor: sonarcloud "use if init" statements (#2587) 2022-02-07 23:44:31 -06:00
Charles Kerr ebb2ab6aee
chore: update license spdx abbreviations (#2582)
Use SPDX license list 3.0 terminology: replace deprecated identifiers
GPL-2.0" and "GPL-3.0" with "GPL-3.0-only" and "GPL-3.0-only".
2022-02-07 10:25:02 -06:00
Charles Kerr ecef0feb0c
refactor: clang-tidy in libtransmission (#2578)
* chore: enable cppcoreguidelines-slicing warning

* chore: enable readability-named-parameter warning

* chore: enable bugprone-reserved-identifier check

* chore: enable bugprone-not-null-terminated-result check

* chore: enable bugprone-sizeof-expression check

* chore: enable bugprone-incorrect-roundings check

* chore: enable misc-misplaced-const check

* chore: enable bugprone-suspicious-include check

* chore: enable bugprone-signed-char-misuse check

* chore: enable modernize-raw-string-literal check

* chore: enable readability-static-accessed-through-instance check

* chore: enable readability-implicit-bool-conversion check

* fixup! Merge branch 'main' into refactor/clang-tidy
2022-02-06 22:28:36 -06:00
LaserEyess 5565255d85
add labels to torrent-add rpc method (#2539)
This commit adds labels to the torrent-add method, allowing RPC users to
specify labels when adding a torrent. Labels metadata is commonly known
when adding torrents, so this removes the need to send another
torrent-set call to add labels.

Additionally, transmission-remote is updated to handle labels in
torrent-add.

Co-authored-by: LaserEyess <LaserEyess@users.noreply.github.com>
2022-02-03 00:02:30 -06:00
Charles Kerr 878405f862
Revert "fix: sonarcloud (#2558)" (#2562)
This reverts commit 8b9483f7fb.
2022-02-01 11:30:51 -06:00
Charles Kerr 8b9483f7fb
fix: sonarcloud (#2558)
* fix: add const modifier for functions

* fix: many sonarcloud use-init-statement warnings
2022-01-31 22:46:27 -06:00
Charles Kerr 87dfabb9d2
refactor: replace tr_thread with std::thread (#2548) 2022-01-31 13:34:04 -06:00
Charles Kerr ac823f3cc4
fix: sonarcloud warnings in new code (#2500) 2022-01-24 19:05:24 -06:00
Charles Kerr e83a57efa3
refactor: re-enable some clang-tidy rules (#2498) 2022-01-24 13:07:55 -06:00
Charles Kerr b45c831bcb
refactor: use C++ objects in announcer (#2474) 2022-01-22 23:41:01 -06:00
Charles Kerr 4833723651
fixup! fix: don't follow symlinks when removing junk files (#1638) (#1638) (#2470)
code style
2022-01-21 12:39:01 -06:00
Vincent Vinel ddca909699
fix: don't follow symlinks when removing junk files (#1638) (#1638)
This prevents accidentally following a symlink that points outside of
the torrent's folder and crawling the rest of the drive for junk files
to remove.

This also prevents symlinks that point to a folder from being treated as
real directories, which would cause them to be removed even if the folder
they point to is not actually empty.
2022-01-21 11:53:00 -06:00
Charles Kerr df1cca9b57
chore: update copyright years, make notices consistent (#2463) 2022-01-20 12:27:56 -06:00
Charles Kerr 8d75736ad1
fix: empty torrent filename (#2435)
fix torrents readded due to unremoved cfg files.
2022-01-17 23:14:00 -06:00
Charles Kerr aa2183c9c5
fix: torrents readded due to unremoved cfg files (#2433)
Fixes #2430.

When removing a torrent, try to remove config filenames under both old
and new filename formats. This prevents torrents from being incorrectly
re-added when old-format files aren't removed.
2022-01-17 20:36:41 -06:00
Charles Kerr bcf5e4636a
fix: calculate seed ratio by torrent size. (#2424)
Previously was calculated by number of bytes downloaded, which caused
edge cases when those two numbers were not the same, e.g. if the user
already had part of the torrent from another source and only downloaded
a small part. When this happened, the ratio could be very large and use
of seedratio would behave in a way that most people would not expect.

Note, the old behavior has been around for a VERY LONG TIME. Even though
this is a bugfix, it does change semantics. I don't think there is any
third-party code that depends on the old behavior but this is arguably
a breaking change.
2022-01-17 17:16:37 -06:00
Charles Kerr 3036a76beb
fix: sonarcloud code smells (#2421) 2022-01-17 12:39:50 -06:00
Charles Kerr db23ca4c6b
refactor: replace tr_info with tr_torrent_metainfo (#2397)
* refactor: replace tr_info with tr_torrent_metafo
2022-01-15 13:33:57 -06:00
Charles Kerr b0ee4007ff
refactor: include cleanups (#2392)
* refactor: include <memory> when using shared_ptr or unique_ptr

* refactor: include <cstdio> iff we use it

* refactor: include <cstring> iff we use it

* refactor: include <cstdlib> iff we use it

* refactor: include <string_view> or <string> iff we use it

* refactor: include <array> iff we use it

* refactor: include <ctime> iff we use it

* refactor: include <cctype> iff we use it

* refactor: misc #include cleanups in libtransmission
2022-01-12 20:13:58 -06:00
Charles Kerr a9284c0a6b
fix: magnet link regression (#2390) 2022-01-11 08:28:14 -06:00
Charles Kerr dfc06fe918
refactor: use std::vector in tr_info (#2386) 2022-01-09 10:55:09 -06:00
Charles Kerr 7068eb66c1
refactor: migrate makeFilename() to tr_magnet_metainfo (#2385) 2022-01-08 21:03:21 -06:00
Charles Kerr 49f2823d6f
refactor: use std::string in tr_info (#2384) 2022-01-08 17:41:05 -06:00
Charles Kerr 79d244db82
refactor: rename tr_torrent.infoDictSize() (#2383) 2022-01-08 14:05:38 -06:00
Charles Kerr 8b65b660c8
refactor: use std::string in tr_file (#2382) 2022-01-08 12:53:35 -06:00
Charles Kerr 385a119fb1
refactor: make tr_torrent aggregates tr_block_info instead of subclassing (#2376) 2022-01-07 13:13:37 -06:00
Charles Kerr eafbf59832
refactor: avoid referencing tr_file struct directly (#2373) 2022-01-01 19:25:25 -06:00
Mike Gelfand e56997185e
Fixup construction of temp dir path in `deleteLocalData` (#2370) 2022-01-01 11:27:03 +03:00
Charles Kerr c832f3c18c
fix: sonarcloud warnings (#2353)
* fix: remove-redundant-cast sonarcloud warning

* fix: make type a pointer-to-const sonarcloud warning

* fix: use-init-statement sonarcloud warning

* fix: use-init-statement sonarcloud warning

* fix: extract-assignment-from-expression sonarcloud warning

* fix: remove-redundant-cast sonarcloud warning

* fix: extract-nested-block-into-method sonarcloud warning
2021-12-28 01:14:52 -06:00
Charles Kerr 0b095dc258
fix: sonarcloud warnings (#2350)
* fix: use-init-statement sonarcloud warning

* fix: use-init-statement sonarcloud warning

* fix: conversion-loses-precision sonarcloud warning

* fix: use std::string_view::npos sonarcoud warning

* fix: refactor code to not nest more than 3x sonarcloud warning

* fix: conversion-loses-precision sonarcloud warning

* fix: use init-statement sonarcloud warning

* fix: global variables should be const sonarcloud warning

* fix: conversion-loses-precision sonarcloud warning

* refactor: reduce complexity in doScrape()
2021-12-26 18:32:36 -06:00
Charles Kerr 6149870540
refactor: remove tr_file.priv (#2349) 2021-12-26 16:04:20 -06:00
Charles Kerr fd96a9270b
refactor: remove tr_file.offset (#2347) 2021-12-26 12:43:27 -06:00
Charles Kerr af183b1423
chore: remove tr_pieceOffset() (#2346) 2021-12-26 11:25:51 -06:00
Charles Kerr a515c1d94b
refactor: use tr_torrent_metainfo in tr ctor (#2345) 2021-12-26 10:25:07 -06:00
Charles Kerr 3f8cf63e59
refactor: use tr_torrent_metainfo in mac client (#2343) 2021-12-25 21:12:32 -06:00
Charles Kerr 7c87cb36eb
refactor: tr_torrent_metainfo (#2340)
* refactor: add tr_torrent_metainfo class

Can be used for parsing bencoded .torrent data without instantiating
a tr_torrent. This will be used in all the places where client code
needs to test a .torrent file for validity / to add a preview window
before adding the torrent.
2021-12-25 15:21:13 -06:00
Charles Kerr b058daff4b
refactor: change tr_torrentNew() args (#2337) 2021-12-24 16:05:17 -06:00
Charles Kerr f3228e9670
refactor: further decouple tr_torrent and tr_info (#2336) 2021-12-24 15:12:33 -06:00
Charles Kerr dd1379b0b6
refactor: add tr_interned_string (#2332) 2021-12-23 11:16:05 -06:00
Charles Kerr bd68d3a2fd
refactor: use tr_sha1_digest_t everywhere (#2330) 2021-12-21 16:14:15 -06:00
Charles Kerr 37a8046ed5
fix: more sonarcloud warnings (#2324) 2021-12-16 23:47:51 -06:00
Charles Kerr b9406dfebb
refactor: even more torrent housekeeping (#2323) 2021-12-16 22:51:53 -06:00
Charles Kerr e4a172d39c
fix: sonarcloud (#2322)
* fix: sonarcloud warning - redundant cast

* fix: sonarcloud warning - init-statement

* fix: sonarcloud warning - init-statement

* fix: sonarcloud warning - move #include to top of file

* fix: sonarcloud warning - implicit conversion loses precision

* fix: sonarcloud warning - confirm safe use of strlen

* fix: sonarcloud warning - refactor code to not nest more than three deep

* iwyu: cstring

* iwyu: algorithm
2021-12-16 16:58:58 -06:00
Charles Kerr b93f3f0463
refactor: more tr_torrent housekeeping (#2320) 2021-12-16 03:43:51 -06:00
Charles Kerr 4ea2429217
refactor: tr_torrent housekeeping (#2319) 2021-12-16 02:49:04 -06:00
Charles Kerr e65e0b3caa
refactor: prefer tr_strv*() even more (#2318) 2021-12-15 23:16:40 -06:00
Charles Kerr 2277fde4e0
refactor: prefer tr_strv*() funcs (#2317) 2021-12-15 20:09:46 -06:00
Charles Kerr 42b1362760
refactor: tidy libtransmission includes (#2316) 2021-12-15 15:25:42 -06:00
Charles Kerr 1c848cf174
refactor: add tr_info accessors to tr_torrent (#2314)
* refactor: add tr_info accessors to tr_torrent
2021-12-15 09:53:20 -06:00
Charles Kerr d00be0dec7
refactor: tr_torrentIsSeed() -> tr_torrent::isDone() (#2313) 2021-12-15 01:04:26 -06:00
Charles Kerr 68518bc307
refactor: make some tr_torrentFoo() methods member functions (#2312) 2021-12-14 23:48:56 -06:00
Charles Kerr 1e20d676c1
refactor: make tr_torrentInfo() private (#2285)
* refactor: make tr_torrentInfo() private
2021-12-14 15:59:44 -06:00
Charles Kerr 656df477f2
refactor: add tr_announce_list (#2308)
* refactor: add tr_announce_list (#2308)
2021-12-14 14:59:40 -06:00
Charles Kerr cec7685a64
refactor: remove unused tr_torrent.dnd_pieces_ (#2296) 2021-12-09 20:54:44 -06:00
Charles Kerr 0cedfec630
fixup! refactor: add tr_torrentTrackers() (#2282) (#2294)
ensure announcer tracker count is correct
2021-12-09 20:03:26 -06:00
Charles Kerr f39a1e45a8
fix: crash in tr_file_priorities::filePriority() (#2291)
Fixes #2262.
2021-12-09 15:38:18 -06:00