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