-
Notifications
You must be signed in to change notification settings - Fork 0
/
message.cpp
80 lines (62 loc) · 1.32 KB
/
message.cpp
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
#include "message.h"
namespace qtxmpp {
Message::Message()
{
m_attributes["type"] = "chat";
Serializable serializable;
serializable.setName("body");
serializable.setText(false);
Serializable serializable2;
serializable2.setName("");
serializable2.setText(true);
setText(false);
setName("message");
serializable.addChild(serializable2);
addChild(serializable);
}
QString Message::getMessage()
{
return m_message;
}
QString Message::getSubject()
{
return m_subject;
}
User *Message::getFrom()
{
return m_from;
}
User *Message::getTo()
{
return m_to;
}
void Message::setMessage(QString message)
{
m_message = message;
deleteChildren();
Serializable serializable;
serializable.setName("body");
serializable.setText(false);
Serializable serializable2;
serializable2.setName(message);
serializable2.setText(true);
setText(false);
setName("message");
serializable.addChild(serializable2);
addChild(serializable);
}
void Message::setSubject(QString subject)
{
m_subject = subject;
}
void Message::setTo(User *to)
{
m_to = to;
m_attributes["to"] = to->getJid() + "/" + to->getRessource();
}
void Message::setFrom(User *from)
{
m_from = from;
m_attributes["from"] = from->getJid() + "/" + from->getRessource();
}
}