Add friend-request backend service (rsFriendRequest) - #306
Conversation
Add rsfriendrequest.h, p3friendrequest.{h,cc} to RS_SOURCES/HEADERS
(CMakeLists.txt) and the qmake HEADERS/SOURCES/PUBLIC_HEADERS lists so
the friend-request backend is actually compiled and linked.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Previously the friend-request backend compiled but was never instantiated and the global rsFriendRequest pointer (declared extern in retroshare/rsfriendrequest.h) was defined nowhere, causing an undefined- reference link error in any consumer (e.g. the GUI Friend Requests page). - Define RsFriendRequest* rsFriendRequest (mirrors rsPeers in p3peers.cc) - Instantiate p3FriendRequest in rsinit.cc, assign the global pointer, and register it with p3ConfigMgr (friend_requests.cfg) for persistence - Call onUnknownPeerConnectionAttempt() from AuthSSL::VerifyX509Callback on the ISSUER_UNKNOWN (not-a-friend) path so attempts populate the UI Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
p3Config only declares a no-arg constructor (p3cfgmgr.h), so ': p3Config(CONFIG_TYPE_FRIEND_REQUESTS)' failed to compile (no matching constructor). RS identifies a config by its filename + RsItem subtype, not a constructor arg, so drop the bogus argument and the now-dead CONFIG_TYPE_FRIEND_REQUESTS macro. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Heads-up on a few follow-up commits that make this build and function end-to-end (the backend was previously additive-only):
This is the backend companion to the GUI PR RetroShare/RetroShare#3216 (closes RetroShare/RetroShare#1794); the two are meant to merge together. One thing worth a maintainer's eye: |
|
Thx for contributing.
Overall this will be much less code. (And just in case, don't simply copy-paste these suggestions into an AI without thinking 8-) ) |
The service did not build. Corrected against the actual API: - include pqi/p3cfgmgr.h so the p3Config base resolves (this cascade also caused the spurious override / "not a direct base" errors) - fix include path rsserver/p3peermgr.h -> pqi/p3peermgr.h - RS_PKT_VERSION2 -> RS_PKT_VERSION_SERVICE (the former does not exist) - RsPeerId/RsPgpId: getId() -> toByteArray(), .init(buf) -> ctor-from-bytes - call inherited IndicateConfigChanged() without the p3Config:: qualifier - implement the RsSerializable serial_process() pure virtual (stub) so the item is no longer abstract Persistence is not yet wired (setupSerialiser() returns a bare RsSerialiser), so entries are in-memory only; serial_process carries a TODO describing how to finish it via an RsServiceSerializer (cf. p3BanList). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@64johnlee rebase? branch is broken with master |
flowchart TD
A["Unknown peer attempts<br/>a secure connection"] --> B{"TLS certificate<br/>verification result"}
B -->|"Known friend"| C["Continue through the normal<br/>RetroShare connection flow"]
B -->|"Issuer unknown"| D["AuthSSL extracts identity data<br/>SSL ID · PGP ID · name · fingerprint"]
D --> E["rsFriendRequest records the request"]
E --> F{"Existing request?"}
F -->|"No"| G["Create pending entry<br/>first seen · last seen · attempts = 1"]
F -->|"Yes"| H["Update last seen<br/>increment attempt count<br/>preserve rejection decision"]
G --> I["Friend Requests GUI / JSON API"]
H --> I
I --> J{"User decision"}
J -->|"Accept"| K["Remove request<br/>add peer as SSL-only friend"]
J -->|"Reject"| L["Keep entry marked rejected"]
J -->|"Delete"| M["Remove the entry"]
L --> N["Repeated attempts remain rejected"]
L -->|"Clear rejected"| M
K --> O["Controlled friendship<br/>establishment"]
N --> P["Less repeated prompting"]
M --> Q["Simple request-list cleanup"]
E -.-> R["Thread-safe request storage"]
R -.-> S["Safe use from the TLS<br/>verification callback"]
|
|
Main advantages:
One current limitation: although the code contains save/load structures, its own TODO states that serialization is not fully registered yet, so requests currently remain in memory and are not reliably retained across restarts. |
Summary
Adds the libretroshare backend service for the Friend Requests feature:
retroshare/rsfriendrequest.h— publicRsFriendRequestinterfacersserver/p3friendrequest.{h,cc}—p3FriendRequestservice implementationsrc/CMakeLists.txtandsrc/libretroshare.pro) so the service is compiled and linked.Why
This is the backend companion to the GUI pull request RetroShare/RetroShare#3216 (gui: add Friend Requests page, closes RetroShare/RetroShare#1794). The GUI page links against
rsFriendRequest, so this service must land for that PR to build.The two PRs are intended to be merged together — the superproject PR's
libretrosharesubmodule pointer references the head of this branch.Notes
master; backend sources are additive (no changes to existing files beyond the two build-list entries).🤖 Generated with Claude Code