|
RunicVTT Open Source Virtual Tabletop for TTRPG using P2P
|
#include <ChatManager.h>
Public Member Functions | |
| ChatManager (std::weak_ptr< NetworkManager > nm, std::shared_ptr< IdentityManager > identity_manager) | |
| void | setNetwork (std::weak_ptr< NetworkManager > nm) |
| void | setActiveGameTable (uint64_t tableId, const std::string &gameTableName) |
| bool | hasCurrent () const |
| bool | saveCurrent () |
| bool | loadCurrent () |
| void | applyReady (const msg::ReadyMessage &m) |
| void | pushMessageLocal (uint64_t groupId, const std::string &fromPeer, const std::string &username, const std::string &text, double ts, bool incoming) |
| void | render () |
| void | writeGroupsToSnapshotGT (std::vector< unsigned char > &buf) const |
| void | readGroupsFromSnapshotGT (const std::vector< unsigned char > &buf, size_t &off) |
| ChatGroupModel * | getGroup (uint64_t id) |
| void | replaceUsernameForUnique (const std::string &uniqueId, const std::string &newUsername) |
| void | tryHandleSlashCommand (uint64_t threadId, const std::string &input) |
| std::set< std::string > | resolvePeerIdsForParticipants (const std::set< std::string > &participantUids) const |
| bool | isMeParticipantOf (const ChatGroupModel &g) const |
Public Attributes | |
| uint64_t | currentTableId_ = 0 |
| std::string | currentTableName_ |
Static Public Attributes | |
| static constexpr uint64_t | generalGroupId_ = 1 |
Private Member Functions | |
| ImU32 | getUsernameColor (const std::string &name) const |
| void | renderColoredUsername (const std::string &name) const |
| void | renderPlainMessage (const std::string &text) const |
| std::filesystem::path | chatFilePathFor (uint64_t tableId, const std::string &name) const |
| void | ensureGeneral () |
| void | markGroupRead (uint64_t groupId) |
| void | emitGroupCreate (const ChatGroupModel &g) |
| void | emitGroupUpdate (const ChatGroupModel &g) |
| void | emitGroupDelete (uint64_t groupId) |
| void | emitChatMessageFrame (uint64_t groupId, const std::string &username, const std::string &text, uint64_t ts) |
| void | emitGroupLeave (uint64_t groupId) |
| void | renderEditGroupPopup () |
| void | renderLeftPanel (float width) |
| void | renderRightPanel (float leftPanelWidth) |
| void | renderCreateGroupPopup () |
| void | renderDeleteGroupPopup () |
| void | renderDicePopup () |
| bool | saveLog (std::vector< uint8_t > &buf) const |
| bool | loadLog (const std::vector< uint8_t > &buf) |
| uint64_t | makeGroupIdFromName (const std::string &name) const |
Static Private Member Functions | |
| static ChatMessageModel::Kind | classifyMessage (const std::string &s) |
| static double | nowSec () |
| static ImVec4 | HSVtoRGB (float h, float s, float v) |
Private Attributes | |
| std::shared_ptr< IdentityManager > | identity_manager |
| std::unordered_map< uint64_t, ChatGroupModel > | groups_ |
| uint64_t | activeGroupId_ = generalGroupId_ |
| std::array< char, 512 > | input_ {} |
| bool | focusInput_ = false |
| bool | followScroll_ = true |
| bool | jumpToBottom_ = false |
| bool | chatWindowFocused_ = false |
| bool | openCreatePopup_ = false |
| bool | openDeletePopup_ = false |
| bool | openDicePopup_ = false |
| std::array< char, 128 > | newGroupName_ {} |
| std::set< std::string > | newGroupSel_ |
| float | leftWidth_ = 170.0f |
| bool | openEditPopup_ = false |
| uint64_t | editGroupId_ = 0 |
| std::array< char, 128 > | editGroupName_ {} |
| std::set< std::string > | editGroupSel_ |
| int | diceN_ = 1 |
| int | diceSides_ = 20 |
| int | diceMod_ = 0 |
| bool | diceModPerDie_ = false |
| std::weak_ptr< NetworkManager > | network_ |
| std::unordered_map< std::string, ImU32 > | nameColorCache_ |
Definition at line 49 of file ChatManager.h.
|
explicit |
Definition at line 40 of file ChatManager.cpp.
| void ChatManager::applyReady | ( | const msg::ReadyMessage & | m | ) |
Definition at line 243 of file ChatManager.cpp.
|
private |
Definition at line 78 of file ChatManager.cpp.
|
staticprivate |
Definition at line 30 of file ChatManager.cpp.
|
private |
Definition at line 489 of file ChatManager.cpp.
|
private |
Definition at line 428 of file ChatManager.cpp.
|
private |
Definition at line 466 of file ChatManager.cpp.
|
private |
Definition at line 511 of file ChatManager.cpp.
|
private |
Definition at line 447 of file ChatManager.cpp.
|
private |
Definition at line 65 of file ChatManager.cpp.
| ChatGroupModel * ChatManager::getGroup | ( | uint64_t | id | ) |
|
private |
Definition at line 684 of file ChatManager.cpp.
|
inline |
|
staticprivate |
Definition at line 637 of file ChatManager.cpp.
| bool ChatManager::isMeParticipantOf | ( | const ChatGroupModel & | g | ) | const |
Definition at line 230 of file ChatManager.cpp.
| bool ChatManager::loadCurrent | ( | ) |
Definition at line 190 of file ChatManager.cpp.
|
private |
Definition at line 114 of file ChatManager.cpp.
|
private |
Definition at line 220 of file ChatManager.cpp.
|
private |
Definition at line 1627 of file ChatManager.cpp.
|
staticprivate |
Definition at line 16 of file ChatManager.cpp.
| void ChatManager::pushMessageLocal | ( | uint64_t | groupId, |
| const std::string & | fromPeer, | ||
| const std::string & | username, | ||
| const std::string & | text, | ||
| double | ts, | ||
| bool | incoming ) |
Definition at line 381 of file ChatManager.cpp.
| void ChatManager::readGroupsFromSnapshotGT | ( | const std::vector< unsigned char > & | buf, |
| size_t & | off ) |
| void ChatManager::render | ( | ) |
Definition at line 604 of file ChatManager.cpp.
|
private |
Definition at line 712 of file ChatManager.cpp.
|
private |
Definition at line 1109 of file ChatManager.cpp.
|
private |
Definition at line 1448 of file ChatManager.cpp.
|
private |
Definition at line 1557 of file ChatManager.cpp.
|
private |
Definition at line 1298 of file ChatManager.cpp.
|
private |
Definition at line 803 of file ChatManager.cpp.
|
private |
Definition at line 720 of file ChatManager.cpp.
|
private |
Definition at line 912 of file ChatManager.cpp.
| void ChatManager::replaceUsernameForUnique | ( | const std::string & | uniqueId, |
| const std::string & | newUsername ) |
Definition at line 566 of file ChatManager.cpp.
| std::set< std::string > ChatManager::resolvePeerIdsForParticipants | ( | const std::set< std::string > & | participantUids | ) | const |
Definition at line 549 of file ChatManager.cpp.
| bool ChatManager::saveCurrent | ( | ) |
Definition at line 171 of file ChatManager.cpp.
|
private |
Definition at line 85 of file ChatManager.cpp.
| void ChatManager::setActiveGameTable | ( | uint64_t | tableId, |
| const std::string & | gameTableName ) |
Definition at line 48 of file ChatManager.cpp.
| void ChatManager::setNetwork | ( | std::weak_ptr< NetworkManager > | nm | ) |
Definition at line 42 of file ChatManager.cpp.
| void ChatManager::tryHandleSlashCommand | ( | uint64_t | threadId, |
| const std::string & | input ) |
Definition at line 725 of file ChatManager.cpp.
| void ChatManager::writeGroupsToSnapshotGT | ( | std::vector< unsigned char > & | buf | ) | const |
|
private |
Definition at line 106 of file ChatManager.h.
|
private |
Definition at line 113 of file ChatManager.h.
| uint64_t ChatManager::currentTableId_ = 0 |
Definition at line 90 of file ChatManager.h.
| std::string ChatManager::currentTableName_ |
Definition at line 91 of file ChatManager.h.
|
private |
Definition at line 133 of file ChatManager.h.
|
private |
Definition at line 134 of file ChatManager.h.
|
private |
Definition at line 131 of file ChatManager.h.
|
private |
Definition at line 132 of file ChatManager.h.
|
private |
Definition at line 126 of file ChatManager.h.
|
private |
Definition at line 127 of file ChatManager.h.
|
private |
Definition at line 128 of file ChatManager.h.
|
private |
Definition at line 110 of file ChatManager.h.
|
private |
Definition at line 111 of file ChatManager.h.
|
staticconstexpr |
Definition at line 89 of file ChatManager.h.
|
private |
Definition at line 105 of file ChatManager.h.
|
private |
Definition at line 102 of file ChatManager.h.
|
private |
Definition at line 109 of file ChatManager.h.
|
private |
Definition at line 112 of file ChatManager.h.
|
private |
Definition at line 123 of file ChatManager.h.
|
mutableprivate |
Definition at line 143 of file ChatManager.h.
|
private |
Definition at line 137 of file ChatManager.h.
|
private |
Definition at line 121 of file ChatManager.h.
|
private |
Definition at line 122 of file ChatManager.h.
|
private |
Definition at line 116 of file ChatManager.h.
|
private |
Definition at line 117 of file ChatManager.h.
|
private |
Definition at line 118 of file ChatManager.h.
|
private |
Definition at line 125 of file ChatManager.h.