anope- supernets anope source code & configuration |
git clone git://git.acid.vegas/anope.git |
Log | Files | Refs | Archive | README |
ns_getemail.cpp (1944B)
1 /* NickServ core functions 2 * 3 * (C) 2003-2022 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 * A simple call to check for all emails that a user may have registered 12 * with. It returns the nicks that match the email you provide. Wild 13 * Cards are not excepted. Must use user@email-host. 14 */ 15 16 #include "module.h" 17 18 class CommandNSGetEMail : public Command 19 { 20 public: 21 CommandNSGetEMail(Module *creator) : Command(creator, "nickserv/getemail", 1, 1) 22 { 23 this->SetDesc(_("Matches and returns all users that registered using given email")); 24 this->SetSyntax(_("\037email\037")); 25 } 26 27 void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override 28 { 29 const Anope::string &email = params[0]; 30 int j = 0; 31 32 Log(LOG_ADMIN, source, this) << "on " << email; 33 34 for (nickcore_map::const_iterator it = NickCoreList->begin(), it_end = NickCoreList->end(); it != it_end; ++it) 35 { 36 const NickCore *nc = it->second; 37 38 if (!nc->email.empty() && Anope::Match(nc->email, email)) 39 { 40 ++j; 41 source.Reply(_("Email matched: \002%s\002 (\002%s\002) to \002%s\002."), nc->display.c_str(), nc->email.c_str(), email.c_str()); 42 } 43 } 44 45 if (j <= 0) 46 { 47 source.Reply(_("No registrations matching \002%s\002 were found."), email.c_str()); 48 return; 49 } 50 51 return; 52 } 53 54 bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override 55 { 56 this->SendSyntax(source); 57 source.Reply(" "); 58 source.Reply(_("Returns the matching accounts that used given email.")); 59 return true; 60 } 61 }; 62 63 class NSGetEMail : public Module 64 { 65 CommandNSGetEMail commandnsgetemail; 66 public: 67 NSGetEMail(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), 68 commandnsgetemail(this) 69 { 70 71 } 72 }; 73 74 MODULE_INIT(NSGetEMail)