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. */
38 CBan(std::string chname, std::string reason, unsigned long expiry)
48 std::string GetReason()
53 unsigned long GetExpiry()
59 class cmd_cban : public command_t
65 cmd_cban () : command_t("CBAN", 'o', 1)
67 this->source = "m_cban.so";
70 void Handle(char **parameters, int pcnt, userrec *user)
72 /* syntax: CBAN #channel time :reason goes here */
73 /* 'time' is a human-readable timestring, like 2d3h2s. */
81 /* form: CBAN #channel removes a CBAN */
85 /* full form to add a CBAN */
86 /* XXX - checking on chnames */
87 chname = parameters[0];
88 expiry = TIME + Srv->Duration(parameters[1]);
89 reason = parameters[2];
91 CBan meow(chname, reason, expiry);
97 class ModuleCBan : public Module
102 ModuleCBan(Server* Me) : Module::Module(Me)
105 mycommand = new cmd_cban();
106 Srv->AddCommand(mycommand);
109 virtual int OnUserPreJoin (userrec *user, chanrec *chan, const char *cname)
111 /* check cbans in here, and apply as necessary. */
113 std::string chname = cname;
115 for (unsigned int a = 0; a < cbans.size(); a++)
117 if (chname == cbans[a].GetName())
124 /* Allow the change. */
128 virtual ~ModuleCBan()
132 virtual Version GetVersion()
134 return Version(1,0,0,0,VF_VENDOR);
139 class ModuleCBanFactory : public ModuleFactory
150 virtual Module * CreateModule(Server* Me)
152 return new ModuleCBan(Me);
158 extern "C" void * init_module( void )
160 return new ModuleCBanFactory;