mirror of
https://github.com/znc/znc.git
synced 2026-05-03 03:52:33 +02:00
Support CZNC::GetUserMap() from modpython.
Thanks to lol768 for reporting it.
This commit is contained in:
@@ -277,6 +277,19 @@ class CPyRetBool {
|
||||
}
|
||||
};
|
||||
|
||||
%extend CZNC {
|
||||
PyObject* GetUserMap_() {
|
||||
PyObject* result = PyDict_New();
|
||||
auto user_type = SWIG_TypeQuery("CUser*");
|
||||
for (const auto& p : $self->GetUserMap()) {
|
||||
PyObject* user = SWIG_NewInstanceObj(p.second, user_type, 0);
|
||||
PyDict_SetItemString(result, p.first.c_str(), user);
|
||||
Py_CLEAR(user);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
/* To allow module-loaders to be written on python.
|
||||
* They can call CreatePyModule() to create CModule* object, but one of arguments to CreatePyModule() is "CModule* pModPython"
|
||||
* Pointer to modpython is already accessible to python modules as self.GetModPython(), but it's just a pointer to something, not to CModule*.
|
||||
|
||||
@@ -704,6 +704,7 @@ def CreateWebSubPage(name, title='', params=dict(), admin=False):
|
||||
CUser.GetNetworks = CUser.GetNetworks_
|
||||
CIRCNetwork.GetChans = CIRCNetwork.GetChans_
|
||||
CChan.GetNicks = CChan.GetNicks_
|
||||
CZNC.GetUserMap = CZNC.GetUserMap_
|
||||
|
||||
|
||||
class ModulesIter(collections.Iterator):
|
||||
|
||||
Reference in New Issue
Block a user