/** * ns_generatepass.C: Generates a new password, either n digits long (w/ nickserv arg), or 7 digits * * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team * Rights to this code are as documented in COPYING. * * * Portions of this file were derived from sources bearing the following license: * Copyright © 2005 Greg Feigenson * Rights to this code are as documented in doc/pod/license.pod. * * $Id: ns_generatepass.C,v 1.5 2007/09/16 18:54:43 pippijn Exp $ */ #include "atheme.h" #include static char const rcsid[] = "$Id: ns_generatepass.C,v 1.5 2007/09/16 18:54:43 pippijn Exp $"; REGISTER_MODULE ("nickserv/generatepass", false, "Epiphanic Networks "); static void ns_cmd_generatepass (sourceinfo_t *si, int parc, char *parv[]); command_t const ns_generatepass = { "GENERATEPASS", "Generates a random password.", AC_NONE, 1, ns_cmd_generatepass }; E cmdvec ns_cmdtree; E helpvec ns_helptree; static void ns_cmd_generatepass (sourceinfo_t *si, int parc, char *parv[]) { int n = 0; char *newpass; if (parc >= 1) n = atoi (parv[0]); if (n <= 0 || n > 127) n = 7; newpass = gen_pw (n); command_success_string (si, newpass, "Randomly generated password: %s", newpass); sfree (newpass); } bool _modinit (module *m) { ns_cmdtree << ns_generatepass; help_addentry (ns_helptree, "GENERATEPASS", "help/nickserv/generatepass", NULL); /* You'll need to create a helpfile and put in help/nickserv */ return true; } void _moddeinit () { ns_cmdtree >> ns_generatepass; help_delentry (ns_helptree, "GENERATEPASS"); }