aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--command.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/command.c b/command.c
index 2a75e7f..bcfa2e8 100644
--- a/command.c
+++ b/command.c
@@ -32,6 +32,11 @@ static bool cmd_login(struct conn_data *data,const char *tag,const char **args){
i64 userid=db_find_user(args[0]);
if(userid==-1){
net_send_error(data->fd,tag,"User not found");
+ if(data->userid!=-1){
+ userdata_unregister(data->userid,data->fd);
+ broadcast_online_change(data->userid);
+ data->userid=-1;
+ }
return false;
}
char *pass=db_get_pass(userid);