summaryrefslogtreecommitdiff
path: root/user.c
diff options
context:
space:
mode:
Diffstat (limited to 'user.c')
-rw-r--r--user.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/user.c b/user.c
index 4fa0174..dc4b5ed 100644
--- a/user.c
+++ b/user.c
@@ -12,8 +12,7 @@ void user_init() {
memset(users, 0, sizeof(struct user_t) * USERS_MAX);
}
-struct user_t *user_get(char *_nick) {
- char *nick = nick_get(_nick);
+struct user_t *user_get(char *nick) {
unsigned long hash = sdbm(nick);
int index = hash % USERS_MAX;
@@ -35,9 +34,11 @@ struct user_t *user_get(char *_nick) {
memset(user->lines, 0, 24*4 * sizeof(unsigned long));
user->words = user->characters = user->kicks = user->kicked = 0;
user->next = NULL;
+ char *_nick = nick_get(nick);
+ user->real_user = strcmp(nick, _nick) ? user_get(_nick) : NULL;
}
- return user;
+ return (user->real_user ? user->real_user : user);
}
void user_free() {