Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
WavelengthJoiner Class Referencefinal

Singleton class responsible for initiating the process of joining an existing wavelength. More...

#include <wavelength_joiner.h>

Inheritance diagram for WavelengthJoiner:
Collaboration diagram for WavelengthJoiner:

Signals

void authenticationFailed (QString frequency)
 Emitted if the join attempt fails due to incorrect or missing password.
 
void connectionError (const QString &error_message)
 Emitted if an error occurs during the connection or join process.
 
void messageReceived (QString frequency, const QString &formatted_message)
 Emitted when a regular chat message is received for the joined frequency. Note: This signal seems misplaced here and might be better handled solely by WavelengthMessageProcessor/Service.
 
void wavelengthClosed (QString frequency)
 Emitted if the WebSocket connection for the wavelength is closed unexpectedly (e.g., after joining).
 
void wavelengthJoined (QString frequency)
 Emitted when the user successfully joins the specified wavelength.
 
void wavelengthLeft (QString frequency)
 Emitted when the user explicitly leaves or is disconnected from the active wavelength.
 

Public Member Functions

JoinResult JoinWavelength (QString frequency, const QString &password=QString())
 Attempts to join an existing wavelength hosted on the relay server. Checks if the wavelength is already joined or pending registration. Creates a new WebSocket connection, connects signals for connection events, errors, and the join result message. Sends the join request upon successful connection. Manages a keep-alive timer for the connection.
 

Static Public Member Functions

static WavelengthJoinerGetInstance ()
 Gets the singleton instance of the WavelengthJoiner.
 

Private Member Functions

WavelengthJoineroperator= (const WavelengthJoiner &)=delete
 Deleted assignment operator to prevent assignment.
 
 WavelengthJoiner (const WavelengthJoiner &)=delete
 Deleted copy constructor to prevent copying.
 
 WavelengthJoiner (QObject *parent=nullptr)
 Private constructor to enforce the singleton pattern.
 
 ~WavelengthJoiner () override=default
 Private destructor.
 

Detailed Description

Singleton class responsible for initiating the process of joining an existing wavelength.

This class handles connecting to the relay server, sending an authentication/join request for a specific frequency (wavelength), and managing the WebSocket connection. It interacts with WavelengthRegistry, WavelengthConfig, AuthenticationManager, MessageHandler, and WavelengthMessageProcessor. It emits signals indicating success (wavelengthJoined), failure (connectionError, authenticationFailed), or disconnection (wavelengthClosed, wavelengthLeft).

Constructor & Destructor Documentation

◆ WavelengthJoiner() [1/2]

WavelengthJoiner::WavelengthJoiner ( QObject * parent = nullptr)
inlineexplicitprivate

Private constructor to enforce the singleton pattern.

Parameters
parentOptional parent QObject.
Here is the caller graph for this function:

◆ ~WavelengthJoiner()

WavelengthJoiner::~WavelengthJoiner ( )
overrideprivatedefault

Private destructor.

◆ WavelengthJoiner() [2/2]

WavelengthJoiner::WavelengthJoiner ( const WavelengthJoiner & )
privatedelete

Deleted copy constructor to prevent copying.

Here is the call graph for this function:

Member Function Documentation

◆ authenticationFailed

void WavelengthJoiner::authenticationFailed ( QString frequency)
signal

Emitted if the join attempt fails due to incorrect or missing password.

Parameters
frequencyThe frequency identifier for which authentication failed.
Here is the caller graph for this function:

◆ connectionError

void WavelengthJoiner::connectionError ( const QString & error_message)
signal

Emitted if an error occurs during the connection or join process.

Parameters
error_messageA description of the error.
Here is the caller graph for this function:

◆ GetInstance()

static WavelengthJoiner * WavelengthJoiner::GetInstance ( )
inlinestatic

Gets the singleton instance of the WavelengthJoiner.

Returns
Pointer to the singleton WavelengthJoiner instance.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ JoinWavelength()

JoinResult WavelengthJoiner::JoinWavelength ( QString frequency,
const QString & password = QString() )

Attempts to join an existing wavelength hosted on the relay server. Checks if the wavelength is already joined or pending registration. Creates a new WebSocket connection, connects signals for connection events, errors, and the join result message. Sends the join request upon successful connection. Manages a keep-alive timer for the connection.

Parameters
frequencyThe frequency identifier of the wavelength to join.
passwordOptional password required to join the wavelength.
Returns
A JoinResult struct indicating immediate success (already joined) or failure (pending), or {true, QString()} if the connection process was initiated. Asynchronous results are communicated via signals.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ messageReceived

void WavelengthJoiner::messageReceived ( QString frequency,
const QString & formatted_message )
signal

Emitted when a regular chat message is received for the joined frequency. Note: This signal seems misplaced here and might be better handled solely by WavelengthMessageProcessor/Service.

Parameters
frequencyThe frequency the message belongs to.
formatted_messageThe HTML-formatted message string.
Here is the caller graph for this function:

◆ operator=()

WavelengthJoiner & WavelengthJoiner::operator= ( const WavelengthJoiner & )
privatedelete

Deleted assignment operator to prevent assignment.

Here is the call graph for this function:

◆ wavelengthClosed

void WavelengthJoiner::wavelengthClosed ( QString frequency)
signal

Emitted if the WebSocket connection for the wavelength is closed unexpectedly (e.g., after joining).

Parameters
frequencyThe frequency identifier of the wavelength whose connection closed.
Here is the caller graph for this function:

◆ wavelengthJoined

void WavelengthJoiner::wavelengthJoined ( QString frequency)
signal

Emitted when the user successfully joins the specified wavelength.

Parameters
frequencyThe frequency identifier of the joined wavelength.
Here is the caller graph for this function:

◆ wavelengthLeft

void WavelengthJoiner::wavelengthLeft ( QString frequency)
signal

Emitted when the user explicitly leaves or is disconnected from the active wavelength.

Parameters
frequencyThe frequency identifier of the wavelength that was left.
Here is the caller graph for this function:

The documentation for this class was generated from the following files: