@@ -32,25 +32,35 @@ void IrcServer::checkKick(std::string _msg, int _pos)
32
32
i = 0 ;
33
33
j = 0 ;
34
34
35
+
35
36
if (!splitKickCommand (_pos, _msg, users, chan))
36
37
return ;
37
38
while (i < users.size ())
38
39
{
39
40
j = i;
40
- target_user = userExist (users[i]);
41
- target_channel = channelExist (chan[i]);
42
41
42
+ if (chan.size () > 1 && users.size () > chan.size () && i >= chan.size ())
43
+ {
44
+ i++;
45
+ continue ;
46
+ }
47
+
43
48
if (chan.size () == 1 )
44
49
j = 0 ;
45
50
51
+ target_user = userExist (users[i]);
52
+ target_channel = channelExist (chan[j]);
53
+
54
+ std::cout << " Delete " + users[i] + " from " + chan[i] + " . i = " << i << " . j = " << j << std::endl;
55
+
46
56
if (!checkChannelNames (chan[j]))
47
57
sendMsg (ERR_BADCHANMASK (chan[j]), fd_sockets[_pos]);
48
58
else if (target_user == -1 )
49
59
sendMsg (ERR_NOSUCHNICK (clients[_pos -1 ]->getNickname (), users[i]), fd_sockets[_pos]);
50
60
else if (target_channel == -1 )
51
61
sendMsg (ERR_NOSUCHCHANNEL (clients[_pos - 1 ]->getNickname (), chan[j]), fd_sockets[_pos]);
52
62
else if (searchUserInChannel (users[i], chan[j]) == -1 )
53
- sendMsg (ERR_NOTONCHANNEL (users[i] , channels[target_channel]->getname ()), fd_sockets[_pos]);
63
+ sendMsg (ERR_NOTONCHANNEL (clients[_pos - 1 ]-> getNickname () , channels[target_channel]->getname ()), fd_sockets[_pos]);
54
64
else if (!clients[_pos - 1 ]->operatorOfThisChannel (chan[j]))
55
65
sendMsg (ERR_CHANOPRIVSNEEDED (clients[_pos -1 ]->getNickname (), chan[j]), fd_sockets[_pos]);
56
66
else
0 commit comments