-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathannouncement.h
121 lines (100 loc) · 3.08 KB
/
announcement.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
#ifndef ANNOUNCEMENT_H
#define ANNOUNCEMENT_H
#include <QUuid>
#include <QDateTime>
#include <QDomDocument>
#include <QStringList>
#ifdef __cplusplus
extern "C" {
#endif
#include <openssl/rand.h>
#ifdef __cplusplus
}
#endif
#define KEY_LENGTH 512/8
#define SHA_DIGEST_LENGTH 20
class Announcement
{
private:
QString confName;
QString organizer;
QString email;
bool own;
bool audio;
bool video;
bool text;
QString desc;
QDate date;
QTime time;
int hours;
int minutes;
QString uuid;
bool isPrivate;
QStringList certs;
QString opaqueName;
QString out;
public:
Announcement();
void copy(Announcement *a);
QString getConfName() { return confName; }
QString getOrganizer() { return organizer; }
QString getEmail() { return email; }
QString getUuid() {return uuid; }
bool getAudio() { return audio; }
bool getVideo() { return video; }
bool getText() { return text; }
bool getOwner() { return own; }
QString getDesc() { return desc; }
QDate getDate() { return date; }
QTime getTime() { return time; }
int getHours() { return hours; }
int getMinutes() { return minutes; }
bool getIsPrivate() { return isPrivate; }
bool equalDigest(unsigned char *hash);
QStringList &getCerts() { return certs; }
QString getOpaqueName() { return opaqueName; }
QString getXmlOut() { return out; }
void setConfName(QString confName) { this->confName = confName; }
void setOrganizer(QString organizer) { this->organizer = organizer; }
void setEmail(QString email) { this->email = email; }
void setUuid(QString uuid) { this->uuid = uuid; }
void setOwner(bool own) { this->own = own; }
void setAudio(bool audio) { this->audio = audio; }
void setVideo(bool video) { this->video = video; }
void setText(bool text) { this->text = text; }
void setDesc(QString desc) { this->desc = desc; }
void setDate(QDate date) { this->date = date; }
void setTime(QTime time) { this->time = time; }
void setHours(int hours) { this->hours = hours; }
void setMinutes(int minutes) { this->minutes = minutes; }
void setIsPrivate(bool b) { isPrivate = b; }
void setCerts(QStringList &certs) { this->certs = certs; }
void setOpaqueName(QString opaqueName) { this->opaqueName = opaqueName; }
void setXmlOut(QString out) { this->out = out; }
void setDigest(unsigned char *hash);
void initConferenceKey();
void initAudioSessionKey();
unsigned char conferenceKey[KEY_LENGTH];
unsigned char audioSessionKey[KEY_LENGTH];
unsigned char digest[SHA_DIGEST_LENGTH];
};
QDataStream &operator<<(QDataStream &out, Announcement *a);
class FetchedAnnouncement : public Announcement
{
public:
FetchedAnnouncement();
void refreshReceived();
bool isStaled();
bool needRefresh();
bool isDismissed() { return dismissed; }
void setDismissed(bool dismissed) { this->dismissed = dismissed; }
bool getIsEligible() { return isEligible; }
void setIsEligible(bool b) { isEligible = b; }
private:
QDateTime timestamp;
bool dismissed;
bool isEligible;
};
QString &operator<<(QString &out, Announcement *a);
QDomDocument &operator>>(QDomDocument &in, Announcement *a);
#endif