diff options
| author | 2021-12-15 09:37:13 +0000 | |
|---|---|---|
| committer | 2021-12-15 09:37:13 +0000 | |
| commit | 2998fd178b7b0f799bf2e660f5f2e2d6aaaccf10 (patch) | |
| tree | 72aa9175333fc4eced1774cbd1a412fbb70f7d3b /src/modules/m_starttls.cpp | |
| parent | If a user has a unique username then include it in bans. (diff) | |
Only show the tls cap if there is a TLS provider available.
Diffstat (limited to 'src/modules/m_starttls.cpp')
| -rw-r--r-- | src/modules/m_starttls.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/modules/m_starttls.cpp b/src/modules/m_starttls.cpp index 80e2bb006..d73fb4e6d 100644 --- a/src/modules/m_starttls.cpp +++ b/src/modules/m_starttls.cpp @@ -81,16 +81,39 @@ class CommandStartTLS : public SplitCommand } }; +class TLSCap : public Cap::Capability +{ + private: + dynamic_reference_nocheck<IOHookProvider>& sslref; + + bool OnList(LocalUser* user) CXX11_OVERRIDE + { + return sslref; + } + + bool OnRequest(LocalUser* user, bool adding) CXX11_OVERRIDE + { + return sslref; + } + + public: + TLSCap(Module* mod, dynamic_reference_nocheck<IOHookProvider>& ssl) + : Cap::Capability(mod, "tls") + , sslref(ssl) + { + } +}; + class ModuleStartTLS : public Module { CommandStartTLS starttls; - Cap::Capability tls; + TLSCap tls; dynamic_reference_nocheck<IOHookProvider> ssl; public: ModuleStartTLS() : starttls(this, ssl) - , tls(this, "tls") + , tls(this, ssl) , ssl(this, "ssl") { } |
