diff --git a/extensions/m_roleplay.cc b/extensions/m_roleplay.cc index 47c57a3e6..5ad5fa509 100644 --- a/extensions/m_roleplay.cc +++ b/extensions/m_roleplay.cc @@ -164,7 +164,7 @@ m_displaymsg(struct MsgBuf *msgbuf_p, struct Client *source_p, const char *chann return; /* enforce target change on roleplay commands */ - if(!is_chanop_voiced(msptr) && !IsOper(source_p) && !add_channel_target(source_p, chptr)) + if(!is_chanop(msptr) && !is_voiced(msptr) && !IsOper(source_p) && !add_channel_target(source_p, chptr)) { sendto_one(source_p, form_str(ERR_TARGCHANGE), me.name, source_p->name, chptr->name.c_str()); diff --git a/include/ircd/channel.h b/include/ircd/channel.h index 92292f6d1..6acf41f56 100644 --- a/include/ircd/channel.h +++ b/include/ircd/channel.h @@ -113,8 +113,6 @@ bool is_chanop(const membership &); bool is_chanop(const membership *const &); bool is_voiced(const membership &); bool is_voiced(const membership *const &); -bool is_chanop_voiced(const membership &); -bool is_chanop_voiced(const membership *const &); bool can_send_banned(const membership &); bool can_send_banned(const membership *const &); const char *find_status(const membership *const &msptr, const int &combine); @@ -401,42 +399,6 @@ exists(const members &m, const client &c) return m.global.count(const_cast(&c)); } -inline bool -is_chanop(const membership &m) -{ - return m.flags & CHANOP; -} - -inline bool -is_chanop(const membership *const &m) -{ - return m && is_chanop(*m); -} - -inline bool -is_voiced(const membership &m) -{ - return m.flags & VOICE; -} - -inline bool -is_voiced(const membership *const &m) -{ - return m && is_voiced(*m); -} - -inline bool -is_chanop_voiced(const membership &m) -{ - return m.flags & (VOICE | CHANOP); -} - -inline bool -is_chanop_voiced(const membership *const &m) -{ - return m && is_chanop_voiced(*m); -} - inline client & get_client(membership &m) { @@ -449,6 +411,12 @@ get_client(const membership &m) return *m.git->first; } +inline bool +can_send_banned(const membership *const &m) +{ + return m && can_send_banned(*m); +} + inline bool can_send_banned(const membership &m) { @@ -456,9 +424,27 @@ can_send_banned(const membership &m) } inline bool -can_send_banned(const membership *const &m) +is_voiced(const membership *const &m) { - return m && can_send_banned(*m); + return m && is_voiced(*m); +} + +inline bool +is_voiced(const membership &m) +{ + return m.flags & VOICE; +} + +inline bool +is_chanop(const membership *const &m) +{ + return m && is_chanop(*m); +} + +inline bool +is_chanop(const membership &m) +{ + return m.flags & CHANOP; } inline uint diff --git a/ircd/channel.cc b/ircd/channel.cc index 46e743959..638def736 100644 --- a/ircd/channel.cc +++ b/ircd/channel.cc @@ -905,7 +905,7 @@ chan::can_send(chan *chptr, client *source_p, membership *msptr) } } - if(is_chanop_voiced(msptr)) + if (is_chanop(msptr) || is_voiced(msptr)) moduledata.approved = CAN_SEND_OPV; moduledata.client = source_p; @@ -999,7 +999,7 @@ chan::find_bannickchange_channel(client *client_p) auto &chptr(pit.first); auto &msptr(pit.second); - if (is_chanop_voiced(msptr)) + if (is_chanop(msptr) || is_voiced(msptr)) continue; /* cached can_send */ if (msptr->bants == chptr->bants) diff --git a/ircd/tgchange.cc b/ircd/tgchange.cc index d981a9881..d364912c5 100644 --- a/ircd/tgchange.cc +++ b/ircd/tgchange.cc @@ -34,7 +34,7 @@ find_allowing_channel(struct Client *source, struct Client *target) auto &chan(*pit.first); auto &member(*pit.second); - if (is_chanop_voiced(member) && is_member(chan, *target)) + if ((is_chanop(member) || is_voiced(member)) && is_member(chan, *target)) return &chan; } diff --git a/modules/core/m_message.cc b/modules/core/m_message.cc index 994be4431..e6d992f23 100644 --- a/modules/core/m_message.cc +++ b/modules/core/m_message.cc @@ -338,7 +338,7 @@ build_target_list(enum message_type msgtype, struct Client *client_p, msptr = get(chptr->members, *source_p, std::nothrow); - if(!IsServer(source_p) && !IsService(source_p) && !is_chanop_voiced(msptr)) + if(!IsServer(source_p) && !IsService(source_p) && !is_chanop(msptr) && !is_voiced(msptr)) { sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), get_id(&me, source_p), diff --git a/modules/m_topic.cc b/modules/m_topic.cc index 37b1e7a80..836b3c279 100644 --- a/modules/m_topic.cc +++ b/modules/m_topic.cc @@ -94,9 +94,11 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_ return; } - if(MyClient(source_p) && !is_chanop_voiced(msptr) && - !IsOper(source_p) && - !add_channel_target(source_p, chptr)) + if (MyClient(source_p) && + !is_chanop(msptr) && + !is_voiced(msptr) && + !IsOper(source_p) && + !add_channel_target(source_p, chptr)) { sendto_one(source_p, form_str(ERR_TARGCHANGE), me.name, source_p->name, chptr->name.c_str());