Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use expiration timestamps for user privileges #26

Merged
merged 3 commits into from
Oct 5, 2024

Conversation

mathiascode
Copy link
Member

Fixes two issues:

  • Privileges don't decrement when a user is offline
  • No way of knowing if user had privileges in the past (needed for the 'supporter' attribute in the login message)

The timestamp approach also reduces the number of writes to the database, since the timestamp is only updated when privileges are extended or reduced.

Fixes two issues:
- Privileges don't decrement when a user is offline
- No way of knowing if user had privileges in the past (needed for
  the 'supporter' attribute in the login message)

The timestamp approach also reduces the number of writes to the
database, since the timestamp is only updated when privileges are
extended or reduced.
@@ -197,28 +206,6 @@ class Sdb
upload_number = user[1].to!uint.ifThrown(0);
shared_files = user[2].to!uint.ifThrown(0);
shared_folders = user[3].to!uint.ifThrown(0);
something = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that something might be like supporter or privileged (i.e. privileges > 0), but nobody has tested the user stats response given by the official server about what happens about privileged users.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've verified that it's not related to privileges, the value is always zero no matter which user. The attribute existed in the official server software in 2001, and its value was already zero at that point.

Copy link
Contributor

@slook slook Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps then it could be the "temp-ban" timer/flag, that would be set by the server for a short time to defend against a chat flooding or in case of a dictionary attack during login?

Of course if the user is temp-banned than they could not ever see this value being anything other than 0, nor could any other querying user see their stats while they are blocked, almost as if they didn't exist.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I doubt it, but someone could verify.

@mathiascode mathiascode merged commit 0599f03 into soulfind-dev:master Oct 5, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants