Anope IRC Services  Version 2.0
ns_set.cpp
Go to the documentation of this file.
1 /* NickServ 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 
14 class CommandNSSet : public Command
15 {
16  public:
17  CommandNSSet(Module *creator) : Command(creator, "nickserv/set", 1, 3)
18  {
19  this->SetDesc(_("Set options, including kill protection"));
20  this->SetSyntax(_("\037option\037 \037parameters\037"));
21  }
22 
23  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
24  {
25  this->OnSyntaxError(source, "");
26  return;
27  }
28 
29  bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
30  {
31  this->SendSyntax(source);
32  source.Reply(" ");
33  source.Reply(_("Sets various nickname options. \037option\037 can be one of:"));
34 
35  Anope::string this_name = source.command;
36  bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands");
37  for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
38  {
39  const Anope::string &c_name = it->first;
40  const CommandInfo &info = it->second;
41 
42  if (c_name.find_ci(this_name + " ") == 0)
43  {
44  ServiceReference<Command> c("Command", info.name);
45  if (!c)
46  continue;
47  else if (!hide_privileged_commands)
48  ; // Always show with hide_privileged_commands disabled
49  else if (!c->AllowUnregistered() && !source.GetAccount())
50  continue;
51  else if (!info.permission.empty() && !source.HasCommand(info.permission))
52  continue;
53 
54  source.command = c_name;
55  c->OnServHelp(source);
56  }
57  }
58 
59  source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information\n"
60  "on a specific option."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), this_name.c_str());
61 
62  return true;
63  }
64 };
65 
66 class CommandNSSASet : public Command
67 {
68  public:
69  CommandNSSASet(Module *creator) : Command(creator, "nickserv/saset", 2, 4)
70  {
71  this->SetDesc(_("Set SET-options on another nickname"));
72  this->SetSyntax(_("\037option\037 \037nickname\037 \037parameters\037"));
73  }
74 
75  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
76  {
77  this->OnSyntaxError(source, "");
78  return;
79  }
80 
81  bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
82  {
83  this->SendSyntax(source);
84  source.Reply(" ");
85  source.Reply(_("Sets various nickname options. \037option\037 can be one of:"));
86 
87  Anope::string this_name = source.command;
88  for (CommandInfo::map::const_iterator it = source.service->commands.begin(), it_end = source.service->commands.end(); it != it_end; ++it)
89  {
90  const Anope::string &c_name = it->first;
91  const CommandInfo &info = it->second;
92 
93  if (c_name.find_ci(this_name + " ") == 0)
94  {
95  ServiceReference<Command> command("Command", info.name);
96  if (command)
97  {
98  source.command = c_name;
99  command->OnServHelp(source);
100  }
101  }
102  }
103 
104  source.Reply(_("Type \002%s%s HELP %s \037option\037\002 for more information\n"
105  "on a specific option. The options will be set on the given\n"
106  "\037nickname\037."), Config->StrictPrivmsg.c_str(), source.service->nick.c_str(), this_name.c_str());
107  return true;
108  }
109 };
110 
112 {
113  public:
114  CommandNSSetPassword(Module *creator) : Command(creator, "nickserv/set/password", 1)
115  {
116  this->SetDesc(_("Set your nickname password"));
117  this->SetSyntax(_("\037new-password\037"));
118  }
119 
120  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
121  {
122  const Anope::string &param = params[0];
123  unsigned len = param.length();
124 
125  if (Anope::ReadOnly)
126  {
127  source.Reply(READ_ONLY_MODE);
128  return;
129  }
130 
131  if (source.GetNick().equals_ci(param) || (Config->GetBlock("options")->Get<bool>("strictpasswords") && len < 5))
132  {
133  source.Reply(MORE_OBSCURE_PASSWORD);
134  return;
135  }
136  else if (len > Config->GetModule("nickserv")->Get<unsigned>("passlen", "32"))
137  {
138  source.Reply(PASSWORD_TOO_LONG);
139  return;
140  }
141 
142  Log(LOG_COMMAND, source, this) << "to change their password";
143 
144  Anope::Encrypt(param, source.nc->pass);
145  Anope::string tmp_pass;
146  if (Anope::Decrypt(source.nc->pass, tmp_pass) == 1)
147  source.Reply(_("Password for \002%s\002 changed to \002%s\002."), source.nc->display.c_str(), tmp_pass.c_str());
148  else
149  source.Reply(_("Password for \002%s\002 changed."), source.nc->display.c_str());
150  }
151 
153  {
154  this->SendSyntax(source);
155  source.Reply(" ");
156  source.Reply(_("Changes the password used to identify you as the nick's\n"
157  "owner."));
158  return true;
159  }
160 };
161 
163 {
164  public:
165  CommandNSSASetPassword(Module *creator) : Command(creator, "nickserv/saset/password", 2, 2)
166  {
167  this->SetDesc(_("Set the nickname password"));
168  this->SetSyntax(_("\037nickname\037 \037new-password\037"));
169  }
170 
171  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
172  {
173  if (Anope::ReadOnly)
174  {
175  source.Reply(READ_ONLY_MODE);
176  return;
177  }
178 
179  const NickAlias *setter_na = NickAlias::Find(params[0]);
180  if (setter_na == NULL)
181  {
182  source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str());
183  return;
184  }
185  NickCore *nc = setter_na->nc;
186 
187  size_t len = params[1].length();
188 
189  if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper())
190  {
191  source.Reply(_("You may not change the password of other Services Operators."));
192  return;
193  }
194  else if (nc->display.equals_ci(params[1]) || (Config->GetBlock("options")->Get<bool>("strictpasswords") && len < 5))
195  {
196  source.Reply(MORE_OBSCURE_PASSWORD);
197  return;
198  }
199  else if (len > Config->GetModule("nickserv")->Get<unsigned>("passlen", "32"))
200  {
201  source.Reply(PASSWORD_TOO_LONG);
202  return;
203  }
204 
205  Log(LOG_ADMIN, source, this) << "to change the password of " << nc->display;
206 
207  Anope::Encrypt(params[1], nc->pass);
208  Anope::string tmp_pass;
209  if (Anope::Decrypt(nc->pass, tmp_pass) == 1)
210  source.Reply(_("Password for \002%s\002 changed to \002%s\002."), nc->display.c_str(), tmp_pass.c_str());
211  else
212  source.Reply(_("Password for \002%s\002 changed."), nc->display.c_str());
213  }
214 
216  {
217  this->SendSyntax(source);
218  source.Reply(" ");
219  source.Reply(_("Changes the password used to identify as the nick's owner."));
220  return true;
221  }
222 };
223 
225 {
226  public:
227  CommandNSSetAutoOp(Module *creator, const Anope::string &sname = "nickserv/set/autoop", size_t min = 1) : Command(creator, sname, min, min + 1)
228  {
229  this->SetDesc(_("Sets whether services should set channel status modes on you automatically."));
230  this->SetSyntax("{ON | OFF}");
231  }
232 
233  void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
234  {
235  if (Anope::ReadOnly)
236  {
237  source.Reply(READ_ONLY_MODE);
238  return;
239  }
240 
241  const NickAlias *na = NickAlias::Find(user);
242  if (na == NULL)
243  {
244  source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
245  return;
246  }
247  NickCore *nc = na->nc;
248 
249  EventReturn MOD_RESULT;
250  FOREACH_RESULT(OnSetNickOption, MOD_RESULT, (source, this, nc, param));
251  if (MOD_RESULT == EVENT_STOP)
252  return;
253 
254  if (param.equals_ci("ON"))
255  {
256  Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable autoop for " << na->nc->display;
257  nc->Extend<bool>("AUTOOP");
258  source.Reply(_("Services will from now on set status modes on %s in channels."), nc->display.c_str());
259  }
260  else if (param.equals_ci("OFF"))
261  {
262  Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable autoop for " << na->nc->display;
263  nc->Shrink<bool>("AUTOOP");
264  source.Reply(_("Services will no longer set status modes on %s in channels."), nc->display.c_str());
265  }
266  else
267  this->OnSyntaxError(source, "AUTOOP");
268  }
269 
270  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
271  {
272  this->Run(source, source.nc->display, params[0]);
273  }
274 
276  {
277  BotInfo *bi = Config->GetClient("ChanServ");
278  this->SendSyntax(source);
279  source.Reply(" ");
280  source.Reply(_("Sets whether you will be given your channel status modes automatically.\n"
281  "Set to \002ON\002 to allow %s to set status modes on you automatically\n"
282  "when entering channels. Note that depending on channel settings some modes\n"
283  "may not get set automatically."), bi ? bi->nick.c_str() : "ChanServ");
284  return true;
285  }
286 };
287 
289 {
290  public:
291  CommandNSSASetAutoOp(Module *creator) : CommandNSSetAutoOp(creator, "nickserv/saset/autoop", 2)
292  {
293  this->ClearSyntax();
294  this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
295  }
296 
297  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
298  {
299  this->Run(source, params[0], params[1]);
300  }
301 
303  {
304  BotInfo *bi = Config->GetClient("ChanServ");
305  this->SendSyntax(source);
306  source.Reply(" ");
307  source.Reply(_("Sets whether the given nickname will be given its status modes\n"
308  "in channels automatically. Set to \002ON\002 to allow %s\n"
309  "to set status modes on the given nickname automatically when it\n"
310  "is entering channels. Note that depending on channel settings\n"
311  "some modes may not get set automatically."), bi ? bi->nick.c_str() : "ChanServ");
312  return true;
313  }
314 };
315 
317 {
318  public:
319  CommandNSSetDisplay(Module *creator, const Anope::string &sname = "nickserv/set/display", size_t min = 1) : Command(creator, sname, min, min + 1)
320  {
321  this->SetDesc(_("Set the display of your group in Services"));
322  this->SetSyntax(_("\037new-display\037"));
323  }
324 
325  void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
326  {
327  if (Anope::ReadOnly)
328  {
329  source.Reply(READ_ONLY_MODE);
330  return;
331  }
332 
333  NickAlias *user_na = NickAlias::Find(user), *na = NickAlias::Find(param);
334 
335  if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
336  {
337  source.Reply(_("This command may not be used on this network because nickname ownership is disabled."));
338  return;
339  }
340  if (user_na == NULL)
341  {
342  source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
343  return;
344  }
345  else if (!na || *na->nc != *user_na->nc)
346  {
347  source.Reply(_("The new display MUST be a nickname of the nickname group %s."), user_na->nc->display.c_str());
348  return;
349  }
350 
351  EventReturn MOD_RESULT;
352  FOREACH_RESULT(OnSetNickOption, MOD_RESULT, (source, this, user_na->nc, param));
353  if (MOD_RESULT == EVENT_STOP)
354  return;
355 
356  Log(user_na->nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the display of " << user_na->nc->display << " to " << na->nick;
357 
358  user_na->nc->SetDisplay(na);
359  if (source.GetUser())
360  IRCD->SendLogin(source.GetUser(), na);
361  source.Reply(NICK_SET_DISPLAY_CHANGED, user_na->nc->display.c_str());
362  }
363 
364  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
365  {
366  this->Run(source, source.nc->display, params[0]);
367  }
368 
370  {
371  this->SendSyntax(source);
372  source.Reply(" ");
373  source.Reply(_("Changes the display used to refer to your nickname group in\n"
374  "Services. The new display MUST be a nick of your group."));
375  return true;
376  }
377 };
378 
380 {
381  public:
382  CommandNSSASetDisplay(Module *creator) : CommandNSSetDisplay(creator, "nickserv/saset/display", 2)
383  {
384  this->ClearSyntax();
385  this->SetSyntax(_("\037nickname\037 \037new-display\037"));
386  }
387 
388  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
389  {
390  this->Run(source, params[0], params[1]);
391  }
392 
394  {
395  this->SendSyntax(source);
396  source.Reply(" ");
397  source.Reply(_("Changes the display used to refer to the nickname group in\n"
398  "Services. The new display MUST be a nick of the group."));
399  return true;
400  }
401 };
402 
404 {
405  static bool SendConfirmMail(User *u, BotInfo *bi, const Anope::string &new_email)
406  {
407  Anope::string code = Anope::Random(9);
408 
409  std::pair<Anope::string, Anope::string> *n = u->Account()->Extend<std::pair<Anope::string, Anope::string> >("ns_set_email");
410  n->first = new_email;
411  n->second = code;
412 
413  Anope::string subject = Config->GetBlock("mail")->Get<const Anope::string>("emailchange_subject"),
414  message = Config->GetBlock("mail")->Get<const Anope::string>("emailchange_message");
415 
416  subject = subject.replace_all_cs("%e", u->Account()->email);
417  subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
418  subject = subject.replace_all_cs("%c", code);
419 
420  message = message.replace_all_cs("%e", u->Account()->email);
421  message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname"));
422  message = message.replace_all_cs("%c", code);
423 
424  Anope::string old = u->Account()->email;
425  u->Account()->email = new_email;
426  bool b = Mail::Send(u, u->Account(), bi, subject, message);
427  u->Account()->email = old;
428  return b;
429  }
430 
431  public:
432  CommandNSSetEmail(Module *creator, const Anope::string &cname = "nickserv/set/email", size_t min = 0) : Command(creator, cname, min, min + 1)
433  {
434  this->SetDesc(_("Associate an E-mail address with your nickname"));
435  this->SetSyntax(_("\037address\037"));
436  }
437 
438  void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
439  {
440  if (Anope::ReadOnly)
441  {
442  source.Reply(READ_ONLY_MODE);
443  return;
444  }
445 
446  const NickAlias *na = NickAlias::Find(user);
447  if (!na)
448  {
449  source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
450  return;
451  }
452  NickCore *nc = na->nc;
453 
454  if (nc->HasExt("UNCONFIRMED"))
455  {
456  source.Reply(_("You may not change the email of an unconfirmed account."));
457  return;
458  }
459 
460  if (param.empty() && Config->GetModule("nickserv")->Get<bool>("forceemail", "yes"))
461  {
462  source.Reply(_("You cannot unset the e-mail on this network."));
463  return;
464  }
465  else if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.nc != nc && nc->IsServicesOper())
466  {
467  source.Reply(_("You may not change the e-mail of other Services Operators."));
468  return;
469  }
470  else if (!param.empty() && !Mail::Validate(param))
471  {
472  source.Reply(MAIL_X_INVALID, param.c_str());
473  return;
474  }
475 
476  EventReturn MOD_RESULT;
477  FOREACH_RESULT(OnSetNickOption, MOD_RESULT, (source, this, nc, param));
478  if (MOD_RESULT == EVENT_STOP)
479  return;
480 
481  if (!param.empty() && Config->GetModule("nickserv")->Get<bool>("confirmemailchanges") && !source.IsServicesOper())
482  {
483  if (SendConfirmMail(source.GetUser(), source.service, param))
484  source.Reply(_("A confirmation e-mail has been sent to \002%s\002. Follow the instructions in it to change your e-mail address."), param.c_str());
485  }
486  else
487  {
488  if (!param.empty())
489  {
490  Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the email of " << nc->display << " to " << param;
491  nc->email = param;
492  source.Reply(_("E-mail address for \002%s\002 changed to \002%s\002."), nc->display.c_str(), param.c_str());
493  }
494  else
495  {
496  Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to unset the email of " << nc->display;
497  nc->email.clear();
498  source.Reply(_("E-mail address for \002%s\002 unset."), nc->display.c_str());
499  }
500  }
501  }
502 
503  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
504  {
505  this->Run(source, source.nc->display, params.size() ? params[0] : "");
506  }
507 
509  {
510  this->SendSyntax(source);
511  source.Reply(" ");
512  source.Reply(_("Associates the given E-mail address with your nickname.\n"
513  "This address will be displayed whenever someone requests\n"
514  "information on the nickname with the \002INFO\002 command."));
515  return true;
516  }
517 };
518 
520 {
521  public:
522  CommandNSSASetEmail(Module *creator) : CommandNSSetEmail(creator, "nickserv/saset/email", 2)
523  {
524  this->ClearSyntax();
525  this->SetSyntax(_("\037nickname\037 \037address\037"));
526  }
527 
528  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
529  {
530  this->Run(source, params[0], params.size() > 1 ? params[1] : "");
531  }
532 
534  {
535  this->SendSyntax(source);
536  source.Reply(" ");
537  source.Reply(_("Associates the given E-mail address with the nickname."));
538  return true;
539  }
540 };
541 
543 {
544  public:
545  CommandNSSetKeepModes(Module *creator, const Anope::string &sname = "nickserv/set/keepmodes", size_t min = 1) : Command(creator, sname, min, min + 1)
546  {
547  this->SetDesc(_("Enable or disable keep modes"));
548  this->SetSyntax("{ON | OFF}");
549  }
550 
551  void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
552  {
553  if (Anope::ReadOnly)
554  {
555  source.Reply(READ_ONLY_MODE);
556  return;
557  }
558 
559  const NickAlias *na = NickAlias::Find(user);
560  if (!na)
561  {
562  source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
563  return;
564  }
565  NickCore *nc = na->nc;
566 
567  EventReturn MOD_RESULT;
568  FOREACH_RESULT(OnSetNickOption, MOD_RESULT, (source, this, nc, param));
569  if (MOD_RESULT == EVENT_STOP)
570  return;
571 
572  if (param.equals_ci("ON"))
573  {
574  Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable keepmodes for " << nc->display;
575  nc->Extend<bool>("NS_KEEP_MODES");
576  source.Reply(_("Keep modes for %s is now \002on\002."), nc->display.c_str());
577  }
578  else if (param.equals_ci("OFF"))
579  {
580  Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable keepmodes for " << nc->display;
581  nc->Shrink<bool>("NS_KEEP_MODES");
582  source.Reply(_("Keep modes for %s is now \002off\002."), nc->display.c_str());
583  }
584  else
585  this->OnSyntaxError(source, "");
586  }
587 
588  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
589  {
590  this->Run(source, source.nc->display, params[0]);
591  }
592 
594  {
595  this->SendSyntax(source);
596  source.Reply(" ");
597  source.Reply(_("Enables or disables keepmodes for your nick. If keep\n"
598  "modes is enabled, services will remember your usermodes\n"
599  "and attempt to re-set them the next time you authenticate."));
600  return true;
601  }
602 };
603 
605 {
606  public:
607  CommandNSSASetKeepModes(Module *creator) : CommandNSSetKeepModes(creator, "nickserv/saset/keepmodes", 2)
608  {
609  this->ClearSyntax();
610  this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
611  }
612 
613  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
614  {
615  this->Run(source, params[0], params[1]);
616  }
617 
619  {
620  this->SendSyntax(source);
621  source.Reply(" ");
622  source.Reply(_("Enables or disables keepmodes for the given nick. If keep\n"
623  "modes is enabled, services will remember users' usermodes\n"
624  "and attempt to re-set them the next time they authenticate."));
625  return true;
626  }
627 };
628 
629 class CommandNSSetKill : public Command
630 {
631  public:
632  CommandNSSetKill(Module *creator, const Anope::string &sname = "nickserv/set/kill", size_t min = 1) : Command(creator, sname, min, min + 1)
633  {
634  this->SetDesc(_("Turn protection on or off"));
635  this->SetSyntax("{ON | QUICK | IMMED | OFF}");
636  }
637 
638  void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
639  {
640  if (Anope::ReadOnly)
641  {
642  source.Reply(READ_ONLY_MODE);
643  return;
644  }
645 
646  if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership"))
647  {
648  source.Reply(_("This command may not be used on this network because nickname ownership is disabled."));
649  return;
650  }
651 
652  const NickAlias *na = NickAlias::Find(user);
653  if (!na)
654  {
655  source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
656  return;
657  }
658  NickCore *nc = na->nc;
659 
660  EventReturn MOD_RESULT;
661  FOREACH_RESULT(OnSetNickOption, MOD_RESULT, (source, this, nc, param));
662  if (MOD_RESULT == EVENT_STOP)
663  return;
664 
665  if (param.equals_ci("ON"))
666  {
667  nc->Extend<bool>("KILLPROTECT");
668  nc->Shrink<bool>("KILL_QUICK");
669  nc->Shrink<bool>("KILL_IMMED");
670  Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill on for " << nc->display;
671  source.Reply(_("Protection is now \002on\002 for \002%s\002."), nc->display.c_str());
672  }
673  else if (param.equals_ci("QUICK"))
674  {
675  nc->Extend<bool>("KILLPROTECT");
676  nc->Extend<bool>("KILL_QUICK");
677  nc->Shrink<bool>("KILL_IMMED");
678  Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill quick for " << nc->display;
679  source.Reply(_("Protection is now \002on\002 for \002%s\002, with a reduced delay."), nc->display.c_str());
680  }
681  else if (param.equals_ci("IMMED"))
682  {
683  if (Config->GetModule(this->owner)->Get<bool>("allowkillimmed"))
684  {
685  nc->Extend<bool>("KILLPROTECT");
686  nc->Shrink<bool>("KILL_QUICK");
687  nc->Extend<bool>("KILL_IMMED");
688  Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill immed for " << nc->display;
689  source.Reply(_("Protection is now \002on\002 for \002%s\002, with no delay."), nc->display.c_str());
690  }
691  else
692  source.Reply(_("The \002IMMED\002 option is not available on this network."));
693  }
694  else if (param.equals_ci("OFF"))
695  {
696  nc->Shrink<bool>("KILLPROTECT");
697  nc->Shrink<bool>("KILL_QUICK");
698  nc->Shrink<bool>("KILL_IMMED");
699  Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable kill for " << nc->display;
700  source.Reply(_("Protection is now \002off\002 for \002%s\002."), nc->display.c_str());
701  }
702  else
703  this->OnSyntaxError(source, "KILL");
704 
705  return;
706  }
707 
708  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
709  {
710  this->Run(source, source.nc->display, params[0]);
711  }
712 
714  {
715  this->SendSyntax(source);
716  source.Reply(" ");
717  source.Reply(_("Turns the automatic protection option for your nick\n"
718  "on or off. With protection on, if another user\n"
719  "tries to take your nick, they will be given one minute to\n"
720  "change to another nick, after which %s will forcibly change\n"
721  "their nick.\n"
722  " \n"
723  "If you select \002QUICK\002, the user will be given only 20 seconds\n"
724  "to change nicks instead of the usual 60. If you select\n"
725  "\002IMMED\002, the user's nick will be changed immediately \037without\037 being\n"
726  "warned first or given a chance to change their nick; please\n"
727  "do not use this option unless necessary. Also, your\n"
728  "network's administrators may have disabled this option."), source.service->nick.c_str());
729  return true;
730  }
731 };
732 
734 {
735  public:
736  CommandNSSASetKill(Module *creator) : CommandNSSetKill(creator, "nickserv/saset/kill", 2)
737  {
738  this->ClearSyntax();
739  this->SetSyntax(_("\037nickname\037 {ON | QUICK | IMMED | OFF}"));
740  }
741 
742  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
743  {
744  this->Run(source, params[0], params[1]);
745  }
746 
748  {
749  this->SendSyntax(source);
750  source.Reply(" ");
751  source.Reply(_("Turns the automatic protection option for the nick\n"
752  "on or off. With protection on, if another user\n"
753  "tries to take the nick, they will be given one minute to\n"
754  "change to another nick, after which %s will forcibly change\n"
755  "their nick.\n"
756  " \n"
757  "If you select \002QUICK\002, the user will be given only 20 seconds\n"
758  "to change nicks instead of the usual 60. If you select\n"
759  "\002IMMED\002, the user's nick will be changed immediately \037without\037 being\n"
760  "warned first or given a chance to change their nick; please\n"
761  "do not use this option unless necessary. Also, your\n"
762  "network's administrators may have disabled this option."), source.service->nick.c_str());
763  return true;
764  }
765 };
766 
768 {
769  public:
770  CommandNSSetLanguage(Module *creator, const Anope::string &sname = "nickserv/set/language", size_t min = 1) : Command(creator, sname, min, min + 1)
771  {
772  this->SetDesc(_("Set the language Services will use when messaging you"));
773  this->SetSyntax(_("\037language\037"));
774  }
775 
776  void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
777  {
778  if (Anope::ReadOnly)
779  {
780  source.Reply(READ_ONLY_MODE);
781  return;
782  }
783 
784  const NickAlias *na = NickAlias::Find(user);
785  if (!na)
786  {
787  source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
788  return;
789  }
790  NickCore *nc = na->nc;
791 
792  EventReturn MOD_RESULT;
793  FOREACH_RESULT(OnSetNickOption, MOD_RESULT, (source, this, nc, param));
794  if (MOD_RESULT == EVENT_STOP)
795  return;
796 
797  if (param != "en_US")
798  for (unsigned j = 0; j < Language::Languages.size(); ++j)
799  {
800  if (Language::Languages[j] == param)
801  break;
802  else if (j + 1 == Language::Languages.size())
803  {
804  this->OnSyntaxError(source, "");
805  return;
806  }
807  }
808 
809  Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the language of " << nc->display << " to " << param;
810 
811  nc->language = param;
812  source.Reply(_("Language changed to \002English\002."));
813  }
814 
815  void Execute(CommandSource &source, const std::vector<Anope::string> &param) anope_override
816  {
817  this->Run(source, source.nc->display, param[0]);
818  }
819 
821  {
822  this->SendSyntax(source);
823  source.Reply(" ");
824  source.Reply(_("Changes the language Services uses when sending messages to\n"
825  "you (for example, when responding to a command you send).\n"
826  "\037language\037 should be chosen from the following list of\n"
827  "supported languages:"));
828 
829  source.Reply(" en_US (English)");
830  for (unsigned j = 0; j < Language::Languages.size(); ++j)
831  {
832  const Anope::string &langname = Language::Translate(Language::Languages[j].c_str(), _("English"));
833  if (langname == "English")
834  continue;
835  source.Reply(" %s (%s)", Language::Languages[j].c_str(), langname.c_str());
836  }
837 
838  return true;
839  }
840 };
841 
843 {
844  public:
845  CommandNSSASetLanguage(Module *creator) : CommandNSSetLanguage(creator, "nickserv/saset/language", 2)
846  {
847  this->ClearSyntax();
848  this->SetSyntax(_("\037nickname\037 \037language\037"));
849  }
850 
851  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
852  {
853  this->Run(source, params[0], params[1]);
854  }
855 
857  {
858  this->SendSyntax(source);
859  source.Reply(" ");
860  source.Reply(_("Changes the language Services uses when sending messages to\n"
861  "the given user (for example, when responding to a command they send).\n"
862  "\037language\037 should be chosen from the following list of\n"
863  "supported languages:"));
864  source.Reply(" en (English)");
865  for (unsigned j = 0; j < Language::Languages.size(); ++j)
866  {
867  const Anope::string &langname = Language::Translate(Language::Languages[j].c_str(), _("English"));
868  if (langname == "English")
869  continue;
870  source.Reply(" %s (%s)", Language::Languages[j].c_str(), langname.c_str());
871  }
872  return true;
873  }
874 };
875 
877 {
878  public:
879  CommandNSSetMessage(Module *creator, const Anope::string &sname = "nickserv/set/message", size_t min = 1) : Command(creator, sname, min, min + 1)
880  {
881  this->SetDesc(_("Change the communication method of Services"));
882  this->SetSyntax("{ON | OFF}");
883  }
884 
885  void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
886  {
887  if (Anope::ReadOnly)
888  {
889  source.Reply(READ_ONLY_MODE);
890  return;
891  }
892 
893  const NickAlias *na = NickAlias::Find(user);
894  if (!na)
895  {
896  source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
897  return;
898  }
899  NickCore *nc = na->nc;
900 
901  if (!Config->GetBlock("options")->Get<bool>("useprivmsg"))
902  {
903  source.Reply(_("You cannot %s on this network."), source.command.c_str());
904  return;
905  }
906 
907  EventReturn MOD_RESULT;
908  FOREACH_RESULT(OnSetNickOption, MOD_RESULT, (source, this, nc, param));
909  if (MOD_RESULT == EVENT_STOP)
910  return;
911 
912  if (param.equals_ci("ON"))
913  {
914  Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable " << source.command << " for " << nc->display;
915  nc->Extend<bool>("MSG");
916  source.Reply(_("Services will now reply to \002%s\002 with \002messages\002."), nc->display.c_str());
917  }
918  else if (param.equals_ci("OFF"))
919  {
920  Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable " << source.command << " for " << nc->display;
921  nc->Shrink<bool>("MSG");
922  source.Reply(_("Services will now reply to \002%s\002 with \002notices\002."), nc->display.c_str());
923  }
924  else
925  this->OnSyntaxError(source, "MSG");
926  }
927 
928  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
929  {
930  this->Run(source, source.nc->display, params[0]);
931  }
932 
934  {
935  Anope::string cmd = source.command;
936  size_t i = cmd.find_last_of(' ');
937  if (i != Anope::string::npos)
938  cmd = cmd.substr(i + 1);
939 
940  this->SendSyntax(source);
941  source.Reply(" ");
942  source.Reply(_("Allows you to choose the way Services are communicating with\n"
943  "you. With \002%s\002 set, Services will use messages, else they'll\n"
944  "use notices."), cmd.upper().c_str());
945  return true;
946  }
947 
949  {
950  if (!Config->GetBlock("options")->Get<bool>("useprivmsg"))
951  Command::OnServHelp(source);
952  }
953 };
954 
956 {
957  public:
958  CommandNSSASetMessage(Module *creator) : CommandNSSetMessage(creator, "nickserv/saset/message", 2)
959  {
960  this->ClearSyntax();
961  this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
962  }
963 
965  {
966  this->SendSyntax(source);
967  source.Reply(" ");
968  source.Reply(_("Allows you to choose the way Services are communicating with\n"
969  "the given user. With \002MSG\002 set, Services will use messages,\n"
970  "else they'll use notices."));
971  return true;
972  }
973 
974  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
975  {
976  this->Run(source, params[0], params[1]);
977  }
978 };
979 
981 {
982  public:
983  CommandNSSetSecure(Module *creator, const Anope::string &sname = "nickserv/set/secure", size_t min = 1) : Command(creator, sname, min, min + 1)
984  {
985  this->SetDesc(_("Turn nickname security on or off"));
986  this->SetSyntax("{ON | OFF}");
987  }
988 
989  void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
990  {
991  if (Anope::ReadOnly)
992  {
993  source.Reply(READ_ONLY_MODE);
994  return;
995  }
996 
997  const NickAlias *na = NickAlias::Find(user);
998  if (!na)
999  {
1000  source.Reply(NICK_X_NOT_REGISTERED, user.c_str());
1001  return;
1002  }
1003  NickCore *nc = na->nc;
1004 
1005  EventReturn MOD_RESULT;
1006  FOREACH_RESULT(OnSetNickOption, MOD_RESULT, (source, this, nc, param));
1007  if (MOD_RESULT == EVENT_STOP)
1008  return;
1009 
1010  if (param.equals_ci("ON"))
1011  {
1012  Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable secure for " << nc->display;
1013  nc->Extend<bool>("NS_SECURE");
1014  source.Reply(_("Secure option is now \002on\002 for \002%s\002."), nc->display.c_str());
1015  }
1016  else if (param.equals_ci("OFF"))
1017  {
1018  Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable secure for " << nc->display;
1019  nc->Shrink<bool>("NS_SECURE");
1020  source.Reply(_("Secure option is now \002off\002 for \002%s\002."), nc->display.c_str());
1021  }
1022  else
1023  this->OnSyntaxError(source, "SECURE");
1024  }
1025 
1026  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
1027  {
1028  this->Run(source, source.nc->display, params[0]);
1029  }
1030 
1032  {
1033  this->SendSyntax(source);
1034  source.Reply(" ");
1035  source.Reply(_("Turns %s's security features on or off for your\n"
1036  "nick. With \002SECURE\002 set, you must enter your password\n"
1037  "before you will be recognized as the owner of the nick,\n"
1038  "regardless of whether your address is on the access\n"
1039  "list. However, if you are on the access list, %s\n"
1040  "will not auto-kill you regardless of the setting of the\n"
1041  "\002KILL\002 option."), source.service->nick.c_str(), source.service->nick.c_str());
1042  return true;
1043  }
1044 };
1045 
1047 {
1048  public:
1049  CommandNSSASetSecure(Module *creator) : CommandNSSetSecure(creator, "nickserv/saset/secure", 2)
1050  {
1051  this->ClearSyntax();
1052  this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
1053  }
1054 
1055  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
1056  {
1057  this->Run(source, params[0], params[1]);
1058  }
1059 
1061  {
1062  this->SendSyntax(source);
1063  source.Reply(" ");
1064  source.Reply(_("Turns %s's security features on or off for your\n"
1065  "nick. With \002SECURE\002 set, you must enter your password\n"
1066  "before you will be recognized as the owner of the nick,\n"
1067  "regardless of whether your address is on the access\n"
1068  "list. However, if you are on the access list, %s\n"
1069  "will not auto-kill you regardless of the setting of the\n"
1070  "\002KILL\002 option."), source.service->nick.c_str(), source.service->nick.c_str());
1071  return true;
1072  }
1073 };
1074 
1076 {
1077  public:
1078  CommandNSSASetNoexpire(Module *creator) : Command(creator, "nickserv/saset/noexpire", 1, 2)
1079  {
1080  this->SetDesc(_("Prevent the nickname from expiring"));
1081  this->SetSyntax(_("\037nickname\037 {ON | OFF}"));
1082  }
1083 
1084  void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
1085  {
1086  if (Anope::ReadOnly)
1087  {
1088  source.Reply(READ_ONLY_MODE);
1089  return;
1090  }
1091 
1092  NickAlias *na = NickAlias::Find(params[0]);
1093  if (na == NULL)
1094  {
1095  source.Reply(NICK_X_NOT_REGISTERED, params[0].c_str());
1096  return;
1097  }
1098 
1099  Anope::string param = params.size() > 1 ? params[1] : "";
1100 
1101  if (param.equals_ci("ON"))
1102  {
1103  Log(LOG_ADMIN, source, this) << "to enable noexpire for " << na->nc->display;
1104  na->Extend<bool>("NS_NO_EXPIRE");
1105  source.Reply(_("Nick %s \002will not\002 expire."), na->nick.c_str());
1106  }
1107  else if (param.equals_ci("OFF"))
1108  {
1109  Log(LOG_ADMIN, source, this) << "to disable noexpire for " << na->nc->display;
1110  na->Shrink<bool>("NS_NO_EXPIRE");
1111  source.Reply(_("Nick %s \002will\002 expire."), na->nick.c_str());
1112  }
1113  else
1114  this->OnSyntaxError(source, "NOEXPIRE");
1115  }
1116 
1118  {
1119  this->SendSyntax(source);
1120  source.Reply(" ");
1121  source.Reply(_("Sets whether the given nickname will expire. Setting this\n"
1122  "to \002ON\002 prevents the nickname from expiring."));
1123  return true;
1124  }
1125 };
1126 
1127 class NSSet : public Module
1128 {
1131 
1134 
1137 
1140 
1143 
1146 
1149 
1152 
1155 
1158 
1160 
1163 
1165  {
1167 
1169  {
1171 
1172  if (s->GetSerializableType()->GetName() != "NickCore")
1173  return;
1174 
1175  const NickCore *nc = anope_dynamic_static_cast<const NickCore *>(s);
1177  for (User::ModeList::const_iterator it = nc->last_modes.begin(); it != nc->last_modes.end(); ++it)
1178  {
1179  if (!modes.empty())
1180  modes += " ";
1181  modes += it->first;
1182  if (!it->second.empty())
1183  modes += "," + it->second;
1184  }
1185  data["last_modes"] << modes;
1186  }
1187 
1189  {
1191 
1192  if (s->GetSerializableType()->GetName() != "NickCore")
1193  return;
1194 
1197  data["last_modes"] >> modes;
1198  for (spacesepstream sep(modes); sep.GetToken(modes);)
1199  {
1200  size_t c = modes.find(',');
1201  if (c == Anope::string::npos)
1202  nc->last_modes.insert(std::make_pair(modes, ""));
1203  else
1204  nc->last_modes.insert(std::make_pair(modes.substr(0, c), modes.substr(c + 1)));
1205  }
1206  }
1207  } keep_modes;
1208 
1209  /* email, passcode */
1211 
1212  public:
1213  NSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
1214  commandnsset(this), commandnssaset(this),
1215  commandnssetautoop(this), commandnssasetautoop(this),
1216  commandnssetdisplay(this), commandnssasetdisplay(this),
1217  commandnssetemail(this), commandnssasetemail(this),
1218  commandnssetkeepmodes(this), commandnssasetkeepmodes(this),
1219  commandnssetkill(this), commandnssasetkill(this),
1220  commandnssetlanguage(this), commandnssasetlanguage(this),
1221  commandnssetmessage(this), commandnssasetmessage(this),
1222  commandnssetpassword(this), commandnssasetpassword(this),
1223  commandnssetsecure(this), commandnssasetsecure(this),
1224  commandnssasetnoexpire(this),
1225 
1226  autoop(this, "AUTOOP"),
1227  killprotect(this, "KILLPROTECT"), kill_quick(this, "KILL_QUICK"),
1228  kill_immed(this, "KILL_IMMED"), message(this, "MSG"),
1229  secure(this, "NS_SECURE"), noexpire(this, "NS_NO_EXPIRE"),
1230 
1231  keep_modes(this, "NS_KEEP_MODES"), ns_set_email(this, "ns_set_email")
1232  {
1233 
1234  }
1235 
1236  EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> &params) anope_override
1237  {
1238  NickCore *uac = source.nc;
1239 
1240  if (command->name == "nickserv/confirm" && !params.empty() && uac)
1241  {
1242  std::pair<Anope::string, Anope::string> *n = ns_set_email.Get(uac);
1243  if (n)
1244  {
1245  if (params[0] == n->second)
1246  {
1247  uac->email = n->first;
1248  Log(LOG_COMMAND, source, command) << "to confirm their email address change to " << uac->email;
1249  source.Reply(_("Your email address has been changed to \002%s\002."), uac->email.c_str());
1250  ns_set_email.Unset(uac);
1251  return EVENT_STOP;
1252  }
1253  }
1254  }
1255 
1256  return EVENT_CONTINUE;
1257  }
1258 
1259  void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) anope_override
1260  {
1261  if (chan->ci)
1262  {
1263  /* Only give modes if autoop is set */
1264  give_modes &= !user->Account() || autoop.HasExt(user->Account());
1265  }
1266  }
1267 
1268  void OnPreNickExpire(NickAlias *na, bool &expire) anope_override
1269  {
1270  if (noexpire.HasExt(na))
1271  expire = false;
1272  }
1273 
1274  void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) anope_override
1275  {
1276  if (!show_hidden)
1277  return;
1278 
1279  if (kill_immed.HasExt(na->nc))
1280  info.AddOption(_("Immediate protection"));
1281  else if (kill_quick.HasExt(na->nc))
1282  info.AddOption(_("Quick protection"));
1283  else if (killprotect.HasExt(na->nc))
1284  info.AddOption(_("Protection"));
1285  if (secure.HasExt(na->nc))
1286  info.AddOption(_("Security"));
1287  if (message.HasExt(na->nc))
1288  info.AddOption(_("Message mode"));
1289  if (autoop.HasExt(na->nc))
1290  info.AddOption(_("Auto-op"));
1291  if (noexpire.HasExt(na))
1292  info.AddOption(_("No expire"));
1293  if (keep_modes.HasExt(na->nc))
1294  info.AddOption(_("Keep modes"));
1295  }
1296 
1297  void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) anope_override
1298  {
1299  if (u->Account() && setter.GetUser() == u)
1300  u->Account()->last_modes = u->GetModeList();
1301  }
1302 
1303  void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) anope_override
1304  {
1305  if (u->Account() && setter.GetUser() == u)
1306  u->Account()->last_modes = u->GetModeList();
1307  }
1308 
1310  {
1311  if (keep_modes.HasExt(u->Account()))
1312  {
1313  User::ModeList modes = u->Account()->last_modes;
1314  for (User::ModeList::iterator it = modes.begin(); it != modes.end(); ++it)
1315  {
1316  UserMode *um = ModeManager::FindUserModeByName(it->first);
1317  /* if the null user can set the mode, then it's probably safe */
1318  if (um && um->CanSet(NULL))
1319  u->SetMode(NULL, it->first, it->second);
1320  }
1321  }
1322  }
1323 };
1324 
Serialize::Reference< NickCore > nc
Definition: account.h:47
Definition: bots.h:24
CoreExport bool ReadOnly
Definition: main.cpp:28
Anope::string permission
Definition: commands.h:34
static NickAlias * Find(const Anope::string &nick)
Definition: nickalias.cpp:121
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:297
CommandNSSetMessage(Module *creator, const Anope::string &sname="nickserv/set/message", size_t min=1)
Definition: ns_set.cpp:879
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override
Definition: extensible.h:168
CommandNSSetPassword commandnssetpassword
Definition: ns_set.cpp:1153
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
Definition: ns_set.cpp:638
void Execute(CommandSource &source, const std::vector< Anope::string > &param) anope_override
Definition: ns_set.cpp:815
Anope::string name
Definition: commands.h:32
void OnSetCorrectModes(User *user, Channel *chan, AccessGroup &access, bool &give_modes, bool &take_modes) anope_override
Definition: ns_set.cpp:1259
CommandNSSetSecure(Module *creator, const Anope::string &sname="nickserv/set/secure", size_t min=1)
Definition: ns_set.cpp:983
CommandNSSetMessage commandnssetmessage
Definition: ns_set.cpp:1150
CommandNSSetDisplay commandnssetdisplay
Definition: ns_set.cpp:1135
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
Definition: ns_set.cpp:233
void clear()
Definition: anope.h:187
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:508
CommandNSSASetSecure(Module *creator)
Definition: ns_set.cpp:1049
CommandNSSet commandnsset
Definition: ns_set.cpp:1129
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:152
CommandNSSASetAutoOp commandnssasetautoop
Definition: ns_set.cpp:1133
bool IsServicesOper()
Definition: command.cpp:78
Anope::string nick
Definition: account.h:37
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:215
void AllowUnregistered(bool b)
Definition: command.cpp:164
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
Definition: ns_set.cpp:989
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
Definition: ns_set.cpp:551
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
Definition: ns_set.cpp:885
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:613
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:933
CommandNSSASetMessage(Module *creator)
Definition: ns_set.cpp:958
CommandNSSASetMessage commandnssasetmessage
Definition: ns_set.cpp:1151
CommandNSSetKill commandnssetkill
Definition: ns_set.cpp:1144
Definition: users.h:34
T * Extend(const Anope::string &name, const T &what)
Definition: extensible.h:224
#define NICK_X_NOT_REGISTERED
Definition: language.h:79
CommandNSSetPassword(Module *creator)
Definition: ns_set.cpp:114
string upper() const
Definition: anope.h:266
CommandNSSASetPassword commandnssasetpassword
Definition: ns_set.cpp:1154
void ClearSyntax()
Definition: command.cpp:135
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:388
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:393
#define READ_ONLY_MODE
Definition: language.h:71
#define FOREACH_RESULT(ename, ret, args)
Definition: modules.h:95
void SetDesc(const Anope::string &d)
Definition: command.cpp:130
bool equals_ci(const char *_str) const
Definition: anope.h:78
void Unset(Extensible *obj) anope_override
Definition: extensible.h:95
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:588
static UserMode * FindUserModeByName(const Anope::string &name)
Definition: modes.cpp:550
Anope::string pass
Definition: account.h:115
CommandNSSetAutoOp commandnssetautoop
Definition: ns_set.cpp:1132
CommandNSSetKeepModes commandnssetkeepmodes
Definition: ns_set.cpp:1141
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
Definition: ns_set.cpp:438
SerializableExtensibleItem< bool > kill_immed
Definition: ns_set.cpp:1161
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:747
size_type find_ci(const string &_str, size_type pos=0) const
Definition: anope.h:194
CommandNSSASetNoexpire(Module *creator)
Definition: ns_set.cpp:1078
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
Definition: ns_set.cpp:81
string substr(size_type pos=0, size_type n=npos) const
Definition: anope.h:277
void ExtensibleSerialize(const Extensible *e, const Serializable *s, Serialize::Data &data) const anope_override
Definition: ns_set.cpp:1168
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:302
CoreExport bool Decrypt(const Anope::string &src, Anope::string &dest)
Definition: misc.cpp:518
#define MAIL_X_INVALID
Definition: language.h:87
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
Definition: ns_set.cpp:776
size_type length() const
Definition: anope.h:131
CommandNSSASetPassword(Module *creator)
Definition: ns_set.cpp:165
Definition: Config.cs:26
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:275
void Shrink(const Anope::string &name)
Definition: extensible.h:253
CommandNSSASetDisplay commandnssasetdisplay
Definition: ns_set.cpp:1136
CoreExport bool Validate(const Anope::string &email)
Definition: mail.cpp:115
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:708
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:851
CommandNSSetLanguage(Module *creator, const Anope::string &sname="nickserv/set/language", size_t min=1)
Definition: ns_set.cpp:770
virtual void OnSyntaxError(CommandSource &source, const Anope::string &subcommand)
Definition: command.cpp:191
CommandNSSASetEmail(Module *creator)
Definition: ns_set.cpp:522
static const size_type npos
Definition: anope.h:44
Anope::string command
Definition: commands.h:69
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:974
CommandNSSetEmail commandnssetemail
Definition: ns_set.cpp:1138
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:856
void Reply(const char *message,...)
Definition: command.cpp:96
SerializableExtensibleItem< bool > message
Definition: ns_set.cpp:1161
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:742
SerializableExtensibleItem< bool > secure
Definition: ns_set.cpp:1161
string replace_all_cs(const string &_orig, const string &_repl) const
Definition: anope.h:229
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:503
CommandNSSetSecure commandnssetsecure
Definition: ns_set.cpp:1156
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override
Definition: extensible.h:174
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:593
SerializableExtensibleItem< bool > noexpire
Definition: ns_set.cpp:1161
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:270
#define MORE_OBSCURE_PASSWORD
Definition: language.h:74
void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) anope_override
Definition: ns_set.cpp:1303
Reference< BotInfo > service
Definition: commands.h:67
Definition: modes.h:68
#define NICK_SET_DISPLAY_CHANGED
Definition: language.h:99
void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) anope_override
Definition: ns_set.cpp:1297
Anope::string display
Definition: account.h:113
static bool SendConfirmMail(User *u, BotInfo *bi, const Anope::string &new_email)
Definition: ns_set.cpp:405
CommandNSSetKeepModes(Module *creator, const Anope::string &sname="nickserv/set/keepmodes", size_t min=1)
Definition: ns_set.cpp:545
PrimitiveExtensibleItem< std::pair< Anope::string, Anope::string > > ns_set_email
Definition: ns_set.cpp:1210
void ExtensibleUnserialize(Extensible *e, Serializable *s, Serialize::Data &data) anope_override
Definition: ns_set.cpp:1188
CoreExport bool Send(User *from, NickCore *to, BotInfo *service, const Anope::string &subject, const Anope::string &message)
Definition: mail.cpp:54
CoreExport std::vector< Anope::string > Languages
Definition: language.cpp:23
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
CommandNSSetEmail(Module *creator, const Anope::string &cname="nickserv/set/email", size_t min=0)
Definition: ns_set.cpp:432
SerializableExtensibleItem< bool > killprotect
Definition: ns_set.cpp:1161
CoreExport IRCDProto * IRCD
Definition: protocol.cpp:23
void OnNickInfo(CommandSource &source, NickAlias *na, InfoFormatter &info, bool show_hidden) anope_override
Definition: ns_set.cpp:1274
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:120
NSSet::KeepModes keep_modes
EventReturn
Definition: modules.h:129
#define MODULE_INIT(x)
Definition: modules.h:45
CommandNSSASetAutoOp(Module *creator)
Definition: ns_set.cpp:291
CommandNSSASetKeepModes commandnssasetkeepmodes
Definition: ns_set.cpp:1142
CommandNSSASetDisplay(Module *creator)
Definition: ns_set.cpp:382
CoreExport const char * Translate(const char *string)
Definition: language.cpp:59
CoreExport Anope::string Random(size_t len)
Definition: misc.cpp:754
User * GetUser()
Definition: command.cpp:31
std::map< Anope::string, Anope::string > ModeList
Definition: users.h:42
void SetSyntax(const Anope::string &s)
Definition: command.cpp:140
CommandNSSetAutoOp(Module *creator, const Anope::string &sname="nickserv/set/autoop", size_t min=1)
Definition: ns_set.cpp:227
NSSet(const Anope::string &modname, const Anope::string &creator)
Definition: ns_set.cpp:1213
std::map< Anope::string, Anope::string > last_modes
Definition: account.h:123
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:713
CommandNSSASetKill commandnssasetkill
Definition: ns_set.cpp:1145
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:369
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:964
virtual bool CanSet(User *u) const
Definition: modes.cpp:126
virtual void SendLogin(User *u, NickAlias *na)=0
virtual void OnServHelp(CommandSource &source)
Definition: command.cpp:184
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:1117
void OnUserLogin(User *u) anope_override
Definition: ns_set.cpp:1309
CommandNSSetDisplay(Module *creator, const Anope::string &sname="nickserv/set/display", size_t min=1)
Definition: ns_set.cpp:319
EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:1236
Anope::string nick
Definition: users.h:62
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:533
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:1060
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:75
NickCore * Account() const
Definition: users.cpp:422
bool GetToken(Anope::string &token)
Definition: hashcomp.cpp:99
CommandNSSet(Module *creator)
Definition: ns_set.cpp:17
T * Get(const Extensible *obj) const
Definition: extensible.h:103
T anope_dynamic_static_cast(O ptr)
Definition: anope.h:774
CommandNSSASet(Module *creator)
Definition: ns_set.cpp:69
void Run(CommandSource &source, const Anope::string &user, const Anope::string &param)
Definition: ns_set.cpp:325
Reference< NickCore > nc
Definition: commands.h:61
void OnServHelp(CommandSource &source) anope_override
Definition: ns_set.cpp:948
void SendSyntax(CommandSource &)
Definition: command.cpp:145
CommandNSSASetSecure commandnssasetsecure
Definition: ns_set.cpp:1157
#define PASSWORD_TOO_LONG
Definition: language.h:77
NickCore * GetAccount()
Definition: command.cpp:36
CoreExport void Encrypt(const Anope::string &src, Anope::string &dest)
Definition: misc.cpp:511
CommandNSSASetKeepModes(Module *creator)
Definition: ns_set.cpp:607
const char * c_str() const
Definition: anope.h:117
Definition: logger.h:53
CommandNSSASetLanguage commandnssasetlanguage
Definition: ns_set.cpp:1148
CommandNSSASet commandnssaset
Definition: ns_set.cpp:1130
CommandNSSASetLanguage(Module *creator)
Definition: ns_set.cpp:845
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:820
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:171
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
Definition: ns_set.cpp:29
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:23
CommandNSSetLanguage commandnssetlanguage
Definition: ns_set.cpp:1147
virtual bool IsServicesOper() const
Definition: nickcore.cpp:173
CommandNSSASetKill(Module *creator)
Definition: ns_set.cpp:736
SerializableExtensibleItem< bool > kill_quick
Definition: ns_set.cpp:1161
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:1031
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:928
bool HasExt(const Extensible *obj) const
Definition: extensible.h:111
Anope::string email
Definition: account.h:116
CommandNSSASetEmail commandnssasetemail
Definition: ns_set.cpp:1139
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:1084
SerializableExtensibleItem< bool > autoop
Definition: ns_set.cpp:1161
void OnPreNickExpire(NickAlias *na, bool &expire) anope_override
Definition: ns_set.cpp:1268
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:1055
size_type find_last_of(const string &_str, size_type pos=npos) const
Definition: anope.h:208
#define _(x)
Definition: services.h:50
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:364
bool HasExt(const Anope::string &name) const
Definition: extensible.cpp:31
CommandNSSetKill(Module *creator, const Anope::string &sname="nickserv/set/kill", size_t min=1)
Definition: ns_set.cpp:632
bool OnHelp(CommandSource &source, const Anope::string &) anope_override
Definition: ns_set.cpp:618
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:1026
Anope::string language
Definition: account.h:118
CommandNSSASetNoexpire commandnssasetnoexpire
Definition: ns_set.cpp:1159
void Execute(CommandSource &source, const std::vector< Anope::string > &params) anope_override
Definition: ns_set.cpp:528
KeepModes(Module *m, const Anope::string &n)
Definition: ns_set.cpp:1166