+ // Adding - XXX todo make this respect <insane> tag perhaps..
+ long duration = ServerInstance->Duration(parameters[1]);
+ CBan *r = NULL;
+ const char *reason = (parameters.size() > 2) ? parameters[2].c_str() : "No reason supplied";
+
+ try
+ {
+ r = new CBan(ServerInstance, ServerInstance->Time(), duration, user->nick.c_str(), reason, parameters[0].c_str());
+ }
+ catch (...)
+ {
+ ; // Do nothing. If we get here, the regex was fucked up, and they already got told it fucked up.
+ }
+
+ if (r)
+ {
+ if (ServerInstance->XLines->AddLine(r, user))
+ {
+ if (!duration)
+ {
+ ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent CBan for %s: %s", user->nick.c_str(), parameters[0].c_str(), reason);
+ ServerInstance->PI->SendSNONotice("x", user->nick + " added permenant CBan for " + parameters[0] + ": " + std::string(reason));
+ }
+ else
+ {
+ time_t c_requires_crap = duration + ServerInstance->Time();
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added timed CBan for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), ServerInstance->TimeString(c_requires_crap).c_str(), reason);
+ ServerInstance->PI->SendSNONotice("x", user->nick + " added timed CBan for " + parameters[0] + ", expires on " + ServerInstance->TimeString(c_requires_crap) + ": " + std::string(reason));
+ }
+
+ ServerInstance->XLines->ApplyLines();
+ }
+ else
+ {
+ delete r;
+ user->WriteServ("NOTICE %s :*** CBan for %s already exists", user->nick.c_str(), parameters[0].c_str());
+ }
+ }