From 172deacb065d1db5f8dead0924fc06b8fa4088f2 Mon Sep 17 00:00:00 2001 From: Sam Dodrill Date: Fri, 13 Sep 2013 19:52:30 -0700 Subject: [PATCH] Finalize behavor of channel admins Channel admins are able to kick channel admins --- src/channel.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) 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()