The chat messages to show, newest last, each for shown_for.
More...
#include </__w/project-rtype/project-rtype/client/network/include/rtype/chat_log.hpp>
|
| using | Clock = std::chrono::steady_clock |
| | Clock of the lines.
|
| |
|
| bool | add (const ChatMessage &message, Clock::time_point now) |
| | Adds a message relayed by the server.
|
| |
| void | refused (std::uint8_t reason, Clock::time_point now) |
| | Adds the reason a message of this client was not relayed.
|
| |
| void | prune (Clock::time_point now) |
| | Drops the lines whose time is over.
|
| |
| const std::vector< PlayerNotice > & | shown () const noexcept |
| | Lines to show, oldest first.
|
| |
| void | clear () noexcept |
| | Forgets every line, for a new session.
|
| |
|
| static constexpr std::chrono::seconds | shown_for {8} |
| | How long a line stays.
|
| |
| static constexpr std::size_t | max_shown = 6 |
| | Most lines shown at once: a new one pushes out the oldest.
|
| |
The chat messages to show, newest last, each for shown_for.
A line is a PlayerNotice: the sender's number gives its color (lobby_player for a sender in the lobby, and for what the server refused), its text is "name: text". A message whose name or text breaks the rules of the protocol is ignored (RFC section 3.8).
◆ Clock
◆ add()
| bool rtype::ChatLog::add |
( |
const ChatMessage & |
message, |
|
|
Clock::time_point |
now |
|
) |
| |
Adds a message relayed by the server.
- Parameters
-
| message | Its sender and text. |
| now | Time it is shown from. |
- Returns
false if it was ignored.
◆ clear()
| void rtype::ChatLog::clear |
( |
| ) |
|
|
noexcept |
Forgets every line, for a new session.
◆ prune()
| void rtype::ChatLog::prune |
( |
Clock::time_point |
now | ) |
|
Drops the lines whose time is over.
- Parameters
-
◆ refused()
| void rtype::ChatLog::refused |
( |
std::uint8_t |
reason, |
|
|
Clock::time_point |
now |
|
) |
| |
Adds the reason a message of this client was not relayed.
- Parameters
-
| reason | reason of the ChatRejected, as received. |
| now | Time it is shown from. |
◆ shown()
| const std::vector< PlayerNotice > & rtype::ChatLog::shown |
( |
| ) |
const |
|
noexcept |
Lines to show, oldest first.
- Returns
- The lines.
◆ max_shown
| constexpr std::size_t rtype::ChatLog::max_shown = 6 |
|
staticconstexpr |
Most lines shown at once: a new one pushes out the oldest.
◆ shown_for
| constexpr std::chrono::seconds rtype::ChatLog::shown_for {8} |
|
staticconstexpr |
The documentation for this class was generated from the following file:
- /__w/project-rtype/project-rtype/client/network/include/rtype/chat_log.hpp