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