1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
15 #include "u_listmode.h"
17 /* $ModDesc: Provides support for the +w channel mode, autoop list */
19 /** Handles +w channel mode
21 class AutoOpList : public ListModeBase
24 AutoOpList(Module* Creator) : ListModeBase(Creator, "autoop", 'w', "End of Channel Access List", 910, 911, true)
26 levelrequired = OP_VALUE;
28 // TODO need own numerics
29 // TODO add some serious access control for setting this mode (you can currently gain +qa with it)
33 class ModuleAutoOp : public Module
38 ModuleAutoOp() : mh(this)
40 ServerInstance->Modules->AddService(mh);
41 mh.DoImplements(this);
43 Implementation list[] = { I_OnUserPreJoin, };
44 ServerInstance->Modules->Attach(list, this, 1);
47 ModResult OnUserPreJoin(User *user, Channel *chan, const char *cname, std::string &privs, const std::string &keygiven)
50 return MOD_RES_PASSTHRU;
52 modelist* list = mh.extItem.get(chan);
55 for (modelist::iterator it = list->begin(); it != list->end(); it++)
57 std::string::size_type colon = it->mask.find(':');
58 if (colon == std::string::npos)
60 if (chan->CheckBan(user, it->mask.substr(colon+1)))
62 privs = it->mask.substr(0, colon);
68 return MOD_RES_PASSTHRU;
71 void OnCleanup(int target_type, void* item)
73 mh.DoCleanup(target_type, item);
76 void OnSyncChannel(Channel* chan, Module* proto, void* opaque)
78 mh.DoSyncChannel(chan, proto, opaque);
81 void OnRehash(User* user)
88 return Version("Provides support for the +w channel mode", VF_VENDOR);
92 MODULE_INIT(ModuleAutoOp)