Anope IRC Services  Version 2.0
os_defcon.cpp
Go to the documentation of this file.
1 /* OperServ core functions
2  *
3  * (C) 2003-2014 Anope Team
4  * Contact us at team@anope.org
5  *
6  * Please read COPYING and README for further details.
7  *
8  * Based on the original code of Epona by Lara.
9  * Based on the original code of Services by Andy Church.
10  */
11 
12 #include "module.h"
13 #include "modules/os_session.h"
14 
16 {
27 };
28 
29 bool DefConModesSet = false;
30 
32 {
33  std::vector<std::bitset<32> > DefCon;
34  std::set<Anope::string> DefConModesOn, DefConModesOff;
35  std::map<Anope::string, Anope::string> DefConModesOnParams;
36 
39  std::vector<Anope::string> defcons;
42 
43  unsigned max_session_kill;
46 
48  {
49  this->DefCon.resize(6);
50  this->defcons.resize(5);
51  }
52 
53  bool Check(DefconLevel level)
54  {
55  return this->Check(this->defaultlevel, level);
56  }
57 
58  bool Check(int dlevel, DefconLevel level)
59  {
60  return this->DefCon[dlevel].test(level);
61  }
62 
63  void Add(int dlevel, DefconLevel level)
64  {
65  this->DefCon[dlevel][level] = true;
66  }
67 
68  void Del(int dlevel, DefconLevel level)
69  {
70  this->DefCon[dlevel][level] = false;
71  }
72 
74  {
75  return DefConModesOnParams.insert(std::make_pair(name, buf)).second;
76  }
77 
79  {
80  DefConModesOnParams.erase(name);
81  }
82 
84  {
85  std::map<Anope::string, Anope::string>::iterator it = DefConModesOnParams.find(name);
86 
87  buf.clear();
88 
89  if (it != DefConModesOnParams.end())
90  {
91  buf = it->second;
92  return true;
93  }
94 
95  return false;
96  }
97 };
98 
100 
101 static void runDefCon();
103 
104 static ServiceReference<GlobalService> GlobalService("GlobalService", "Global");
105 
106 static Timer *timeout;
107 
108 class DefConTimeout : public Timer
109 {
110  int level;
111 
112  public:
113  DefConTimeout(Module *mod, int newlevel) : Timer(mod, DConfig.timeout), level(newlevel)
114  {
115  timeout = this;
116  }
117 
119  {
120  timeout = NULL;
121  }
122 
123  void Tick(time_t) anope_override
124  {
125  if (DConfig.defaultlevel != level)
126  {
127  DConfig.defaultlevel = level;
128  FOREACH_MOD(OnDefconLevel, (level));
129  Log(Config->GetClient("OperServ"), "operserv/defcon") << "Defcon level timeout, returning to level " << level;
130 
131  if (DConfig.globalondefcon)
132  {
133  if (!DConfig.offmessage.empty())
134  GlobalService->SendGlobal(NULL, "", DConfig.offmessage);
135  else
136  GlobalService->SendGlobal(NULL, "", Anope::printf(Language::Translate(_("The Defcon level is now at: \002%d\002")), DConfig.defaultlevel));
137 
138  if (!DConfig.message.empty())
139  GlobalService->SendGlobal(NULL, "", DConfig.message);
140  }
141 
142  runDefCon();
143  }
144  }
145 };
146 
147 class CommandOSDefcon : public Command
148 {
149  void SendLevels(CommandSource &source)
150  {
151  if (DConfig.Check(DEFCON_NO_NEW_CHANNELS))
152  source.Reply(_("* No new channel registrations"));
153  if (DConfig.Check(DEFCON_NO_NEW_NICKS))
154  source.Reply(_("* No new nick registrations"));
155  if (DConfig.Check(DEFCON_NO_MLOCK_CHANGE))
156  source.Reply(_("* No mode lock changes"));
157  if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && !DConfig.chanmodes.empty())
158  source.Reply(_("* Force channel modes (%s) to be set on all channels"), DConfig.chanmodes.c_str());
159  if (DConfig.Check(DEFCON_REDUCE_SESSION))
160  source.Reply(_("* Use the reduced session limit of %d"), DConfig.sessionlimit);
161  if (DConfig.Check(DEFCON_NO_NEW_CLIENTS))
162  source.Reply(_("* Kill any new clients connecting"));
163  if (DConfig.Check(DEFCON_OPER_ONLY))
164  source.Reply(_("* Ignore non-opers with a message"));
165  if (DConfig.Check(DEFCON_SILENT_OPER_ONLY))
166  source.Reply(_("* Silently ignore non-opers"));
167  if (DConfig.Check(DEFCON_AKILL_NEW_CLIENTS))
168  source.Reply(_("* AKILL any new clients connecting"));
169  if (DConfig.Check(DEFCON_NO_NEW_MEMOS))
170  source.Reply(_("* No new memos sent"));
171  }
172 
173  public:
174  CommandOSDefcon(Module *creator) : Command(creator, "operserv/defcon", 1, 1)
175  {
176  this->SetDesc(_("Manipulate the DefCon system"));
177  this->SetSyntax(_("[\0021\002|\0022\002|\0023\002|\0024\002|\0025\002]"));
178  }
179 
180  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
181  {
182  const Anope::string &lvl = params[0];
183 
184  if (lvl.empty())
185  {
186  source.Reply(_("Services are now at DEFCON \002%d\002."), DConfig.defaultlevel);
187  this->SendLevels(source);
188  return;
189  }
190 
191  int newLevel = 0;
192  try
193  {
194  newLevel = convertTo<int>(lvl);
195  }
196  catch (const ConvertException &) { }
197 
198  if (newLevel < 1 || newLevel > 5)
199  {
200  this->OnSyntaxError(source, "");
201  return;
202  }
203 
204  DConfig.defaultlevel = newLevel;
205 
206  FOREACH_MOD(OnDefconLevel, (newLevel));
207 
208  delete timeout;
209 
210  if (DConfig.timeout)
211  timeout = new DefConTimeout(this->module, 5);
212 
213  source.Reply(_("Services are now at DEFCON \002%d\002."), DConfig.defaultlevel);
214  this->SendLevels(source);
215  Log(LOG_ADMIN, source, this) << "to change defcon level to " << newLevel;
216 
217  /* Global notice the user what is happening. Also any Message that
218  the Admin would like to add. Set in config file. */
219  if (DConfig.globalondefcon)
220  {
221  if (DConfig.defaultlevel == 5 && !DConfig.offmessage.empty())
222  GlobalService->SendGlobal(NULL, "", DConfig.offmessage);
223  else if (DConfig.defaultlevel != 5)
224  {
225  GlobalService->SendGlobal(NULL, "", Anope::printf(_("The Defcon level is now at: \002%d\002"), DConfig.defaultlevel));
226  if (!DConfig.message.empty())
227  GlobalService->SendGlobal(NULL, "", DConfig.message);
228  }
229  }
230 
231  /* Run any defcon functions, e.g. FORCE CHAN MODE */
232  runDefCon();
233  return;
234  }
235 
236  bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
237  {
238  this->SendSyntax(source);
239  source.Reply(" ");
240  source.Reply(_("The defcon system can be used to implement a pre-defined\n"
241  "set of restrictions to services useful during an attempted\n"
242  "attack on the network."));
243  return true;
244  }
245 };
246 
247 class OSDefcon : public Module
248 {
252 
254  {
255  int add = -1; /* 1 if adding, 0 if deleting, -1 if neither */
256  unsigned char mode;
257  ChannelMode *cm;
258  ChannelModeParam *cmp;
259  Anope::string modes, param;
260 
261  spacesepstream ss(DConfig.chanmodes);
262 
263  DConfig.DefConModesOn.clear();
264  DConfig.DefConModesOff.clear();
265  ss.GetToken(modes);
266 
267  /* Loop while there are modes to set */
268  for (unsigned i = 0, end = modes.length(); i < end; ++i)
269  {
270  mode = modes[i];
271 
272  switch (mode)
273  {
274  case '+':
275  add = 1;
276  continue;
277  case '-':
278  add = 0;
279  continue;
280  default:
281  if (add < 0)
282  continue;
283  }
284 
285  if ((cm = ModeManager::FindChannelModeByChar(mode)))
286  {
287  if (cm->type == MODE_STATUS || cm->type == MODE_LIST)
288  {
289  Log(this) << "DefConChanModes mode character '" << mode << "' cannot be locked";
290  continue;
291  }
292  else if (add)
293  {
294  DConfig.DefConModesOn.insert(cm->name);
295  DConfig.DefConModesOff.erase(cm->name);
296 
297  if (cm->type == MODE_PARAM)
298  {
300 
301  if (!ss.GetToken(param))
302  {
303  Log(this) << "DefConChanModes mode character '" << mode << "' has no parameter while one is expected";
304  continue;
305  }
306 
307  if (!cmp->IsValid(param))
308  continue;
309 
310  DConfig.SetDefConParam(cmp->name, param);
311  }
312  }
313  else if (DConfig.DefConModesOn.count(cm->name))
314  {
315  DConfig.DefConModesOn.erase(cm->name);
316 
317  if (cm->type == MODE_PARAM)
318  DConfig.UnsetDefConParam(cm->name);
319  }
320  }
321  }
322 
323  /* We can't mlock +L if +l is not mlocked as well. */
324  if ((cm = ModeManager::FindChannelModeByName("REDIRECT")) && DConfig.DefConModesOn.count(cm->name) && !DConfig.DefConModesOn.count("LIMIT"))
325  {
326  DConfig.DefConModesOn.erase("REDIRECT");
327 
328  Log(this) << "DefConChanModes must lock mode +l as well to lock mode +L";
329  }
330  }
331 
332  public:
333  OSDefcon(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), session_service("SessionService", "session"), akills("XLineManager", "xlinemanager/sgline"), commandosdefcon(this)
334  {
335 
336  }
337 
339  {
340  Configuration::Block *block = conf->GetModule(this);
341  DefconConfig dconfig;
342 
343  dconfig.defaultlevel = block->Get<int>("defaultlevel");
344  dconfig.defcons[4] = block->Get<const Anope::string>("level4");
345  dconfig.defcons[3] = block->Get<const Anope::string>("level3");
346  dconfig.defcons[2] = block->Get<const Anope::string>("level2");
347  dconfig.defcons[1] = block->Get<const Anope::string>("level1");
348  dconfig.sessionlimit = block->Get<int>("sessionlimit");
349  dconfig.akillreason = block->Get<const Anope::string>("akillreason");
350  dconfig.akillexpire = block->Get<time_t>("akillexpire");
351  dconfig.chanmodes = block->Get<const Anope::string>("chanmodes");
352  dconfig.timeout = block->Get<time_t>("timeout");
353  dconfig.globalondefcon = block->Get<bool>("globalondefcon");
354  dconfig.message = block->Get<const Anope::string>("message");
355  dconfig.offmessage = block->Get<const Anope::string>("offmessage");
356 
357  Module *session = ModuleManager::FindModule("os_session");
358  block = conf->GetModule(session);
359 
360  dconfig.max_session_kill = block->Get<int>("maxsessionkill");
361  dconfig.session_autokill_expiry = block->Get<time_t>("sessionautokillexpiry");
362  dconfig.sle_reason = block->Get<const Anope::string>("sessionlimitexceeded");
363  dconfig.sle_detailsloc = block->Get<const Anope::string>("sessionlimitdetailsloc");
364 
365  if (dconfig.defaultlevel < 1 || dconfig.defaultlevel > 5)
366  throw ConfigException("The value for <defcon:defaultlevel> must be between 1 and 5");
367  else if (dconfig.akillexpire <= 0)
368  throw ConfigException("The value for <defcon:akillexpire> must be greater than zero!");
369 
370  for (unsigned level = 1; level < 5; ++level)
371  {
372  spacesepstream operations(dconfig.defcons[level]);
373  Anope::string operation;
374  while (operations.GetToken(operation))
375  {
376  if (operation.equals_ci("nonewchannels"))
377  dconfig.Add(level, DEFCON_NO_NEW_CHANNELS);
378  else if (operation.equals_ci("nonewnicks"))
379  dconfig.Add(level, DEFCON_NO_NEW_NICKS);
380  else if (operation.equals_ci("nomlockchanges"))
381  dconfig.Add(level, DEFCON_NO_MLOCK_CHANGE);
382  else if (operation.equals_ci("forcechanmodes"))
383  dconfig.Add(level, DEFCON_FORCE_CHAN_MODES);
384  else if (operation.equals_ci("reducedsessions"))
385  dconfig.Add(level, DEFCON_REDUCE_SESSION);
386  else if (operation.equals_ci("nonewclients"))
387  dconfig.Add(level, DEFCON_NO_NEW_CLIENTS);
388  else if (operation.equals_ci("operonly"))
389  dconfig.Add(level, DEFCON_OPER_ONLY);
390  else if (operation.equals_ci("silentoperonly"))
391  dconfig.Add(level, DEFCON_SILENT_OPER_ONLY);
392  else if (operation.equals_ci("akillnewclients"))
393  dconfig.Add(level, DEFCON_AKILL_NEW_CLIENTS);
394  else if (operation.equals_ci("nonewmemos"))
395  dconfig.Add(level, DEFCON_NO_NEW_MEMOS);
396  }
397 
398  if (dconfig.Check(level, DEFCON_REDUCE_SESSION) && dconfig.sessionlimit <= 0)
399  throw ConfigException("The value for <defcon:sessionlimit> must be greater than zero!");
400  else if (dconfig.Check(level, DEFCON_AKILL_NEW_CLIENTS) && dconfig.akillreason.empty())
401  throw ConfigException("The value for <defcon:akillreason> must not be empty!");
402  else if (dconfig.Check(level, DEFCON_FORCE_CHAN_MODES) && dconfig.chanmodes.empty())
403  throw ConfigException("The value for <defcon:chanmodes> must not be empty!");
404  }
405 
406  DConfig = dconfig;
407  this->ParseModeString();
408  }
409 
411  {
412  if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && DConfig.DefConModesOff.count(mode->name) && source.GetUser() && !source.GetBot())
413  {
414  c->RemoveMode(Config->GetClient("OperServ"), mode, param);
415 
416  return EVENT_STOP;
417  }
418 
419  return EVENT_CONTINUE;
420  }
421 
423  {
424  if (DConfig.Check(DEFCON_FORCE_CHAN_MODES) && DConfig.DefConModesOn.count(mode->name) && source.GetUser() && !source.GetBot())
425  {
426  Anope::string param;
427 
428  if (DConfig.GetDefConParam(mode->name, param))
429  c->SetMode(Config->GetClient("OperServ"), mode, param);
430  else
431  c->SetMode(Config->GetClient("OperServ"), mode);
432 
433  return EVENT_STOP;
434 
435  }
436 
437  return EVENT_CONTINUE;
438  }
439 
440  EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> &params) anope_override
441  {
442  if (command->name == "nickserv/register" || command->name == "nickserv/group")
443  {
444  if (DConfig.Check(DEFCON_NO_NEW_NICKS))
445  {
446  source.Reply(_("Services are in DefCon mode, please try again later."));
447  return EVENT_STOP;
448  }
449  }
450  else if (command->name == "chanserv/mode" && params.size() > 1 && params[1].equals_ci("LOCK"))
451  {
452  if (DConfig.Check(DEFCON_NO_MLOCK_CHANGE))
453  {
454  source.Reply(_("Services are in DefCon mode, please try again later."));
455  return EVENT_STOP;
456  }
457  }
458  else if (command->name == "chanserv/register")
459  {
460  if (DConfig.Check(DEFCON_NO_NEW_CHANNELS))
461  {
462  source.Reply(_("Services are in DefCon mode, please try again later."));
463  return EVENT_STOP;
464  }
465  }
466  else if (command->name == "memoserv/send")
467  {
468  if (DConfig.Check(DEFCON_NO_NEW_MEMOS))
469  {
470  source.Reply(_("Services are in DefCon mode, please try again later."));
471  return EVENT_STOP;
472  }
473  }
474 
475  return EVENT_CONTINUE;
476  }
477 
478  void OnUserConnect(User *u, bool &exempt) anope_override
479  {
480  if (exempt || u->Quitting() || !u->server->IsSynced() || u->server->IsULined())
481  return;
482 
483  BotInfo *OperServ = Config->GetClient("OperServ");
484  if (DConfig.Check(DEFCON_AKILL_NEW_CLIENTS) && akills)
485  {
486  Log(OperServ, "operserv/defcon") << "DEFCON: adding akill for *@" << u->host;
487  XLine x("*@" + u->host, OperServ ? OperServ->nick : "defcon", Anope::CurTime + DConfig.akillexpire, DConfig.akillreason, XLineManager::GenerateUID());
488  akills->Send(NULL, &x);
489  }
491  {
492  u->Kill(OperServ ? OperServ->nick : "", DConfig.akillreason);
493  return;
494  }
495 
497  {
498  u->Kill(OperServ ? OperServ->nick : "", DConfig.akillreason);
499  return;
500  }
501 
502  if (DConfig.sessionlimit <= 0 || !session_service)
503  return;
504 
505  Session *session = session_service->FindSession(u->ip.addr());
506  Exception *exception = session_service->FindException(u);
507 
508  if (DConfig.Check(DEFCON_REDUCE_SESSION) && !exception)
509  {
510  if (session && session->count > static_cast<unsigned>(DConfig.sessionlimit))
511  {
512  if (!DConfig.sle_reason.empty())
513  {
514  Anope::string message = DConfig.sle_reason.replace_all_cs("%IP%", u->ip.addr());
515  u->SendMessage(OperServ, message);
516  }
517  if (!DConfig.sle_detailsloc.empty())
518  u->SendMessage(OperServ, DConfig.sle_detailsloc);
519 
520  ++session->hits;
521  if (akills && DConfig.max_session_kill && session->hits >= DConfig.max_session_kill)
522  {
523  XLine x("*@" + u->host, OperServ ? OperServ->nick : "", Anope::CurTime + DConfig.session_autokill_expiry, "Defcon session limit exceeded", XLineManager::GenerateUID());
524  akills->Send(NULL, &x);
525  Log(OperServ, "akill/defcon") << "[DEFCON] Added a temporary AKILL for \002*@" << u->host << "\002 due to excessive connections";
526  }
527  else
528  {
529  u->Kill(OperServ ? OperServ->nick : "", "Defcon session limit exceeded");
530  }
531  }
532  }
533  }
534 
536  {
537  if (DConfig.chanmodes.find(cm->mchar) != Anope::string::npos)
538  this->ParseModeString();
539  }
540 
542  {
543  if (DConfig.Check(DEFCON_FORCE_CHAN_MODES))
544  c->SetModes(Config->GetClient("OperServ"), false, "%s", DConfig.chanmodes.c_str());
545  }
546 };
547 
548 static void runDefCon()
549 {
550  BotInfo *OperServ = Config->GetClient("OperServ");
551  if (DConfig.Check(DEFCON_FORCE_CHAN_MODES))
552  {
553  if (!DConfig.chanmodes.empty() && !DefConModesSet)
554  {
555  if (DConfig.chanmodes[0] == '+' || DConfig.chanmodes[0] == '-')
556  {
557  Log(OperServ, "operserv/defcon") << "DEFCON: setting " << DConfig.chanmodes << " on all channels";
558  DefConModesSet = true;
559  for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it)
560  it->second->SetModes(OperServ, false, "%s", DConfig.chanmodes.c_str());
561  }
562  }
563  }
564  else
565  {
566  if (!DConfig.chanmodes.empty() && DefConModesSet)
567  {
568  if (DConfig.chanmodes[0] == '+' || DConfig.chanmodes[0] == '-')
569  {
570  DefConModesSet = false;
571  Anope::string newmodes = defconReverseModes(DConfig.chanmodes);
572  if (!newmodes.empty())
573  {
574  Log(OperServ, "operserv/defcon") << "DEFCON: setting " << newmodes << " on all channels";
575  for (channel_map::const_iterator it = ChannelList.begin(), it_end = ChannelList.end(); it != it_end; ++it)
576  it->second->SetModes(OperServ, false, "%s", newmodes.c_str());
577  }
578  }
579  }
580  }
581 }
582 
584 {
585  if (modes.empty())
586  return "";
587  Anope::string newmodes;
588  for (unsigned i = 0, end = modes.length(); i < end; ++i)
589  {
590  if (modes[i] == '+')
591  newmodes += '-';
592  else if (modes[i] == '-')
593  newmodes += '+';
594  else
595  newmodes += modes[i];
596  }
597  return newmodes;
598 }
599 
Definition: bots.h:24
void OnUserConnect(User *u, bool &exempt) anope_override
Definition: os_defcon.cpp:478
static DefconConfig DConfig
Definition: os_defcon.cpp:99
unsigned max_session_kill
Definition: os_defcon.cpp:43
void ParseModeString()
Definition: os_defcon.cpp:253
static Module * FindModule(const Anope::string &name)
static ChannelMode * FindChannelModeByName(const Anope::string &name)
Definition: modes.cpp:542
Definition: timers.h:18
std::vector< std::bitset< 32 > > DefCon
Definition: os_defcon.cpp:33
Module * module
Definition: commands.h:108
void clear()
Definition: anope.h:187
unsigned count
Definition: os_session.h:7
bool DefConModesSet
Definition: os_defcon.cpp:29
std::set< Anope::string > DefConModesOff
Definition: os_defcon.cpp:34
ServiceReference< XLineManager > akills
Definition: os_defcon.cpp:250
EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector< Anope::string > &params) anope_override
Definition: os_defcon.cpp:440
CoreExport string printf(const char *fmt,...)
Definition: misc.cpp:536
Anope::string sle_detailsloc
Definition: os_defcon.cpp:45
int defaultlevel
Definition: os_defcon.cpp:37
Definition: users.h:34
std::set< Anope::string > DefConModesOn
Definition: os_defcon.cpp:34
void OnChannelModeAdd(ChannelMode *cm) anope_override
Definition: os_defcon.cpp:535
static Anope::string defconReverseModes(const Anope::string &modes)
Definition: os_defcon.cpp:583
void SetDesc(const Anope::string &d)
Definition: command.cpp:130
bool equals_ci(const char *_str) const
Definition: anope.h:78
virtual void SendGlobal(BotInfo *sender, const Anope::string &source, const Anope::string &message)=0
void OnChannelSync(Channel *c) anope_override
Definition: os_defcon.cpp:541
CoreExport time_t CurTime
Definition: main.cpp:41
#define FOREACH_MOD(ename, args)
Definition: modules.h:62
bool SetDefConParam(const Anope::string &name, const Anope::string &buf)
Definition: os_defcon.cpp:73
CommandOSDefcon(Module *creator)
Definition: os_defcon.cpp:174
time_t session_autokill_expiry
Definition: os_defcon.cpp:44
std::map< Anope::string, Anope::string > DefConModesOnParams
Definition: os_defcon.cpp:35
size_type length() const
Definition: anope.h:131
EventReturn OnChannelModeUnset(Channel *c, MessageSource &source, ChannelMode *mode, const Anope::string &) anope_override
Definition: os_defcon.cpp:422
void Add(int dlevel, DefconLevel level)
Definition: os_defcon.cpp:63
DefConTimeout(Module *mod, int newlevel)
Definition: os_defcon.cpp:113
Anope::string chanmodes
Definition: os_defcon.cpp:38
ModeType type
Definition: modes.h:49
Definition: Config.cs:26
void Del(int dlevel, DefconLevel level)
Definition: os_defcon.cpp:68
time_t timeout
Definition: os_defcon.cpp:40
virtual void OnSyntaxError(CommandSource &source, const Anope::string &subcommand)
Definition: command.cpp:191
static const size_type npos
Definition: anope.h:44
ServiceReference< SessionService > session_service
Definition: os_defcon.cpp:249
void Reply(const char *message,...)
Definition: command.cpp:96
void SendLevels(CommandSource &source)
Definition: os_defcon.cpp:149
string replace_all_cs(const string &_orig, const string &_repl) const
Definition: anope.h:229
void UnsetDefConParam(const Anope::string &name)
Definition: os_defcon.cpp:78
void Tick(time_t) anope_override
Definition: os_defcon.cpp:123
OSDefcon(const Anope::string &modname, const Anope::string &creator)
Definition: os_defcon.cpp:333
bool Check(DefconLevel level)
Definition: os_defcon.cpp:53
virtual bool IsValid(Anope::string &value) const
Definition: modes.h:180
static ChannelMode * FindChannelModeByChar(char mode)
Definition: modes.cpp:524
BotInfo * GetBot() const
Definition: protocol.cpp:483
static Anope::map< std::pair< bool, Anope::string > > modes
Definition: cs_mode.cpp:745
User * GetUser() const
Definition: protocol.cpp:478
#define anope_override
Definition: services.h:56
bool empty() const
Definition: anope.h:126
static ServiceReference< GlobalService > GlobalService("GlobalService","Global")
std::vector< Anope::string > defcons
Definition: os_defcon.cpp:39
EventReturn
Definition: modules.h:129
#define MODULE_INIT(x)
Definition: modules.h:45
static Timer * timeout
Definition: os_defcon.cpp:106
CoreExport channel_map ChannelList
Definition: channels.cpp:29
CoreExport const char * Translate(const char *string)
Definition: language.cpp:59
Anope::string message
Definition: os_defcon.cpp:38
int sessionlimit
Definition: os_defcon.cpp:37
bool globalondefcon
Definition: os_defcon.cpp:41
CommandOSDefcon commandosdefcon
Definition: os_defcon.cpp:251
void SetSyntax(const Anope::string &s)
Definition: command.cpp:140
time_t akillexpire
Definition: os_defcon.cpp:40
Anope::string nick
Definition: users.h:62
static void runDefCon()
Definition: os_defcon.cpp:548
void OnReload(Configuration::Conf *conf) anope_override
Definition: os_defcon.cpp:338
unsigned hits
Definition: os_session.h:8
bool Check(int dlevel, DefconLevel level)
Definition: os_defcon.cpp:58
DefconLevel
Definition: os_defcon.cpp:15
Definition: xline.h:18
bool GetToken(Anope::string &token)
Definition: hashcomp.cpp:99
T anope_dynamic_static_cast(O ptr)
Definition: anope.h:774
Anope::string name
Definition: access.cpp:22
void SetMode(BotInfo *bi, ChannelMode *cm, const Anope::string &param="", bool enforce_mlock=true)
Definition: channels.cpp:401
void SendSyntax(CommandSource &)
Definition: command.cpp:145
const char * c_str() const
Definition: anope.h:117
Definition: logger.h:53
T Get(const Anope::string &tag)
Definition: config.h:44
static Anope::string GenerateUID()
Definition: xline.cpp:234
Anope::string name
Definition: modes.h:43
EventReturn OnChannelModeSet(Channel *c, MessageSource &source, ChannelMode *mode, const Anope::string &param) anope_override
Definition: os_defcon.cpp:410
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
Definition: os_defcon.cpp:236
size_type find(const string &_str, size_type pos=0) const
Definition: anope.h:192
#define _(x)
Definition: services.h:50
Anope::string sle_reason
Definition: os_defcon.cpp:45
Anope::string akillreason
Definition: os_defcon.cpp:38
bool GetDefConParam(const Anope::string &name, Anope::string &buf)
Definition: os_defcon.cpp:83
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: os_defcon.cpp:180
Anope::string offmessage
Definition: os_defcon.cpp:38