diff --git a/srcs/commands/channel_op/mode.cpp b/srcs/commands/channel_op/mode.cpp index 14a706e..34eab32 100644 --- a/srcs/commands/channel_op/mode.cpp +++ b/srcs/commands/channel_op/mode.cpp @@ -6,7 +6,7 @@ /* By: sadjigui +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2023/02/11 19:19:30 by apommier #+# #+# */ -/* Updated: 2023/02/23 00:15:27 by sadjigui ### ########.fr */ +/* Updated: 2023/02/23 00:41:10 by sadjigui ### ########.fr */ /* */ /* ************************************************************************** */ @@ -27,6 +27,19 @@ int search_and_erase(std::string &str, std::string toFind) return 1; } +int ft_stoi(std::string str) +{ + int i = 0; + int result = 0; + + while (str[i] >= '0' && str[i] <= '9') + { + result = result * 10 +str[i] - 48; + i++; + } + return result; +} + // void exec_chan_opt(fdList &allFds, char opt, bool sign) // { // (void)allFds; @@ -118,7 +131,9 @@ void do_chan_opt(fdList &allFds, int userNbr, std::vector opt, int break ; case 5: allFds.channelList[chanNbr].mode.n = (sign = true) ? true : false; break ; - case 6: allFds.channelList[chanNbr].mode.m = (sign = true) ? true : false; + case 6: + if (sign == true) + allFds.channelList[chanNbr].maxUser = ft_stoi(opt[3]); break ; case 7: std::cout << "launching option: " << opt[2][i] << std::endl; break ;