1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2005 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
23 #include "helperfuncs.h"
25 /* $ModDesc: Gives /cban, aka C:lines. Think Q:lines, for channels. */
29 class cmd_cban : public command_t
32 cmd_cban () : command_t("CBAN", 'o', 1)
34 this->source = "m_cban.so";
37 void Handle(char **parameters, int pcnt, userrec *user)
39 /* syntax: CBAN #channel time :reason goes here */
40 /* 'time' is a human-readable timestring, like 2d3h2s. */
44 /* form: CBAN #channel removes a CBAN */
48 /* full form to add a CBAN */
53 class ModuleCBan : public Module
56 vector<std::string> cbans;
59 ModuleCBan(Server* Me) : Module::Module(Me)
62 mycommand = new cmd_cban();
63 Srv->AddCommand(mycommand);
66 virtual int OnUserPreJoin (userrec *user, chanrec *chan, const char *cname)
68 /* check cbans in here, and apply as necessary. */
70 std::string chname = cname;
72 for (vector<std::string>::iterator iterate = cbans.begin(); iterate < cbans.end(); iterate++)
74 if (chname == *iterate)
81 /* Allow the change. */
89 virtual Version GetVersion()
91 return Version(1,0,0,0,VF_VENDOR);
96 class ModuleCBanFactory : public ModuleFactory
107 virtual Module * CreateModule(Server* Me)
109 return new ModuleCBan(Me);
115 extern "C" void * init_module( void )
117 return new ModuleCBanFactory;