23 #include <QSharedData>
25 #include <TelepathyQt/ContactManager>
26 #include <TelepathyQt/Connection>
28 #include <TelepathyLoggerQt4/Entity>
32 class Message::Private :
public QSharedData {
41 Tp::ChannelTextMessageType messageType;
42 QVariantMap properties;
59 d->sentTime = original.sent();
60 d->token = original.messageToken();
61 d->messageType = original.messageType();
70 context.
account()->connection()->selfContact()->id());
78 d->sentTime = original.sent();
79 if (d->sentTime.isNull()) {
80 d->sentTime = original.received();
83 d->token = original.messageToken();
84 d->messageType = original.messageType();
85 d->isHistory = original.isScrollback();
90 if (!original.sender().isNull()) {
91 setProperty(
"senderName", original.sender()->alias());
92 setProperty(
"senderAvatar", original.sender()->avatarData().fileName);
95 setProperty(
"senderName", original.senderNickname());
102 d->sentTime = original->timestamp();
103 d->token = original->messageToken();
104 d->messageType = original->messageType();
107 setProperty(
"senderName", original->sender()->alias());
108 setProperty(
"senderId", original->sender()->identifier());
111 if (original->sender()->identifier() == context.
account()->normalizedName()) {
114 connection()->selfContact()->avatarData().fileName);
118 context.
channel()->targetContact()->avatarData().fileName);
128 d->sentTime = QDateTime::currentDateTime();
129 d->messageType = Tp::ChannelTextMessageTypeNormal;
131 d->isHistory =
false;
135 connection()->selfContact()->id());
137 connection()->selfContact()->avatarData().fileName);
158 d->mainPart = message;
170 if (!d->scripts.contains(script)) {
171 d->scripts << script;
177 QString msg = d->mainPart + QLatin1String(
"\n") +
178 d->parts.join(QLatin1String(
"\n"));
186 if (d->scripts.empty()) {
190 QString finalScript = d->scripts.join(QLatin1String(
""));
192 if (!finalScript.isEmpty()) {
193 finalScript.append(QLatin1String(
"false;"));
202 return d->properties[QLatin1String(name)];
207 d->properties[QLatin1String(name)] = value;
222 return d->messageType;
227 return property(
"senderName").toString();
232 return property(
"senderId").toString();
237 return d->parts.size();