commit - ec0b405d9d75045e521136ff28e42d7212f14834
commit + f92a614a35699f5192b8ea85a5844c3bf57ec0b6
blob - d774e576af95882ae134c9b2341a205752709dc9
blob + 0f25a190470e51216e256b4caf2d9734a6b35a40
--- src/ngircd/channel.c
+++ src/ngircd/channel.c
} /* Channel_Part */
-/* Kick user from Channel */
+/**
+ * Kick user from Channel
+ */
GLOBAL void
-Channel_Kick( CLIENT *Client, CLIENT *Origin, const char *Name, const char *Reason )
+Channel_Kick(CLIENT *Peer, CLIENT *Target, CLIENT *Origin, const char *Name,
+ const char *Reason )
{
CHANNEL *chan;
- assert( Client != NULL );
- assert( Origin != NULL );
- assert( Name != NULL );
- assert( Reason != NULL );
+ assert(Peer != NULL);
+ assert(Target != NULL);
+ assert(Origin != NULL);
+ assert(Name != NULL);
+ assert(Reason != NULL);
/* Check that channel exists */
chan = Channel_Search( Name );
return;
}
- /* Check that user is on the specified channel */
- if( ! Channel_IsMemberOf( chan, Origin ))
- {
- IRC_WriteStrClient( Origin, ERR_NOTONCHANNEL_MSG, Client_ID( Origin ), Name );
- return;
- }
+ if (Client_Type(Peer) != CLIENT_SERVER &&
+ Client_Type(Origin) != CLIENT_SERVICE) {
+ /* Check that user is on the specified channel */
+ if (!Channel_IsMemberOf(chan, Origin)) {
+ IRC_WriteStrClient( Origin, ERR_NOTONCHANNEL_MSG,
+ Client_ID(Origin), Name);
+ return;
+ }
- /* Check if user has operator status */
- if( ! strchr( Channel_UserModes( chan, Origin ), 'o' ))
- {
- IRC_WriteStrClient( Origin, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( Origin ), Name);
- return;
+ /* Check if user has operator status */
+ if (!strchr(Channel_UserModes(chan, Origin), 'o')) {
+ IRC_WriteStrClient(Origin, ERR_CHANOPRIVSNEEDED_MSG,
+ Client_ID(Origin), Name);
+ return;
+ }
}
/* Check that the client to be kicked is on the specified channel */
- if( ! Channel_IsMemberOf( chan, Client ))
- {
- IRC_WriteStrClient( Origin, ERR_USERNOTINCHANNEL_MSG, Client_ID( Origin ), Client_ID( Client ), Name );
+ if (!Channel_IsMemberOf(chan, Target)) {
+ IRC_WriteStrClient(Origin, ERR_USERNOTINCHANNEL_MSG,
+ Client_ID(Origin), Client_ID(Target), Name );
return;
}
/* Kick Client from channel */
- Remove_Client( REMOVE_KICK, chan, Client, Origin, Reason, true);
+ Remove_Client( REMOVE_KICK, chan, Target, Origin, Reason, true);
} /* Channel_Kick */
blob - a562645c6c0c6b79c6df9f4ff02ca32865be739f
blob + 792f26928996c641f29f8688553f90c01d8e7e51
--- src/ngircd/channel.h
+++ src/ngircd/channel.h
GLOBAL void Channel_Quit PARAMS(( CLIENT *Client, char *Reason ));
-GLOBAL void Channel_Kick PARAMS(( CLIENT *Client, CLIENT *Origin, const char *Name, const char *Reason ));
+GLOBAL void Channel_Kick PARAMS((CLIENT *Peer, CLIENT *Target, CLIENT *Origin,
+ const char *Name, const char *Reason));
GLOBAL unsigned long Channel_Count PARAMS(( void ));
GLOBAL unsigned long Channel_MemberCount PARAMS(( CHANNEL *Chan ));
blob - f1ebc79236c5da35155c7a7b426596535969e57c
blob + 6cd01049b88e284743289a88308dc786077d4560
--- src/ngircd/irc-op.c
+++ src/ngircd/irc-op.c
static bool
-try_kick(CLIENT* from, const char *nick, const char *channel, const char *reason)
+try_kick(CLIENT *peer, CLIENT* from, const char *nick, const char *channel,
+ const char *reason)
{
CLIENT *target = Client_Search(nick);
if (!target)
return IRC_WriteStrClient(from, ERR_NOSUCHNICK_MSG, Client_ID(from), nick);
- Channel_Kick(target, from, channel, reason);
+ Channel_Kick(peer, target, from, channel, reason);
return true;
}
currentChannel = Req->argv[0];
if (channelCount == 1) {
while (nickCount > 0) {
- if (!try_kick(from, currentNick, currentChannel, reason))
+ if (!try_kick(Client, from, currentNick,
+ currentChannel, reason))
return false;
while (*currentNick)
}
} else if (channelCount == nickCount) {
while (nickCount > 0) {
- if (!try_kick(from, currentNick, currentChannel, reason))
+ if (!try_kick(Client, from, currentNick,
+ currentChannel, reason))
return false;
while (*currentNick)