diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2025-06-11 19:55:25 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2025-06-11 19:55:25 +0800 |
| commit | 9d1452447481d45344a1e33446ad9a418e9ea64f (patch) | |
| tree | 9fdaf4301c461f23eec210663874b3cdd567779b /src/session.cpp | |
| parent | e30f6eb6872d57f7da764690589c2f0c9ffdb53b (diff) | |
internal: fully discard the use of uintptr_t for identification use
Diffstat (limited to 'src/session.cpp')
| -rw-r--r-- | src/session.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/session.cpp b/src/session.cpp index 116c9bc..aa6147c 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -10,6 +10,7 @@ #include <cerrno> #include <cstring> #include <memory> +#include <optional> #include <sys/socket.h> CSession::CSession() { @@ -90,7 +91,7 @@ void CSession::recvLoop() { if (isCommand) g_pCommandHandler->handleCommand(recvData->data, this); - g_pChatManager->newMessage({.msg = recvData->data, .username = m_name, .sender = (uintptr_t)this, .admin = isCommand}); + g_pChatManager->newMessage({.msg = recvData->data, .username = m_name, .sender = self->second, .admin = isCommand}); } } @@ -246,7 +247,7 @@ bool CSession::write(const std::string &msg) { } bool CSession::writeChat(const CChatManager::SMessage &msg) { - if (msg.sender ? (uintptr_t)this != *msg.sender : msg.username != m_name) { + if (msg.sender ? this != msg.sender->get() : msg.username != m_name) { if (msg.admin && !m_isAdmin) return false; |
