]>
Commit | Line | Data |
---|---|---|
87b2117f CP |
1 | /* Automatically generated by refactor.pl. |
2 | * | |
3 | * | |
4 | * CMDNAME: sendpassword | |
d353effa | 5 | * CMDALIASES: sendpass |
e4cf95f2 | 6 | * CMDLEVEL: QCMD_HELPER |
87b2117f CP |
7 | * CMDARGS: 1 |
8 | * CMDDESC: Sends the users current password by email. | |
a03c04b3 CP |
9 | * CMDFUNC: csa_dosendpw |
10 | * CMDPROTO: int csa_dosendpw(void *source, int cargc, char **cargv); | |
d353effa | 11 | * CMDHELP: Usage: @UCOMMAND@ <username> |
87b2117f CP |
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 | ||
a03c04b3 | 21 | int csa_dosendpw(void *source, int cargc, char **cargv) { |
87b2117f CP |
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 | ||
a03c04b3 CP |
33 | if(UHasHelperPriv(rup)) { |
34 | chanservstdmessage(sender, QM_REQUESTPASSPRIVUSER); | |
4a3ebc9e | 35 | cs_log(sender,"SENDPASSWORD FAIL privilidged user %s",rup->username); |
a03c04b3 CP |
36 | return CMD_ERROR; |
37 | } | |
38 | ||
87b2117f CP |
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 | } | |
b7ae0f2c | 49 | chanservstdmessage(sender, QM_MAILQUEUED); |
16739dbe | 50 | cs_log(sender,"SENDPASSWORD username %s", rup->username); |
87b2117f CP |
51 | |
52 | return CMD_OK; | |
53 | } |