feat(amulegui): populate Server Info tab from amuled via EC - #120
Merged
Conversation
The Network tab's bottom notebook in the monolithic build has four sub-panels (aMule Log / Server Info / ED2K Info / Kad Info). In amulegui only three were ever visible: amuleDlg::DoNetworkRearrange gated the Server Info AddPage with `#ifndef CLIENT_GUI` because the remote GUI had no way to populate ID_SERVERINFO from the daemon. EC has actually shipped `EC_OP_GET_SERVERINFO` / `EC_OP_SERVERINFO` / `EC_OP_CLEAR_SERVERINFO` opcodes for years (amuleweb uses them), and the corresponding stubs `CRemoteConnect::GetServerInfo` / `ClearServerInfo` were declared back in 2009 but never implemented. This wires the daemon's `server_msg` buffer to amulegui: - `CServerInfoHandlerRem` (new) issues `EC_OP_GET_SERVERINFO`, receives the cumulative log as one `EC_TAG_STRING`, and diffs against the last-seen snapshot so the on-screen text control only receives new lines (preserves scroll position, no full-redraw on every poll). On a non-monotonic delta (amuled restart, or someone else called `EC_OP_CLEAR_SERVERINFO`) it resets the ctrl and refills from the current snapshot. - The poll fires from `OnPollTimer` step 2 while the Network tab is visible. Step 2 fires roughly every 3 s, which is plenty for the bursty ed2k server-message traffic (welcome on connect, ID change, disconnect) and avoids waking amuled when the user isn't looking. - `CamuleRemoteGuiApp::AddServerMessageLine` (new) dispatches to `CamuleDlg::AddServerMessageLine`, the same code path the monolithic build calls, so the ID_SERVERINFO text control behaves identically (500-char truncation + auto-scroll). - `CamuleRemoteGuiApp::GetServerLog(true)` now actually issues `EC_OP_CLEAR_SERVERINFO`, resets the local snapshot, and clears ID_SERVERINFO so the existing "Reset" button on the Server Info panel works the same as the monolithic one. - `CamuleDlg::DoNetworkRearrange` drops the `#ifndef CLIENT_GUI` so the tab is shown unconditionally. Refs amule-project#54.
2 tasks
got3nks
added a commit
that referenced
this pull request
Jun 15, 2026
Reported in #162. The Server Info tab in the Network panel kept displaying messages from the disconnected server because there was no clear-on-disconnect path — the cumulative `server_msg` buffer (monolithic) and the diff-snapshot / on-screen text ctrl (amulegui post-#120) just kept accumulating. Adds a small ClearServerInfo() on each app variant: - CamuleApp::ClearServerInfo() — clears server_msg. - CamuleRemoteGuiApp::ClearServerInfo() — sends EC_OP_CLEAR_SERVERINFO to amuled and clears m_serverinfo_handler.m_seenSoFar. CamuleDlg::ShowConnectionState tracks the previous ed2k state via a static bool and on a connected -> disconnected transition calls both theApp->ClearServerInfo() (data) and ResetLog(ID_SERVERINFO) (UI). The dialog does the UI clear so the data-side method stays compilable in the daemon build (amuledlg lives on CamuleGuiBase which CamuleApp doesn't inherit).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses the first item in #54 — the "Server Info" sub-tab on the Network panel was present in
amule(monolithic) but missing inamulegui. The tab UI has actually been generated byserverListDlgDownfor years, but amuleDlg.cpp:1581-1586 gated itsAddPagebehind#ifndef CLIENT_GUI, because no one had wired the EC plumbing to populate it. This PR wires the plumbing and drops the gate. The other items in #54 (directory tree behaviour and the broader preferences enable/disable audit) are intentionally left for follow-ups; the issue stays open.What was already there
CamuleApp::server_msg(amule.cpp:1841) and exposes it on EC asEC_OP_GET_SERVERINFO/EC_OP_SERVERINFO/EC_OP_CLEAR_SERVERINFO(ExternalConn.cpp:2230-2237). amuleweb has consumed these for years (php_amule_lib.cpp:705-715).CRemoteConnect::GetServerInfo/ClearServerInfo(RemoteConnect.h:293,302) were declared back in 2009 (sturedman's "Implement directory preferences in remote gui" commit) but never implemented, never called, and the declarations have been dead weight ever since.What this PR adds
CServerInfoHandlerRemin amule-remote-gui.h — anEC_OP_GET_SERVERINFOresponse handler that keeps the last-seen snapshot inm_seenSoFar, computes a delta against the fresh response, and only feeds the new tail to the GUI. Diff-based update preserves scroll position and avoids re-rendering the full log on every poll. On a non-monotonic delta (e.g. amuled restarted, or another client calledEC_OP_CLEAR_SERVERINFO), the handler resetsID_SERVERINFOand refills from the current snapshot.CamuleRemoteGuiApp::OnPollTimerstep 2 — fires the EC request only while the Network tab is visible. Step 2's natural ~3 s cadence is plenty for the bursty traffic pattern (welcome on connect, ID change, disconnect) and doesn't wake amuled when the user isn't looking.CamuleRemoteGuiApp::AddServerMessageLine— dispatches toCamuleDlg::AddServerMessageLine, the same code path the monolithic build calls, soID_SERVERINFO(500-char truncation + auto-scroll) behaves identically.CamuleRemoteGuiApp::GetServerLog(true)— was a stub that returned""; now issuesEC_OP_CLEAR_SERVERINFO, resetsm_seenSoFar, and clearsID_SERVERINFOso the existing "Reset" button on the Server Info panel (wired via ServerWnd.cpp:171) works the same as in monolithic.#ifndef CLIENT_GUIgate at amuleDlg.cpp:1582 so the tab is shown unconditionally.What's deliberately not in this PR (left for the rest of #54)
Test plan
cmake --build build-macos --target amulegui).aMuleGUI.appagainst anamuledon a remote ARM64 Ubuntu VM. After amuled connected to an ed2k server, the welcome message appeared in the Server Info sub-tab within ~3 s, and "Reset" both cleared the on-screen log and emptied amuled'sserver_msgbuffer (verified by the next poll arriving empty).