mirror of
https://github.com/znc/znc.git
synced 2026-08-08 18:03:22 +02:00
Make modperl support AddServerDependentCapability
This commit is contained in:
@@ -189,6 +189,10 @@ class MCString : public std::map<CString, CString> {};
|
||||
bool ExistsNV(const CString& sName) {
|
||||
return $self->EndNV() != $self->FindNV(sName);
|
||||
}
|
||||
void AddServerDependentCapability(const CString& sName, SV* serverCb,
|
||||
SV* clientCb) {
|
||||
$self->AddServerDependentCapability(sName, std::make_unique<CPerlCapability>(serverCb, clientCb));
|
||||
}
|
||||
}
|
||||
|
||||
%extend CModules {
|
||||
|
||||
@@ -216,6 +216,20 @@ inline CPerlSocket* CreatePerlSocket(CPerlModule* pModule, SV* perlObj) {
|
||||
return new CPerlSocket(pModule, perlObj);
|
||||
}
|
||||
|
||||
class ZNC_EXPORT_LIB_EXPORT CPerlCapability : public CCapability {
|
||||
public:
|
||||
CPerlCapability(SV* serverCb, SV* clientCb)
|
||||
: m_serverCb(newSVsv(serverCb)), m_clientCb(newSVsv(clientCb)) {}
|
||||
~CPerlCapability();
|
||||
|
||||
void OnServerChangedSupport(CIRCNetwork* pNetwork, bool bState) override;
|
||||
void OnClientChangedSupport(CClient* pClient, bool bState) override;
|
||||
|
||||
private:
|
||||
SV* m_serverCb;
|
||||
SV* m_clientCb;
|
||||
};
|
||||
|
||||
inline bool HaveIPv6() {
|
||||
#ifdef HAVE_IPV6
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user