mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 16:22:35 +01:00
Better names for some channel mode convenience former-macros.
This commit is contained in:
parent
d064881b2d
commit
7d44e271f7
9 changed files with 33 additions and 32 deletions
|
@ -48,7 +48,7 @@ static int eb_channel(const char *data, struct Client *client_p,
|
|||
if (chptr->name[0] == '#' && data[0] == '&')
|
||||
return INVALID;
|
||||
/* privacy! don't allow +s/+p channels to influence another channel */
|
||||
if (!pub(chptr2) && chptr2 != chptr)
|
||||
if (!is_public(chptr2) && chptr2 != chptr)
|
||||
return INVALID;
|
||||
|
||||
return is_member(chptr2, client_p)? MATCH : NOMATCH;
|
||||
|
|
|
@ -19,5 +19,5 @@ DECLARE_MODULE_AV2(hide_uncommon_channels, NULL, NULL, NULL, NULL, huc_hfnlist,
|
|||
static void
|
||||
h_huc_doing_whois_channel_visibility(hook_data_client *hdata)
|
||||
{
|
||||
hdata->approved = (pub(hdata->chptr) && !IsInvisible(hdata->target)) || is_member(hdata->chptr, hdata->client);
|
||||
hdata->approved = (is_public(hdata->chptr) && !IsInvisible(hdata->target)) || is_member(hdata->chptr, hdata->client);
|
||||
}
|
||||
|
|
|
@ -140,17 +140,18 @@ struct chan
|
|||
~chan() noexcept;
|
||||
};
|
||||
|
||||
bool secret(const chan &);
|
||||
bool secret(const chan *const &);
|
||||
bool hidden(const chan &);
|
||||
bool hidden(const chan *const &);
|
||||
bool pub(const chan &);
|
||||
bool pub(const chan *const &);
|
||||
bool can_show(const chan &, const client &);
|
||||
bool can_show(const chan *const &, const client *const &);
|
||||
bool is_name(const char *const &name);
|
||||
|
||||
bool is_secret(const chan &);
|
||||
bool is_secret(const chan *const &);
|
||||
bool is_hidden(const chan &);
|
||||
bool is_hidden(const chan *const &);
|
||||
bool is_public(const chan &);
|
||||
bool is_public(const chan *const &);
|
||||
bool is_member(const chan &c, const client &);
|
||||
bool is_member(const chan *const &, const client *const &);
|
||||
bool is_name(const char *const &name);
|
||||
bool can_show(const chan &, const client &);
|
||||
bool can_show(const chan *const &, const client *const &);
|
||||
|
||||
enum : int
|
||||
{
|
||||
|
@ -201,39 +202,39 @@ void init();
|
|||
|
||||
|
||||
inline bool
|
||||
secret(const chan &c)
|
||||
is_secret(const chan &c)
|
||||
{
|
||||
return c.mode.mode & mode::SECRET;
|
||||
}
|
||||
|
||||
inline bool
|
||||
secret(const chan *const &c)
|
||||
is_secret(const chan *const &c)
|
||||
{
|
||||
return c && secret(*c);
|
||||
return c && is_secret(*c);
|
||||
}
|
||||
|
||||
inline bool
|
||||
hidden(const chan &c)
|
||||
is_hidden(const chan &c)
|
||||
{
|
||||
return c.mode.mode & mode::PRIVATE;
|
||||
}
|
||||
|
||||
inline bool
|
||||
hidden(const chan *const &c)
|
||||
is_hidden(const chan *const &c)
|
||||
{
|
||||
return c && hidden(*c);
|
||||
return c && is_hidden(*c);
|
||||
}
|
||||
|
||||
inline bool
|
||||
pub(const chan &c)
|
||||
is_public(const chan &c)
|
||||
{
|
||||
return ~c.mode.mode & (mode::PRIVATE | mode::SECRET);
|
||||
}
|
||||
|
||||
inline bool
|
||||
pub(const chan *const &c)
|
||||
is_public(const chan *const &c)
|
||||
{
|
||||
return !c || pub(*c);
|
||||
return !c || is_public(*c);
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
@ -252,13 +253,13 @@ is_member(const chan *const &c, const client *const &client)
|
|||
inline bool
|
||||
can_show(const chan &c, const client &client)
|
||||
{
|
||||
return pub(c) || is_member(c, client);
|
||||
return is_public(c) || is_member(c, client);
|
||||
}
|
||||
|
||||
inline bool
|
||||
can_show(const chan *const &c, const client *const &client)
|
||||
{
|
||||
return pub(c) || is_member(c, client);
|
||||
return is_public(c) || is_member(c, client);
|
||||
}
|
||||
|
||||
inline bool
|
||||
|
|
|
@ -397,9 +397,9 @@ chan::free_channel_list(rb_dlink_list * list)
|
|||
static const char *
|
||||
channel_pub_or_secret(chan::chan *const &chptr)
|
||||
{
|
||||
return chan::pub(chptr)? "=":
|
||||
chan::secret(chptr)? "@":
|
||||
"*";
|
||||
return chan::is_public(chptr)? "=":
|
||||
chan::is_secret(chptr)? "@":
|
||||
"*";
|
||||
}
|
||||
|
||||
/* channel_member_names()
|
||||
|
|
|
@ -106,7 +106,7 @@ m_knock(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
}
|
||||
|
||||
/* cant knock to a +p channel */
|
||||
if(hidden(chptr))
|
||||
if(is_hidden(chptr))
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN,
|
||||
form_str(ERR_CANNOTSENDTOCHAN), name);
|
||||
|
|
|
@ -398,7 +398,7 @@ static void safelist_channel_named(struct Client *source_p, const char *name, in
|
|||
return;
|
||||
}
|
||||
|
||||
visible = !secret(chptr) || is_member(chptr, source_p);
|
||||
visible = !is_secret(chptr) || is_member(chptr, source_p);
|
||||
if (visible || operspy)
|
||||
list_one_channel(source_p, chptr, visible);
|
||||
|
||||
|
@ -418,7 +418,7 @@ static void safelist_one_channel(struct Client *source_p, chan::chan *chptr, str
|
|||
{
|
||||
int visible;
|
||||
|
||||
visible = !secret(chptr) || is_member(chptr, source_p);
|
||||
visible = !is_secret(chptr) || is_member(chptr, source_p);
|
||||
if (!visible && !params->operspy)
|
||||
return;
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ names_global(struct Client *source_p)
|
|||
msptr = (chan::membership *)lp->data;
|
||||
chptr = msptr->chan;
|
||||
|
||||
if(pub(chptr) || is_member(chptr, source_p) || secret(chptr))
|
||||
if(is_public(chptr) || is_member(chptr, source_p) || is_secret(chptr))
|
||||
{
|
||||
dont_show = true;
|
||||
break;
|
||||
|
|
|
@ -139,7 +139,7 @@ m_topic(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_
|
|||
if(operspy)
|
||||
report_operspy(source_p, "TOPIC", chptr->name.c_str());
|
||||
|
||||
if(!is_member(chptr, source_p) && secret(chptr) && !operspy)
|
||||
if(!is_member(chptr, source_p) && is_secret(chptr) && !operspy)
|
||||
{
|
||||
sendto_one_numeric(source_p, ERR_NOTONCHANNEL, form_str(ERR_NOTONCHANNEL), name);
|
||||
return;
|
||||
|
|
|
@ -190,7 +190,7 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
|
|||
|
||||
if(is_member(chptr, source_p) || operspy)
|
||||
do_who_on_channel(source_p, chptr, server_oper, true, &fmt);
|
||||
else if(!secret(chptr))
|
||||
else if(!is_secret(chptr))
|
||||
do_who_on_channel(source_p, chptr, server_oper, false, &fmt);
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ m_who(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source_p,
|
|||
if(isinvis && !member)
|
||||
continue;
|
||||
|
||||
if(member || (!isinvis && pub(chptr)))
|
||||
if(member || (!isinvis && is_public(chptr)))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue