mirror of
https://github.com/pissnet/pissircd.git
synced 2025-08-13 05:31:36 +01:00
Make +z in set::modes-on-join work (and auto +Z setting). Reported by FwdInTime (#4841).
This commit is contained in:
parent
a687ab022b
commit
5fcff0dd90
2 changed files with 21 additions and 2 deletions
src/modules/chanmodes
|
@ -180,9 +180,14 @@ void issecure_set(aChannel *chptr, aClient *sptr, int notice)
|
|||
|
||||
DLLFUNC int issecure_join(aClient *cptr, aClient *sptr, aChannel *chptr, char *parv[])
|
||||
{
|
||||
/* Only care if chan already +zZ and the user joining is insecure (no need to count) */
|
||||
/* Check only if chan already +zZ and the user joining is insecure (no need to count) */
|
||||
if (IsSecureJoin(chptr) && IsSecureChanIndicated(chptr) && !IsSecureConnect(sptr) && !IsULine(sptr))
|
||||
issecure_unset(chptr, sptr, 1);
|
||||
|
||||
/* Special case for +z in modes-on-join and first user creating the channel */
|
||||
if ((chptr->users == 1) && IsSecureJoin(chptr) && !IsSecureChanIndicated(chptr) && !channel_has_insecure_users(chptr))
|
||||
issecure_set(chptr, NULL, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ void secureonly_channel_sync (aChannel* chptr, unsigned short merge, unsigned sh
|
|||
int secureonly_check_send (aClient *acptr, aChannel* chptr);
|
||||
int secureonly_check_secure (aChannel* chptr);
|
||||
int secureonly_check_sajoin (aClient *acptr, aChannel* chptr, aClient *sptr);
|
||||
int secureonly_specialcheck(aClient *sptr, aChannel *chptr, char *parv[]);
|
||||
|
||||
MOD_TEST(sslonly)
|
||||
{
|
||||
|
@ -52,7 +53,8 @@ MOD_INIT(sslonly)
|
|||
req.flag = 'z';
|
||||
req.is_ok = extcmode_default_requirechop;
|
||||
CmodeAdd(modinfo->handle, req, &EXTCMODE_SSLONLY);
|
||||
|
||||
|
||||
HookAdd(modinfo->handle, HOOKTYPE_PRE_LOCAL_JOIN, 0, secureonly_specialcheck);
|
||||
HookAdd(modinfo->handle, HOOKTYPE_CAN_JOIN, 0, secureonly_check_join);
|
||||
HookAddVoid(modinfo->handle, HOOKTYPE_CHANNEL_SYNCED, 0, secureonly_channel_sync);
|
||||
HookAdd(modinfo->handle, HOOKTYPE_IS_CHANNEL_SECURE, 0, secureonly_check_secure);
|
||||
|
@ -171,3 +173,15 @@ int secureonly_check_sajoin (aClient *acptr, aChannel* chptr, aClient *sptr)
|
|||
return HOOK_CONTINUE;
|
||||
}
|
||||
|
||||
/* Special check for +z in set::modes-on-join. Needs to be done early.
|
||||
* Perhaps one day this will be properly handled in the core so this can be removed.
|
||||
*/
|
||||
int secureonly_specialcheck(aClient *sptr, aChannel *chptr, char *parv[])
|
||||
{
|
||||
if ((chptr->users == 0) && (iConf.modes_on_join.extmodes & EXTCMODE_SSLONLY) && !IsSecure(sptr) && !IsOper(sptr))
|
||||
{
|
||||
sendto_one(sptr, err_str(ERR_SECUREONLYCHAN), me.name, sptr->name, chptr->chname);
|
||||
return HOOK_DENY;
|
||||
}
|
||||
return HOOK_ALLOW;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue