diff --git a/src/channel.c b/src/channel.c index aa365e6..9075594 100644 --- a/src/channel.c +++ b/src/channel.c @@ -319,23 +319,25 @@ can_kick_deop(struct membership *source, struct membership *target) * Reworked the logic to match this: * - owners can do what they want * - admins cannot kick or deop owners + * - admins can kick or deop admins * - ops cannot kick or deop admins * - halfops cannot kick or deop anyone that has halfop or up * -- Niichan */ - if(is_halfop(source) && !is_any_op(target)) - return 1; - else if(is_chanop(source) && !is_admin(target)) - return 1; - else if(is_chanop(source) && !is_owner(target)) - return 1; - else if(is_admin(source) && !is_owner(target)) - return 1; - else if(is_owner(source)) + if(is_owner(source)) return 1; + if(is_admin(source) && is_owner(target)) + return 0; + if(is_chanop(source) && is_owner(target)) + return 0; + if(is_chanop(source) && is_admin(target)) + return 0; + if(is_halfop(source) && is_any_op(target)) + return 0; + + return 1; - return 0; } /* add_user_to_channel()