summaryrefslogtreecommitdiff
path: root/src/sessionManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sessionManager.cpp')
-rw-r--r--src/sessionManager.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/sessionManager.cpp b/src/sessionManager.cpp
index adf3834..801d9a7 100644
--- a/src/sessionManager.cpp
+++ b/src/sessionManager.cpp
@@ -3,6 +3,7 @@
#include "session.hpp"
#include <algorithm>
#include <cstring>
+#include <ranges>
#include <unistd.h>
#include <utility>
@@ -68,6 +69,10 @@ CSession *CSessionManager::getByIp(const char m_ip[INET_ADDRSTRLEN]) const {
return it != m_vSessions.end() ? it->second.get() : nullptr;
}
+std::vector<std::shared_ptr<CSession>> CSessionManager::getSessions() const {
+ return m_vSessions | std::views::transform([](const auto &s) { return s.second; }) | std::ranges::to<std::vector>();
+}
+
void CSessionManager::kick(CSession *session, const bool &kill, const std::string &reason) {
for (auto &_session : m_vSessions)
if (_session.second.get() == session)