Anope IRC Services  Version 2.0
cs_set.cpp
Go to the documentation of this file.
1 /* ChanServ 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/cs_mode.h"
14 
15 class CommandCSSet : public Command
16 {
17  public:
18  CommandCSSet(Module *creator) : Command(creator, "chanserv/set", 2, 3)
19  {
20  this->SetDesc(_("Set channel options and information"));
21  this->SetSyntax(_("\037option\037 \037channel\037 \037parameters\037"));
22  }
23 
24  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
25  {
26  this->OnSyntaxError(source, "");
27  }
28 
29  bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
30  {
31  this->SendSyntax(source);
32  source.Reply(" ");
33  source.Reply(_("Allows the channel founder to set various channel options\n"
34  "and other information.\n"
35  " \n"
36  "Available options:"));
37  Anope::string this_name = source.command;
38  bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands");
39  for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
40  {
41  const Anope::string &c_name = it->first;
42  const CommandInfo &info = it->second;
43  if (c_name.find_ci(this_name + " ") == 0)
44  {
45  ServiceReference<Command> c("Command", info.name);
46 
47  if (!c)
48  continue;
49  else if (!hide_privileged_commands)
50  ; // Always show with hide_privileged_commands disabled
51  else if (!c->AllowUnregistered() && !source.GetAccount())
52  continue;
53  else if (!info.permission.empty() && !source.HasCommand(info.permission))
54  continue;
55 
56  source.command = it->first;
57  c->OnServHelp(source);
58  }
59  }
60  source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information on a\n"
61  "particular option."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), this_name.c_str());
62  return true;
63  }
64 };
65 
67 {
68  public:
69  CommandCSSetAutoOp(Module *creator, const Anope::string &cname = "chanserv/set/autoop") : Command(creator, cname, 2, 2)
70  {
71  this->SetDesc(_("Should services automatically give status to users"));
72  this->SetSyntax(_("\037channel\037 {ON | OFF}"));
73  }
74 
75  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
76  {
77  if (Anope::ReadOnly)
78  {
79  source.Reply(READ_ONLY_MODE);
80  return;
81  }
82 
83  ChannelInfo *ci = ChannelInfo::Find(params[0]);
84  if (ci == NULL)
85  {
86  source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
87  return;
88  }
89 
90  EventReturn MOD_RESULT;
91  FOREACH_RESULT(OnSetChannelOption, MOD_RESULT, (source, this, ci, params[1]));
92  if (MOD_RESULT == EVENT_STOP)
93  return;
94 
95  if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
96  {
97  source.Reply(ACCESS_DENIED);
98  return;
99  }
100 
101  if (params[1].equals_ci("ON"))
102  {
103  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable autoop";
104  ci->Shrink<bool>("NOAUTOOP");
105  source.Reply(_("Services will now automatically give modes to users in \002%s\002."), ci->name.c_str());
106  }
107  else if (params[1].equals_ci("OFF"))
108  {
109  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable autoop";
110  ci->Extend<bool>("NOAUTOOP");
111  source.Reply(_("Services will no longer automatically give modes to users in \002%s\002."), ci->name.c_str());
112  }
113  else
114  this->OnSyntaxError(source, "AUTOOP");
115  }
116 
118  {
119  this->SendSyntax(source);
120  source.Reply(" ");
121  source.Reply(_("Enables or disables %s's autoop feature for a\n"
122  "channel. When disabled, users who join the channel will\n"
123  "not automatically gain any status from %s."), source.service->nick.c_str(),
124  source.service->nick.c_str(), this->name.c_str());
125  return true;
126  }
127 };
128 
130 {
131  public:
132  CommandCSSetBanType(Module *creator, const Anope::string &cname = "chanserv/set/bantype") : Command(creator, cname, 2, 2)
133  {
134  this->SetDesc(_("Set how Services make bans on the channel"));
135  this->SetSyntax(_("\037channel\037 \037bantype\037"));
136  }
137 
138  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
139  {
140  if (Anope::ReadOnly)
141  {
142  source.Reply(READ_ONLY_MODE);
143  return;
144  }
145 
146  ChannelInfo *ci = ChannelInfo::Find(params[0]);
147  if (ci == NULL)
148  {
149  source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
150  return;
151  }
152 
153  EventReturn MOD_RESULT;
154  FOREACH_RESULT(OnSetChannelOption, MOD_RESULT, (source, this, ci, params[1]));
155  if (MOD_RESULT == EVENT_STOP)
156  return;
157 
158  if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
159  {
160  source.Reply(ACCESS_DENIED);
161  return;
162  }
163 
164  try
165  {
166  int16_t new_type = convertTo<int16_t>(params[1]);
167  if (new_type < 0 || new_type > 3)
168  throw ConvertException("Invalid range");
169  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change the ban type to " << new_type;
170  ci->bantype = new_type;
171  source.Reply(_("Ban type for channel %s is now #%d."), ci->name.c_str(), ci->bantype);
172  }
173  catch (const ConvertException &)
174  {
175  source.Reply(_("\002%s\002 is not a valid ban type."), params[1].c_str());
176  }
177  }
178 
180  {
181  this->SendSyntax(source);
182  source.Reply(" ");
183  source.Reply(_("Sets the ban type that will be used by services whenever\n"
184  "they need to ban someone from your channel.\n"
185  " \n"
186  "Bantype is a number between 0 and 3 that means:\n"
187  " \n"
188  "0: ban in the form *!user@host\n"
189  "1: ban in the form *!*user@host\n"
190  "2: ban in the form *!*@host\n"
191  "3: ban in the form *!*user@*.domain"), this->name.c_str());
192  return true;
193  }
194 };
195 
197 {
198  public:
199  CommandCSSetDescription(Module *creator, const Anope::string &cname = "chanserv/set/description") : Command(creator, cname, 1, 2)
200  {
201  this->SetDesc(_("Set the channel description"));
202  this->SetSyntax(_("\037channel\037 [\037description\037]"));
203  }
204 
205  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
206  {
207  if (Anope::ReadOnly)
208  {
209  source.Reply(READ_ONLY_MODE);
210  return;
211  }
212 
213  ChannelInfo *ci = ChannelInfo::Find(params[0]);
214  const Anope::string &param = params.size() > 1 ? params[1] : "";
215  if (ci == NULL)
216  {
217  source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
218  return;
219  }
220 
221  EventReturn MOD_RESULT;
222  FOREACH_RESULT(OnSetChannelOption, MOD_RESULT, (source, this, ci, param));
223  if (MOD_RESULT == EVENT_STOP)
224  return;
225 
226  if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
227  {
228  source.Reply(ACCESS_DENIED);
229  return;
230  }
231 
232  if (!param.empty())
233  {
234  ci->desc = param;
235  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change the description to " << ci->desc;
236  source.Reply(_("Description of %s changed to \002%s\002."), ci->name.c_str(), ci->desc.c_str());
237  }
238  else
239  {
240  ci->desc.clear();
241  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to unset the description";
242  source.Reply(_("Description of %s unset."), ci->name.c_str());
243  }
244 
245  return;
246  }
247 
249  {
250  this->SendSyntax(source);
251  source.Reply(" ");
252  source.Reply(_("Sets the description for the channel, which shows up with\n"
253  "the \002LIST\002 and \002INFO\002 commands."), this->name.c_str());
254  return true;
255  }
256 };
257 
259 {
260  public:
261  CommandCSSetFounder(Module *creator, const Anope::string &cname = "chanserv/set/founder") : Command(creator, cname, 2, 2)
262  {
263  this->SetDesc(_("Set the founder of a channel"));
264  this->SetSyntax(_("\037channel\037 \037nick\037"));
265  }
266 
267  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
268  {
269  if (Anope::ReadOnly)
270  {
271  source.Reply(READ_ONLY_MODE);
272  return;
273  }
274 
275  ChannelInfo *ci = ChannelInfo::Find(params[0]);
276  if (ci == NULL)
277  {
278  source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
279  return;
280  }
281 
282  EventReturn MOD_RESULT;
283  FOREACH_RESULT(OnSetChannelOption, MOD_RESULT, (source, this, ci, params[1]));
284  if (MOD_RESULT == EVENT_STOP)
285  return;
286 
287  if (MOD_RESULT != EVENT_ALLOW && (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration"))
288  {
289  source.Reply(ACCESS_DENIED);
290  return;
291  }
292 
293  const NickAlias *na = NickAlias::Find(params[1]);
294  if (!na)
295  {
296  source.Reply(NICK_X_NOT_REGISTERED, params[1].c_str());
297  return;
298  }
299 
300  NickCore *nc = na->nc;
301  unsigned max_reg = Config->GetModule("chanserv")->Get<unsigned>("maxregistered");
302  if (max_reg && nc->channelcount >= max_reg && !source.HasPriv("chanserv/no-register-limit"))
303  {
304  source.Reply(_("\002%s\002 has too many channels registered."), na->nick.c_str());
305  return;
306  }
307 
308  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to change the founder from " << (ci->GetFounder() ? ci->GetFounder()->display : "(none)") << " to " << nc->display;
309 
310  ci->SetFounder(nc);
311 
312  source.Reply(_("Founder of \002%s\002 changed to \002%s\002."), ci->name.c_str(), na->nick.c_str());
313 
314  return;
315  }
316 
318  {
319  this->SendSyntax(source);
320  source.Reply(" ");
321  source.Reply(_("Changes the founder of a channel. The new nickname must\n"
322  "be a registered one."), this->name.c_str());
323  return true;
324  }
325 };
326 
328 {
329  public:
330  CommandCSSetKeepModes(Module *creator, const Anope::string &cname = "chanserv/set/keepmodes") : Command(creator, cname, 2, 2)
331  {
332  this->SetDesc(_("Retain modes when channel is not in use"));
333  this->SetSyntax(_("\037channel\037 {ON | OFF}"));
334  }
335 
336  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
337  {
338  if (Anope::ReadOnly)
339  {
340  source.Reply(READ_ONLY_MODE);
341  return;
342  }
343 
344  ChannelInfo *ci = ChannelInfo::Find(params[0]);
345  if (ci == NULL)
346  {
347  source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
348  return;
349  }
350 
351  EventReturn MOD_RESULT;
352  FOREACH_RESULT(OnSetChannelOption, MOD_RESULT, (source, this, ci, params[1]));
353  if (MOD_RESULT == EVENT_STOP)
354  return;
355 
356  if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
357  {
358  source.Reply(ACCESS_DENIED);
359  return;
360  }
361 
362  if (params[1].equals_ci("ON"))
363  {
364  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable keep modes";
365  ci->Extend<bool>("CS_KEEP_MODES");
366  source.Reply(_("Keep modes for %s is now \002on\002."), ci->name.c_str());
367  if (ci->c)
368  ci->last_modes = ci->c->GetModes();
369  }
370  else if (params[1].equals_ci("OFF"))
371  {
372  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable keep modes";
373  ci->Shrink<bool>("CS_KEEP_MODES");
374  source.Reply(_("Keep modes for %s is now \002off\002."), ci->name.c_str());
375  ci->last_modes.clear();
376  }
377  else
378  this->OnSyntaxError(source, "KEEPMODES");
379  }
380 
382  {
383  this->SendSyntax(source);
384  source.Reply(" ");
385  source.Reply(_("Enables or disables keepmodes for the given channel. If keep\n"
386  "modes is enabled, services will remember modes set on the channel\n"
387  "and attempt to re-set them the next time the channel is created."));
388  return true;
389  }
390 };
391 
393 {
394  public:
395  CommandCSSetPeace(Module *creator, const Anope::string &cname = "chanserv/set/peace") : Command(creator, cname, 2, 2)
396  {
397  this->SetDesc(_("Regulate the use of critical commands"));
398  this->SetSyntax(_("\037channel\037 {ON | OFF}"));
399  }
400 
401  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
402  {
403  if (Anope::ReadOnly)
404  {
405  source.Reply(READ_ONLY_MODE);
406  return;
407  }
408 
409  ChannelInfo *ci = ChannelInfo::Find(params[0]);
410  if (ci == NULL)
411  {
412  source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
413  return;
414  }
415 
416  EventReturn MOD_RESULT;
417  FOREACH_RESULT(OnSetChannelOption, MOD_RESULT, (source, this, ci, params[1]));
418  if (MOD_RESULT == EVENT_STOP)
419  return;
420 
421  if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
422  {
423  source.Reply(ACCESS_DENIED);
424  return;
425  }
426 
427  if (params[1].equals_ci("ON"))
428  {
429  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable peace";
430  ci->Extend<bool>("PEACE");
431  source.Reply(_("Peace option for %s is now \002on\002."), ci->name.c_str());
432  }
433  else if (params[1].equals_ci("OFF"))
434  {
435  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable peace";
436  ci->Shrink<bool>("PEACE");
437  source.Reply(_("Peace option for %s is now \002off\002."), ci->name.c_str());
438  }
439  else
440  this->OnSyntaxError(source, "PEACE");
441 
442  return;
443  }
444 
446  {
447  this->SendSyntax(source);
448  source.Reply(" ");
449  source.Reply(_("Enables or disables the \002peace\002 option for a channel.\n"
450  "When \002peace\002 is set, a user won't be able to kick,\n"
451  "ban or remove a channel status of a user that has\n"
452  "a level superior or equal to his via %s commands."), source.service->nick.c_str());
453  return true;
454  }
455 };
456 
457 inline static Anope::string BotModes()
458 {
459  return Config->GetModule("botserv")->Get<Anope::string>("botmodes",
460  Config->GetModule("chanserv")->Get<Anope::string>("botmodes", "o")
461  );
462 }
463 
465 {
466  public:
467  CommandCSSetPersist(Module *creator, const Anope::string &cname = "chanserv/set/persist") : Command(creator, cname, 2, 2)
468  {
469  this->SetDesc(_("Set the channel as permanent"));
470  this->SetSyntax(_("\037channel\037 {ON | OFF}"));
471  }
472 
473  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
474  {
475  if (Anope::ReadOnly)
476  {
477  source.Reply(READ_ONLY_MODE);
478  return;
479  }
480 
481  ChannelInfo *ci = ChannelInfo::Find(params[0]);
482  if (ci == NULL)
483  {
484  source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
485  return;
486  }
487 
488  EventReturn MOD_RESULT;
489  FOREACH_RESULT(OnSetChannelOption, MOD_RESULT, (source, this, ci, params[1]));
490  if (MOD_RESULT == EVENT_STOP)
491  return;
492 
493  if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
494  {
495  source.Reply(ACCESS_DENIED);
496  return;
497  }
498 
500 
501  if (params[1].equals_ci("ON"))
502  {
503  if (!ci->HasExt("PERSIST"))
504  {
505  ci->Extend<bool>("PERSIST");
506 
507  /* Channel doesn't exist, create it */
508  if (!ci->c)
509  {
510  bool created;
511  Channel *c = Channel::FindOrCreate(ci->name, created);
512  if (ci->bi)
513  {
514  ChannelStatus status(BotModes());
515  ci->bi->Join(c, &status);
516  }
517  if (created)
518  c->Sync();
519  }
520 
521  /* Set the perm mode */
522  if (cm)
523  {
524  if (ci->c && !ci->c->HasMode("PERM"))
525  ci->c->SetMode(NULL, cm);
526  /* Add it to the channels mlock */
527  ModeLocks *ml = ci->Require<ModeLocks>("modelocks");
528  if (ml)
529  ml->SetMLock(cm, true, "", source.GetNick());
530  }
531  /* No botserv bot, no channel mode, give them ChanServ.
532  * Yes, this works fine with no BotServ.
533  */
534  else if (!ci->bi)
535  {
536  BotInfo *ChanServ = Config->GetClient("ChanServ");
537  if (!ChanServ)
538  {
539  source.Reply(_("ChanServ is required to enable persist on this network."));
540  return;
541  }
542 
543  ChanServ->Assign(NULL, ci);
544  if (!ci->c->FindUser(ChanServ))
545  {
546  ChannelStatus status(BotModes());
547  ChanServ->Join(ci->c, &status);
548  }
549  }
550  }
551 
552  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable persist";
553  source.Reply(_("Channel \002%s\002 is now persistent."), ci->name.c_str());
554  }
555  else if (params[1].equals_ci("OFF"))
556  {
557  if (ci->HasExt("PERSIST"))
558  {
559  ci->Shrink<bool>("PERSIST");
560 
561  BotInfo *ChanServ = Config->GetClient("ChanServ"),
562  *BotServ = Config->GetClient("BotServ");
563 
564  /* Unset perm mode */
565  if (cm)
566  {
567  if (ci->c && ci->c->HasMode("PERM"))
568  ci->c->RemoveMode(NULL, cm);
569  /* Remove from mlock */
570  ModeLocks *ml = ci->GetExt<ModeLocks>("modelocks");
571  if (ml)
572  ml->RemoveMLock(cm, true);
573  }
574  /* No channel mode, no BotServ, but using ChanServ as the botserv bot
575  * which was assigned when persist was set on
576  */
577  else if (!cm && !BotServ && ci->bi)
578  {
579  if (!ChanServ)
580  {
581  source.Reply(_("ChanServ is required to enable persist on this network."));
582  return;
583  }
584 
585  /* Unassign bot */
586  ChanServ->UnAssign(NULL, ci);
587  }
588  }
589 
590  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable persist";
591  source.Reply(_("Channel \002%s\002 is no longer persistent."), ci->name.c_str());
592  }
593  else
594  this->OnSyntaxError(source, "PERSIST");
595  }
596 
598  {
599  BotInfo *BotServ = Config->GetClient("BotServ");
600  BotInfo *ChanServ = Config->GetClient("ChanServ");
601  this->SendSyntax(source);
602  source.Reply(" ");
603  source.Reply(_("Enables or disables the persistent channel setting.\n"
604  "When persistent is set, the service bot will remain\n"
605  "in the channel when it has emptied of users.\n"
606  " \n"
607  "If your IRCd does not have a permanent (persistent) channel\n"
608  "mode you must have a service bot in your channel to\n"
609  "set persist on, and it can not be unassigned while persist\n"
610  "is on.\n"
611  " \n"
612  "If this network does not have %s enabled and does\n"
613  "not have a permanent channel mode, %s will\n"
614  "join your channel when you set persist on (and leave when\n"
615  "it has been set off).\n"
616  " \n"
617  "If your IRCd has a permanent (persistent) channel mode\n"
618  "and it is set or unset (for any reason, including MODE LOCK),\n"
619  "persist is automatically set and unset for the channel aswell.\n"
620  "Additionally, services will set or unset this mode when you\n"
621  "set persist on or off."), BotServ ? BotServ->nick.c_str() : "BotServ",
622  ChanServ ? ChanServ->nick.c_str() : "ChanServ");
623  return true;
624  }
625 };
626 
628 {
629  public:
630  CommandCSSetRestricted(Module *creator, const Anope::string &cname = "chanserv/set/restricted") : Command(creator, cname, 2, 2)
631  {
632  this->SetDesc(_("Restrict access to the channel"));
633  this->SetSyntax(_("\037channel\037 {ON | OFF}"));
634  }
635 
636  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
637  {
638  if (Anope::ReadOnly)
639  {
640  source.Reply(READ_ONLY_MODE);
641  return;
642  }
643 
644  ChannelInfo *ci = ChannelInfo::Find(params[0]);
645  if (ci == NULL)
646  {
647  source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
648  return;
649  }
650 
651  EventReturn MOD_RESULT;
652  FOREACH_RESULT(OnSetChannelOption, MOD_RESULT, (source, this, ci, params[1]));
653  if (MOD_RESULT == EVENT_STOP)
654  return;
655 
656  if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
657  {
658  source.Reply(ACCESS_DENIED);
659  return;
660  }
661 
662  if (params[1].equals_ci("ON"))
663  {
664  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable restricted";
665  ci->Extend<bool>("RESTRICTED");
666  source.Reply(_("Restricted access option for %s is now \002on\002."), ci->name.c_str());
667  }
668  else if (params[1].equals_ci("OFF"))
669  {
670  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable restricted";
671  ci->Shrink<bool>("RESTRICTED");
672  source.Reply(_("Restricted access option for %s is now \002off\002."), ci->name.c_str());
673  }
674  else
675  this->OnSyntaxError(source, "RESTRICTED");
676  }
677 
679  {
680  this->SendSyntax(source);
681  source.Reply(" ");
682  source.Reply(_("Enables or disables the \002restricted access\002 option for a\n"
683  "channel. When \002restricted access\002 is set, users not on the access list will\n"
684  "instead be kicked and banned from the channel."));
685  return true;
686  }
687 };
688 
690 {
691  public:
692  CommandCSSetSecure(Module *creator, const Anope::string &cname = "chanserv/set/secure") : Command(creator, cname, 2, 2)
693  {
694  this->SetDesc(_("Activate security features"));
695  this->SetSyntax(_("\037channel\037 {ON | OFF}"));
696  }
697 
698  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
699  {
700  if (Anope::ReadOnly)
701  {
702  source.Reply(READ_ONLY_MODE);
703  return;
704  }
705 
706  ChannelInfo *ci = ChannelInfo::Find(params[0]);
707  if (ci == NULL)
708  {
709  source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
710  return;
711  }
712 
713  EventReturn MOD_RESULT;
714  FOREACH_RESULT(OnSetChannelOption, MOD_RESULT, (source, this, ci, params[1]));
715  if (MOD_RESULT == EVENT_STOP)
716  return;
717 
718  if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
719  {
720  source.Reply(ACCESS_DENIED);
721  return;
722  }
723 
724  if (params[1].equals_ci("ON"))
725  {
726  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable secure";
727  ci->Extend<bool>("CS_SECURE");
728  source.Reply(_("Secure option for %s is now \002on\002."), ci->name.c_str());
729  }
730  else if (params[1].equals_ci("OFF"))
731  {
732  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable secure";
733  ci->Shrink<bool>("CS_SECURE");
734  source.Reply(_("Secure option for %s is now \002off\002."), ci->name.c_str());
735  }
736  else
737  this->OnSyntaxError(source, "SECURE");
738  }
739 
741  {
742  this->SendSyntax(source);
743  source.Reply(" ");
744  source.Reply(_("Enables or disables security features for a\n"
745  "channel. When \002%s\002 is set, only users who have\n"
746  "registered their nicknames and IDENTIFY'd\n"
747  "with their password will be given access to the channel\n"
748  "as controlled by the access list."), this->name.c_str());
749  return true;
750  }
751 };
752 
754 {
755  public:
756  CommandCSSetSecureFounder(Module *creator, const Anope::string &cname = "chanserv/set/securefounder") : Command(creator, cname, 2, 2)
757  {
758  this->SetDesc(_("Stricter control of channel founder status"));
759  this->SetSyntax(_("\037channel\037 {ON | OFF}"));
760  }
761 
762  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
763  {
764  if (Anope::ReadOnly)
765  {
766  source.Reply(READ_ONLY_MODE);
767  return;
768  }
769 
770  ChannelInfo *ci = ChannelInfo::Find(params[0]);
771  if (ci == NULL)
772  {
773  source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
774  return;
775  }
776 
777  EventReturn MOD_RESULT;
778  FOREACH_RESULT(OnSetChannelOption, MOD_RESULT, (source, this, ci, params[1]));
779  if (MOD_RESULT == EVENT_STOP)
780  return;
781 
782  if (MOD_RESULT != EVENT_ALLOW && (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration"))
783  {
784  source.Reply(ACCESS_DENIED);
785  return;
786  }
787 
788  if (params[1].equals_ci("ON"))
789  {
790  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable secure founder";
791  ci->Extend<bool>("SECUREFOUNDER");
792  source.Reply(_("Secure founder option for %s is now \002on\002."), ci->name.c_str());
793  }
794  else if (params[1].equals_ci("OFF"))
795  {
796  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable secure founder";
797  ci->Shrink<bool>("SECUREFOUNDER");
798  source.Reply(_("Secure founder option for %s is now \002off\002."), ci->name.c_str());
799  }
800  else
801  this->OnSyntaxError(source, "SECUREFOUNDER");
802  }
803 
805  {
806  this->SendSyntax(source);
807  source.Reply(" ");
808  source.Reply(_("Enables or disables the \002secure founder\002 option for a channel.\n"
809  "When \002secure founder\002 is set, only the real founder will be\n"
810  "able to drop the channel, change its founder and its successor,\n"
811  "and not those who have founder level access through\n"
812  "the access/qop command."));
813  return true;
814  }
815 };
816 
818 {
819  public:
820  CommandCSSetSecureOps(Module *creator, const Anope::string &cname = "chanserv/set/secureops") : Command(creator, cname, 2, 2)
821  {
822  this->SetDesc(_("Stricter control of chanop status"));
823  this->SetSyntax(_("\037channel\037 {ON | OFF}"));
824  }
825 
826  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
827  {
828  if (Anope::ReadOnly)
829  {
830  source.Reply(READ_ONLY_MODE);
831  return;
832  }
833 
834  ChannelInfo *ci = ChannelInfo::Find(params[0]);
835  if (ci == NULL)
836  {
837  source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
838  return;
839  }
840 
841  EventReturn MOD_RESULT;
842  FOREACH_RESULT(OnSetChannelOption, MOD_RESULT, (source, this, ci, params[1]));
843  if (MOD_RESULT == EVENT_STOP)
844  return;
845 
846  if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
847  {
848  source.Reply(ACCESS_DENIED);
849  return;
850  }
851 
852  if (params[1].equals_ci("ON"))
853  {
854  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable secure ops";
855  ci->Extend<bool>("SECUREOPS");
856  source.Reply(_("Secure ops option for %s is now \002on\002."), ci->name.c_str());
857  }
858  else if (params[1].equals_ci("OFF"))
859  {
860  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable secure ops";
861  ci->Shrink<bool>("SECUREOPS");
862  source.Reply(_("Secure ops option for %s is now \002off\002."), ci->name.c_str());
863  }
864  else
865  this->OnSyntaxError(source, "SECUREOPS");
866  }
867 
869  {
870  this->SendSyntax(source);
871  source.Reply(" ");
872  source.Reply(_("Enables or disables the \002secure ops\002 option for a channel.\n"
873  "When \002secure ops\002 is set, users who are not on the userlist\n"
874  "will not be allowed chanop status."));
875  return true;
876  }
877 };
878 
880 {
881  public:
882  CommandCSSetSignKick(Module *creator, const Anope::string &cname = "chanserv/set/signkick") : Command(creator, cname, 2, 2)
883  {
884  this->SetDesc(_("Sign kicks that are done with the KICK command"));
885  this->SetSyntax(_("\037channel\037 {ON | LEVEL | OFF}"));
886  }
887 
888  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
889  {
890  if (Anope::ReadOnly)
891  {
892  source.Reply(READ_ONLY_MODE);
893  return;
894  }
895 
896  ChannelInfo *ci = ChannelInfo::Find(params[0]);
897  if (ci == NULL)
898  {
899  source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
900  return;
901  }
902 
903  EventReturn MOD_RESULT;
904  FOREACH_RESULT(OnSetChannelOption, MOD_RESULT, (source, this, ci, params[1]));
905  if (MOD_RESULT == EVENT_STOP)
906  return;
907 
908  if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.permission.empty() && !source.HasPriv("chanserv/administration"))
909  {
910  source.Reply(ACCESS_DENIED);
911  return;
912  }
913 
914  if (params[1].equals_ci("ON"))
915  {
916  ci->Extend<bool>("SIGNKICK");
917  ci->Shrink<bool>("SIGNKICK_LEVEL");
918  source.Reply(_("Signed kick option for %s is now \002on\002."), ci->name.c_str());
919  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable sign kick";
920  }
921  else if (params[1].equals_ci("LEVEL"))
922  {
923  ci->Extend<bool>("SIGNKICK_LEVEL");
924  ci->Shrink<bool>("SIGNKICK");
925  source.Reply(_("Signed kick option for %s is now \002on\002, but depends of the\n"
926  "level of the user that is using the command."), ci->name.c_str());
927  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable sign kick level";
928  }
929  else if (params[1].equals_ci("OFF"))
930  {
931  ci->Shrink<bool>("SIGNKICK");
932  ci->Shrink<bool>("SIGNKICK_LEVEL");
933  source.Reply(_("Signed kick option for %s is now \002off\002."), ci->name.c_str());
934  Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable sign kick";
935  }
936  else
937  this->OnSyntaxError(source, "SIGNKICK");
938  }
939 
941  {
942  this->SendSyntax(source);
943  source.Reply(" ");
944  source.Reply(_("Enables or disables signed kicks for a\n"
945  "channel. When \002SIGNKICK\002 is set, kicks issued with\n"
946  "the \002KICK\002 command will have the nick that used the\n"
947  "command in their reason.\n"
948  " \n"
949  "If you use \002LEVEL\002, those who have a level that is superior\n"
950  "or equal to the SIGNKICK level on the channel won't have their\n"
951  "kicks signed."));
952  return true;
953  }
954 };
955 
957 {
958  public:
959  CommandCSSetSuccessor(Module *creator, const Anope::string &cname = "chanserv/set/successor") : Command(creator, cname, 1, 2)
960  {
961  this->SetDesc(_("Set the successor for a channel"));
962  this->SetSyntax(_("\037channel\037 \037nick\037"));
963  }
964 
965  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
966  {
967  if (Anope::ReadOnly)
968  {
969  source.Reply(READ_ONLY_MODE);
970  return;
971  }
972 
973  ChannelInfo *ci = ChannelInfo::Find(params[0]);
974  const Anope::string &param = params.size() > 1 ? params[1] : "";
975  if (ci == NULL)
976  {
977  source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
978  return;
979  }
980 
981  EventReturn MOD_RESULT;
982  FOREACH_RESULT(OnSetChannelOption, MOD_RESULT, (source, this, ci, param));
983  if (MOD_RESULT == EVENT_STOP)
984  return;
985 
986  if (MOD_RESULT != EVENT_ALLOW && (ci->HasExt("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration"))
987  {
988  source.Reply(ACCESS_DENIED);
989  return;
990  }
991 
992  NickCore *nc;
993 
994  if (!param.empty())
995  {
996  const NickAlias *na = NickAlias::Find(param);
997 
998  if (!na)
999  {
1000  source.Reply(NICK_X_NOT_REGISTERED, param.c_str());
1001  return;
1002  }
1003  if (na->nc == ci->GetFounder())
1004  {
1005  source.Reply(_("%s cannot be the successor on channel %s as they are the founder."), na->nick.c_str(), ci->name.c_str());
1006  return;
1007  }
1008  nc = na->nc;
1009  }
1010  else
1011  nc = NULL;
1012 
1013  Log(!source.permission.empty() ? LOG_ADMIN : LOG_COMMAND, source, this, ci) << "to change the successor from " << (ci->GetSuccessor() ? ci->GetSuccessor()->display : "(none)") << " to " << (nc ? nc->display : "(none)");
1014 
1015  ci->SetSuccessor(nc);
1016 
1017  if (nc)
1018  source.Reply(_("Successor for \002%s\002 changed to \002%s\002."), ci->name.c_str(), nc->display.c_str());
1019  else
1020  source.Reply(_("Successor for \002%s\002 unset."), ci->name.c_str());
1021 
1022  return;
1023  }
1024 
1026  {
1027  this->SendSyntax(source);
1028  source.Reply(" ");
1029  source.Reply(_("Changes the successor of a channel. If the founder's\n"
1030  "nickname expires or is dropped while the channel is still\n"
1031  "registered, the successor will become the new founder of the\n"
1032  "channel. The new nickname must be a registered one."));
1033  unsigned max_reg = Config->GetModule("chanserv")->Get<unsigned>("maxregistered");
1034  if (max_reg)
1035  source.Reply(_("However, if the successor already has too many\n"
1036  "channels registered (%d), the channel will be dropped\n"
1037  "instead, just as if no successor had been set."), max_reg);
1038  return true;
1039  }
1040 };
1041 
1043 {
1044  public:
1045  CommandCSSetNoexpire(Module *creator) : Command(creator, "chanserv/saset/noexpire", 2, 2)
1046  {
1047  this->SetDesc(_("Prevent the channel from expiring"));
1048  this->SetSyntax(_("\037channel\037 {ON | OFF}"));
1049  }
1050 
1051  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
1052  {
1053  if (Anope::ReadOnly)
1054  {
1055  source.Reply(READ_ONLY_MODE);
1056  return;
1057  }
1058 
1059  ChannelInfo *ci = ChannelInfo::Find(params[0]);
1060  if (ci == NULL)
1061  {
1062  source.Reply(CHAN_X_NOT_REGISTERED, params[0].c_str());
1063  return;
1064  }
1065 
1066  if (source.permission.empty() && !source.AccessFor(ci).HasPriv("SET"))
1067  {
1068  source.Reply(ACCESS_DENIED);
1069  return;
1070  }
1071 
1072  if (params[1].equals_ci("ON"))
1073  {
1074  Log(LOG_ADMIN, source, this, ci) << "to enable noexpire";
1075  ci->Extend<bool>("CS_NO_EXPIRE");
1076  source.Reply(_("Channel %s \002will not\002 expire."), ci->name.c_str());
1077  }
1078  else if (params[1].equals_ci("OFF"))
1079  {
1080  Log(LOG_ADMIN, source, this, ci) << "to disable noexpire";
1081  ci->Shrink<bool>("CS_NO_EXPIRE");
1082  source.Reply(_("Channel %s \002will\002 expire."), ci->name.c_str());
1083  }
1084  else
1085  this->OnSyntaxError(source, "NOEXPIRE");
1086 
1087  return;
1088  }
1089 
1091  {
1092  this->SendSyntax(source);
1093  source.Reply(" ");
1094  source.Reply(_("Sets whether the given channel will expire. Setting this\n"
1095  "to ON prevents the channel from expiring."));
1096  return true;
1097  }
1098 };
1099 
1100 class CSSet : public Module
1101 {
1104 
1106  {
1108 
1110  {
1112 
1113  if (s->GetSerializableType()->GetName() != "ChannelInfo")
1114  return;
1115 
1116  const ChannelInfo *ci = anope_dynamic_static_cast<const ChannelInfo *>(s);
1118  for (Channel::ModeList::const_iterator it = ci->last_modes.begin(); it != ci->last_modes.end(); ++it)
1119  {
1120  if (!modes.empty())
1121  modes += " ";
1122  modes += it->first;
1123  if (!it->second.empty())
1124  modes += "," + it->second;
1125  }
1126  data["last_modes"] << modes;
1127  }
1128 
1130  {
1132 
1133  if (s->GetSerializableType()->GetName() != "ChannelInfo")
1134  return;
1135 
1138  data["last_modes"] >> modes;
1139  for (spacesepstream sep(modes); sep.GetToken(modes);)
1140  {
1141  size_t c = modes.find(',');
1142  if (c == Anope::string::npos)
1143  ci->last_modes.insert(std::make_pair(modes, ""));
1144  else
1145  ci->last_modes.insert(std::make_pair(modes.substr(0, c), modes.substr(c + 1)));
1146  }
1147  }
1148  } keep_modes;
1149 
1151  {
1152  Persist(Module *m, const Anope::string &n) : SerializableExtensibleItem<bool>(m, n) { }
1153 
1155  {
1157 
1158  if (s->GetSerializableType()->GetName() != "ChannelInfo" || !this->HasExt(e))
1159  return;
1160 
1162  if (ci->c)
1163  return;
1164 
1165  bool created;
1166  Channel *c = Channel::FindOrCreate(ci->name, created);
1167 
1169  if (cm)
1170  {
1171  c->SetMode(NULL, cm);
1172  }
1173  else
1174  {
1175  if (!ci->bi)
1176  {
1177  BotInfo *ChanServ = Config->GetClient("ChanServ");
1178  if (ChanServ)
1179  ChanServ->Assign(NULL, ci);
1180  }
1181 
1182  if (ci->bi && !c->FindUser(ci->bi))
1183  {
1184  ChannelStatus status(BotModes());
1185  ci->bi->Join(c, &status);
1186  }
1187  }
1188 
1189  if (created)
1190  c->Sync();
1191  }
1192  } persist;
1193 
1209 
1211 
1212  public:
1213  CSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
1214  noautoop(this, "NOAUTOOP"), peace(this, "PEACE"),
1215  securefounder(this, "SECUREFOUNDER"), restricted(this, "RESTRICTED"),
1216  secure(this, "CS_SECURE"), secureops(this, "SECUREOPS"), signkick(this, "SIGNKICK"),
1217  signkick_level(this, "SIGNKICK_LEVEL"), noexpire(this, "CS_NO_EXPIRE"),
1218  keep_modes(this, "CS_KEEP_MODES"), persist(this, "PERSIST"),
1219 
1220  commandcsset(this), commandcssetautoop(this), commandcssetbantype(this),
1221  commandcssetdescription(this), commandcssetfounder(this), commandcssetkeepmodes(this),
1222  commandcssetpeace(this), commandcssetpersist(this), commandcssetrestricted(this),
1223  commandcssetsecure(this), commandcssetsecurefounder(this), commandcssetsecureops(this), commandcssetsignkick(this),
1224  commandcssetsuccessor(this), commandcssetnoexpire(this)
1225  {
1226  }
1227 
1229  {
1230  persist_lower_ts = conf->GetModule(this)->Get<bool>("persist_lower_ts");
1231  }
1232 
1234  {
1235  ci->bantype = Config->GetModule(this)->Get<int>("defbantype", "2");
1236  }
1237 
1239  {
1240  if (c->ci && keep_modes.HasExt(c->ci))
1241  {
1242  Channel::ModeList ml = c->ci->last_modes;
1243  for (Channel::ModeList::iterator it = ml.begin(); it != ml.end(); ++it)
1244  c->SetMode(c->ci->WhoSends(), it->first, it->second);
1245  }
1246  }
1247 
1249  {
1250  OnChannelCreate(c);
1251  }
1252 
1254  {
1255  if (!c->ci || !restricted.HasExt(c->ci) || c->MatchesList(u, "EXCEPT"))
1256  return EVENT_CONTINUE;
1257 
1258  if (c->ci->AccessFor(u).empty() && (!c->ci->GetFounder() || u->Account() != c->ci->GetFounder()))
1259  return EVENT_STOP;
1260 
1261  return EVENT_CONTINUE;
1262  }
1263 
1265  {
1266  if (ci->c && persist.HasExt(ci))
1267  ci->c->RemoveMode(ci->WhoSends(), "PERM", "", false);
1268  persist.Unset(ci);
1269  }
1270 
1272  {
1273  if (c->ci)
1274  {
1275  /* Channel mode +P or so was set, mark this channel as persistent */
1276  if (mode->name == "PERM")
1277  persist.Set(c->ci, true);
1278 
1279  if (mode->type != MODE_STATUS && !c->syncing && Me->IsSynced())
1280  c->ci->last_modes = c->GetModes();
1281  }
1282 
1283  return EVENT_CONTINUE;
1284  }
1285 
1287  {
1288  if (mode->name == "PERM")
1289  {
1290  if (c->ci)
1291  persist.Unset(c->ci);
1292  }
1293 
1294  if (c->ci && mode->type != MODE_STATUS && !c->syncing && Me->IsSynced())
1295  c->ci->last_modes = c->GetModes();
1296 
1297  return EVENT_CONTINUE;
1298  }
1299 
1301  {
1302  if (c->ci && persist.HasExt(c->ci))
1303  return EVENT_STOP;
1304  return EVENT_CONTINUE;
1305  }
1306 
1308  {
1309  if (persist_lower_ts && c->ci && persist.HasExt(c->ci) && c->creation_time > c->ci->time_registered)
1310  {
1311  Log(LOG_DEBUG) << "Changing TS of " << c->name << " from " << c->creation_time << " to " << c->ci->time_registered;
1312  c->creation_time = c->ci->time_registered;
1313  IRCD->SendChannel(c);
1314  c->Reset();
1315  }
1316  }
1317 
1318  void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) anope_override
1319  {
1320  if (chan->ci)
1321  {
1322  if (noautoop.HasExt(chan->ci))
1323  give_modes = false;
1324  if (secureops.HasExt(chan->ci))
1325  // This overrides what chanserv does because it is loaded after chanserv
1326  take_modes = true;
1327  }
1328  }
1329 
1331  {
1332  if (noexpire.HasExt(ci))
1333  expire = false;
1334  }
1335 
1336  void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) anope_override
1337  {
1338  if (!show_all)
1339  return;
1340 
1341  if (peace.HasExt(ci))
1342  info.AddOption(_("Peace"));
1343  if (restricted.HasExt(ci))
1344  info.AddOption(_("Restricted access"));
1345  if (secure.HasExt(ci))
1346  info.AddOption(_("Security"));
1347  if (securefounder.HasExt(ci))
1348  info.AddOption(_("Secure founder"));
1349  if (secureops.HasExt(ci))
1350  info.AddOption(_("Secure ops"));
1351  if (signkick.HasExt(ci) || signkick_level.HasExt(ci))
1352  info.AddOption(_("Signed kicks"));
1353  if (persist.HasExt(ci))
1354  info.AddOption(_("Persistent"));
1355  if (noexpire.HasExt(ci))
1356  info.AddOption(_("No expire"));
1357  if (keep_modes.HasExt(ci))
1358  info.AddOption(_("Keep modes"));
1359  if (noautoop.HasExt(ci))
1360  info.AddOption(_("No auto-op"));
1361  }
1362 };
1363 
CommandCSSetRestricted commandcssetrestricted
Definition: cs_set.cpp:1202
Serialize::Reference< NickCore > nc
Definition: account.h:47
Definition: bots.h:24
CSSet::KeepModes keep_modes
CoreExport bool ReadOnly
Definition: main.cpp:28
Anope::string permission
Definition: commands.h:34
SerializableExtensibleItem< bool > signkick_level
Definition: cs_set.cpp:1102
CommandCSSetKeepModes commandcssetkeepmodes
Definition: cs_set.cpp:1199
static NickAlias * Find(const Anope::string &nick)
Definition: nickalias.cpp:121
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: cs_set.cpp:248
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override
Definition: extensible.h:168
CommandCSSetKeepModes(Module *creator, const Anope::string &cname="chanserv/set/keepmodes")
Definition: cs_set.cpp:330
const ModeList & GetModes() const
Definition: channels.cpp:238
static ChannelMode * FindChannelModeByName(const Anope::string &name)
Definition: modes.cpp:542
CommandCSSetPersist commandcssetpersist
Definition: cs_set.cpp:1201
Anope::string name
Definition: commands.h:32
bool IsSynced() const
Definition: servers.cpp:298
Definition: hashcomp.h:84
void clear()
Definition: anope.h:187
time_t created
Definition: modules.h:237
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: cs_set.cpp:740
Anope::string name
Definition: regchannel.h:63
void Join(Channel *c, ChannelStatus *status=NULL)
Definition: bots.cpp:193
void OnPreChanExpire(ChannelInfo *ci, bool &expire) anope_override
Definition: cs_set.cpp:1330
SerializableExtensibleItem< bool > secureops
Definition: cs_set.cpp:1102
CommandCSSetRestricted(Module *creator, const Anope::string &cname="chanserv/set/restricted")
Definition: cs_set.cpp:630
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: cs_set.cpp:267
SerializableExtensibleItem< bool > noexpire
Definition: cs_set.cpp:1102
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: cs_set.cpp:473
void Assign(User *u, ChannelInfo *ci)
Definition: bots.cpp:153
Anope::string desc
Definition: regchannel.h:64
virtual bool RemoveMLock(ChannelMode *mode, bool status, const Anope::string &param="")=0
Anope::string nick
Definition: account.h:37
#define ACCESS_DENIED
Definition: language.h:73
SerializableExtensibleItem< bool > signkick
Definition: cs_set.cpp:1102
void AllowUnregistered(bool b)
Definition: command.cpp:164
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: cs_set.cpp:1051
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: cs_set.cpp:317
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: cs_set.cpp:698
CommandCSSetSecureFounder commandcssetsecurefounder
Definition: cs_set.cpp:1204
Definition: users.h:34
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: cs_set.cpp:24
void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) anope_override
Definition: cs_set.cpp:1318
T * Extend(const Anope::string &name, const T &what)
Definition: extensible.h:224
#define NICK_X_NOT_REGISTERED
Definition: language.h:79
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: cs_set.cpp:826
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: cs_set.cpp:445
KeepModes(Module *m, const Anope::string &n)
Definition: cs_set.cpp:1107
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: cs_set.cpp:401
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: cs_set.cpp:205
Persist(Module *m, const Anope::string &n)
Definition: cs_set.cpp:1152
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: cs_set.cpp:868
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override
Definition: cs_set.cpp:1154
void OnChanInfo(CommandSource &source, ChannelInfo *ci, InfoFormatter &info, bool show_all) anope_override
Definition: cs_set.cpp:1336
#define READ_ONLY_MODE
Definition: language.h:71
static Anope::string BotModes()
Definition: cs_set.cpp:457
virtual bool SetMLock(ChannelMode *mode, bool status, const Anope::string &param="", Anope::string setter="", time_t created=Anope::CurTime)=0
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: cs_set.cpp:336
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: cs_set.cpp:75
NickCore * GetSuccessor() const
Definition: regchannel.cpp:378
#define FOREACH_RESULT(ename, ret, args)
Definition: modules.h:95
void SetDesc(const Anope::string &d)
Definition: command.cpp:130
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: cs_set.cpp:940
void Unset(Extensible *obj) anope_override
Definition: extensible.h:95
static Channel * FindOrCreate(const Anope::string &name, bool &created, time_t ts=Anope::CurTime)
Definition: channels.cpp:929
void OnCreateChan(ChannelInfo *ci) anope_override
Definition: cs_set.cpp:1233
uint16_t channelcount
Definition: account.h:136
T * Require(const Anope::string &name)
Definition: extensible.h:244
Channel::ModeList last_modes
Definition: regchannel.h:73
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: cs_set.cpp:888
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: cs_set.cpp:804
size_type find_ci(const string &_str, size_type pos=0) const
Definition: anope.h:194
static ChannelInfo * Find(const Anope::string &name)
Definition: regchannel.cpp:630
int16_t bantype
Definition: regchannel.h:75
CommandCSSetSecure commandcssetsecure
Definition: cs_set.cpp:1203
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: cs_set.cpp:678
void SetSuccessor(NickCore *nc)
Definition: regchannel.cpp:369
std::multimap< Anope::string, Anope::string > ModeList
Definition: channels.h:36
CommandCSSetSecureFounder(Module *creator, const Anope::string &cname="chanserv/set/securefounder")
Definition: cs_set.cpp:756
CommandCSSetFounder commandcssetfounder
Definition: cs_set.cpp:1198
NickCore * GetFounder() const
Definition: regchannel.cpp:364
Definition: Config.cs:26
Channel * c
Definition: regchannel.h:79
void Shrink(const Anope::string &name)
Definition: extensible.h:253
CommandCSSetAutoOp commandcssetautoop
Definition: cs_set.cpp:1195
CommandCSSetDescription(Module *creator, const Anope::string &cname="chanserv/set/description")
Definition: cs_set.cpp:199
CommandCSSetPeace(Module *creator, const Anope::string &cname="chanserv/set/peace")
Definition: cs_set.cpp:395
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: cs_set.cpp:597
virtual void OnSyntaxError(CommandSource &source, const Anope::string &subcommand)
Definition: command.cpp:191
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: cs_set.cpp:179
CommandCSSetSuccessor commandcssetsuccessor
Definition: cs_set.cpp:1207
static const size_type npos
Definition: anope.h:44
void Reply(const char *message,...)
Definition: command.cpp:96
T * Set(Extensible *obj, const T &value)
Definition: extensible.h:78
CommandCSSetSignKick(Module *creator, const Anope::string &cname="chanserv/set/signkick")
Definition: cs_set.cpp:882
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
Definition: cs_set.cpp:29
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override
Definition: extensible.h:174
void OnChannelSync(Channel *c) anope_override
Definition: cs_set.cpp:1248
Reference< BotInfo > service
Definition: commands.h:67
const ChannelInfo * ci
Definition: logger.h:69
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: cs_set.cpp:636
CommandCSSetFounder(Module *creator, const Anope::string &cname="chanserv/set/founder")
Definition: cs_set.cpp:261
EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) anope_override
Definition: cs_set.cpp:1253
Anope::string display
Definition: account.h:113
void SetFounder(NickCore *nc)
Definition: regchannel.cpp:347
CommandCSSetSuccessor(Module *creator, const Anope::string &cname="chanserv/set/successor")
Definition: cs_set.cpp:959
CommandCSSetSignKick commandcssetsignkick
Definition: cs_set.cpp:1206
CSSet::Persist persist
static Anope::map< std::pair< bool, Anope::string > > modes
Definition: cs_mode.cpp:745
#define anope_override
Definition: services.h:56
bool empty() const
Definition: anope.h:126
CommandCSSetSecure(Module *creator, const Anope::string &cname="chanserv/set/secure")
Definition: cs_set.cpp:692
CommandCSSetDescription commandcssetdescription
Definition: cs_set.cpp:1197
bool persist_lower_ts
Definition: cs_set.cpp:1210
CoreExport IRCDProto * IRCD
Definition: protocol.cpp:23
EventReturn
Definition: modules.h:129
#define MODULE_INIT(x)
Definition: modules.h:45
ChanUserContainer * FindUser(User *u) const
Definition: channels.cpp:173
void SetSyntax(const Anope::string &s)
Definition: command.cpp:140
CommandCSSetSecureOps(Module *creator, const Anope::string &cname="chanserv/set/secureops")
Definition: cs_set.cpp:820
size_t HasMode(const Anope::string &name, const Anope::string &param="")
Definition: channels.cpp:201
CommandCSSetBanType commandcssetbantype
Definition: cs_set.cpp:1196
CommandCSSetBanType(Module *creator, const Anope::string &cname="chanserv/set/bantype")
Definition: cs_set.cpp:132
virtual void OnServHelp(CommandSource &source)
Definition: command.cpp:184
SerializableExtensibleItem< bool > secure
Definition: cs_set.cpp:1102
Anope::string name
Definition: service.h:88
#define CHAN_X_NOT_REGISTERED
Definition: language.h:84
Anope::string nick
Definition: users.h:62
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: cs_set.cpp:1090
CommandCSSetAutoOp(Module *creator, const Anope::string &cname="chanserv/set/autoop")
Definition: cs_set.cpp:69
EventReturn OnCheckDelete(Channel *c) anope_override
Definition: cs_set.cpp:1300
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override
Definition: cs_set.cpp:1109
virtual void SendChannel(Channel *c)
Definition: protocol.h:224
CommandCSSetNoexpire(Module *creator)
Definition: cs_set.cpp:1045
CommandCSSet commandcsset
Definition: cs_set.cpp:1194
bool GetToken(Anope::string &token)
Definition: hashcomp.cpp:99
CommandCSSetNoexpire commandcssetnoexpire
Definition: cs_set.cpp:1208
T anope_dynamic_static_cast(O ptr)
Definition: anope.h:774
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: cs_set.cpp:381
void SetMode(BotInfo *bi, ChannelMode *cm, const Anope::string &param="", bool enforce_mlock=true)
Definition: channels.cpp:401
CommandCSSet(Module *creator)
Definition: cs_set.cpp:18
CoreExport Server * Me
Definition: servers.cpp:24
void SendSyntax(CommandSource &)
Definition: command.cpp:145
CommandCSSetPeace commandcssetpeace
Definition: cs_set.cpp:1200
EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string &param) anope_override
Definition: cs_set.cpp:1286
const char * c_str() const
Definition: anope.h:117
void OnChannelCreate(Channel *c) anope_override
Definition: cs_set.cpp:1238
Definition: logger.h:53
SerializableExtensibleItem< bool > restricted
Definition: cs_set.cpp:1102
void OnReload(Configuration::Conf *conf) anope_override
Definition: cs_set.cpp:1228
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: cs_set.cpp:117
SerializableExtensibleItem< bool > noautoop
Definition: cs_set.cpp:1102
void OnDelChan(ChannelInfo *ci) anope_override
Definition: cs_set.cpp:1264
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: cs_set.cpp:965
T * GetExt(const Anope::string &name) const
Definition: extensible.h:213
CSSet(const Anope::string &modname, const Anope::string &creator)
Definition: cs_set.cpp:1213
Serialize::Reference< BotInfo > bi
Definition: regchannel.h:82
bool HasExt(const Extensible *obj) const
Definition: extensible.h:111
SerializableExtensibleItem< bool > peace
Definition: cs_set.cpp:1102
void Sync()
Definition: channels.cpp:98
#define _(x)
Definition: services.h:50
EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string &param) anope_override
Definition: cs_set.cpp:1271
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: cs_set.cpp:1025
bool HasExt(const Anope::string &name) const
Definition: extensible.cpp:31
void OnJoinChannel(User *u, Channel *c) anope_override
Definition: cs_set.cpp:1307
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: cs_set.cpp:138
SerializableExtensibleItem< bool > securefounder
Definition: cs_set.cpp:1102
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override
Definition: cs_set.cpp:1129
time_t time_registered
Definition: regchannel.h:66
CommandCSSetPersist(Module *creator, const Anope::string &cname="chanserv/set/persist")
Definition: cs_set.cpp:467
CommandCSSetSecureOps commandcssetsecureops
Definition: cs_set.cpp:1205
void RemoveMode(BotInfo *bi, ChannelMode *cm, const Anope::string &param="", bool enforce_mlock=true)
Definition: channels.cpp:459
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: cs_set.cpp:762