diff options
| author | 2021-06-01 01:46:53 +0100 | |
|---|---|---|
| committer | 2021-06-01 01:46:53 +0100 | |
| commit | 7f88bd76c932e3ba5b1c1b082092c9dcbfaf27ec (patch) | |
| tree | 9b35978ee2437f9b3f1529e3c80605f2e212bc40 /src/modules/m_sslmodes.cpp | |
| parent | Added -Wshorten-64-to-32 and fixed all warnings. (diff) | |
| parent | Refactor the sslqueries mode handler. (diff) | |
Merge branch 'insp3' into master.
Diffstat (limited to 'src/modules/m_sslmodes.cpp')
| -rw-r--r-- | src/modules/m_sslmodes.cpp | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/src/modules/m_sslmodes.cpp b/src/modules/m_sslmodes.cpp index 225734db0..fcc2636e4 100644 --- a/src/modules/m_sslmodes.cpp +++ b/src/modules/m_sslmodes.cpp @@ -35,6 +35,8 @@ enum { // From UnrealIRCd. ERR_SECUREONLYCHAN = 489, + + // InspIRCd-specific. ERR_ALLMUSTSSL = 490 }; @@ -138,27 +140,14 @@ class SSLModeUser : public ModeHandler ModeAction OnModeChange(User* user, User* dest, Channel* channel, Modes::Change& change) override { - if (change.adding) - { - if (!dest->IsModeSet(this)) - { - if (!API || !API->GetCertificate(user)) - return MODEACTION_DENY; + if (change.adding == dest->IsModeSet(this)) + return MODEACTION_DENY; - dest->SetMode(this, true); - return MODEACTION_ALLOW; - } - } - else - { - if (dest->IsModeSet(this)) - { - dest->SetMode(this, false); - return MODEACTION_ALLOW; - } - } + if (change.adding && IS_LOCAL(user) && (!API || !API->GetCertificate(user))) + return MODEACTION_DENY; - return MODEACTION_DENY; + dest->SetMode(this, change.adding); + return MODEACTION_ALLOW; } }; |
