fix(server): now compiling with fake method to get list

This commit is contained in:
Raphael 2025-05-26 22:31:40 +02:00
parent 96ed68e8ca
commit bd0f57a7ef
2 changed files with 20 additions and 3 deletions

View file

@ -6,7 +6,7 @@
/* By: omoudni <omoudni@student.42paris.fr> +#+ +:+ +#+ */ /* By: omoudni <omoudni@student.42paris.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/20 21:50:32 by rparodi #+# #+# */ /* Created: 2025/05/20 21:50:32 by rparodi #+# #+# */
/* Updated: 2025/05/25 12:57:29 by rparodi ### ########.fr */ /* Updated: 2025/05/26 22:26:04 by rparodi ### ########.fr */
/* */ /* */
/******************************************************************************/ /******************************************************************************/
@ -16,6 +16,7 @@
#include "core.hpp" #include "core.hpp"
#include "channel.hpp" #include "channel.hpp"
#include "user.hpp" #include "user.hpp"
#include "logs.hpp"
class User; class User;
class Channel; class Channel;
@ -27,6 +28,7 @@ private:
std::string _password; std::string _password;
PollManager _pollManager; PollManager _pollManager;
std::map<int, User *> _users; std::map<int, User *> _users;
std::list<Channel *> _channels;
public: public:
Server(int port, const std::string &password); Server(int port, const std::string &password);

View file

@ -6,7 +6,7 @@
/* By: omoudni <omoudni@student.42paris.fr> +#+ +:+ +#+ */ /* By: omoudni <omoudni@student.42paris.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/13 11:11:07 by rparodi #+# #+# */ /* Created: 2025/05/13 11:11:07 by rparodi #+# #+# */
/* Updated: 2025/05/22 18:45:41 by omoudni ### ########.fr */ /* Updated: 2025/05/26 22:30:07 by rparodi ### ########.fr */
/* */ /* */
/******************************************************************************/ /******************************************************************************/
@ -14,6 +14,7 @@
#include "server.hpp" #include "server.hpp"
#include "core.hpp" #include "core.hpp"
#include "PollManager.hpp" #include "PollManager.hpp"
#include "logs.hpp"
#include <iostream> #include <iostream>
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
@ -146,3 +147,17 @@ void Server::printUsers() const
std::cout << "Nickname: " << it->second->getName() << std::endl; std::cout << "Nickname: " << it->second->getName() << std::endl;
} }
} }
std::list<User *> Server::getUsersList() const {
// to_delete when done
WARNING_MSG("TO DO FILL")
std::list<User*> userList;
for (std::map<int, User*>::const_iterator it = _users.begin(); it != _users.end(); ++it) {
userList.push_back(it->second);
}
return userList;
}
std::list<Channel *> Server::getChannelsList() const {
return this->_channels;
}