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 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); } } } }