diff --git a/include/channel.h b/include/channel.h index 9e84dce..df6008e 100644 --- a/include/channel.h +++ b/include/channel.h @@ -228,6 +228,7 @@ extern int can_join(struct Client *source_p, struct Channel *chptr, char *key); extern struct membership *find_channel_membership(struct Channel *, struct Client *); extern const char *find_channel_status(struct membership *msptr, int combine); +extern int is_any_op(struct membership *msptr); extern void add_user_to_channel(struct Channel *, struct Client *, int flags); extern void remove_user_from_channel(struct membership *); extern void remove_user_from_channels(struct Client *); diff --git a/modules/core/m_part.c b/modules/core/m_part.c index 5e38047..61c585b 100644 --- a/modules/core/m_part.c +++ b/modules/core/m_part.c @@ -123,7 +123,7 @@ part_one_client(struct Client *client_p, struct Client *source_p, char *name, ch * Remove user from the old channel (if any) * only allow /part reasons in -m chans */ - if(reason[0] && (is_chanop(msptr) || !MyConnect(source_p) || + if(reason[0] && (is_any_op(msptr) || !MyConnect(source_p) || ((can_send(chptr, source_p, msptr) > 0 && (source_p->localClient->firsttime + ConfigFileEntry.anti_spam_exit_message_time) < rb_current_time())))) diff --git a/modules/m_invite.c b/modules/m_invite.c index 7eef5c0..2a711e4 100644 --- a/modules/m_invite.c +++ b/modules/m_invite.c @@ -145,7 +145,7 @@ m_invite(struct Client *client_p, struct Client *source_p, int parc, const char /* unconditionally require ops, unless the channel is +g */ /* treat remote clients as chanops */ - if(MyClient(source_p) && !is_chanop(msptr) && !IsOverride(source_p) && + if(MyClient(source_p) && !is_any_op(msptr) && !IsOverride(source_p) && !(chptr->mode.mode & MODE_FREEINVITE)) { sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), diff --git a/modules/m_topic.c b/modules/m_topic.c index 001a5e1..e81ce2c 100644 --- a/modules/m_topic.c +++ b/modules/m_topic.c @@ -114,7 +114,7 @@ m_topic(struct Client *client_p, struct Client *source_p, int parc, const char * return 0; } - if((chptr->mode.mode & MODE_TOPICLIMIT) == 0 || is_chanop(msptr) || IsOverride(source_p)) + if((chptr->mode.mode & MODE_TOPICLIMIT) == 0 || is_any_op(msptr) || IsOverride(source_p)) { char topic_info[USERHOST_REPLYLEN]; diff --git a/src/channel.c b/src/channel.c index a5f53a2..36ad743 100644 --- a/src/channel.c +++ b/src/channel.c @@ -194,6 +194,23 @@ find_channel_status(struct membership *msptr, int combine) return buffer; } +/* is_any_op() + * + * input - membership to check for ops + * output - 1 if the user is op, halfop, or owner, 0 elsewise + * side effects - + */ + +int +is_any_op(struct membership *msptr) +{ + /* Checks for +ah will go here when +ah are implemented */ + if(is_chanop(msptr)) + return 1; + else + return 0; +} + /* add_user_to_channel() * * input - channel to add client to, client to add, channel flags @@ -928,7 +945,7 @@ find_nonickchange_channel(struct Client *client_p) { msptr = ptr->data; chptr = msptr->chptr; - if (is_chanop_voiced(msptr)) + if (is_any_op(msptr)) continue; if (chptr->mode.mode & MODE_NONICK) return chptr;