Skip to content

amule: aggregate AddLink failures into one popup (extends #310) - #577

Merged
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:fix/addlink-aggregate-popup
May 11, 2026
Merged

amule: aggregate AddLink failures into one popup (extends #310)#577
mrjimenez merged 1 commit into
amule-project:masterfrom
got3nks:fix/addlink-aggregate-popup

Conversation

@got3nks

@got3nks got3nks commented May 11, 2026

Copy link
Copy Markdown
Contributor

Why

PR #557 fixed the silent failure in amulegui (issue #310): pasting a malformed link no longer disappears into the void — the user gets a dialog. The same regression still existed in the monolithic amule binary: CDownloadQueue::AddLink logs the failure via AddLogLineC and returns false, but no UI feedback ever reaches the user.

The naive fix — popping a wxMessageBox from inside AddLink — would produce N dialogs when the user pastes N invalid lines into the Fast eD2k box. And amulegui has the same N-popup problem from a different angle: PR #551 already taught amuled's EC handler to accept N child tags in one EC_OP_ADD_LINK packet and emit a single aggregated EC_OP_FAILED response, but CDownQueueRem::AddLink was still looping client-side and sending one packet per link.

What

Introduce a batch AddLinks(wxArrayString, uint8 cat) abstraction on both queue types, so the GUI's batch callers go through one symmetric API and each app aggregates in the way that fits its transport:

  • CDownloadQueue::AddLinks (monolithic + daemon): loops AddLink, counts failures, dispatches one wxPLURAL'd dialog through theApp->ShowAlert. ShowAlert is polymorphic (wxMessageBox under amule, log-only under amuled) so the same code is safe to compile into the daemon and amuled keeps its quiet-batch behaviour.
  • CDownQueueRem::AddLinks (amulegui): packs the entire batch into a single EC_OP_ADD_LINK packet (one child tag per link, EC_TAG_PARTFILE_CAT carrying the category). The daemon's existing EC: aggregate per-link result into a single ADD_LINK response #551 aggregation produces one reply; CAddLinkHandler fires exactly once with the existing catalog string "%d of %d links failed (invalid or already on list).".

Two GUI batch callers switched from AddLink-in-loop to one AddLinks call:

  • CamuleDlg::OnBnClickedFast (Fast eD2k paste box)
  • CSharedFilesCtrl::OnAddCollection (.emulecollection import)

CamuleAppCommon::AddLinksFromFile (the ED2KLinks-in-config-dir poller) keeps a per-line counter + AddLink-in-loop because each line can carry its own :CAT suffix, which doesn't fit a single-category batch signature. Rare path, rare feature — left alone.

CDownloadQueue::AddLink itself is untouched: it still logs the protocol-specific reason per failure, which the aggregated popup intentionally points to (see log for details) rather than duplicating inline.

Test

  • macOS local build (2.3.3-353-g9da63394a): amule, amulegui, amuled, amulecmd, amuleweb all compile clean.
  • Dropped an ED2KLinks file with 2 valid + 2 invalid links into ~/Library/Application Support/aMule/: one dialog appeared reading "Could not add 2 links from ED2KLinks file (see log for details).", the two invalid lines logged with their specific reasons, the two valid lines added to the queue.
  • The Fast eD2k paste box / collection import paths route through the new AddLinks method on both binaries (compile-tested; runtime smoke test still recommended on amulegui talking to amuled before merge).

…ct#310)

Adds a batch CDownloadQueue::AddLinks / CDownQueueRem::AddLinks
abstraction and routes the GUI's batch callers (Fast eD2k paste box,
.emulecollection import) through it. Centralises the popup aggregation
logic and fixes both monolithic *and* amulegui in one move.

Background:
PR amule-project#557 made amulegui's CAddLinkHandler pop a wxMessageBox so an
EC_OP_FAILED reply from EC_OP_ADD_LINK surfaces to the user instead of
being silently dropped (amule-project#310). The same regression existed in the
monolithic amule binary: CDownloadQueue::AddLink logs the failure via
AddLogLineC and returns false, but no UI feedback ever reaches the
user.

The naive fix -- popping a wxMessageBox inside AddLink -- produces N
dialogs when the user pastes N invalid lines into the Fast eD2k box.
PR amule-project#551 had already taught amuled's EC handler to accept N tags in one
EC_OP_ADD_LINK packet and emit a single aggregated EC_OP_FAILED
response, but amulegui's CDownQueueRem::AddLink was still looping
client-side and sending one packet per link, so CAddLinkHandler still
fired once per failure.

Change:
1. CDownloadQueue::AddLinks(wxArrayString, cat)
   Calls AddLink in a loop, counts failures, dispatches a single
   wxPLURAL'd ShowAlert at the end. ShowAlert is polymorphic
   (wxMessageBox under amule, log-only under amuled), so the same
   code is safe to compile into the daemon.

2. CDownQueueRem::AddLinks(wxArrayString, cat)
   Packs the entire batch into one EC_OP_ADD_LINK packet (one child
   tag per link, EC_TAG_PARTFILE_CAT carrying the category). Daemon
   aggregates per PR amule-project#551; CAddLinkHandler fires exactly once with
   the existing catalog string ("%d of %d links failed...").

3. The two uniform-cat batch callers now call AddLinks instead of
   looping AddLink:
     - CamuleDlg::OnBnClickedFast (Fast eD2k paste box)
     - CSharedFilesCtrl::OnAddCollection (.emulecollection import)

4. CamuleAppCommon::AddLinksFromFile (ED2KLinks-in-config-dir poller)
   keeps its own per-line counter + AddLink-in-loop because each line
   may carry its own ":CAT" suffix, which doesn't fit the single-cat
   AddLinks signature. Rare path, rare feature -- left alone.

CDownloadQueue::AddLink itself is untouched; it still logs the
protocol-specific reason per failure, which the aggregated popup
intentionally points to ("see log for details") rather than duplicating
inline.
@got3nks
got3nks force-pushed the fix/addlink-aggregate-popup branch from 4b0826a to 9da6339 Compare May 11, 2026 09:44
@mrjimenez
mrjimenez merged commit 38f2911 into amule-project:master May 11, 2026
12 checks passed
@got3nks
got3nks deleted the fix/addlink-aggregate-popup branch May 11, 2026 13:46
got3nks added a commit to got3nks/amule that referenced this pull request Jul 24, 2026
…ip (amule-project#577)

The "Auto-update ipfilter at startup" toggle (IPFilterAutoLoad) ships on
by default, but the update is gated on a non-empty IPFilterURL, which
defaulted to "" -- so the default-on toggle did nothing. Set the default
URL to https://upd.emule-security.org/ipfilter.zip, the same source
already used for the server list (server.met) and Kad nodes (nodes.dat).

Fresh installs now conditionally fetch the filter on startup (the
download uses If-Modified-Since, so an unchanged file returns 304 and is
skipped). Existing configs that already stored an empty IPFilterURL keep
their value.
ngosang pushed a commit to ngosang/amule that referenced this pull request Jul 24, 2026
)

Ship the emule-security ipfilter.zip URL as the default (from amule-project#577) but
leave the auto-update toggle off by default, so new users opt in rather
than silently loading a filter at startup. emule-security's list blocks
whole hosting ranges, which flags many VPN exit IPs; a default-on fetch
would block those users before they ever open the preferences.

Existing configs keep their stored IPFilterAutoLoad value; this only
changes the shipped default for new configs. The URL default is
unchanged, so ticking the box works out of the box.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants