save realm on user join, password change, and transfer; bump to v0.2

This commit is contained in:
Iris Lightshard 2021-10-23 09:46:20 -06:00
parent 9f1ddd0300
commit abf36856d9
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
2 changed files with 5 additions and 2 deletions

View file

@ -68,6 +68,7 @@ int protect_realm(UserInfo* table, char* uname, char* password) {
if (u != nil && u->realm != nil && scmp(uname, u->realm->master)) {
u->realm->password = hash(password, 0);
save_realm(u->cart->name, u->realm);
return 1;
}
return 0;
@ -81,6 +82,7 @@ int transfer_realm(UserInfo* table, char* from, char* to) {
return 0;
scpy(to, old_user->realm->master, 32);
save_realm(old_user->cart->name, old_user->realm);
return 1;
}
@ -121,6 +123,7 @@ int enter_realm(UserInfo* table, char* uname, char* realm_name) {
if (r != nil) {
if (j < r->max) {
u->realm = r;
save_realm(u->cart->name, r);
return 1;
} else {
return 0;
@ -215,4 +218,4 @@ int delete_realm(UserInfo* table, char* uname, char* realm) {
return 1;
else
return 0;
}
}

View file

@ -17,7 +17,7 @@
#include "realm.h"
#include "user.h"
char version[] = "0.1";
char version[] = "0.2";
int chatty9p = 0;