Add is_any_op() in preperation for adding +ah, start using it instead of is_chanop() in a few places.

This commit is contained in:
B.Greenham 2010-02-27 19:20:01 -05:00
parent 4424a19423
commit d1c7eccf6a
5 changed files with 22 additions and 4 deletions

View File

@ -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 *);

View File

@ -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()))))

View File

@ -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),

View File

@ -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];

View File

@ -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;