strcpy(user->ident, &cmask[ii]);
ii = i+1;
} else if(cmask[i] == '\0') {
- if(user == NULL) return NULL;
+ if(user == NULL) {
+ //nick only
+ user = malloc(sizeof(*user));
+ if (!user)
+ {
+ perror("malloc() failed");
+ return NULL;
+ }
+ strcpy(user->nick, cmask);
+ user->created = time(0);
+ user->ident[0] = 0;
+ user->host[0] = 0;
+ user->realname[0] = 0;
+ user->flags = 0;
+ user->channel = NULL;
+ return user;
+ }
strcpy(user->host, &cmask[ii]);
}
}