mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
@@ -234,6 +234,29 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class CModulesIter {
|
||||
public:
|
||||
CModulesIter(CModules *pModules) {
|
||||
m_pModules = pModules;
|
||||
m_it = pModules->begin();
|
||||
}
|
||||
|
||||
void plusplus() {
|
||||
++m_it;
|
||||
}
|
||||
|
||||
const CModule* get() const {
|
||||
return *m_it;
|
||||
}
|
||||
|
||||
bool is_end() const {
|
||||
return m_pModules->end() == m_it;
|
||||
}
|
||||
|
||||
CModules *m_pModules;
|
||||
CModules::const_iterator m_it;
|
||||
};
|
||||
|
||||
#if HAVE_VISIBILITY
|
||||
#pragma GCC visibility pop
|
||||
#endif
|
||||
|
||||
@@ -647,3 +647,17 @@ def CreateWebSubPage(name, title='', params=dict(), admin=False):
|
||||
CUser.GetNetworks = CUser.GetNetworks_
|
||||
CIRCNetwork.GetChans = CIRCNetwork.GetChans_
|
||||
CChan.GetNicks = CChan.GetNicks_
|
||||
|
||||
|
||||
class ModulesIter(collections.Iterator):
|
||||
def __init__(self, cmod):
|
||||
self._cmod = cmod
|
||||
|
||||
def __next__(self):
|
||||
if self._cmod.is_end():
|
||||
raise StopIteration
|
||||
|
||||
module = self._cmod.get()
|
||||
self._cmod.plusplus()
|
||||
return module
|
||||
CModules.__iter__ = lambda cmod: ModulesIter(CModulesIter(cmod))
|
||||
|
||||
Reference in New Issue
Block a user