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

#include <remote_client.h>

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

Signals

void serverTimeout ()
void loginError (Response::ResponseCode resp, QString reasonStr, quint32 endTime, QList< QString > missingFeatures)
void registerError (Response::ResponseCode resp, QString reasonStr, quint32 endTime)
void activateError ()
void socketError (const QString &errorString)
void protocolVersionMismatch (int clientVersion, int serverVersion)
void sigConnectToServer (const QString &hostname, unsigned int port, const QString &_userName, const QString &_password)
void sigRegisterToServer (const QString &hostname, unsigned int port, const QString &_userName, const QString &_password, const QString &_email, const QString &_country, const QString &_realname)
void sigActivateToServer (const QString &_token)
void sigDisconnectFromServer ()
void notifyUserAboutUpdate ()
void sigRequestForgotPasswordToServer (const QString &hostname, unsigned int port, const QString &_userName)
void sigForgotPasswordSuccess ()
void sigForgotPasswordError ()
void sigPromptForForgotPasswordReset ()
void sigSubmitForgotPasswordResetToServer (const QString &hostname, unsigned int port, const QString &_userName, const QString &_token, const QString &_newpassword)
void sigPromptForForgotPasswordChallenge ()
void sigSubmitForgotPasswordChallengeToServer (const QString &hostname, unsigned int port, const QString &_userName, const QString &_email)
Signals inherited from AbstractClient
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

 RemoteClient (QObject *parent=nullptr, INetworkSettingsProvider *networkSettingsProvider=nullptr)
 ~RemoteClient () override
QString peerName () const
quint16 peerPort () const
QString serverName () const override
 Returns the server address configured for the current connection.
quint16 serverPort () const override
void connectToServer (const QString &hostname, unsigned int port, const QString &_userName, const QString &_password)
void registerToServer (const QString &hostname, unsigned int port, const QString &_userName, const QString &_password, const QString &_email, const QString &_country, const QString &_realname)
void activateToServer (const QString &_token)
void disconnectFromServer ()
void requestForgotPasswordToServer (const QString &hostname, unsigned int port, const QString &_userName)
void submitForgotPasswordResetToServer (const QString &hostname, unsigned int port, const QString &_userName, const QString &_token, const QString &_newpassword)
void submitForgotPasswordChallengeToServer (const QString &hostname, unsigned int port, const QString &_userName, const QString &_email)
Public Member Functions inherited from AbstractClient
 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

Protected Slots

void sendCommandContainer (const CommandContainer &cont) override
Protected Slots inherited from AbstractClient
void processProtocolItem (const ServerMessage &item)

Private Slots

void slotConnected ()
void readData ()
void websocketMessageReceived (const QByteArray &message)
void slotSocketError (QAbstractSocket::SocketError error)
void slotWebSocketError (QAbstractSocket::SocketError error)
void ping ()
void processServerIdentificationEvent (const Event_ServerIdentification &event)
void processConnectionClosedEvent (const Event_ConnectionClosed &event)
void passwordSaltResponse (const Response &response)
void loginResponse (const Response &response)
void registerResponse (const Response &response)
void activateResponse (const Response &response)
void doConnectToServer (const QString &hostname, unsigned int port, const QString &_userName, const QString &_password)
void doRegisterToServer (const QString &hostname, unsigned int port, const QString &_userName, const QString &_password, const QString &_email, const QString &_country, const QString &_realname)
void doRequestPasswordSalt ()
void doLogin ()
void doHashedLogin ()
Command_Login generateCommandLogin ()
void doDisconnectFromServer ()
void doActivateToServer (const QString &_token)
void doRequestForgotPasswordToServer (const QString &hostname, unsigned int port, const QString &_userName)
void requestForgotPasswordResponse (const Response &response)
void doSubmitForgotPasswordResetToServer (const QString &hostname, unsigned int port, const QString &_userName, const QString &_token, const QString &_newpassword)
void submitForgotPasswordResetResponse (const Response &response)
void doSubmitForgotPasswordChallengeToServer (const QString &hostname, unsigned int port, const QString &_userName, const QString &_email)
void submitForgotPasswordChallengeResponse (const Response &response)

Private Member Functions

QString getSrvClientID (const QString &_hostname)
bool newMissingFeatureFound (const QString &_serversMissingFeatures)
void clearNewClientFeatures ()
void connectToHost (const QString &hostname, unsigned int port)

Private Attributes

INetworkSettingsProvidernetworkSettingsProvider
int maxTimeout
int timeRunning
int lastDataReceived
QByteArray inputBuffer
bool messageInProgress
bool handshakeStarted
bool usingWebSocket
int messageLength
QTimer * timer
QTcpSocket * socket
QWebSocket * websocket
QString lastHostname
unsigned int lastPort
QString hashedPassword

Additional Inherited Members

Static Public Member Functions inherited from AbstractClient
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 inherited from AbstractClient
QMap< QString, bool > clientFeatures
Protected Member Functions inherited from AbstractClient
void setStatus (ClientStatus _status)
int getNewCmdId ()
virtual void sendCommandContainer (const CommandContainer &cont)=0
Protected Attributes inherited from AbstractClient
QMap< int, PendingCommand * > pendingCommands
QString userName
QString password
QString email
QString country
QString realName
QString token
bool serverSupportsPasswordHash

Constructor & Destructor Documentation

◆ RemoteClient()

RemoteClient::RemoteClient ( QObject * parent = nullptr,
INetworkSettingsProvider * networkSettingsProvider = nullptr )
explicit
Here is the call graph for this function:

◆ ~RemoteClient()

RemoteClient::~RemoteClient ( )
override
Here is the call graph for this function:

Member Function Documentation

◆ activateError

void RemoteClient::activateError ( )
signal
Here is the caller graph for this function:

◆ activateResponse

void RemoteClient::activateResponse ( const Response & response)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ activateToServer()

void RemoteClient::activateToServer ( const QString & _token)
Here is the call graph for this function:

◆ clearNewClientFeatures()

void RemoteClient::clearNewClientFeatures ( )
private
Here is the caller graph for this function:

◆ connectToHost()

void RemoteClient::connectToHost ( const QString & hostname,
unsigned int port )
private
Here is the caller graph for this function:

◆ connectToServer()

void RemoteClient::connectToServer ( const QString & hostname,
unsigned int port,
const QString & _userName,
const QString & _password )
Here is the call graph for this function:

◆ disconnectFromServer()

void RemoteClient::disconnectFromServer ( )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doActivateToServer

void RemoteClient::doActivateToServer ( const QString & _token)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doConnectToServer

void RemoteClient::doConnectToServer ( const QString & hostname,
unsigned int port,
const QString & _userName,
const QString & _password )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doDisconnectFromServer

void RemoteClient::doDisconnectFromServer ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doHashedLogin

void RemoteClient::doHashedLogin ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doLogin

void RemoteClient::doLogin ( )
privateslot
Todo
Store and log in using stored hashed password.
Todo
Add setting for client to reject unhashed logins.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doRegisterToServer

void RemoteClient::doRegisterToServer ( const QString & hostname,
unsigned int port,
const QString & _userName,
const QString & _password,
const QString & _email,
const QString & _country,
const QString & _realname )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doRequestForgotPasswordToServer

void RemoteClient::doRequestForgotPasswordToServer ( const QString & hostname,
unsigned int port,
const QString & _userName )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doRequestPasswordSalt

void RemoteClient::doRequestPasswordSalt ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doSubmitForgotPasswordChallengeToServer

void RemoteClient::doSubmitForgotPasswordChallengeToServer ( const QString & hostname,
unsigned int port,
const QString & _userName,
const QString & _email )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doSubmitForgotPasswordResetToServer

void RemoteClient::doSubmitForgotPasswordResetToServer ( const QString & hostname,
unsigned int port,
const QString & _userName,
const QString & _token,
const QString & _newpassword )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ generateCommandLogin

Command_Login RemoteClient::generateCommandLogin ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSrvClientID()

QString RemoteClient::getSrvClientID ( const QString & _hostname)
private
Here is the caller graph for this function:

◆ loginError

void RemoteClient::loginError ( Response::ResponseCode resp,
QString reasonStr,
quint32 endTime,
QList< QString > missingFeatures )
signal
Here is the caller graph for this function:

◆ loginResponse

void RemoteClient::loginResponse ( const Response & response)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ newMissingFeatureFound()

bool RemoteClient::newMissingFeatureFound ( const QString & _serversMissingFeatures)
private
Here is the caller graph for this function:

◆ notifyUserAboutUpdate

void RemoteClient::notifyUserAboutUpdate ( )
signal
Here is the caller graph for this function:

◆ passwordSaltResponse

void RemoteClient::passwordSaltResponse ( const Response & response)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ peerName()

QString RemoteClient::peerName ( ) const
inline

◆ peerPort()

quint16 RemoteClient::peerPort ( ) const
inline

◆ ping

void RemoteClient::ping ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processConnectionClosedEvent

void RemoteClient::processConnectionClosedEvent ( const Event_ConnectionClosed & event)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ processServerIdentificationEvent

void RemoteClient::processServerIdentificationEvent ( const Event_ServerIdentification & event)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ protocolVersionMismatch

void RemoteClient::protocolVersionMismatch ( int clientVersion,
int serverVersion )
signal
Here is the caller graph for this function:

◆ readData

void RemoteClient::readData ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerError

void RemoteClient::registerError ( Response::ResponseCode resp,
QString reasonStr,
quint32 endTime )
signal
Here is the caller graph for this function:

◆ registerResponse

void RemoteClient::registerResponse ( const Response & response)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerToServer()

void RemoteClient::registerToServer ( const QString & hostname,
unsigned int port,
const QString & _userName,
const QString & _password,
const QString & _email,
const QString & _country,
const QString & _realname )
Here is the call graph for this function:

◆ requestForgotPasswordResponse

void RemoteClient::requestForgotPasswordResponse ( const Response & response)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ requestForgotPasswordToServer()

void RemoteClient::requestForgotPasswordToServer ( const QString & hostname,
unsigned int port,
const QString & _userName )
Here is the call graph for this function:

◆ sendCommandContainer

void RemoteClient::sendCommandContainer ( const CommandContainer & cont)
overrideprotectedslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ serverName()

QString RemoteClient::serverName ( ) const
inlineoverridevirtual

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 from AbstractClient.

◆ serverPort()

quint16 RemoteClient::serverPort ( ) const
inlineoverridevirtual

Reimplemented from AbstractClient.

◆ serverTimeout

void RemoteClient::serverTimeout ( )
signal
Here is the caller graph for this function:

◆ sigActivateToServer

void RemoteClient::sigActivateToServer ( const QString & _token)
signal
Here is the caller graph for this function:

◆ sigConnectToServer

void RemoteClient::sigConnectToServer ( const QString & hostname,
unsigned int port,
const QString & _userName,
const QString & _password )
signal
Here is the caller graph for this function:

◆ sigDisconnectFromServer

void RemoteClient::sigDisconnectFromServer ( )
signal
Here is the caller graph for this function:

◆ sigForgotPasswordError

void RemoteClient::sigForgotPasswordError ( )
signal
Here is the caller graph for this function:

◆ sigForgotPasswordSuccess

void RemoteClient::sigForgotPasswordSuccess ( )
signal
Here is the caller graph for this function:

◆ sigPromptForForgotPasswordChallenge

void RemoteClient::sigPromptForForgotPasswordChallenge ( )
signal
Here is the caller graph for this function:

◆ sigPromptForForgotPasswordReset

void RemoteClient::sigPromptForForgotPasswordReset ( )
signal
Here is the caller graph for this function:

◆ sigRegisterToServer

void RemoteClient::sigRegisterToServer ( const QString & hostname,
unsigned int port,
const QString & _userName,
const QString & _password,
const QString & _email,
const QString & _country,
const QString & _realname )
signal
Here is the caller graph for this function:

◆ sigRequestForgotPasswordToServer

void RemoteClient::sigRequestForgotPasswordToServer ( const QString & hostname,
unsigned int port,
const QString & _userName )
signal
Here is the caller graph for this function:

◆ sigSubmitForgotPasswordChallengeToServer

void RemoteClient::sigSubmitForgotPasswordChallengeToServer ( const QString & hostname,
unsigned int port,
const QString & _userName,
const QString & _email )
signal
Here is the caller graph for this function:

◆ sigSubmitForgotPasswordResetToServer

void RemoteClient::sigSubmitForgotPasswordResetToServer ( const QString & hostname,
unsigned int port,
const QString & _userName,
const QString & _token,
const QString & _newpassword )
signal
Here is the caller graph for this function:

◆ slotConnected

void RemoteClient::slotConnected ( )
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ slotSocketError

void RemoteClient::slotSocketError ( QAbstractSocket::SocketError error)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ slotWebSocketError

void RemoteClient::slotWebSocketError ( QAbstractSocket::SocketError error)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ socketError

void RemoteClient::socketError ( const QString & errorString)
signal
Here is the caller graph for this function:

◆ submitForgotPasswordChallengeResponse

void RemoteClient::submitForgotPasswordChallengeResponse ( const Response & response)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ submitForgotPasswordChallengeToServer()

void RemoteClient::submitForgotPasswordChallengeToServer ( const QString & hostname,
unsigned int port,
const QString & _userName,
const QString & _email )
Here is the call graph for this function:

◆ submitForgotPasswordResetResponse

void RemoteClient::submitForgotPasswordResetResponse ( const Response & response)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

◆ submitForgotPasswordResetToServer()

void RemoteClient::submitForgotPasswordResetToServer ( const QString & hostname,
unsigned int port,
const QString & _userName,
const QString & _token,
const QString & _newpassword )
Here is the call graph for this function:

◆ websocketMessageReceived

void RemoteClient::websocketMessageReceived ( const QByteArray & message)
privateslot
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ handshakeStarted

bool RemoteClient::handshakeStarted
private

◆ hashedPassword

QString RemoteClient::hashedPassword
private

◆ inputBuffer

QByteArray RemoteClient::inputBuffer
private

◆ lastDataReceived

int RemoteClient::lastDataReceived
private

◆ lastHostname

QString RemoteClient::lastHostname
private

◆ lastPort

unsigned int RemoteClient::lastPort
private

◆ maxTimeout

int RemoteClient::maxTimeout
private

◆ messageInProgress

bool RemoteClient::messageInProgress
private

◆ messageLength

int RemoteClient::messageLength
private

◆ networkSettingsProvider

INetworkSettingsProvider* RemoteClient::networkSettingsProvider
private

◆ socket

QTcpSocket* RemoteClient::socket
private

◆ timer

QTimer* RemoteClient::timer
private

◆ timeRunning

int RemoteClient::timeRunning
private

◆ usingWebSocket

bool RemoteClient::usingWebSocket
private

◆ websocket

QWebSocket* RemoteClient::websocket
private

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