Skip to content

feat(gui): add "Connected since" to the ED2K/Kad Info panes - #650

Merged
got3nks merged 3 commits into
amule-org:masterfrom
LSalami:add-networks-panel-timestamps
Jul 27, 2026
Merged

feat(gui): add "Connected since" to the ED2K/Kad Info panes#650
got3nks merged 3 commits into
amule-org:masterfrom
LSalami:add-networks-panel-timestamps

Conversation

@LSalami

@LSalami LSalami commented Jul 27, 2026

Copy link
Copy Markdown

Summary

Fixes #174 — "Nothing major here but knowing the connect time is sometimes useful."

Implementation

CamuleApp::ShowConnectionState() already detects the exact tick a
connection flips false→true (and back) to decide whether to log
"Connected to ..." / "Disconnected from ...". This stamps that same
transition into m_ed2kConnectedSince / m_kadConnectedSince instead of
tracking it separately, so the timestamp can't drift from what the log
already says happened.

CServerWnd::UpdateED2KInfo/UpdateKadInfo (Networks → ED2K Info /
Kad Info
) add a "Connected since:" row when connected, using the
locale-aware date+time format (%x %X).

Monolithic-only: the timestamp lives on CamuleApp and isn't carried
over the EC protocol, so amulegui doesn't show it — gated behind
#ifndef CLIENT_GUI rather than adding new EC wiring, to keep this a
small, self-contained change matching the issue's "nothing major" scope.
Happy to extend it over EC in a follow-up if that's wanted.

Test plan

  • Both the monolithic amule and amulegui targets build cleanly with the #ifndef CLIENT_GUI guard in place
  • Manually verified in a running app: both panes show "Connected since:" with the expected timestamp once ed2k/Kad connect
  • scripts/update-po.sh run to register the new string

@got3nks got3nks left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @LSalami — the change itself is clean (stamping the timestamp off the same false→true transition ShowConnectionState() already detects is the right call, and the panes read well).

For the next release we're trying to make every feature available across all three clients — amule, amulegui, and amuleapi — so I'd rather not land this monolithic-only (it's currently #ifndef CLIENT_GUI, so amulegui and amuleapi don't get it). Could you wire "Connected since" over the EC protocol instead? The connection state already flows to the remote clients, so carrying the two timestamps alongside it is the natural spot — that surfaces it to amulegui, and lets amuleapi expose it too.

One heads-up on the EC tag: we keep the abstract and the committed header in sync by hand — add the tag to src/libs/ec/abstracts/ECCodes.abstract, then hand-add the two matching lines to src/libs/ec/cpp/ECCodes.h (the EC_TAG_… = 0xNNNN, enum entry and its case 0xNNNN: return "EC_TAG_…"; in the debug-name switch). Please don't regenerate the committed header — the generator reflows the whole license block into a huge diff.

Ping me when it's ready and I'll review again.

LSalami added 2 commits July 27, 2026 21:36
…g#174)

CamuleApp::ShowConnectionState() already detects the exact tick a
connection flips false->true (and back) to decide whether to log
"Connected to ..." / "Disconnected from ..." -- stamp that same
transition into m_ed2kConnectedSince / m_kadConnectedSince instead of
tracking it separately, so the timestamp can't drift from what the
log already says happened.

CServerWnd::UpdateED2KInfo/UpdateKadInfo (Networks -> ED2K Info / Kad
Info) add a "Connected since:" row when connected, using the
locale-aware date+time format ("%x %X").

Monolithic-only: the timestamp lives on CamuleApp and isn't carried
over the EC protocol, so amulegui doesn't show it -- gated behind
small, self-contained change. Verified both the monolithic amule and
amulegui targets still build with the guard in place.

Manually verified in a running app: both panes show "Connected
since:" with the expected timestamp once ed2k/Kad connect.
got3nks's review of amule-org#650 asked for this to reach amulegui and amuleapi,
not just the monolithic app, ahead of the push to keep every feature
available across all three clients.

Adds two optional EC_TAG_CONNSTATE sub-tags, hand-synced into
ECCodes.abstract/.h per the project's existing convention (never
regenerate the committed header -- it reflows the whole license block):

- EC_TAG_ED2K_CONNECTED_SINCE / EC_TAG_KAD_CONNECTED_SINCE (uint32 unix
  timestamps), populated in CEC_ConnState_Tag's constructor from
  CamuleApp's existing m_ed2kConnectedSince/m_kadConnectedSince, present
  only while actually connected.

Consumption side:
- CamuleRemoteGuiApp (amulegui) gets matching m_ed2kConnectedSince/
  m_kadConnectedSince members and GetED2KConnectedSince()/
  GetKadConnectedSince() accessors -- same names as CamuleApp's, so
  ServerWnd.cpp's "Connected since" rows no longer need a
  #ifndef CLIENT_GUI gate; each build's theApp resolves to whichever
  class actually has the data.
- amuleapi's Refresher.cpp reads the same sub-tags directly into
  StatusSnapshot.{ed2k,kad}_connected_since, surfaced in GET /status as
  ed2k.connected_since / kad.connected_since (0 while disconnected).
  Documented in docs/api/REFERENCE.md.

po/ catalogs regenerated as the final step (scripts/update-po.sh) so
the diff is just the "Connected since:" string in sync with the tree,
per got3nks's note on amule-org#278 about avoiding line-number-shift churn.

Verified by building and running all three targets (amule, amulegui,
amuleapi) plus the full unit test suite (26/26 passing, including
RefresherTest which exercises the new StatusSnapshot fields directly).
@LSalami
LSalami force-pushed the add-networks-panel-timestamps branch from 2421d7b to f62aa77 Compare July 27, 2026 19:49
@LSalami

LSalami commented Jul 27, 2026

Copy link
Copy Markdown
Author

Done in f62aa77 — wired "Connected since" over EC as two new optional EC_TAG_CONNSTATE sub-tags (EC_TAG_ED2K_CONNECTED_SINCE / EC_TAG_KAD_CONNECTED_SINCE, uint32 unix timestamps, present only while actually connected).

  • ECCodes.abstract + ECCodes.h hand-synced (not regenerated), per your note.
  • CamuleRemoteGuiApp (amulegui) gets the same GetED2KConnectedSince()/GetKadConnectedSince() accessor names as CamuleApp, so ServerWnd.cpp's "Connected since" rows no longer need a #ifndef CLIENT_GUI gate at all — same source file, same code path, whichever theApp the build resolves to.
  • amuleapi's Refresher.cpp reads the same sub-tags directly and surfaces them as ed2k.connected_since / kad.connected_since on GET /status (0 while disconnected), documented in docs/api/REFERENCE.md.

Rebased onto current master and regenerated the po/ catalogs as the final step, so that diff is just the one string in sync with the tree.

Verified for real, not just compiled: built and ran all three targets (amule, amulegui, amuleapi) locally, plus the full unit test suite (26/26 passing, including RefresherTest which exercises the new StatusSnapshot fields directly).

@got3nks got3nks left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks — this is exactly the shape I wanted: full parity across amule / amulegui / amuleapi, ECCodes hand-synced cleanly, docs and tests included. Merging once CI's green.

Pre-existing m_CurrServer = 0 in CServerConnectRem::HandlePacket ended
up on a changed line when the ed2k-branch was restructured to also set
m_ed2kConnectedSince, tripping clang-tidy's changed-lines Tier-2 check
(modernize-use-nullptr) in CI on amule-org#650.
@got3nks
got3nks merged commit 5760abb into amule-org:master Jul 27, 2026
13 checks passed
@LSalami
LSalami deleted the add-networks-panel-timestamps branch July 27, 2026 20:27
LSalami added a commit to LSalami/amule that referenced this pull request Jul 27, 2026
Mechanical rebase to resolve the po/ catalog conflicts against master's
amule-org#648/amule-org#650/amule-org#651 (per got3nks's note on amule-org#643) -- no source changes here,
scripts/update-po.sh output only, so the diff is just the tree back in
sync with the current strings.
LSalami added a commit to LSalami/amule that referenced this pull request Jul 28, 2026
Mechanical rebase to resolve the po/ conflicts against master's
amule-org#643/amule-org#646/amule-org#648/amule-org#650/amule-org#651 -- no source changes here. Confirms got3nks's
prediction on the Alt+<letter>-outside-_() fix: the only genuinely new
msgid in the diff is "Navigate" (the new macOS menu itself); every
other hunk is line-number-comment churn from the rebase, not orphaned
or duplicated translations.
LSalami added a commit to LSalami/amule that referenced this pull request Jul 28, 2026
Mechanical rebase to resolve the po/ catalog conflicts against master's
amule-org#648/amule-org#650/amule-org#651 (per got3nks's note on amule-org#643) -- no source changes here,
scripts/update-po.sh output only, so the diff is just the tree back in
sync with the current strings.
got3nks pushed a commit that referenced this pull request Jul 28, 2026
* feat(search): persist search history across restarts (#641)

The search field was a plain text control with no memory of past
searches. Swap it for a wxComboBox (a wxTextEntry, like wxTextCtrl,
so the existing GetValue()/Clear() call sites keep working via that
shared base) and persist submitted terms to wxConfig, most-recent
first, capped at 20 entries and deduplicated case-insensitively.

Right-clicking the field opens a small menu ("Remember search
history" checkbox + "Clear search history") so history can be paused
or wiped without a dedicated Preferences page.

i18n: ran scripts/update-po.sh to register the two new menu strings.

* style(search): separate the destructive Clear item from the toggle above

A separator between the checkbox and "Clear search history" keeps the
one-shot destructive action visually distinct from the persistent
on/off state, instead of reading as a second toggle in the same group.

* style(search): use nullptr instead of NULL for the new combo box

Fixes the modernize-use-nullptr clang-tidy finding on the changed
line; matches the nullptr convention already used a couple of
wxComboBox constructions below in the same file.

* feat(search): rework query history per #643 review — file, prefs toggle, edit menu

Addresses all four blocking points from got3nks's review, plus both
optional suggestions:

1. Edit context menu restored. Overriding the field's context menu no
   longer drops Cut/Copy/Paste/Select All -- same custom-Paste-ID idiom
   as CMuleTextCtrl::OnRightDown (wxMenu over-permits wxID_PASTE, so it
   gets a manual clipboard-content check), plus a separator, plus the
   history's own Clear action.

2. Persisted to a dedicated searchhistory.dat (via CTextFile, one term
   per line) instead of amule.conf -- mirrors eMule's AC_SearchStrings.dat.
   Query terms no longer bloat the main config or travel with config
   backups / the --amule-config-file push to amuleweb/amuleapi.

3. "Remember search history" moved into Preferences > General as an
   ordinary Cfg_Bool checkbox (IDC_SEARCHHISTORYENABLED), same
   NewCfgItem wiring as every other GUI-behavior toggle on that page.
   It's a client-side-only setting, so the one checkbox works unchanged
   in both amule and amuleGUI. The context menu keeps only Clear (a
   one-shot action, not a setting to toggle from a hidden menu).

4. Cap raised from 20 to 30, matching eMule's CCustomAutoComplete default.

Optional, done anyway:
- wxComboBox::AutoComplete() wired up (eMule's ACO_AUTOSUGGEST
  equivalent), re-armed after every load/record/clear so it always
  reflects the current entry set.
- Explicitly framed as *query* history throughout (comments, tooltip)
  to distinguish it from the separate, not-yet-implemented result
  persistence that's the rest of #641.

The dedup/move-to-front/cap logic that used to live inline in
CSearchDlg::RecordSearchHistory is extracted into a pure function,
ApplySearchHistoryEntry() (SearchHistory.h/.cpp), decoupled from
wxComboBox/wxConfig specifically so it's unit-testable without a wx
event loop -- new SearchHistoryTest covers empty-list insert, reorder
of an existing term, case-insensitive dedup, empty-term no-op, and
capping (including locking in the actual 30-entry constant).

Rebased onto current master; po/ catalogs regenerated as the final
step so the diff is just the new/changed strings in sync with the tree.

Verified for real: built and ran both amule and amulegui, plus the
full unit test suite (27/27 passing, including the new
SearchHistoryTest's 7 cases).

* fix(tests): link Format.cpp + strerror_r.c into SearchHistoryTest

Same Linux/mingw-only link failure as CMuleCollectionTest/MagnetURITest
already work around: muleunit's MuleDebug.cpp needs CFormat for its
glibc backtrace path, which isn't compiled in on macOS -- so the
target linked fine locally but failed on the Ubuntu/mingw CI builds
(and the clang-tidy jobs, which build the tree first).

* i18n: regenerate po/ catalogs after rebasing onto current master

Mechanical rebase to resolve the po/ catalog conflicts against master's
#648/#650/#651 (per got3nks's note on #643) -- no source changes here,
scripts/update-po.sh output only, so the diff is just the tree back in
sync with the current strings.

* fix(search): avoid an unnamed EReadTextFile bitmask cast in history load

txtIgnoreEmptyLines|txtStripWhitespace has no single named enumerator
to cast to -- clang-tidy Tier-1 flagged it (clang-analyzer-optin.core.
EnumCastOutOfRange), correctly: EReadTextFile isn't a flag enum, so a
synthesized OR'd value is genuinely out of its declared range even
though CTextFile::ReadLines treats it as bitflags at runtime.

txtReadDefault would dodge the cast but also drops '#'-led lines,
silently eating a legitimate search term that happens to start with
one. Read unfiltered (txtReadAll, a real enumerator) and do the
trim/empty-line-drop by hand instead -- same behavior, no cast, no
lost terms.

* i18n: regenerate po/ catalogs after rebasing onto current master

Mechanical rebase to resolve the po/ conflicts against master's #642
(just merged) -- no source changes here.
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.

Enh: Timestamp Networks -> Server Info/Ed2k Info/Kad Info pane entries

2 participants