diff --git a/modules/modpython/codegen.pl b/modules/modpython/codegen.pl index f4f19de6..dc67ccad 100644 --- a/modules/modpython/codegen.pl +++ b/modules/modpython/codegen.pl @@ -275,6 +275,9 @@ while (<$in>) { say $out "Py_BuildValue(\"l\", (long int)$a->{var});"; } } + when (/^CSmartPtr/) { + say $out "SWIG_NewInstanceObj(new $a->{type}($a->{var}), SWIG_TypeQuery(\"$a->{type}*\"), SWIG_POINTER_OWN);"; + } when (/\*$/) { (my $t = $a->{type}) =~ s/^const//; say $out "SWIG_NewInstanceObj(const_cast<$t>($a->{var}), SWIG_TypeQuery(\"$t\"), 0);"; @@ -283,7 +286,7 @@ while (<$in>) { (my $b = $a->{base}) =~ s/^const//; say $out "SWIG_NewInstanceObj(const_cast<$b*>(&$a->{var}), SWIG_TypeQuery(\"$b*\"), 0);"; } - when (/(?:^|::)E/) { + when (/(?:^|::)E/) { # Enumerations say $out "Py_BuildValue(\"i\", (int)$a->{var});"; } default { diff --git a/modules/modpython/functions.in b/modules/modpython/functions.in index 43a5e131..91b5defb 100644 --- a/modules/modpython/functions.in +++ b/modules/modpython/functions.in @@ -73,3 +73,4 @@ EModRet OnModuleUnloading(CModule* pModule, bool& bSuccess, CString& sRetMsg) EModRet OnGetModInfo(CModInfo& ModInfo, const CString& sModule, bool& bSuccess, CString& sRetMsg) void OnGetAvailableMods(std::set& ssMods, CModInfo::EModuleType eType) void OnClientCapLs(CClient* pClient, SCString& ssCaps) +EModRet OnLoginAttempt(CSmartPtr Auth) diff --git a/modules/modpython/modpython.i b/modules/modpython/modpython.i index aa2d449c..a5c90ddb 100644 --- a/modules/modpython/modpython.i +++ b/modules/modpython/modpython.i @@ -106,6 +106,7 @@ class MCString : public std::map {}; #include "../include/znc/ZNCString.h" %include "../include/znc/defines.h" %include "../include/znc/Utils.h" +%template(PAuthBase) CSmartPtr; %include "../include/znc/Config.h" %include "../include/znc/Csocket.h" %template(ZNCSocketManager) TSocketManager; diff --git a/modules/modpython/module.h b/modules/modpython/module.h index 2afc3633..26c3388a 100644 --- a/modules/modpython/module.h +++ b/modules/modpython/module.h @@ -124,6 +124,7 @@ public: bool& bSuccess, CString& sRetMsg); virtual void OnGetAvailableMods(std::set& ssMods, CModInfo::EModuleType eType); virtual void OnClientCapLs(CClient* pClient, SCString& ssCaps); + virtual EModRet OnLoginAttempt(CSmartPtr Auth); }; static inline CPyModule* AsPyModule(CModule* p) {