- return Version(1, 1, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION);
- }
-
- 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;
- int set_on;
- irc::tokenstream tokens(data);
- tokens.GetToken(res.chname);
- tokens.GetToken(res.set_by);
- tokens.GetToken(set_on);
- res.set_on = set_on;
- tokens.GetToken(res.length);
- tokens.GetToken(res.reason);
- return res;
- }
-
- void ExpireBans()
- {
- bool go_again = true;
-
- while (go_again)
- {
- go_again = false;
-
- for (cbanlist::iterator iter = cbans.begin(); iter != cbans.end(); iter++)
- {
- /* 0 == permanent, don't mess with them! -- w00t */
- if (iter->length != 0)
- {
- if (iter->set_on + iter->length <= ServerInstance->Time())
- {
- ServerInstance->WriteOpers("*** %li second CBAN on %s (%s) set on %s expired", iter->length, iter->chname.c_str(), iter->reason.c_str(), ServerInstance->TimeString(iter->set_on).c_str());
- cbans.erase(iter);
- go_again = true;
- }
- }
-
- if (go_again == true)
- break;
- }
- }