1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-04 07:03:12 +02:00

Add is_invited(client, channel) function.

This commit is contained in:
Bram Matthys
2020-04-25 17:01:41 +02:00
parent 0902ed7a99
commit ca2ba56d82
4 changed files with 24 additions and 19 deletions
+3 -4
View File
@@ -140,11 +140,10 @@ int secureonly_check_join(Client *client, Channel *channel, char *key, char *par
/* if the channel is +z we still allow an ircop to bypass it
* if they are invited.
*/
for (lp = client->user->invited; lp; lp = lp->next)
if (lp->value.channel == channel)
return HOOK_CONTINUE;
if (is_invited(client, channel))
return HOOK_CONTINUE;
}
return (ERR_SECUREONLYCHAN);
return ERR_SECUREONLYCHAN;
}
return 0;
}
+5 -14
View File
@@ -113,9 +113,8 @@ int _can_join(Client *client, Channel *channel, char *key, char *parv[])
if (banned && j == HOOK_DENY)
return (ERR_BANNEDFROMCHAN);
for (lp = client->user->invited; lp; lp = lp->next)
if (lp->value.channel == channel)
return 0;
if (is_invited(client, channel))
return 0; /* allowed */
if (channel->users >= channel->mode.limit)
{
@@ -515,20 +514,12 @@ void _do_join(Client *client, int parc, char *parv[])
!strcasecmp(name, SPAMFILTER_VIRUSCHAN) &&
!ValidatePermissionsForPath("immune:server-ban:viruschan",client,NULL,NULL,NULL) && !spamf_ugly_vchanoverride)
{
int invited = 0;
Link *lp;
Channel *channel = find_channel(name, NULL);
if (channel)
if (!channel || !is_invited(client, channel))
{
for (lp = client->user->invited; lp; lp = lp->next)
if (lp->value.channel == channel)
invited = 1;
}
if (!invited)
{
sendnotice(client, "*** Cannot join '%s' because it's the virus-help-channel which is "
"reserved for infected users only", name);
sendnotice(client, "*** Cannot join '%s' because it's the virus-help-channel "
"which is reserved for infected users only", name);
continue;
}
}