pairpal
Loading...
Searching...
No Matches
Chat Class Reference

A class to handle Chat_test functionalities including sending and retrieving messages. More...

#include <chat.hpp>

Public Member Functions

 Chat ()
 Constructor for the Chat class.
 
 ~Chat ()
 Destructor for the Chat class.
 
bool sendMessage (const std::string &from, const std::string &to, const std::string &message)
 Sends a message from one user to another.
 
std::vector< MessagegetSentMessages (const std::string &username) const
 Retrieves the messages sent by a specific user.
 
std::vector< MessagegetReceivedMessages (const std::string &username) const
 Retrieves the messages received by a specific user.
 

Detailed Description

A class to handle Chat_test functionalities including sending and retrieving messages.

Member Function Documentation

◆ getReceivedMessages()

std::vector< Message > Chat::getReceivedMessages ( const std::string & username) const
nodiscard

Retrieves the messages received by a specific user.

Parameters
usernameThe username of the receiver.
Returns
A vector of messages received by the specified user.

◆ getSentMessages()

std::vector< Message > Chat::getSentMessages ( const std::string & username) const
nodiscard

Retrieves the messages sent by a specific user.

Parameters
usernameThe username of the sender.
Returns
A vector of messages sent by the specified user.

◆ sendMessage()

bool Chat::sendMessage ( const std::string & from,
const std::string & to,
const std::string & message )

Sends a message from one user to another.

Parameters
fromThe username of the sender.
toThe username of the receiver.
messageThe content of the message to be sent.
Returns
True if the message was sent successfully, false otherwise.

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