segfault in function JOIN Fixed
This commit is contained in:
parent
2b3b6654e7
commit
150ada2f4e
4 changed files with 13 additions and 15 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/05/20 22:18:17 by rparodi #+# #+# */
|
||||
/* Updated: 2025/06/17 23:38:49 by sben-tay ### ########.fr */
|
||||
/* Updated: 2025/06/18 00:10:56 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ class Channel {
|
|||
size_t getMaxUsers() const;
|
||||
User *getOwner() const;
|
||||
std::list<User *> getOperators() const;
|
||||
std::list<User *> getUsers() const;
|
||||
std::list<User *>& getUsers();
|
||||
std::list<User *> getInvited() const;
|
||||
std::string getPassword() const;
|
||||
bool isOperator(User *user) const;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/05/20 22:43:24 by rparodi #+# #+# */
|
||||
/* Updated: 2025/06/17 23:51:54 by sben-tay ### ########.fr */
|
||||
/* Updated: 2025/06/18 00:10:48 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ User *Channel::getOwner() const {
|
|||
*
|
||||
* @return list of Users in the channel
|
||||
*/
|
||||
std::list<User *> Channel::getUsers() const {
|
||||
std::list<User *>& Channel::getUsers() {
|
||||
return this->_users;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/05/24 17:29:48 by rparodi #+# #+# */
|
||||
/* Updated: 2025/06/17 23:50:28 by sben-tay ### ########.fr */
|
||||
/* Updated: 2025/06/17 23:55:31 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -89,5 +89,4 @@ void Join::execute() {
|
|||
msg353 += (*it)->getNickname() + " ";
|
||||
}
|
||||
_cTarget->sendAllClientInAChannel(msgJoin + msg332 + msg353 + "\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sben-tay <sben-tay@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/05/13 11:11:07 by rparodi #+# #+# */
|
||||
/* Updated: 2025/06/17 23:16:55 by sben-tay ### ########.fr */
|
||||
/* Updated: 2025/06/18 00:10:14 by sben-tay ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -185,7 +185,6 @@ void Server::printUsers() const
|
|||
std::string Server::getPassword() const { return this->_password; }
|
||||
|
||||
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) {
|
||||
|
|
@ -212,10 +211,10 @@ std::vector<std::string> splitLines(const std::string& input) {
|
|||
}
|
||||
|
||||
void Server::disconnectClient(int fd) {
|
||||
_pollManager.removeClient(fd);
|
||||
close(fd);
|
||||
if (_users.count(fd)) {
|
||||
delete _users[fd];
|
||||
_users.erase(fd);
|
||||
}
|
||||
User *user = _users[fd];
|
||||
for (std::list<Channel*>::iterator it = _channels.begin(); it != _channels.end(); ++it)
|
||||
(*it)->removeUser(user);
|
||||
|
||||
delete user;
|
||||
_users.erase(fd);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue