Add CModInfo::SupportsType(EModuleType) and supply a module type with CModules::LoadModule

This would allow a module support multiple module types but CModule's do
not support this currently
This commit is contained in:
Kyle Fuller
2011-08-10 18:49:04 +01:00
parent 0c9eae226e
commit b2d8f2ed62
11 changed files with 60 additions and 35 deletions

View File

@@ -127,7 +127,7 @@ public:
}
virtual EModRet OnModuleLoading(const CString& sModName, const CString& sArgs,
bool& bSuccess, CString& sRetMsg) {
EModuleType eType, bool& bSuccess, CString& sRetMsg) {
PyObject* pyFunc = PyObject_GetAttrString(m_PyZNCModule, "load_module");
if (!pyFunc) {
sRetMsg = GetPyExceptionStr();
@@ -138,7 +138,7 @@ public:
PyObject* pyRes = PyObject_CallFunction(pyFunc, const_cast<char*>("ssNNN"),
sModName.c_str(),
sArgs.c_str(),
SWIG_NewInstanceObj(GetUser(), SWIG_TypeQuery("CUser*"), 0),
(eType == ModuleTypeUser ? SWIG_NewInstanceObj(GetUser(), SWIG_TypeQuery("CUser*"), 0) : NULL),
CPyRetString::wrap(sRetMsg),
SWIG_NewInstanceObj(reinterpret_cast<CModule*>(this), SWIG_TypeQuery("CModule*"), 0));
if (!pyRes) {