void ServerState::rebuildChannelOpList() { channelOpList.clear(); const chanptrmap_t chans = getChannels(); for (chanptrmap_t::const_iterator i = chans.begin(); i != chans.end(); ++i) { if (i->second->getType() == CT_PUBLIC) { ChannelPtr chan = i->second; const chmodmap_t mods = chan->getModRecords(); for (chmodmap_t::const_iterator m = mods.begin(); m != mods.end(); ++m) { if (m->first != "") { channelOpList.insert(m->first); } } } } }
/** * Gets a the list of moderators in a channel. * @param LUD channel * @returns [table of string] moderators */ int LuaChannel::getModList(lua_State* L) { luaL_checkany(L, 1); LBase* base = 0; GETLCHAN(base, L, 1, chan); lua_pop(L, 1); lua_newtable(L); const chmodmap_t mods = chan->getModRecords(); int i = 1; lua_pushstring(L, chan->getOwner().c_str()); lua_rawseti(L, -2, i++); for (chmodmap_t::const_iterator itr = mods.begin(); itr != mods.end(); ++itr) { lua_pushstring(L, itr->first.c_str()); lua_rawseti(L, -2, i++); } return 1; }