From 9d1452447481d45344a1e33446ad9a418e9ea64f Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Wed, 11 Jun 2025 19:55:25 +0800 Subject: internal: fully discard the use of uintptr_t for identification use --- src/session.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/session.cpp') 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 #include #include +#include #include 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; -- cgit v1.2.3