diff options
| -rw-r--r-- | TODO.md | 2 | ||||
| -rw-r--r-- | src/chatManager.cpp | 1 | ||||
| -rw-r--r-- | src/chatManager.hpp | 2 | ||||
| -rw-r--r-- | src/session.cpp | 2 |
4 files changed, 5 insertions, 2 deletions
@@ -2,7 +2,7 @@ - [ ] ci unit testing - [ ] multiline buffer input/output - [ ] file upload/download -- [ ] user identifier, UUID or something, IP can duplicate, username can be .empty() +- [x] user identifier, ~UUID or something~uintptr_t of instance, IP can duplicate, username can be .empty() ## FTXUI diff --git a/src/chatManager.cpp b/src/chatManager.cpp index 96c1b0c..07dfce4 100644 --- a/src/chatManager.cpp +++ b/src/chatManager.cpp @@ -20,6 +20,7 @@ void CChatManager::newMessage(const SMessage &msg) { return; } g_pSessionManager->broadcastChat(msg); + g_pIOManager->m_vIO.push_back({.msg = msg, .log = std::nullopt}); g_pInputManager->updateIO(); } diff --git a/src/chatManager.hpp b/src/chatManager.hpp index 0f423f7..46b02de 100644 --- a/src/chatManager.hpp +++ b/src/chatManager.hpp @@ -1,6 +1,7 @@ #pragma once #include <memory> +#include <optional> #include <string> #include <vector> @@ -11,6 +12,7 @@ class CChatManager { struct SMessage { std::string msg; std::string username; + std::optional<uintptr_t> sender = std::nullopt; bool admin = false; }; void newMessage(const SMessage &msg); diff --git a/src/session.cpp b/src/session.cpp index 8a311bf..8167a91 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -249,7 +249,7 @@ bool CSession::write(const std::string &msg) { } bool CSession::writeChat(const CChatManager::SMessage &msg) { - if (m_name != msg.username) { + if ((uintptr_t)this != *msg.sender) { if (msg.admin && !m_isAdmin) return false; |
