Revision [313]

Last edited on 2005-10-06 04:03:42 by KogAdmin [notes]
Additions:
~7 - notes
== 7 - Notes ==
You can find source for both userserv and nickserv in /contrib. I believe I tested the boundary case where someone gives generatepass an alpha char, but my results looked like I had a bad compile... Please add a comment if this is not the case.


Revision [312]

Edited on 2005-10-06 03:59:13 by KogAdmin [help.c hookin update]
Additions:
Is no longer necessary! There's now a list_t called us_helptree that contains all help hookins, and you can see we add ourselves as a node to it. Thank you nenolod et al.
Deletions:
in atheme-current/modules/userserv there's a file called help.c add a field to the help_command_ struct for your command like so:
{ "GENERATEPASS", AC_NONE, "help/userserv/generatepass" },
Your end product might look like:
static struct help_command_ us_help_commands[] = {
{ "REGISTER", AC_NONE, "help/userserv/register" },
{ "VERIFY", AC_NONE, "help/userserv/verify" },
{ "IDENTIFY", AC_NONE, "help/userserv/identify" },
{ "LOGOUT", AC_NONE, "help/userserv/logout" },
{ "HELP", AC_NONE, "help/help" },
{ "INFO", AC_NONE, "help/userserv/info" },
{ "DROP", AC_NONE, "help/userserv/drop" },
{ "GENERATEPASS", AC_NONE, "help/userserv/generatepass" },
{ "GHOST", AC_NONE, "help/userserv/ghost" },
{ "STATUS", AC_NONE, "help/userserv/status" },
{ "TAXONOMY", AC_NONE, "help/userserv/taxonomy" },
{ "LINK", AC_NONE, "help/userserv/link" },
{ "RESETPASS",AC_IRCOP, "help/userserv/resetpass"},
{ "SENDPASS", AC_IRCOP, "help/userserv/sendpass" },
{ "LISTMAIL", AC_IRCOP, "help/userserv/listmail" },
{ "MARK", AC_IRCOP, "help/userserv/mark" },
{ "LIST", AC_IRCOP, "help/userserv/list" },
{ "HOLD", AC_SRA, "help/userserv/hold" },
{ "MYACCESS", AC_NONE, "help/userserv/myaccess" },
{ "SET EMAIL", AC_NONE, "help/userserv/set_email" },
{ "SET HIDEMAIL", AC_NONE, "help/userserv/set_hidemail" },
{ "SET NEVEROP", AC_NONE, "help/userserv/set_neverop" },
{ "SET NOOP", AC_NONE, "help/userserv/set_noop" },
{ "SET PASSWORD", AC_NONE, "help/userserv/set_password" },
{ "SET PROPERTY", AC_NONE, "help/userserv/set_property" },
{ NULL, 0, NULL }
};
etc etc etc. This is a part that will need to be recompiled, since you can't loadmodule it via opserv. We're basically adding a hookin so that it knows what file to play when a help request is made
<< NOTE: Nenolod et al are in the process of editing the help process ... this may not be valid soon << ::c::


Revision [311]

Edited on 2005-10-06 03:57:43 by KogAdmin [new help hookins, input filtering on sourcecode]
Additions:
* Copyright (c) 2005 Greg Feigenson
AC_NONE, us_cmd_generatepass };
list_t *us_cmdtree;
list_t *us_helptree;
us_cmdtree = module_locate_symbol("userserv/main", "us_cmdtree");
command_add(&us_generatepass, us_cmdtree);
us_helptree = module_locate_symbol("userserv/main", "us_helptree");
help_addentry(us_helptree, "GENERATEPASS", "help/userserv/generatepass", NULL);
/* You'll need to create a helpfile and put in help/userserv */
command_delete(&us_generatepass, us_cmdtree);
help_delentry(us_helptree, "GENERATEPASS");
int n;

if (!n)
n = 7;
Deletions:
* Copyright (c) 2005 Greg Feigenson et al.
//basic module stuff - I leave the id bit empty because of lack of SVN
//prototype for function - must be declared up at top in C
//command struct, give it a name, description, access (could be AC_IRCOP if privileged), function hook
AC_NONE, us_cmd_generatepass };
list_t *us_cmdtree; //apparently the command tree is a list type
us_cmdtree = module_locate_symbol("userserv/main", "us_cmdtree"); //find userserv command tree
command_add(&us_generatepass, us_cmdtree); //add ourselves to the command tree for this service
command_delete(&us_generatepass, us_cmdtree); //modunload
int n = 7;


Revision [282]

Edited on 2005-10-04 21:53:18 by KogAdmin [fixed atoi core]
Additions:
static void us_cmd_generatepass(char *origin)
int n = 7;
char *newpass = strtok(NULL, " ");
if (newpass)
n = atoi(newpass);
newpass = gen_pw(n);
notice(usersvs.nick, origin, "Randomly generated password: %s",newpass);
free(newpass);
Deletions:
static void us_cmd_generatepass(char *origin) //origin is who sent it
int n;
char *newpass; //string
int size = atoi(strtok(NULL, " ")); //convert the first argument from a string to an int
if (!size) //if first argument
size = 7; //if they didn't provide a size, use 7
newpass = gen_pw(size); //generate password - this calls malloc (function.c in src)
notice(usersvs.nick, origin, "Randomly generated password: %s",newpass); //notice the user their new password
free(newpass); //gen_pw calls malloc, we need to demalloc


Revision [278]

Edited on 2005-10-04 04:12:57 by KogAdmin [updates]
Additions:
~2 - Add it to the makefile.in
<< NOTE: remember to run ./configure after updating makefile.in! << ::c::
"Epiphanic Networks <http://www.epiphanic.org>"
This is so we will know to build the module (and make generatepass.so) and do our magic on it when we make && make install.
You're going to want to edit your Makefile.in (and re-run ./configure), or also edit your Makefile (as it's generated by autoconfigure). You'll notice there's a definition for base_srcs that contains a bunch of .c files. Add generatepass in there, add a tab and a \ if it's not the last entry (that's a character that tells it ignore linebreak).
<< NOTE: Nenolod et al are in the process of editing the help process ... this may not be valid soon << ::c::
Deletions:
~2 - Add it to the makefile/makefile.in
"GamesNET Development Group <http://www.gamesnet.net>"
This is so we will know to build the module (and, I'm not sure, but so you can do make generatepass.so... not sure about targets yet) and do our magic on it when we make && make install.
I edited both Makefile and Makefile.in because I'm rather new to this, I think you just want the .in, but hey... You'll notice there's a definition for base_srcs that contains a bunch of .c files. Add generatepass in there, add a tab and a \ if it's not the last entry (that's a character that tells it ignore linebreak).


Revision [266]

Edited on 2005-10-03 22:03:17 by KogAdmin [added atheme link]
Additions:
This file is also available on [[http://wiki.atheme.org/modules:userserv_password_generator Atheme's Wiki]]


Revision [265]

Edited on 2005-10-03 21:37:51 by KogAdmin [edited group on generatepass.c file]
Additions:
"GamesNET Development Group <http://www.gamesnet.net>"
Deletions:
"Atheme Development Group <http://www.atheme.org>"


Revision [264]

The oldest known version of this page was created on 2005-10-03 21:28:21 by KogAdmin [edited group on generatepass.c file]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki