diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-21 23:52:23 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-12-21 23:52:23 +0000 |
commit | 588c5c915aded6c23585a95ef7e048172dac712d (patch) | |
tree | be52e7cbcc40dee5be98ecfd3d4f20089704c10d /src | |
parent | b19a5188fc577a971a1aa347e1f7ed9c18b28766 (diff) |
More CBAN structuring... getting there :-)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2608 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_cban.cpp | 41 |
1 files changed, 32 insertions, 9 deletions
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<std::string> 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<std::string>::iterator iterate = cbans.begin();; iterate < cbans.end(); iterate++) + { + if (chname == *iterate) + { + /* matches CBAN */ + return 1; + } + } + /* Allow the change. */ return 0; } |