summaryrefslogtreecommitdiffstats
path: root/src/user.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/user.h')
-rw-r--r--src/user.h40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/user.h b/src/user.h
index bd490c5..e653d09 100644
--- a/src/user.h
+++ b/src/user.h
@@ -1,23 +1,33 @@
+#ifndef USER_H
+#define USER_H
+
+#include <atomic>
+#include "ocelot.h"
+
class user {
private:
- int id;
+ userid_t id;
+ bool deleted;
bool leechstatus;
bool protect_ip;
struct {
- unsigned int leeching;
- unsigned int seeding;
+ std::atomic<uint32_t> leeching;
+ std::atomic<uint32_t> seeding;
} stats;
public:
- user(int uid, bool leech, bool protect);
- int get_id();
- bool is_protected();
- void set_protected(bool status);
- bool can_leech();
- void set_leechstatus(bool status);
- void decr_leeching();
- void decr_seeding();
- void incr_leeching();
- void incr_seeding();
- unsigned int get_leeching();
- unsigned int get_seeding();
+ user(userid_t uid, bool leech, bool protect);
+ userid_t get_id() { return id; }
+ bool is_deleted() { return deleted; }
+ void set_deleted(bool status) { deleted = status; }
+ bool is_protected() { return protect_ip; }
+ void set_protected(bool status) { protect_ip = status; }
+ bool can_leech() { return leechstatus; }
+ void set_leechstatus(bool status) { leechstatus = status; }
+ void decr_leeching() { --stats.leeching; }
+ void decr_seeding() { --stats.seeding; }
+ void incr_leeching() { ++stats.leeching; }
+ void incr_seeding() { ++stats.seeding; }
+ uint32_t get_leeching() { return stats.leeching; }
+ uint32_t get_seeding() { return stats.seeding; }
};
+#endif