#include "module.h" #define AUTHOR "DukePyrolator" #define VERSION "0.9 for anope 1.9.4 only" EventReturn DoOnAccess(User *u, const std::vector ¶ms) { Anope::string cmd = params[0]; Anope::string mask = params.size() > 1 ? params[1] : ""; if (!u->IsIdentified()) return EVENT_CONTINUE; // nick not identified if (mask.empty()) return EVENT_CONTINUE; // let it handle by ns_access if (mask.find('@') != Anope::string::npos) return EVENT_CONTINUE; // let it handle by ns_access if (cmd.equals_ci("DEL")) { if (mask.equals_ci("fingerprint")) { if (!u->fingerprint.empty()) { if (u->Account()->FindAccess(u->fingerprint)) { u->SendMessage(NickServ, _("\002%s\002 deleted from your access list."), u->fingerprint.c_str()); u->Account()->EraseAccess(u->fingerprint); } else { u->SendMessage(NickServ, _("\002%s\002 not found on your access list."), u->fingerprint.c_str()); } } else { u->SendMessage(NickServ, "You have no SSL Fingerprint to delete"); } return EVENT_STOP; } else if (u->Account()->FindAccess(mask)) { u->SendMessage(NickServ, _("\002%s\002 deleted from your access list."), mask.c_str()); u->Account()->EraseAccess(mask); return EVENT_STOP; } } return EVENT_CONTINUE; } class NSaccessfix : public Module { public: NSaccessfix(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator) { ModuleManager::Attach(I_OnPreCommand, this); this->SetAuthor(AUTHOR); this->SetVersion(VERSION); this->SetType(THIRD); } ~NSaccessfix() { } EventReturn OnPreCommand(CommandSource &source, Command *command, const std::vector ¶ms) { if ((source.service == NickServ) && (command->name.equals_ci("ACCESS"))) return DoOnAccess(source.u, params); return EVENT_CONTINUE; } }; MODULE_INIT(NSaccessfix)