summaryrefslogtreecommitdiff
path: root/src/modules/m_cban.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-11 00:46:41 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-11 00:46:41 +0000
commitfd6ee21f2f55875984884a8413d61012e066029f (patch)
treeff9feeffe5ddac50d30db1e44656cc9d2dc2e216 /src/modules/m_cban.cpp
parent66098d307c036997e51eaea21724615e27fdc3e9 (diff)
None of the modules use an extern InspIRCd* any more
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4863 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_cban.cpp')
-rw-r--r--src/modules/m_cban.cpp84
1 files changed, 42 insertions, 42 deletions
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index 10193a2ad..eba40ee0c 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -30,7 +30,7 @@
/* $ModDesc: Gives /cban, aka C:lines. Think Q:lines, for channels. */
-extern InspIRCd* ServerInstance;
+
class CBan : public classbase
{
@@ -126,6 +126,11 @@ class cmd_cban : public command_t
}
};
+bool CBanComp(const CBan &ban1, const CBan &ban2)
+{
+ return ((ban1.set_on + ban1.length) < (ban2.set_on + ban2.length));
+}
+
class ModuleCBan : public Module
{
cmd_cban* mycommand;
@@ -203,60 +208,55 @@ class ModuleCBan : public Module
{
return Version(1,0,0,1,VF_VENDOR);
}
-};
-std::string EncodeCBan(const CBan &ban)
-{
- std::ostringstream stream;
- stream << ban.chname << " " << ban.set_by << " " << ban.set_on << " " << ban.length << " " << ban.reason;
- return stream.str();
-}
+ std::string EncodeCBan(const CBan &ban)
+ {
+ std::ostringstream stream;
+ stream << ban.chname << " " << ban.set_by << " " << ban.set_on << " " << ban.length << " " << ban.reason;
+ return stream.str();
+ }
-CBan DecodeCBan(const std::string &data)
-{
- CBan res;
- std::istringstream stream(data);
- stream >> res.chname;
- stream >> res.set_by;
- stream >> res.set_on;
- stream >> res.length;
- res.reason = stream.str();
+ CBan DecodeCBan(const std::string &data)
+ {
+ CBan res;
+ std::istringstream stream(data);
+ stream >> res.chname;
+ stream >> res.set_by;
+ stream >> res.set_on;
+ stream >> res.length;
+ res.reason = stream.str();
- return res;
-}
-
-bool CBanComp(const CBan &ban1, const CBan &ban2)
-{
- return ((ban1.set_on + ban1.length) < (ban2.set_on + ban2.length));
-}
-
-void ExpireBans()
-{
- bool go_again = true;
+ return res;
+ }
- while (go_again)
+ void ExpireBans()
{
- go_again = false;
+ bool go_again = true;
- for (cbanlist::iterator iter = cbans.begin(); iter != cbans.end(); iter++)
+ while (go_again)
{
- /* 0 == permanent, don't mess with them! -- w00t */
- if (iter->length != 0)
+ go_again = false;
+
+ for (cbanlist::iterator iter = cbans.begin(); iter != cbans.end(); iter++)
{
- if (iter->set_on + iter->length <= TIME)
+ /* 0 == permanent, don't mess with them! -- w00t */
+ if (iter->length != 0)
{
- log(DEBUG, "m_cban.so: Ban on %s expired, removing...", iter->chname.c_str());
- ServerInstance->WriteOpers("*** %li second CBAN on %s (%s) set %u seconds ago expired", iter->length, iter->chname.c_str(), iter->reason.c_str(), TIME - iter->set_on);
- cbans.erase(iter);
- go_again = true;
+ if (iter->set_on + iter->length <= TIME)
+ {
+ log(DEBUG, "m_cban.so: Ban on %s expired, removing...", iter->chname.c_str());
+ ServerInstance->WriteOpers("*** %li second CBAN on %s (%s) set %u seconds ago expired", iter->length, iter->chname.c_str(), iter->reason.c_str(), TIME - iter->set_on);
+ cbans.erase(iter);
+ go_again = true;
+ }
}
+
+ if (go_again == true)
+ break;
}
-
- if (go_again == true)
- break;
}
}
-}
+};
class ModuleCBanFactory : public ModuleFactory
{