EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) override { if (command->name == "nickserv/confirm" && params.size() > 1) { if (Anope::ReadOnly) { source.Reply(_("Services are in read-only mode.")); return EVENT_STOP; } NickServ::Nick *na = NickServ::FindNick(params[0]); ResetInfo *ri = na ? reset.Get(na->GetAccount()) : NULL; if (na && ri) { NickServ::Account *nc = na->GetAccount(); const Anope::string &passcode = params[1]; if (ri->time < Anope::CurTime - 3600) { reset.Unset(nc); source.Reply(_("Your password reset request has expired.")); } else if (passcode.equals_cs(ri->code)) { reset.Unset(nc); nc->UnsetS<bool>("UNCONFIRMED"); Log(LOG_COMMAND, source, &commandnsresetpass) << "confirmed RESETPASS to forcefully identify as " << na->GetNick(); if (source.GetUser()) { source.GetUser()->Identify(na); source.Reply(_("You are now identified for \002{0}\002. Change your password now."), na->GetAccount()->GetDisplay()); } } else return EVENT_CONTINUE; return EVENT_STOP; } } return EVENT_CONTINUE; }
void OnUserModeSet(const MessageSource &, User *u, const Anope::string &mname) override { Anope::string *setter; if (mname == "OPER" && (setter = noop.Get(u->server))) { Anope::string reason = "NOOP command used by " + *setter; ServiceBot *OperServ = Config->GetClient("OperServ"); u->Kill(OperServ, reason); } }
EventReturn IsServicesOper(User *u) override { if (!u->Account()->o->GetPassword().empty()) { if (os_login.HasExt(u)) return EVENT_ALLOW; return EVENT_STOP; } return EVENT_CONTINUE; }
void OnJoinChannel(User *u, Channel *c) override { if (Config->GetModule(this)->Get<bool>("restoreonrecover")) { NSRecoverInfo *ei = recover.Get(u); if (ei != NULL) { NSRecoverInfo::iterator it = ei->find(c->name); if (it != ei->end()) { for (size_t i = 0; i < it->second.Modes().length(); ++i) c->SetMode(c->ci->WhoSends(), ModeManager::FindChannelModeByChar(it->second.Modes()[i]), u->GetUID()); ei->erase(it); if (ei->empty()) recover.Unset(u); } } } }
void OnUserNickChange(User *u, const Anope::string &oldnick) override { if (Config->GetModule(this)->Get<bool>("restoreonrecover")) { NSRecoverInfo *ei = recover.Get(u); ServiceBot *NickServ = Config->GetClient("NickServ"); if (ei != NULL && NickServ != NULL) for (NSRecoverInfo::iterator it = ei->begin(), it_end = ei->end(); it != it_end;) { Channel *c = Channel::Find(it->first); const Anope::string &cname = it->first; ++it; /* User might already be on the channel */ if (u->FindChannel(c)) this->OnJoinChannel(u, c); else if (IRCD->CanSVSJoin) IRCD->SendSVSJoin(NickServ, u, cname, ""); } } }