mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
ircd: Reduce is_chanop_voiced().
This commit is contained in:
parent
a6dccc4419
commit
68b8a83419
6 changed files with 36 additions and 48 deletions
|
@ -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());
|
||||
|
|
|
@ -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<client *>(&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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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());
|
||||
|
|
Loading…
Reference in a new issue