* CMDDESC: Creates a new user account.
* CMDFUNC: csa_dohello
* CMDPROTO: int csa_dohello(void *source, int cargc, char **cargv);
+ * CMDHELP: Usage: HELLO <email> <email>
+ * CMDHELP: Creates a new user account for yourself. Your current nickname will be used
+ * CMDHELP: for the name of the account, and may only contain letters, numbers and
+ * CMDHELP: hyphens (-). An email containing password details will be sent to the email
+ * CMDHELP: address supplied. Where:
+ * CMDHELP: email - your email address. Must be entered the same way both times.
*/
#include "../chanserv.h"
reguser *ruh;
int found=0;
char *dupemail;
+ activeuser *aup;
if (getreguserfromnick(sender))
return CMD_ERROR;
return CMD_ERROR;
}
+ if (!(aup = getactiveuserfromnick(sender)))
+ return CMD_ERROR;
+
+ if (aup->helloattempts > MAXHELLOS) {
+ chanservstdmessage(sender, QM_MAXHELLOLIMIT);
+ return CMD_ERROR;
+ }
+
if (strcmp(cargv[0],cargv[1])) {
chanservstdmessage(sender, QM_EMAILDONTMATCH);
cs_log(sender,"HELLO FAIL username %s email don't match (%s vs %s)",sender->nick,cargv[0],cargv[1]);
if (csa_checkeboy(sender, cargv[0]))
return CMD_ERROR;
- mdp=findorcreatemaildomain(cargv[0]);
- for(smdp=mdp; smdp; smdp=smdp->parent) {
- if((smdp->count >= smdp->limit) && (smdp->limit > 0)) {
- chanservstdmessage(sender, QM_DOMAINLIMIT);
- return CMD_ERROR;
- }
- }
+ if (csa_checkaccountname(sender, sender->nick))
+ return CMD_ERROR;
dupemail = strdup(cargv[0]);
local=strchr(dupemail, '@');
+ if(!local)
+ return CMD_ERROR;
*(local++)='\0';
- for (ruh=mdp->users; ruh; ruh=ruh->nextbydomain) {
- if (ruh->localpart)
- if (!match(local, ruh->localpart->content)) {
- found++;
+
+ mdp=findnearestmaildomain(local);
+ if(mdp) {
+ for(smdp=mdp; smdp; smdp=smdp->parent) {
+ if(MDIsBanned(smdp)) {
+ free(dupemail);
+ chanservstdmessage(sender, QM_DOMAINBANNED);
+ return CMD_ERROR;
+ }
+ if((smdp->count >= smdp->limit) && (smdp->limit > 0)) {
+ free(dupemail);
+ chanservstdmessage(sender, QM_DOMAINLIMIT);
+ return CMD_ERROR;
}
+ }
}
- free(dupemail);
- if((found > mdp->actlimit) && (mdp->actlimit > 0)) {
- chanservstdmessage(sender, QM_DOMAINLIMIT);
- return CMD_ERROR;
+ mdp=findmaildomainbydomain(local);
+ if(mdp) {
+ for (ruh=mdp->users; ruh; ruh=ruh->nextbydomain) {
+ if (ruh->localpart)
+ if (!strcasecmp(dupemail, ruh->localpart->content)) {
+ found++;
+ }
+ }
+
+ if((found >= mdp->actlimit) && (mdp->actlimit > 0)) {
+ free(dupemail);
+ chanservstdmessage(sender, QM_ADDRESSLIMIT);
+ return CMD_ERROR;
+ }
}
+ mdp=findorcreatemaildomain(cargv[0]);
+
+ aup->helloattempts++;
+
rup=getreguser();
rup->status=0;
rup->ID=++lastuserID;
strncpy(rup->username,sender->nick,NICKLEN); rup->username[NICKLEN]='\0';
rup->created=time(NULL);
- rup->lastauth=time(NULL);
+ rup->lastauth=0;
rup->lastemailchange=time(NULL);
rup->flags=QUFLAG_NOTICE;
rup->languageid=0;
rup->suspendby=0;
rup->suspendexp=0;
+ rup->suspendtime=0;
+ rup->lockuntil=0;
rup->password[0]='\0';
- rup->masterpass[0]='\0';
rup->email=getsstring(cargv[0],EMAILLEN);
- rup->localpart=getsstring(local,EMAILLEN);
+ rup->lastemail=NULL;
+
+ rup->localpart=getsstring(dupemail,EMAILLEN);
+ free(dupemail);
+
rup->domain=mdp;
addregusertomaildomain(rup, rup->domain);
rup->info=NULL;
rup->checkshd=NULL;
rup->stealcount=0;
rup->fakeuser=NULL;
- rup->nicks=NULL;
addregusertohash(rup);
csa_createrandompw(rup->password, PASSLEN);
- csa_createrandompw(rup->masterpass, PASSLEN);
chanservstdmessage(sender, QM_NEWACCOUNT, rup->username,rup->email->content);
cs_log(sender,"HELLO OK created auth %s (%s)",rup->username,rup->email->content);
csdb_createuser(rup);