Cockatrice 2026-09-01-Development-3.1.0-beta.10
A virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
AbstractClient Class Referenceabstract

#include <abstract_client.h>

Inheritance diagram for AbstractClient:
[legend]
Collaboration diagram for AbstractClient:
[legend]

Signals

void statusChanged (ClientStatus _status)
void maxPingTime (int seconds, int maxSeconds)
void pingStatsUpdated (const LatencyTracker::Stats &stats, const QList< int > &samplesMs)
 Aggregated round-trip statistics and a chronological snapshot of the rolling window, emitted at most once per second.
void roomEventReceived (const RoomEvent &event)
void gameEventContainerReceived (const GameEventContainer &event)
void serverIdentificationEventReceived (const Event_ServerIdentification &event)
void connectionClosedEventReceived (const Event_ConnectionClosed &event)
void serverShutdownEventReceived (const Event_ServerShutdown &event)
void addToListEventReceived (const Event_AddToList &event)
void removeFromListEventReceived (const Event_RemoveFromList &event)
void userJoinedEventReceived (const Event_UserJoined &event)
void userLeftEventReceived (const Event_UserLeft &event)
void serverMessageEventReceived (const Event_ServerMessage &event)
void listRoomsEventReceived (const Event_ListRooms &event)
void gameJoinedEventReceived (const Event_GameJoined &event)
void userMessageEventReceived (const Event_UserMessage &event)
void notifyUserEventReceived (const Event_NotifyUser &event)
void userInfoChanged (const ServerInfo_User &userInfo)
void buddyListReceived (const QList< ServerInfo_User > &buddyList)
void ignoreListReceived (const QList< ServerInfo_User > &ignoreList)
void replayAddedEventReceived (const Event_ReplayAdded &event)
void registerAccepted ()
void registerAcceptedNeedsActivate ()
void activateAccepted ()
void sigQueuePendingCommand (PendingCommand *pend)

Public Member Functions

 AbstractClient (QObject *parent=nullptr)
 ~AbstractClient () override
ClientStatus getStatus () const
void sendCommand (const CommandContainer &cont)
void sendCommand (PendingCommand *pend)
void clearLatencyStats ()
 Drops all recorded round-trip samples and resets the stats emission throttle, emitting zeroed stats so that UI listeners can clear their display.
bool getServerSupportsPasswordHash () const
const QString & getUserName () const
virtual QString serverName () const
 Returns the server address configured for the current connection.
virtual quint16 serverPort () const

Static Public Member Functions

static PendingCommandprepareSessionCommand (const ::google::protobuf::Message &cmd)
static PendingCommandprepareRoomCommand (const ::google::protobuf::Message &cmd, int roomId)
static PendingCommandprepareModeratorCommand (const ::google::protobuf::Message &cmd)
static PendingCommandprepareAdminCommand (const ::google::protobuf::Message &cmd)

Public Attributes

QMap< QString, bool > clientFeatures

Protected Slots

void processProtocolItem (const ServerMessage &item)

Protected Member Functions

void setStatus (ClientStatus _status)
int getNewCmdId ()
virtual void sendCommandContainer (const CommandContainer &cont)=0

Protected Attributes

QMap< int, PendingCommand * > pendingCommands
QString userName
QString password
QString email
QString country
QString realName
QString token
bool serverSupportsPasswordHash

Private Slots

void queuePendingCommand (PendingCommand *pend)

Private Member Functions

void recordLatency (PendingCommand &pend)

Private Attributes

int nextCmdId
QMutex clientMutex
ClientStatus status
LatencyTracker latencyTracker
QElapsedTimer statsEmitClock
bool statsEmitClockStarted = false

Constructor & Destructor Documentation

◆ AbstractClient()

AbstractClient::AbstractClient ( QObject * parent = nullptr)
explicit
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~AbstractClient()

AbstractClient::~AbstractClient ( )
override

Member Function Documentation

◆ activateAccepted

void AbstractClient::activateAccepted ( )
signal
Here is the caller graph for this function:

◆ addToListEventReceived

void AbstractClient::addToListEventReceived ( const Event_AddToList & event)
signal
Here is the caller graph for this function:

◆ buddyListReceived

void AbstractClient::buddyListReceived ( const QList< ServerInfo_User > & buddyList)
signal
Here is the caller graph for this function:

◆ clearLatencyStats()

void AbstractClient::clearLatencyStats ( )

Drops all recorded round-trip samples and resets the stats emission throttle, emitting zeroed stats so that UI listeners can clear their display.

Must be called from the client thread (as RemoteClient's disconnect path does). The tracker is deliberately lock-free.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ connectionClosedEventReceived

void AbstractClient::connectionClosedEventReceived ( const Event_ConnectionClosed & event)
signal
Here is the caller graph for this function:

◆ gameEventContainerReceived

void AbstractClient::gameEventContainerReceived ( const GameEventContainer & event)
signal
Here is the caller graph for this function:

◆ gameJoinedEventReceived

void AbstractClient::gameJoinedEventReceived ( const Event_GameJoined & event)
signal
Here is the caller graph for this function:

◆ getNewCmdId()

int AbstractClient::getNewCmdId ( )
inlineprotected
Here is the caller graph for this function:

◆ getServerSupportsPasswordHash()

bool AbstractClient::getServerSupportsPasswordHash ( ) const
inline

◆ getStatus()

ClientStatus AbstractClient::getStatus ( ) const
inline
Here is the caller graph for this function:

◆ getUserName()

const QString & AbstractClient::getUserName ( ) const
inline

◆ ignoreListReceived

void AbstractClient::ignoreListReceived ( const QList< ServerInfo_User > & ignoreList)
signal
Here is the caller graph for this function:

◆ listRoomsEventReceived

void AbstractClient::listRoomsEventReceived ( const Event_ListRooms & event)
signal
Here is the caller graph for this function:

◆ maxPingTime

void AbstractClient::maxPingTime ( int seconds,
int maxSeconds )
signal
Here is the caller graph for this function:

◆ notifyUserEventReceived

void AbstractClient::notifyUserEventReceived ( const Event_NotifyUser & event)
signal
Here is the caller graph for this function:

◆ pingStatsUpdated

void AbstractClient::pingStatsUpdated ( const LatencyTracker::Stats & stats,
const QList< int > & samplesMs )
signal

Aggregated round-trip statistics and a chronological snapshot of the rolling window, emitted at most once per second.

All values in the stats struct are in milliseconds; sampleCount is the number of samples currently in the rolling window. The samples list is ordered oldest first so graphs can redraw without polling the tracker across threads. Emitted from the client thread. The connection to UI objects is automatically queued across threads.

Here is the caller graph for this function:

◆ prepareAdminCommand()

PendingCommand * AbstractClient::prepareAdminCommand ( const ::google::protobuf::Message & cmd)
static
Here is the caller graph for this function:

◆ prepareModeratorCommand()

PendingCommand * AbstractClient::prepareModeratorCommand ( const ::google::protobuf::Message & cmd)
static

◆ prepareRoomCommand()

PendingCommand * AbstractClient::prepareRoomCommand ( const ::google::protobuf::Message & cmd,
int roomId )
static
Here is the caller graph for this function:

◆ prepareSessionCommand()

PendingCommand * AbstractClient::prepareSessionCommand ( const ::google::protobuf::Message & cmd)
static
Here is the caller graph for this function:

◆ processProtocolItem

void AbstractClient::processProtocolItem ( const ServerMessage & item)
protectedslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ queuePendingCommand

void AbstractClient::queuePendingCommand ( PendingCommand * pend)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ recordLatency()

void AbstractClient::recordLatency ( PendingCommand & pend)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerAccepted

void AbstractClient::registerAccepted ( )
signal
Here is the caller graph for this function:

◆ registerAcceptedNeedsActivate

void AbstractClient::registerAcceptedNeedsActivate ( )
signal
Here is the caller graph for this function:

◆ removeFromListEventReceived

void AbstractClient::removeFromListEventReceived ( const Event_RemoveFromList & event)
signal
Here is the caller graph for this function:

◆ replayAddedEventReceived

void AbstractClient::replayAddedEventReceived ( const Event_ReplayAdded & event)
signal
Here is the caller graph for this function:

◆ roomEventReceived

void AbstractClient::roomEventReceived ( const RoomEvent & event)
signal
Here is the caller graph for this function:

◆ sendCommand() [1/2]

void AbstractClient::sendCommand ( const CommandContainer & cont)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendCommand() [2/2]

void AbstractClient::sendCommand ( PendingCommand * pend)
Here is the call graph for this function:

◆ sendCommandContainer()

virtual void AbstractClient::sendCommandContainer ( const CommandContainer & cont)
protectedpure virtual

Implemented in LocalClient.

Here is the caller graph for this function:

◆ serverIdentificationEventReceived

void AbstractClient::serverIdentificationEventReceived ( const Event_ServerIdentification & event)
signal
Here is the caller graph for this function:

◆ serverMessageEventReceived

void AbstractClient::serverMessageEventReceived ( const Event_ServerMessage & event)
signal
Here is the caller graph for this function:

◆ serverName()

virtual QString AbstractClient::serverName ( ) const
inlinevirtual

Returns the server address configured for the current connection.

May be empty for clients that have no server counterpart (e.g. local test clients).

Reimplemented in RemoteClient.

Here is the caller graph for this function:

◆ serverPort()

virtual quint16 AbstractClient::serverPort ( ) const
inlinevirtual

Reimplemented in RemoteClient.

Here is the caller graph for this function:

◆ serverShutdownEventReceived

void AbstractClient::serverShutdownEventReceived ( const Event_ServerShutdown & event)
signal
Here is the caller graph for this function:

◆ setStatus()

void AbstractClient::setStatus ( ClientStatus _status)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigQueuePendingCommand

void AbstractClient::sigQueuePendingCommand ( PendingCommand * pend)
signal
Here is the caller graph for this function:

◆ statusChanged

void AbstractClient::statusChanged ( ClientStatus _status)
signal
Here is the caller graph for this function:

◆ userInfoChanged

void AbstractClient::userInfoChanged ( const ServerInfo_User & userInfo)
signal
Here is the caller graph for this function:

◆ userJoinedEventReceived

void AbstractClient::userJoinedEventReceived ( const Event_UserJoined & event)
signal
Here is the caller graph for this function:

◆ userLeftEventReceived

void AbstractClient::userLeftEventReceived ( const Event_UserLeft & event)
signal
Here is the caller graph for this function:

◆ userMessageEventReceived

void AbstractClient::userMessageEventReceived ( const Event_UserMessage & event)
signal
Here is the caller graph for this function:

Member Data Documentation

◆ clientFeatures

QMap<QString, bool> AbstractClient::clientFeatures

◆ clientMutex

QMutex AbstractClient::clientMutex
mutableprivate

◆ country

QString AbstractClient::country
protected

◆ email

QString AbstractClient::email
protected

◆ latencyTracker

LatencyTracker AbstractClient::latencyTracker
private

◆ nextCmdId

int AbstractClient::nextCmdId
private

◆ password

QString AbstractClient::password
protected

◆ pendingCommands

QMap<int, PendingCommand *> AbstractClient::pendingCommands
protected

◆ realName

QString AbstractClient::realName
protected

◆ serverSupportsPasswordHash

bool AbstractClient::serverSupportsPasswordHash
protected

◆ statsEmitClock

QElapsedTimer AbstractClient::statsEmitClock
private

◆ statsEmitClockStarted

bool AbstractClient::statsEmitClockStarted = false
private

◆ status

ClientStatus AbstractClient::status
private

◆ token

QString AbstractClient::token
protected

◆ userName

QString AbstractClient::userName
protected

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