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()
60 /* don't ask why this is here. */
62 class cmd_cban : public command_t
68 cmd_cban () : command_t("CBAN", 'o', 1)
70 this->source = "m_cban.so";
73 void Handle(char **parameters, int pcnt, userrec *user)
75 /* syntax: CBAN #channel time :reason goes here */
76 /* 'time' is a human-readable timestring, like 2d3h2s. */
84 /* form: CBAN #channel removes a CBAN */
88 /* full form to add a CBAN */
89 /* XXX - checking on chnames */
90 chname = parameters[0];
92 //TIME + Srv->CalcDuration(parameters[1]);
93 reason = parameters[2];
95 CBan meow(chname, reason, expiry);
96 cbans.push_back(meow);
101 class ModuleCBan : public Module
106 ModuleCBan(Server* Me) : Module::Module(Me)
109 mycommand = new cmd_cban();
110 Srv->AddCommand(mycommand);
113 virtual int OnUserPreJoin(userrec *user, chanrec *chan, const char *cname)
115 /* check cbans in here, and apply as necessary. */
117 std::string chname = cname;
119 for (unsigned int a = 0; a < cbans.size(); a++)
121 WriteOpers("m_cban: DEBUG: checking %s against %s in OnPreUserJoin()", chname, cbans[a].GetName());
122 if (chname == cbans[a].GetName())
125 WriteOpers("DENY join");
130 WriteOpers("DONE checking, allowed");
132 /* Allow the change. */
136 virtual ~ModuleCBan()
140 virtual Version GetVersion()
142 return Version(1,0,0,0,VF_VENDOR);
147 class ModuleCBanFactory : public ModuleFactory
158 virtual Module * CreateModule(Server* Me)
160 return new ModuleCBan(Me);
166 extern "C" void * init_module( void )
168 return new ModuleCBanFactory;