-
Notifications
You must be signed in to change notification settings - Fork 1
/
sup.h
64 lines (48 loc) · 1.29 KB
/
sup.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef SUP_H
#define SUP_H
#include <QObject>
#include <QMap>
#include <QList>
class MessageProcessor;
class Database;
class NameDatabase;
class Subscribe;
class Permission;
class SupEntry
{
private:
qint64 id;
QString txt;
public:
SupEntry() {}
SupEntry(qint64 _id, const QString &str) : id(_id), txt(str) {}
qint64 Id() const {return id;}
QString &text() {return txt;}
};
class Sup : public QObject
{
Q_OBJECT
private:
static const int MaxSupPerGroup;
static const int DistanceBetweenSup;
Database *database;
NameDatabase *nameDatabase;
MessageProcessor *messageProcessor;
Permission *permission;
Subscribe *subscribe;
QMap<qint64, qint64> lastSup;
typedef QList<SupEntry> SupEntries;
QMap<qint64, SupEntries> data;
void loadData();
bool addEntry(qint64 gid, const QString &str);
void delEntry(qint64 gid, int id);
void editEntry(qint64 gid, int id, const QString &str);
void freshSup();
public:
explicit Sup(Database *db, NameDatabase *namedb, MessageProcessor *msgproc, Permission *perm,
Subscribe *sub, QObject *parent = 0);
void input(const QString &gid, const QString &uid, const QString &str, bool inpm, bool isAdmin);
void groupDeleted(qint64 gid);
public slots:
};
#endif // SUP_H