]> jfr.im git - irc/quakenet/newserv.git/blob - chanserv/authcmds/sendpassword.c
fix indentation
[irc/quakenet/newserv.git] / chanserv / authcmds / sendpassword.c
1 /* Automatically generated by refactor.pl.
2 *
3 *
4 * CMDNAME: sendpassword
5 * CMDLEVEL: QCMD_HELPER
6 * CMDARGS: 1
7 * CMDDESC: Sends the users current password by email.
8 * CMDFUNC: csa_dosendpw
9 * CMDPROTO: int csa_dosendpw(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: SENDPASSWORD <username>
11 * CMDHELP: Sends the password for the specified account to the specified users email address.
12 */
13
14 #include "../chanserv.h"
15 #include "../authlib.h"
16 #include "../../lib/irc_string.h"
17 #include <stdio.h>
18 #include <string.h>
19
20 int csa_dosendpw(void *source, int cargc, char **cargv) {
21 reguser *rup;
22 nick *sender=source;
23
24 if (cargc<1) {
25 chanservstdmessage(sender, QM_NOTENOUGHPARAMS, "sendpassword");
26 return CMD_ERROR;
27 }
28
29 if (!(rup=findreguser(sender, cargv[0])))
30 return CMD_ERROR;
31
32 if(UHasHelperPriv(rup)) {
33 chanservstdmessage(sender, QM_REQUESTPASSPRIVUSER);
34 cs_log(sender,"SENDPASSWORD FAIL privilidged user %s",rup->username);
35 return CMD_ERROR;
36 }
37
38 /* we don't reset the throttling timer
39 rup->lastemailchange=time(NULL);
40 csdb_updateuser(rup);
41 */
42
43 if(rup->lastauth) {
44 csdb_createmail(rup, QMAIL_REQPW);
45 } else {
46 csdb_createmail(rup, QMAIL_NEWACCOUNT); /* user hasn't authed yet and needs to do the captcha */
47 }
48 chanservstdmessage(sender, QM_MAILQUEUED);
49 cs_log(sender,"SENDPASSWORD username %s", rup->username);
50
51 return CMD_OK;
52 }