From 588c5c915aded6c23585a95ef7e048172dac712d Mon Sep 17 00:00:00 2001 From: w00t Date: Wed, 21 Dec 2005 23:52:23 +0000 Subject: More CBAN structuring... getting there :-) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2608 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_cban.cpp | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) (limited to 'src/modules') diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 1baa8d93b..f83f4dec8 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -29,32 +29,55 @@ Server *Srv; class cmd_cban : public command_t { public: - cmd_cban () : command_t("CBAN",'o',2) + cmd_cban () : command_t("CBAN", 'o', 1) { this->source = "m_cban.so"; } void Handle(char **parameters, int pcnt, userrec *user) { - /* Handle CBAN here. */ + /* syntax: CBAN #channel time :reason goes here */ + /* 'time' is a human-readable timestring, like 2d3h2s. */ + + if (pcnt == 1) + { + /* form: CBAN #channel removes a CBAN */ + } + else if (pcnt >= 2) + { + /* full form to add a CBAN */ + } } }; class ModuleCBan : public Module { cmd_cban* mycommand; - public: - ModuleCBan(Server* Me) : Module::Module(Me) - { - Srv = Me; - mycommand = new cmd_cban(); - Srv->AddCommand(mycommand); - } + vector cbans; + + public: + ModuleCBan(Server* Me) : Module::Module(Me) + { + Srv = Me; + mycommand = new cmd_cban(); + Srv->AddCommand(mycommand); + } virtual int OnUserPreJoin (userrec *user, chanrec *chan, const char *cname) { /* check cbans in here, and apply as necessary. */ + std::string chname(cname); + + for (vector::iterator iterate = cbans.begin();; iterate < cbans.end(); iterate++) + { + if (chname == *iterate) + { + /* matches CBAN */ + return 1; + } + } + /* Allow the change. */ return 0; } -- cgit v1.2.3