forked from torrentpier/ocelot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.h
33 lines (31 loc) · 939 Bytes
/
user.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef USER_H
#define USER_H
#include <atomic>
#include "ocelot.h"
class user {
private:
userid_t id;
bool deleted;
bool leechstatus;
bool protect_ip;
struct {
std::atomic<uint32_t> leeching;
std::atomic<uint32_t> seeding;
} stats;
public:
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