Merge lp:~boiko/telephony-service/protocol_background_and_overlay into lp:telephony-service
- protocol_background_and_overlay
- Merge into trunk
Proposed by
Gustavo Pichorim Boiko
Status: | Superseded |
---|---|
Proposed branch: | lp:~boiko/telephony-service/protocol_background_and_overlay |
Merge into: | lp:telephony-service |
Diff against target: |
930 lines (+293/-64) 24 files modified
handler/Handler.xml (+1/-0) handler/handlerdbus.cpp (+2/-2) handler/handlerdbus.h (+1/-1) handler/texthandler.cpp (+90/-20) handler/texthandler.h (+3/-2) libtelephonyservice/chatmanager.cpp (+10/-6) libtelephonyservice/chatmanager.h (+1/-1) libtelephonyservice/protocol.cpp (+23/-3) libtelephonyservice/protocol.h (+18/-1) protocols/multimedia.protocol (+0/-4) protocols/ofono.protocol (+1/-0) tests/common/mock/MockConnection.xml (+5/-2) tests/common/mock/connection.cpp (+1/-1) tests/common/mock/connection.h (+1/-1) tests/common/mock/mockconnectiondbus.cpp (+2/-2) tests/common/mock/mockconnectiondbus.h (+1/-1) tests/common/mock/textchannel.cpp (+19/-3) tests/common/mock/textchannel.h (+1/-1) tests/handler/HandlerTest.cpp (+81/-3) tests/handler/handlercontroller.cpp (+11/-2) tests/handler/handlercontroller.h (+2/-1) tests/libtelephonyservice/ChatManagerTest.cpp (+4/-4) tests/libtelephonyservice/ProtocolTest.cpp (+12/-3) tests/libtelephonyservice/testProtocols/foo.protocol (+3/-0) |
To merge this branch: | bzr merge lp:~boiko/telephony-service/protocol_background_and_overlay |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tiago Salem Herrmann (community) | Approve | ||
PS Jenkins bot | continuous-integration | Needs Fixing | |
Review via email: mp+278643@code.launchpad.net |
This proposal has been superseded by a proposal from 2015-12-09.
Commit message
Expose extra information about the protocols we support.
Description of the change
Expose extra information about the protocols we support.
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Needs Fixing
(continuous-integration)
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote : | # |
Looks good.
review:
Approve
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote : | # |
Ops, actually, removing the multimedia.protocol file make lots of tests fail.
review:
Needs Fixing
- 1147. By Gustavo Pichorim Boiko
-
Re-add the multimedia protocol.
Revision history for this message
Tiago Salem Herrmann (tiagosh) : | # |
review:
Needs Fixing
- 1148. By Gustavo Pichorim Boiko
-
Rename property.
Revision history for this message
Tiago Salem Herrmann (tiagosh) wrote : | # |
looks good now.
Thanks.
review:
Approve
- 1149. By Gustavo Pichorim Boiko
-
Merge parent branch
- 1150. By Gustavo Pichorim Boiko
-
Merge parent
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'assets/message_watermark.png' | |||
2 | 0 | Binary files assets/message_watermark.png 1970-01-01 00:00:00 +0000 and assets/message_watermark.png 2015-12-09 13:28:53 +0000 differ | 0 | Binary files assets/message_watermark.png 1970-01-01 00:00:00 +0000 and assets/message_watermark.png 2015-12-09 13:28:53 +0000 differ |
3 | === modified file 'handler/Handler.xml' | |||
4 | --- handler/Handler.xml 2015-11-17 17:23:54 +0000 | |||
5 | +++ handler/Handler.xml 2015-12-09 13:28:53 +0000 | |||
6 | @@ -19,6 +19,7 @@ | |||
7 | 19 | <arg name="recipients" type="as" direction="in"/> | 19 | <arg name="recipients" type="as" direction="in"/> |
8 | 20 | <arg name="message" type="s" direction="in"/> | 20 | <arg name="message" type="s" direction="in"/> |
9 | 21 | <arg name="attachments" type="a(sss)" direction="in"/> | 21 | <arg name="attachments" type="a(sss)" direction="in"/> |
10 | 22 | <arg name="accountIdOut" type="s" direction="out"/> | ||
11 | 22 | <annotation name="org.qtproject.QtDBus.QtTypeName.In3" value="AttachmentList"/> | 23 | <annotation name="org.qtproject.QtDBus.QtTypeName.In3" value="AttachmentList"/> |
12 | 23 | <arg name="properties" type="a{sv}" direction="in"/> | 24 | <arg name="properties" type="a{sv}" direction="in"/> |
13 | 24 | <annotation name="org.qtproject.QtDBus.QtTypeName.In4" value="QVariantMap"/> | 25 | <annotation name="org.qtproject.QtDBus.QtTypeName.In4" value="QVariantMap"/> |
14 | 25 | 26 | ||
15 | === modified file 'handler/handlerdbus.cpp' | |||
16 | --- handler/handlerdbus.cpp 2015-11-17 17:23:54 +0000 | |||
17 | +++ handler/handlerdbus.cpp 2015-12-09 13:28:53 +0000 | |||
18 | @@ -93,9 +93,9 @@ | |||
19 | 93 | return true; | 93 | return true; |
20 | 94 | } | 94 | } |
21 | 95 | 95 | ||
23 | 96 | void HandlerDBus::SendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const AttachmentList &attachments, const QVariantMap &properties) | 96 | QString HandlerDBus::SendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const AttachmentList &attachments, const QVariantMap &properties) |
24 | 97 | { | 97 | { |
26 | 98 | TextHandler::instance()->sendMessage(accountId, recipients, message, attachments, properties); | 98 | return TextHandler::instance()->sendMessage(accountId, recipients, message, attachments, properties); |
27 | 99 | } | 99 | } |
28 | 100 | 100 | ||
29 | 101 | void HandlerDBus::AcknowledgeMessages(const QStringList &numbers, const QStringList &messageIds, const QString &accountId) | 101 | void HandlerDBus::AcknowledgeMessages(const QStringList &numbers, const QStringList &messageIds, const QString &accountId) |
30 | 102 | 102 | ||
31 | === modified file 'handler/handlerdbus.h' | |||
32 | --- handler/handlerdbus.h 2015-11-17 17:23:54 +0000 | |||
33 | +++ handler/handlerdbus.h 2015-12-09 13:28:53 +0000 | |||
34 | @@ -55,7 +55,7 @@ | |||
35 | 55 | bool connectToBus(); | 55 | bool connectToBus(); |
36 | 56 | 56 | ||
37 | 57 | // messages related | 57 | // messages related |
39 | 58 | Q_NOREPLY void SendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const AttachmentList &attachments, const QVariantMap &properties); | 58 | QString SendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const AttachmentList &attachments, const QVariantMap &properties); |
40 | 59 | Q_NOREPLY void AcknowledgeMessages(const QStringList &numbers, const QStringList &messageIds, const QString &accountId); | 59 | Q_NOREPLY void AcknowledgeMessages(const QStringList &numbers, const QStringList &messageIds, const QString &accountId); |
41 | 60 | Q_NOREPLY void StartChat(const QString &accountId, const QStringList &participants); | 60 | Q_NOREPLY void StartChat(const QString &accountId, const QStringList &participants); |
42 | 61 | Q_NOREPLY void StartChatRoom(const QString &accountId, const QStringList &initialParticipants, const QVariantMap &properties); | 61 | Q_NOREPLY void StartChatRoom(const QString &accountId, const QStringList &initialParticipants, const QVariantMap &properties); |
43 | 62 | 62 | ||
44 | === modified file 'handler/texthandler.cpp' | |||
45 | --- handler/texthandler.cpp 2015-11-17 17:23:54 +0000 | |||
46 | +++ handler/texthandler.cpp 2015-12-09 13:28:53 +0000 | |||
47 | @@ -1,8 +1,9 @@ | |||
48 | 1 | /* | 1 | /* |
50 | 2 | * Copyright (C) 2012-2013 Canonical, Ltd. | 2 | * Copyright (C) 2012-2015 Canonical, Ltd. |
51 | 3 | * | 3 | * |
52 | 4 | * Authors: | 4 | * Authors: |
53 | 5 | * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com> | 5 | * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com> |
54 | 6 | * Tiago Salem Herrmann <tiago.herrmann@canonical.com> | ||
55 | 6 | * | 7 | * |
56 | 7 | * This file is part of telephony-service. | 8 | * This file is part of telephony-service. |
57 | 8 | * | 9 | * |
58 | @@ -32,12 +33,20 @@ | |||
59 | 32 | 33 | ||
60 | 33 | #define SMIL_TEXT_REGION "<region id=\"Text\" width=\"100%\" height=\"100%\" fit=\"scroll\" />" | 34 | #define SMIL_TEXT_REGION "<region id=\"Text\" width=\"100%\" height=\"100%\" fit=\"scroll\" />" |
61 | 34 | #define SMIL_IMAGE_REGION "<region id=\"Image\" width=\"100%\" height=\"100%\" fit=\"meet\" />" | 35 | #define SMIL_IMAGE_REGION "<region id=\"Image\" width=\"100%\" height=\"100%\" fit=\"meet\" />" |
62 | 36 | #define SMIL_VIDEO_REGION "<region id=\"Video\" width=\"100%\" height=\"100%\" fit=\"meet\" />" | ||
63 | 37 | #define SMIL_AUDIO_REGION "<region id=\"Audio\" width=\"100%\" height=\"100%\" fit=\"meet\" />" | ||
64 | 35 | #define SMIL_TEXT_PART "<par dur=\"3s\">\ | 38 | #define SMIL_TEXT_PART "<par dur=\"3s\">\ |
65 | 36 | <text src=\"cid:%1\" region=\"Text\" />\ | 39 | <text src=\"cid:%1\" region=\"Text\" />\ |
66 | 37 | </par>" | 40 | </par>" |
67 | 38 | #define SMIL_IMAGE_PART "<par dur=\"5000ms\">\ | 41 | #define SMIL_IMAGE_PART "<par dur=\"5000ms\">\ |
68 | 39 | <img src=\"cid:%1\" region=\"Image\" />\ | 42 | <img src=\"cid:%1\" region=\"Image\" />\ |
69 | 40 | </par>" | 43 | </par>" |
70 | 44 | #define SMIL_VIDEO_PART "<par>\ | ||
71 | 45 | <video src=\"cid:%1\" region=\"Video\" />\ | ||
72 | 46 | </par>" | ||
73 | 47 | #define SMIL_AUDIO_PART "<par>\ | ||
74 | 48 | <audio src=\"cid:%1\" region=\"Audio\" />\ | ||
75 | 49 | </par>" | ||
76 | 41 | 50 | ||
77 | 42 | #define SMIL_FILE "<smil>\ | 51 | #define SMIL_FILE "<smil>\ |
78 | 43 | <head>\ | 52 | <head>\ |
79 | @@ -139,7 +148,7 @@ | |||
80 | 139 | // start chatting to the contacts | 148 | // start chatting to the contacts |
81 | 140 | Q_FOREACH(Tp::ContactPtr contact, contacts) { | 149 | Q_FOREACH(Tp::ContactPtr contact, contacts) { |
82 | 141 | // hold the ContactPtr to make sure its refcounting stays bigger than 0 | 150 | // hold the ContactPtr to make sure its refcounting stays bigger than 0 |
84 | 142 | mContacts[contact->id()] = contact; | 151 | mContacts[account->uniqueIdentifier()][contact->id()] = contact; |
85 | 143 | } | 152 | } |
86 | 144 | } | 153 | } |
87 | 145 | 154 | ||
88 | @@ -148,7 +157,7 @@ | |||
89 | 148 | Tp::MessagePartList message; | 157 | Tp::MessagePartList message; |
90 | 149 | Tp::MessagePart header; | 158 | Tp::MessagePart header; |
91 | 150 | QString smil, regions, parts; | 159 | QString smil, regions, parts; |
93 | 151 | bool hasImage = false, hasText = false, isMMS = false; | 160 | bool hasImage = false, hasText = false, hasVideo = false, hasAudio = false, isMMS = false; |
94 | 152 | 161 | ||
95 | 153 | AccountEntry *account = TelepathyHelper::instance()->accountForId(pendingMessage.accountId); | 162 | AccountEntry *account = TelepathyHelper::instance()->accountForId(pendingMessage.accountId); |
96 | 154 | if (!account) { | 163 | if (!account) { |
97 | @@ -207,6 +216,16 @@ | |||
98 | 207 | fileData = attachmentFile.readAll(); | 216 | fileData = attachmentFile.readAll(); |
99 | 208 | } | 217 | } |
100 | 209 | } | 218 | } |
101 | 219 | } else if (attachment.contentType.startsWith("video/")) { | ||
102 | 220 | if (isMMS) { | ||
103 | 221 | hasVideo = true; | ||
104 | 222 | parts += QString(SMIL_VIDEO_PART).arg(attachment.id); | ||
105 | 223 | } | ||
106 | 224 | } else if (attachment.contentType.startsWith("audio/")) { | ||
107 | 225 | if (isMMS) { | ||
108 | 226 | hasAudio = true; | ||
109 | 227 | parts += QString(SMIL_AUDIO_PART).arg(attachment.id); | ||
110 | 228 | } | ||
111 | 210 | } else if (attachment.contentType.startsWith("text/plain")) { | 229 | } else if (attachment.contentType.startsWith("text/plain")) { |
112 | 211 | if (isMMS) { | 230 | if (isMMS) { |
113 | 212 | hasText = true; | 231 | hasText = true; |
114 | @@ -230,6 +249,14 @@ | |||
115 | 230 | attachmentFile.remove(); | 249 | attachmentFile.remove(); |
116 | 231 | } | 250 | } |
117 | 232 | 251 | ||
118 | 252 | if (hasVideo) { | ||
119 | 253 | regions += QString(SMIL_VIDEO_REGION); | ||
120 | 254 | } | ||
121 | 255 | |||
122 | 256 | if (hasAudio) { | ||
123 | 257 | regions += QString(SMIL_AUDIO_REGION); | ||
124 | 258 | } | ||
125 | 259 | |||
126 | 233 | if (hasText) { | 260 | if (hasText) { |
127 | 234 | regions += QString(SMIL_TEXT_REGION); | 261 | regions += QString(SMIL_TEXT_REGION); |
128 | 235 | } | 262 | } |
129 | @@ -274,28 +301,54 @@ | |||
130 | 274 | return message; | 301 | return message; |
131 | 275 | } | 302 | } |
132 | 276 | 303 | ||
134 | 277 | void TextHandler::sendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const AttachmentList &attachments, const QVariantMap &properties) | 304 | QString TextHandler::sendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const AttachmentList &attachments, const QVariantMap &properties) |
135 | 278 | { | 305 | { |
136 | 279 | AccountEntry *account = TelepathyHelper::instance()->accountForId(accountId); | 306 | AccountEntry *account = TelepathyHelper::instance()->accountForId(accountId); |
137 | 280 | if (!account) { | 307 | if (!account) { |
138 | 281 | // account does not exist | 308 | // account does not exist |
140 | 282 | return; | 309 | return QString(); |
141 | 283 | } | 310 | } |
142 | 284 | 311 | ||
143 | 285 | // check if the message should be sent via multimedia account | 312 | // check if the message should be sent via multimedia account |
157 | 286 | if (account->type() == AccountEntry::PhoneAccount) { | 313 | // we just use fallback to 1-1 chats |
158 | 287 | // we just use fallback to 1-1 chats | 314 | if (account->type() == AccountEntry::PhoneAccount && recipients.size() == 1) { |
159 | 288 | if (recipients.size() == 1) { | 315 | Q_FOREACH(AccountEntry *newAccount, TelepathyHelper::instance()->accounts()) { |
160 | 289 | 316 | // TODO: we have to find the multimedia account that matches the same phone number, | |
161 | 290 | Q_FOREACH(AccountEntry *newAccount, TelepathyHelper::instance()->accounts()) { | 317 | // but for now we just pick any multimedia connected account |
162 | 291 | // TODO: we have to find the multimedia account that matches the same phone number, | 318 | if (newAccount->type() != AccountEntry::MultimediaAccount) { |
163 | 292 | // but for now we just pick any multimedia connected account | 319 | continue; |
164 | 293 | if (newAccount->type() == AccountEntry::MultimediaAccount) { | 320 | } |
165 | 294 | if (newAccount->connected()) { | 321 | // FIXME: the fallback implementation needs to be changed to use protocol info and create a map of |
166 | 295 | account = newAccount; | 322 | // accounts. Also, it needs to check connection capabilities to determine if we can send message |
167 | 296 | break; | 323 | // to offline contacts. |
168 | 297 | } | 324 | bool shouldFallback = false; |
169 | 298 | } | 325 | // if the account is offline, dont fallback to this account |
170 | 326 | if (!newAccount->connected()) { | ||
171 | 327 | continue; | ||
172 | 328 | } | ||
173 | 329 | QList<Tp::TextChannelPtr> channels = existingChannels(recipients, newAccount->accountId()); | ||
174 | 330 | // check if we have a channel for this contact already and get the contact pointer from there, | ||
175 | 331 | // this way we avoid doing the while(op->isFinished()) all the time | ||
176 | 332 | if (!channels.isEmpty()) { | ||
177 | 333 | // if the contact is known, force fallback to this account | ||
178 | 334 | Tp::Presence presence = channels.first()->targetContact()->presence(); | ||
179 | 335 | shouldFallback = (presence.type() == Tp::ConnectionPresenceTypeAvailable || | ||
180 | 336 | presence.type() == Tp::ConnectionPresenceTypeOffline); | ||
181 | 337 | } else { | ||
182 | 338 | Tp::PendingOperation *op = newAccount->account()->connection()->contactManager()->contactsForIdentifiers(recipients); | ||
183 | 339 | while (!op->isFinished()) { | ||
184 | 340 | qApp->processEvents(); | ||
185 | 341 | } | ||
186 | 342 | Tp::PendingContacts *pc = qobject_cast<Tp::PendingContacts*>(op); | ||
187 | 343 | if (pc) { | ||
188 | 344 | Tp::Presence presence = pc->contacts().first()->presence(); | ||
189 | 345 | shouldFallback = (presence.type() == Tp::ConnectionPresenceTypeAvailable || | ||
190 | 346 | presence.type() == Tp::ConnectionPresenceTypeOffline); | ||
191 | 347 | } | ||
192 | 348 | } | ||
193 | 349 | if (shouldFallback) { | ||
194 | 350 | account = newAccount; | ||
195 | 351 | break; | ||
196 | 299 | } | 352 | } |
197 | 300 | } | 353 | } |
198 | 301 | } | 354 | } |
199 | @@ -304,21 +357,24 @@ | |||
200 | 304 | QStringList sortedRecipients = recipients; | 357 | QStringList sortedRecipients = recipients; |
201 | 305 | sortedRecipients.sort(); | 358 | sortedRecipients.sort(); |
202 | 306 | PendingMessage pendingMessage = {account->accountId(), sortedRecipients, message, attachments, properties}; | 359 | PendingMessage pendingMessage = {account->accountId(), sortedRecipients, message, attachments, properties}; |
203 | 360 | |||
204 | 307 | if (!account->connected()) { | 361 | if (!account->connected()) { |
205 | 308 | mPendingMessages.append(pendingMessage); | 362 | mPendingMessages.append(pendingMessage); |
207 | 309 | return; | 363 | return account->accountId(); |
208 | 310 | } | 364 | } |
209 | 311 | 365 | ||
210 | 312 | QList<Tp::TextChannelPtr> channels = existingChannels(recipients, account->accountId()); | 366 | QList<Tp::TextChannelPtr> channels = existingChannels(recipients, account->accountId()); |
211 | 313 | if (channels.isEmpty()) { | 367 | if (channels.isEmpty()) { |
212 | 314 | mPendingMessages.append(pendingMessage); | 368 | mPendingMessages.append(pendingMessage); |
213 | 315 | startChat(sortedRecipients, account->accountId()); | 369 | startChat(sortedRecipients, account->accountId()); |
215 | 316 | return; | 370 | return account->accountId(); |
216 | 317 | } | 371 | } |
217 | 318 | 372 | ||
218 | 319 | connect(channels.last()->send(buildMessage(pendingMessage)), | 373 | connect(channels.last()->send(buildMessage(pendingMessage)), |
219 | 320 | SIGNAL(finished(Tp::PendingOperation*)), | 374 | SIGNAL(finished(Tp::PendingOperation*)), |
220 | 321 | SLOT(onMessageSent(Tp::PendingOperation*))); | 375 | SLOT(onMessageSent(Tp::PendingOperation*))); |
221 | 376 | |||
222 | 377 | return account->accountId(); | ||
223 | 322 | } | 378 | } |
224 | 323 | 379 | ||
225 | 324 | void TextHandler::acknowledgeMessages(const QStringList &recipients, const QStringList &messageIds, const QString &accountId) | 380 | void TextHandler::acknowledgeMessages(const QStringList &recipients, const QStringList &messageIds, const QString &accountId) |
226 | @@ -351,12 +407,26 @@ | |||
227 | 351 | } | 407 | } |
228 | 352 | } | 408 | } |
229 | 353 | 409 | ||
230 | 410 | void TextHandler::onTextChannelInvalidated() | ||
231 | 411 | { | ||
232 | 412 | Tp::TextChannelPtr textChannel(qobject_cast<Tp::TextChannel*>(sender())); | ||
233 | 413 | mChannels.removeAll(textChannel); | ||
234 | 414 | AccountEntry *account = TelepathyHelper::instance()->accountForConnection(textChannel->connection()); | ||
235 | 415 | if (account) { | ||
236 | 416 | mContacts.remove(account->accountId()); | ||
237 | 417 | } | ||
238 | 418 | } | ||
239 | 419 | |||
240 | 354 | void TextHandler::onTextChannelAvailable(Tp::TextChannelPtr channel) | 420 | void TextHandler::onTextChannelAvailable(Tp::TextChannelPtr channel) |
241 | 355 | { | 421 | { |
242 | 356 | AccountEntry *account = TelepathyHelper::instance()->accountForConnection(channel->connection()); | 422 | AccountEntry *account = TelepathyHelper::instance()->accountForConnection(channel->connection()); |
243 | 357 | if (!account) { | 423 | if (!account) { |
244 | 358 | return; | 424 | return; |
245 | 359 | } | 425 | } |
246 | 426 | connect(channel.data(), | ||
247 | 427 | SIGNAL(invalidated(Tp::DBusProxy*,const QString&, const QString&)), | ||
248 | 428 | SLOT(onTextChannelInvalidated())); | ||
249 | 429 | |||
250 | 360 | QString accountId = account->accountId(); | 430 | QString accountId = account->accountId(); |
251 | 361 | mChannels.append(channel); | 431 | mChannels.append(channel); |
252 | 362 | 432 | ||
253 | 363 | 433 | ||
254 | === modified file 'handler/texthandler.h' | |||
255 | --- handler/texthandler.h 2015-11-17 17:23:54 +0000 | |||
256 | +++ handler/texthandler.h 2015-12-09 13:28:53 +0000 | |||
257 | @@ -47,12 +47,13 @@ | |||
258 | 47 | void startChat(const Tp::AccountPtr &account, const Tp::Contacts &contacts); | 47 | void startChat(const Tp::AccountPtr &account, const Tp::Contacts &contacts); |
259 | 48 | 48 | ||
260 | 49 | public Q_SLOTS: | 49 | public Q_SLOTS: |
262 | 50 | void sendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const AttachmentList &attachments, const QVariantMap &properties); | 50 | QString sendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const AttachmentList &attachments, const QVariantMap &properties); |
263 | 51 | void acknowledgeMessages(const QStringList &recipients, const QStringList &messageIds, const QString &accountId); | 51 | void acknowledgeMessages(const QStringList &recipients, const QStringList &messageIds, const QString &accountId); |
264 | 52 | void acknowledgeAllMessages(const QStringList &recipients, const QString &accountId); | 52 | void acknowledgeAllMessages(const QStringList &recipients, const QString &accountId); |
265 | 53 | 53 | ||
266 | 54 | protected Q_SLOTS: | 54 | protected Q_SLOTS: |
267 | 55 | void onTextChannelAvailable(Tp::TextChannelPtr channel); | 55 | void onTextChannelAvailable(Tp::TextChannelPtr channel); |
268 | 56 | void onTextChannelInvalidated(); | ||
269 | 56 | void onContactsAvailable(Tp::PendingOperation *op); | 57 | void onContactsAvailable(Tp::PendingOperation *op); |
270 | 57 | void onMessageSent(Tp::PendingOperation *op); | 58 | void onMessageSent(Tp::PendingOperation *op); |
271 | 58 | void onConnectedChanged(); | 59 | void onConnectedChanged(); |
272 | @@ -65,7 +66,7 @@ | |||
273 | 65 | Tp::MessagePartList buildMessage(const PendingMessage &pendingMessage); | 66 | Tp::MessagePartList buildMessage(const PendingMessage &pendingMessage); |
274 | 66 | 67 | ||
275 | 67 | QList<Tp::TextChannelPtr> mChannels; | 68 | QList<Tp::TextChannelPtr> mChannels; |
277 | 68 | QMap<QString, Tp::ContactPtr> mContacts; | 69 | QMap<QString, QMap<QString, Tp::ContactPtr> > mContacts; |
278 | 69 | QList<PendingMessage> mPendingMessages; | 70 | QList<PendingMessage> mPendingMessages; |
279 | 70 | }; | 71 | }; |
280 | 71 | 72 | ||
281 | 72 | 73 | ||
282 | === modified file 'libtelephonyservice/chatmanager.cpp' | |||
283 | --- libtelephonyservice/chatmanager.cpp 2015-11-17 17:23:54 +0000 | |||
284 | +++ libtelephonyservice/chatmanager.cpp 2015-12-09 13:28:53 +0000 | |||
285 | @@ -95,12 +95,12 @@ | |||
286 | 95 | return manager; | 95 | return manager; |
287 | 96 | } | 96 | } |
288 | 97 | 97 | ||
290 | 98 | void ChatManager::sendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const QVariant &attachments, const QVariantMap &properties) | 98 | QString ChatManager::sendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const QVariant &attachments, const QVariantMap &properties) |
291 | 99 | { | 99 | { |
292 | 100 | AccountEntry *account = TelepathyHelper::instance()->accountForId(accountId); | 100 | AccountEntry *account = TelepathyHelper::instance()->accountForId(accountId); |
293 | 101 | 101 | ||
294 | 102 | if (!account) { | 102 | if (!account) { |
296 | 103 | return; | 103 | return QString(); |
297 | 104 | } | 104 | } |
298 | 105 | 105 | ||
299 | 106 | // check if files should be copied to a temporary location before passing them to handler | 106 | // check if files should be copied to a temporary location before passing them to handler |
300 | @@ -121,16 +121,16 @@ | |||
301 | 121 | tmpFile.setAutoRemove(false); | 121 | tmpFile.setAutoRemove(false); |
302 | 122 | if (!tmpFile.open()) { | 122 | if (!tmpFile.open()) { |
303 | 123 | qWarning() << "Unable to create a temporary file"; | 123 | qWarning() << "Unable to create a temporary file"; |
305 | 124 | return; | 124 | return QString(); |
306 | 125 | } | 125 | } |
307 | 126 | QFile originalFile(list.at(2).toString()); | 126 | QFile originalFile(list.at(2).toString()); |
308 | 127 | if (!originalFile.open(QIODevice::ReadOnly)) { | 127 | if (!originalFile.open(QIODevice::ReadOnly)) { |
309 | 128 | qWarning() << "Attachment file not found"; | 128 | qWarning() << "Attachment file not found"; |
311 | 129 | return; | 129 | return QString(); |
312 | 130 | } | 130 | } |
313 | 131 | if (tmpFile.write(originalFile.readAll()) == -1) { | 131 | if (tmpFile.write(originalFile.readAll()) == -1) { |
314 | 132 | qWarning() << "Failed to write attachment to a temporary file"; | 132 | qWarning() << "Failed to write attachment to a temporary file"; |
316 | 133 | return; | 133 | return QString(); |
317 | 134 | } | 134 | } |
318 | 135 | newAttachment.filePath = tmpFile.fileName(); | 135 | newAttachment.filePath = tmpFile.fileName(); |
319 | 136 | tmpFile.close(); | 136 | tmpFile.close(); |
320 | @@ -142,7 +142,11 @@ | |||
321 | 142 | } | 142 | } |
322 | 143 | 143 | ||
323 | 144 | QDBusInterface *phoneAppHandler = TelepathyHelper::instance()->handlerInterface(); | 144 | QDBusInterface *phoneAppHandler = TelepathyHelper::instance()->handlerInterface(); |
325 | 145 | phoneAppHandler->call("SendMessage", account->accountId(), recipients, message, QVariant::fromValue(newAttachments), properties); | 145 | QDBusReply<QString> reply = phoneAppHandler->call("SendMessage", account->accountId(), recipients, message, QVariant::fromValue(newAttachments), properties); |
326 | 146 | if (reply.isValid()) { | ||
327 | 147 | return reply.value(); | ||
328 | 148 | } | ||
329 | 149 | return QString(); | ||
330 | 146 | } | 150 | } |
331 | 147 | 151 | ||
332 | 148 | void ChatManager::onTextChannelAvailable(Tp::TextChannelPtr channel) | 152 | void ChatManager::onTextChannelAvailable(Tp::TextChannelPtr channel) |
333 | 149 | 153 | ||
334 | === modified file 'libtelephonyservice/chatmanager.h' | |||
335 | --- libtelephonyservice/chatmanager.h 2015-11-17 17:23:54 +0000 | |||
336 | +++ libtelephonyservice/chatmanager.h 2015-12-09 13:28:53 +0000 | |||
337 | @@ -39,7 +39,7 @@ | |||
338 | 39 | public: | 39 | public: |
339 | 40 | static ChatManager *instance(); | 40 | static ChatManager *instance(); |
340 | 41 | 41 | ||
342 | 42 | Q_INVOKABLE void sendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const QVariant &attachments = QVariant(), const QVariantMap &properties = QVariantMap()); | 42 | Q_INVOKABLE QString sendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const QVariant &attachments = QVariant(), const QVariantMap &properties = QVariantMap()); |
343 | 43 | Q_INVOKABLE ChatEntry *chatEntryForParticipants(const QString &accountId, const QStringList &participants, bool create = false); | 43 | Q_INVOKABLE ChatEntry *chatEntryForParticipants(const QString &accountId, const QStringList &participants, bool create = false); |
344 | 44 | Q_INVOKABLE ChatEntry *chatEntryForChatRoom(const QString &accountId, const QVariantMap &properties, bool create); | 44 | Q_INVOKABLE ChatEntry *chatEntryForChatRoom(const QString &accountId, const QVariantMap &properties, bool create); |
345 | 45 | 45 | ||
346 | 46 | 46 | ||
347 | === modified file 'libtelephonyservice/protocol.cpp' | |||
348 | --- libtelephonyservice/protocol.cpp 2015-06-10 21:05:50 +0000 | |||
349 | +++ libtelephonyservice/protocol.cpp 2015-12-09 13:28:53 +0000 | |||
350 | @@ -3,6 +3,7 @@ | |||
351 | 3 | * | 3 | * |
352 | 4 | * Authors: | 4 | * Authors: |
353 | 5 | * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com> | 5 | * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com> |
354 | 6 | * Tiago Salem Herrmann <tiago.herrmann@canonical.com> | ||
355 | 6 | * | 7 | * |
356 | 7 | * This file is part of telephony-service. | 8 | * This file is part of telephony-service. |
357 | 8 | * | 9 | * |
358 | @@ -23,8 +24,8 @@ | |||
359 | 23 | #include <QFileInfo> | 24 | #include <QFileInfo> |
360 | 24 | #include <QSettings> | 25 | #include <QSettings> |
361 | 25 | 26 | ||
364 | 26 | Protocol::Protocol(const QString &name, Features features, const QString &fallbackProtocol, QObject *parent) | 27 | Protocol::Protocol(const QString &name, Features features, const QString &fallbackProtocol, const QString &backgroundImage, const QString &icon, const QString &serviceName, QObject *parent) |
365 | 27 | : QObject(parent), mName(name), mFeatures(features), mFallbackProtocol(fallbackProtocol) | 28 | : QObject(parent), mName(name), mFeatures(features), mFallbackProtocol(fallbackProtocol), mBackgroundImage(backgroundImage), mIcon(icon), mServiceName(serviceName) |
366 | 28 | { | 29 | { |
367 | 29 | } | 30 | } |
368 | 30 | 31 | ||
369 | @@ -33,6 +34,16 @@ | |||
370 | 33 | return mName; | 34 | return mName; |
371 | 34 | } | 35 | } |
372 | 35 | 36 | ||
373 | 37 | QString Protocol::icon() const | ||
374 | 38 | { | ||
375 | 39 | return mIcon; | ||
376 | 40 | } | ||
377 | 41 | |||
378 | 42 | QString Protocol::serviceName() const | ||
379 | 43 | { | ||
380 | 44 | return mServiceName; | ||
381 | 45 | } | ||
382 | 46 | |||
383 | 36 | Protocol::Features Protocol::features() const | 47 | Protocol::Features Protocol::features() const |
384 | 37 | { | 48 | { |
385 | 38 | return mFeatures; | 49 | return mFeatures; |
386 | @@ -43,6 +54,11 @@ | |||
387 | 43 | return mFallbackProtocol; | 54 | return mFallbackProtocol; |
388 | 44 | } | 55 | } |
389 | 45 | 56 | ||
390 | 57 | QString Protocol::backgroundImage() const | ||
391 | 58 | { | ||
392 | 59 | return mBackgroundImage; | ||
393 | 60 | } | ||
394 | 61 | |||
395 | 46 | Protocol *Protocol::fromFile(const QString &fileName) | 62 | Protocol *Protocol::fromFile(const QString &fileName) |
396 | 47 | { | 63 | { |
397 | 48 | QFileInfo file(fileName); | 64 | QFileInfo file(fileName); |
398 | @@ -52,6 +68,7 @@ | |||
399 | 52 | 68 | ||
400 | 53 | QString protocolName = file.baseName(); | 69 | QString protocolName = file.baseName(); |
401 | 54 | QSettings settings(fileName, QSettings::IniFormat); | 70 | QSettings settings(fileName, QSettings::IniFormat); |
402 | 71 | settings.setIniCodec("UTF-8"); | ||
403 | 55 | settings.beginGroup("Protocol"); | 72 | settings.beginGroup("Protocol"); |
404 | 56 | QString name = settings.value("Name", protocolName).toString(); | 73 | QString name = settings.value("Name", protocolName).toString(); |
405 | 57 | QStringList featureList = settings.value("Features").toStringList(); | 74 | QStringList featureList = settings.value("Features").toStringList(); |
406 | @@ -64,6 +81,9 @@ | |||
407 | 64 | } | 81 | } |
408 | 65 | } | 82 | } |
409 | 66 | QString fallbackProtocol = settings.value("FallbackProtocol").toString(); | 83 | QString fallbackProtocol = settings.value("FallbackProtocol").toString(); |
410 | 84 | QString backgroundImage = settings.value("BackgroundImage").toString(); | ||
411 | 85 | QString icon = settings.value("Icon").toString(); | ||
412 | 86 | QString serviceName = settings.value("ServiceName").toString(); | ||
413 | 67 | 87 | ||
415 | 68 | return new Protocol(name, features, fallbackProtocol); | 88 | return new Protocol(name, features, fallbackProtocol, backgroundImage, icon, serviceName); |
416 | 69 | } | 89 | } |
417 | 70 | 90 | ||
418 | === modified file 'libtelephonyservice/protocol.h' | |||
419 | --- libtelephonyservice/protocol.h 2015-06-10 21:05:50 +0000 | |||
420 | +++ libtelephonyservice/protocol.h 2015-12-09 13:28:53 +0000 | |||
421 | @@ -3,6 +3,7 @@ | |||
422 | 3 | * | 3 | * |
423 | 4 | * Authors: | 4 | * Authors: |
424 | 5 | * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com> | 5 | * Gustavo Pichorim Boiko <gustavo.boiko@canonical.com> |
425 | 6 | * Tiago Salem Herrmann <tiago.herrmann@canonical.com> | ||
426 | 6 | * | 7 | * |
427 | 7 | * This file is part of telephony-service. | 8 | * This file is part of telephony-service. |
428 | 8 | * | 9 | * |
429 | @@ -36,6 +37,16 @@ | |||
430 | 36 | 37 | ||
431 | 37 | /// @brief the fallback protocol to be used for operations that support it (mainly text features) | 38 | /// @brief the fallback protocol to be used for operations that support it (mainly text features) |
432 | 38 | Q_PROPERTY(QString fallbackProtocol READ fallbackProtocol CONSTANT) | 39 | Q_PROPERTY(QString fallbackProtocol READ fallbackProtocol CONSTANT) |
433 | 40 | |||
434 | 41 | /// @brief the file path for the image that represents this protocol | ||
435 | 42 | Q_PROPERTY(QString backgroundImage READ backgroundImage CONSTANT) | ||
436 | 43 | |||
437 | 44 | /// @brief the file path for the image that represents this protocol | ||
438 | 45 | Q_PROPERTY(QString icon READ icon CONSTANT) | ||
439 | 46 | |||
440 | 47 | /// @brief the title that represents this protocol | ||
441 | 48 | Q_PROPERTY(QString serviceName READ serviceName CONSTANT) | ||
442 | 49 | |||
443 | 39 | public: | 50 | public: |
444 | 40 | enum Feature { | 51 | enum Feature { |
445 | 41 | TextChats = 0x1, | 52 | TextChats = 0x1, |
446 | @@ -46,18 +57,24 @@ | |||
447 | 46 | QString name() const; | 57 | QString name() const; |
448 | 47 | Features features() const; | 58 | Features features() const; |
449 | 48 | QString fallbackProtocol() const; | 59 | QString fallbackProtocol() const; |
450 | 60 | QString backgroundImage() const; | ||
451 | 61 | QString icon() const; | ||
452 | 62 | QString serviceName() const; | ||
453 | 49 | 63 | ||
454 | 50 | static Protocol *fromFile(const QString &fileName); | 64 | static Protocol *fromFile(const QString &fileName); |
455 | 51 | 65 | ||
456 | 52 | friend class ProtocolManager; | 66 | friend class ProtocolManager; |
457 | 53 | 67 | ||
458 | 54 | protected: | 68 | protected: |
460 | 55 | explicit Protocol(const QString &name, Features features, const QString &fallbackProtocol = QString::null, QObject *parent = 0); | 69 | explicit Protocol(const QString &name, Features features, const QString &fallbackProtocol = QString::null, const QString &backgroundImage = QString::null, const QString &icon = QString::null, const QString &serviceName = QString::null, QObject *parent = 0); |
461 | 56 | 70 | ||
462 | 57 | private: | 71 | private: |
463 | 58 | QString mName; | 72 | QString mName; |
464 | 59 | Features mFeatures; | 73 | Features mFeatures; |
465 | 60 | QString mFallbackProtocol; | 74 | QString mFallbackProtocol; |
466 | 75 | QString mBackgroundImage; | ||
467 | 76 | QString mIcon; | ||
468 | 77 | QString mServiceName; | ||
469 | 61 | }; | 78 | }; |
470 | 62 | 79 | ||
471 | 63 | typedef QList<Protocol*> Protocols; | 80 | typedef QList<Protocol*> Protocols; |
472 | 64 | 81 | ||
473 | === added file 'protocols/multimedia.protocol' | |||
474 | --- protocols/multimedia.protocol 1970-01-01 00:00:00 +0000 | |||
475 | +++ protocols/multimedia.protocol 2015-12-09 13:28:53 +0000 | |||
476 | @@ -0,0 +1,4 @@ | |||
477 | 1 | [Protocol] | ||
478 | 2 | Name=multimedia | ||
479 | 3 | Features=text | ||
480 | 4 | FallbackProtocol=ofono | ||
481 | 0 | 5 | ||
482 | === removed file 'protocols/multimedia.protocol' | |||
483 | --- protocols/multimedia.protocol 2015-06-11 16:48:18 +0000 | |||
484 | +++ protocols/multimedia.protocol 1970-01-01 00:00:00 +0000 | |||
485 | @@ -1,4 +0,0 @@ | |||
486 | 1 | [Protocol] | ||
487 | 2 | Name=multimedia | ||
488 | 3 | Features=text | ||
489 | 4 | FallbackProtocol=ofono | ||
490 | 5 | 0 | ||
491 | === modified file 'protocols/ofono.protocol' | |||
492 | --- protocols/ofono.protocol 2015-06-10 21:05:50 +0000 | |||
493 | +++ protocols/ofono.protocol 2015-12-09 13:28:53 +0000 | |||
494 | @@ -2,3 +2,4 @@ | |||
495 | 2 | Name=ofono | 2 | Name=ofono |
496 | 3 | Features=text,voice | 3 | Features=text,voice |
497 | 4 | FallbackProtocol= | 4 | FallbackProtocol= |
498 | 5 | BackgroundImage=/usr/share/telephony-service/assets/message_watermark.png | ||
499 | 5 | 6 | ||
500 | === modified file 'tests/common/mock/MockConnection.xml' | |||
501 | --- tests/common/mock/MockConnection.xml 2015-11-17 17:23:54 +0000 | |||
502 | +++ tests/common/mock/MockConnection.xml 2015-12-09 13:28:53 +0000 | |||
503 | @@ -210,9 +210,12 @@ | |||
504 | 210 | A message was sent from the client. | 210 | A message was sent from the client. |
505 | 211 | ]]></dox:d> | 211 | ]]></dox:d> |
506 | 212 | <arg name="message" type="s"/> | 212 | <arg name="message" type="s"/> |
507 | 213 | <arg name="attachments" type="av"/> | ||
508 | 213 | <arg name="properties" type="a{sv}"/> | 214 | <arg name="properties" type="a{sv}"/> |
511 | 214 | <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/> | 215 | <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantList"/> |
512 | 215 | <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/> | 216 | <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantList"/> |
513 | 217 | <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QVariantMap"/> | ||
514 | 218 | <annotation name="org.qtproject.QtDBus.QtTypeName.Out2" value="QVariantMap"/> | ||
515 | 216 | </signal> | 219 | </signal> |
516 | 217 | <signal name="CallReceived"> | 220 | <signal name="CallReceived"> |
517 | 218 | <dox:d><![CDATA[ | 221 | <dox:d><![CDATA[ |
518 | 219 | 222 | ||
519 | === modified file 'tests/common/mock/connection.cpp' | |||
520 | --- tests/common/mock/connection.cpp 2015-11-17 17:23:54 +0000 | |||
521 | +++ tests/common/mock/connection.cpp 2015-12-09 13:28:53 +0000 | |||
522 | @@ -371,7 +371,7 @@ | |||
523 | 371 | MockTextChannel *channel = new MockTextChannel(this, recipients, targetHandle); | 371 | MockTextChannel *channel = new MockTextChannel(this, recipients, targetHandle); |
524 | 372 | QObject::connect(channel, SIGNAL(messageRead(QString)), SLOT(onMessageRead(QString))); | 372 | QObject::connect(channel, SIGNAL(messageRead(QString)), SLOT(onMessageRead(QString))); |
525 | 373 | QObject::connect(channel, SIGNAL(destroyed()), SLOT(onTextChannelClosed())); | 373 | QObject::connect(channel, SIGNAL(destroyed()), SLOT(onTextChannelClosed())); |
527 | 374 | QObject::connect(channel, SIGNAL(messageSent(QString,QVariantMap)), SIGNAL(messageSent(QString,QVariantMap))); | 374 | QObject::connect(channel, SIGNAL(messageSent(QString,QVariantList,QVariantMap)), SIGNAL(messageSent(QString,QVariantList,QVariantMap))); |
528 | 375 | qDebug() << channel; | 375 | qDebug() << channel; |
529 | 376 | mTextChannels << channel; | 376 | mTextChannels << channel; |
530 | 377 | return channel->baseChannel(); | 377 | return channel->baseChannel(); |
531 | 378 | 378 | ||
532 | === modified file 'tests/common/mock/connection.h' | |||
533 | --- tests/common/mock/connection.h 2015-11-17 17:23:54 +0000 | |||
534 | +++ tests/common/mock/connection.h 2015-12-09 13:28:53 +0000 | |||
535 | @@ -110,7 +110,7 @@ | |||
536 | 110 | 110 | ||
537 | 111 | Q_SIGNALS: | 111 | Q_SIGNALS: |
538 | 112 | void messageRead(const QString &messageId); | 112 | void messageRead(const QString &messageId); |
540 | 113 | void messageSent(const QString &message, const QVariantMap &info); | 113 | void messageSent(const QString &message, const QVariantList &attachments, const QVariantMap &info); |
541 | 114 | void callReceived(const QString &callerId); | 114 | void callReceived(const QString &callerId); |
542 | 115 | void callEnded(const QString &callerId); | 115 | void callEnded(const QString &callerId); |
543 | 116 | void callStateChanged(const QString &callerId, const QString &objectPath, const QString &state); | 116 | void callStateChanged(const QString &callerId, const QString &objectPath, const QString &state); |
544 | 117 | 117 | ||
545 | === modified file 'tests/common/mock/mockconnectiondbus.cpp' | |||
546 | --- tests/common/mock/mockconnectiondbus.cpp 2015-11-17 17:23:54 +0000 | |||
547 | +++ tests/common/mock/mockconnectiondbus.cpp 2015-12-09 13:28:53 +0000 | |||
548 | @@ -32,8 +32,8 @@ | |||
549 | 32 | SIGNAL(messageRead(QString)), | 32 | SIGNAL(messageRead(QString)), |
550 | 33 | SIGNAL(MessageRead(QString))); | 33 | SIGNAL(MessageRead(QString))); |
551 | 34 | connect(mConnection, | 34 | connect(mConnection, |
554 | 35 | SIGNAL(messageSent(QString,QVariantMap)), | 35 | SIGNAL(messageSent(QString,QVariantList,QVariantMap)), |
555 | 36 | SIGNAL(MessageSent(QString,QVariantMap))); | 36 | SIGNAL(MessageSent(QString,QVariantList,QVariantMap))); |
556 | 37 | connect(mConnection, | 37 | connect(mConnection, |
557 | 38 | SIGNAL(callReceived(QString)), | 38 | SIGNAL(callReceived(QString)), |
558 | 39 | SIGNAL(CallReceived(QString))); | 39 | SIGNAL(CallReceived(QString))); |
559 | 40 | 40 | ||
560 | === modified file 'tests/common/mock/mockconnectiondbus.h' | |||
561 | --- tests/common/mock/mockconnectiondbus.h 2015-11-17 17:23:54 +0000 | |||
562 | +++ tests/common/mock/mockconnectiondbus.h 2015-12-09 13:28:53 +0000 | |||
563 | @@ -71,7 +71,7 @@ | |||
564 | 71 | Q_SIGNALS: | 71 | Q_SIGNALS: |
565 | 72 | // signals that will be relayed into the bus | 72 | // signals that will be relayed into the bus |
566 | 73 | void MessageRead(const QString &messageId); | 73 | void MessageRead(const QString &messageId); |
568 | 74 | void MessageSent(const QString &mesasge, const QVariantMap &properties); | 74 | void MessageSent(const QString &message, const QVariantList &attachments, const QVariantMap &properties); |
569 | 75 | void CallReceived(const QString &callerId); | 75 | void CallReceived(const QString &callerId); |
570 | 76 | void CallEnded(const QString &callerId); | 76 | void CallEnded(const QString &callerId); |
571 | 77 | void CallStateChanged(const QString &callerId, const QString &objectPath, const QString &state); | 77 | void CallStateChanged(const QString &callerId, const QString &objectPath, const QString &state); |
572 | 78 | 78 | ||
573 | === modified file 'tests/common/mock/textchannel.cpp' | |||
574 | --- tests/common/mock/textchannel.cpp 2015-11-17 14:30:19 +0000 | |||
575 | +++ tests/common/mock/textchannel.cpp 2015-12-09 13:28:53 +0000 | |||
576 | @@ -105,13 +105,12 @@ | |||
577 | 105 | QString MockTextChannel::sendMessage(const Tp::MessagePartList& message, uint flags, Tp::DBusError* error) | 105 | QString MockTextChannel::sendMessage(const Tp::MessagePartList& message, uint flags, Tp::DBusError* error) |
578 | 106 | { | 106 | { |
579 | 107 | Tp::MessagePart header = message.at(0); | 107 | Tp::MessagePart header = message.at(0); |
580 | 108 | Tp::MessagePart body = message.at(1); | ||
581 | 109 | 108 | ||
582 | 110 | static int serial = 0; | 109 | static int serial = 0; |
583 | 111 | 110 | ||
584 | 112 | // FIXME: check what other data we need to emit in the signal | 111 | // FIXME: check what other data we need to emit in the signal |
585 | 113 | QString id = QString("sentmessage%1").arg(serial++); | 112 | QString id = QString("sentmessage%1").arg(serial++); |
587 | 114 | QString messageText = body["content"].variant().toString(); | 113 | QString messageText; |
588 | 115 | QVariantMap properties; | 114 | QVariantMap properties; |
589 | 116 | QMap<QString, QDBusVariant>::const_iterator it = header.constBegin(); | 115 | QMap<QString, QDBusVariant>::const_iterator it = header.constBegin(); |
590 | 117 | while (it != header.constEnd()) { | 116 | while (it != header.constEnd()) { |
591 | @@ -122,7 +121,24 @@ | |||
592 | 122 | properties["Recipients"] = mRecipients; | 121 | properties["Recipients"] = mRecipients; |
593 | 123 | properties["Id"] = id; | 122 | properties["Id"] = id; |
594 | 124 | 123 | ||
596 | 125 | Q_EMIT messageSent(messageText, properties); | 124 | QVariantList attachments; |
597 | 125 | Tp::MessagePartList messageList = message; | ||
598 | 126 | messageList.pop_front(); | ||
599 | 127 | Q_FOREACH(const Tp::MessagePart& messagePart, messageList) { | ||
600 | 128 | QVariantMap attachment; | ||
601 | 129 | if (messagePart.contains("content-type") && messagePart["content-type"].variant().toString().startsWith("text/")) { | ||
602 | 130 | messageText = messagePart["content"].variant().toString(); | ||
603 | 131 | continue; | ||
604 | 132 | } | ||
605 | 133 | QMap<QString, QDBusVariant>::const_iterator it = messagePart.constBegin(); | ||
606 | 134 | while (it != messagePart.constEnd()) { | ||
607 | 135 | attachment[it.key()] = it.value().variant().toString(); | ||
608 | 136 | it++; | ||
609 | 137 | } | ||
610 | 138 | attachments << attachment; | ||
611 | 139 | } | ||
612 | 140 | |||
613 | 141 | Q_EMIT messageSent(messageText, attachments, properties); | ||
614 | 126 | 142 | ||
615 | 127 | QTimer *deliveryReportTimer = new QTimer(this); | 143 | QTimer *deliveryReportTimer = new QTimer(this); |
616 | 128 | deliveryReportTimer->setSingleShot(true); | 144 | deliveryReportTimer->setSingleShot(true); |
617 | 129 | 145 | ||
618 | === modified file 'tests/common/mock/textchannel.h' | |||
619 | --- tests/common/mock/textchannel.h 2015-03-20 19:00:21 +0000 | |||
620 | +++ tests/common/mock/textchannel.h 2015-12-09 13:28:53 +0000 | |||
621 | @@ -54,7 +54,7 @@ | |||
622 | 54 | 54 | ||
623 | 55 | Q_SIGNALS: | 55 | Q_SIGNALS: |
624 | 56 | void messageRead(const QString &id); | 56 | void messageRead(const QString &id); |
626 | 57 | void messageSent(const QString &message, const QVariantMap &info); | 57 | void messageSent(const QString &message, const QVariantList &attachments, const QVariantMap &info); |
627 | 58 | 58 | ||
628 | 59 | private: | 59 | private: |
629 | 60 | ~MockTextChannel(); | 60 | ~MockTextChannel(); |
630 | 61 | 61 | ||
631 | === modified file 'tests/handler/HandlerTest.cpp' | |||
632 | --- tests/handler/HandlerTest.cpp 2015-10-09 16:13:30 +0000 | |||
633 | +++ tests/handler/HandlerTest.cpp 2015-12-09 13:28:53 +0000 | |||
634 | @@ -41,10 +41,12 @@ | |||
635 | 41 | void testCallProperties(); | 41 | void testCallProperties(); |
636 | 42 | void testConferenceCall(); | 42 | void testConferenceCall(); |
637 | 43 | void testSendMessage(); | 43 | void testSendMessage(); |
638 | 44 | void testSendMessageWithAttachments(); | ||
639 | 44 | void testAcknowledgeMessage(); | 45 | void testAcknowledgeMessage(); |
640 | 45 | void testAcknowledgeAllMessages(); | 46 | void testAcknowledgeAllMessages(); |
641 | 46 | void testActiveCallIndicator(); | 47 | void testActiveCallIndicator(); |
642 | 47 | void testNotApprovedChannels(); | 48 | void testNotApprovedChannels(); |
643 | 49 | void testMultimediaFallback(); | ||
644 | 48 | 50 | ||
645 | 49 | private: | 51 | private: |
646 | 50 | void registerApprover(); | 52 | void registerApprover(); |
647 | @@ -53,6 +55,11 @@ | |||
648 | 53 | Approver *mApprover; | 55 | Approver *mApprover; |
649 | 54 | MockController *mMockController; | 56 | MockController *mMockController; |
650 | 55 | Tp::AccountPtr mTpAccount; | 57 | Tp::AccountPtr mTpAccount; |
651 | 58 | MockController *mMultimediaMockController; | ||
652 | 59 | Tp::AccountPtr mMultimediaTpAccount; | ||
653 | 60 | MockController *mOfonoMockController; | ||
654 | 61 | Tp::AccountPtr mOfonoTpAccount; | ||
655 | 62 | |||
656 | 56 | }; | 63 | }; |
657 | 57 | 64 | ||
658 | 58 | void HandlerTest::initTestCase() | 65 | void HandlerTest::initTestCase() |
659 | @@ -71,12 +78,20 @@ | |||
660 | 71 | 78 | ||
661 | 72 | // and create the mock controller | 79 | // and create the mock controller |
662 | 73 | mMockController = new MockController("mock", this); | 80 | mMockController = new MockController("mock", this); |
663 | 81 | |||
664 | 82 | mOfonoTpAccount = addAccount("mock", "ofono", "the account"); | ||
665 | 83 | mOfonoMockController = new MockController("ofono", this); | ||
666 | 84 | |||
667 | 85 | mMultimediaTpAccount = addAccount("mock", "multimedia", "the account"); | ||
668 | 86 | mMultimediaMockController = new MockController("multimedia", this); | ||
669 | 74 | } | 87 | } |
670 | 75 | 88 | ||
671 | 76 | void HandlerTest::cleanup() | 89 | void HandlerTest::cleanup() |
672 | 77 | { | 90 | { |
673 | 78 | doCleanup(); | 91 | doCleanup(); |
674 | 79 | mMockController->deleteLater(); | 92 | mMockController->deleteLater(); |
675 | 93 | mMultimediaMockController->deleteLater(); | ||
676 | 94 | mOfonoMockController->deleteLater(); | ||
677 | 80 | } | 95 | } |
678 | 81 | 96 | ||
679 | 82 | void HandlerTest::testMakingCalls() | 97 | void HandlerTest::testMakingCalls() |
680 | @@ -275,7 +290,7 @@ | |||
681 | 275 | { | 290 | { |
682 | 276 | QString recipient("22222222"); | 291 | QString recipient("22222222"); |
683 | 277 | QString message("Hello, world!"); | 292 | QString message("Hello, world!"); |
685 | 278 | QSignalSpy messageSentSpy(mMockController, SIGNAL(MessageSent(QString,QVariantMap))); | 293 | QSignalSpy messageSentSpy(mMockController, SIGNAL(MessageSent(QString,QVariantList,QVariantMap))); |
686 | 279 | // FIXME: add support for multiple accounts | 294 | // FIXME: add support for multiple accounts |
687 | 280 | HandlerController::instance()->sendMessage(mTpAccount->uniqueIdentifier(), QStringList() << recipient, message); | 295 | HandlerController::instance()->sendMessage(mTpAccount->uniqueIdentifier(), QStringList() << recipient, message); |
688 | 281 | TRY_COMPARE(messageSentSpy.count(), 1); | 296 | TRY_COMPARE(messageSentSpy.count(), 1); |
689 | @@ -286,6 +301,31 @@ | |||
690 | 286 | QCOMPARE(messageProperties["Recipients"].value<QStringList>().first(), recipient); | 301 | QCOMPARE(messageProperties["Recipients"].value<QStringList>().first(), recipient); |
691 | 287 | } | 302 | } |
692 | 288 | 303 | ||
693 | 304 | void HandlerTest::testSendMessageWithAttachments() | ||
694 | 305 | { | ||
695 | 306 | QString recipient("22222222"); | ||
696 | 307 | QString message("Hello, world!"); | ||
697 | 308 | QSignalSpy messageSentSpy(mMultimediaMockController, SIGNAL(MessageSent(QString,QVariantList,QVariantMap))); | ||
698 | 309 | |||
699 | 310 | QTemporaryFile outputFile("audioXXXXXX.ogg"); | ||
700 | 311 | outputFile.open(); | ||
701 | 312 | AttachmentStruct attachment{"id", "audio/ogg", outputFile.fileName()}; | ||
702 | 313 | HandlerController::instance()->sendMessage(mOfonoTpAccount->uniqueIdentifier(), QStringList() << recipient, message, AttachmentList() << attachment); | ||
703 | 314 | TRY_COMPARE(messageSentSpy.count(), 1); | ||
704 | 315 | outputFile.close(); | ||
705 | 316 | |||
706 | 317 | QString sentMessage = messageSentSpy.first()[0].toString(); | ||
707 | 318 | QVariantMap messageProperties = messageSentSpy.first()[2].value<QVariantMap>(); | ||
708 | 319 | QCOMPARE(sentMessage, message); | ||
709 | 320 | QCOMPARE(messageProperties["Recipients"].value<QStringList>().count(), 1); | ||
710 | 321 | QCOMPARE(messageProperties["Recipients"].value<QStringList>().first(), recipient); | ||
711 | 322 | |||
712 | 323 | QVariantList messageAttachments = qdbus_cast<QVariantList>(messageSentSpy.first()[1]); | ||
713 | 324 | QVariantMap firstAttachment = qdbus_cast<QVariantMap>(messageAttachments.first()); | ||
714 | 325 | QCOMPARE(firstAttachment["content-type"].toString(), QString("audio/ogg")); | ||
715 | 326 | QCOMPARE(firstAttachment["identifier"].toString(), QString("id")); | ||
716 | 327 | } | ||
717 | 328 | |||
718 | 289 | void HandlerTest::testAcknowledgeMessage() | 329 | void HandlerTest::testAcknowledgeMessage() |
719 | 290 | { | 330 | { |
720 | 291 | // if we register the observer before this test, other tests fail | 331 | // if we register the observer before this test, other tests fail |
721 | @@ -293,7 +333,7 @@ | |||
722 | 293 | QString recipient("84376666"); | 333 | QString recipient("84376666"); |
723 | 294 | QString recipient2("+554184376666"); | 334 | QString recipient2("+554184376666"); |
724 | 295 | QString message("Hello, world!"); | 335 | QString message("Hello, world!"); |
726 | 296 | QSignalSpy messageSentSpy(mMockController, SIGNAL(MessageSent(QString,QVariantMap))); | 336 | QSignalSpy messageSentSpy(mMockController, SIGNAL(MessageSent(QString,QVariantList,QVariantMap))); |
727 | 297 | 337 | ||
728 | 298 | // first send a message to a certain number so the handler request one channel | 338 | // first send a message to a certain number so the handler request one channel |
729 | 299 | HandlerController::instance()->sendMessage(mTpAccount->uniqueIdentifier(), QStringList() << recipient, message); | 339 | HandlerController::instance()->sendMessage(mTpAccount->uniqueIdentifier(), QStringList() << recipient, message); |
730 | @@ -327,7 +367,7 @@ | |||
731 | 327 | QString recipient2("+554198437666"); | 367 | QString recipient2("+554198437666"); |
732 | 328 | QString message("Hello, world! %1"); | 368 | QString message("Hello, world! %1"); |
733 | 329 | int messageCount = 10; | 369 | int messageCount = 10; |
735 | 330 | QSignalSpy messageSentSpy(mMockController, SIGNAL(MessageSent(QString,QVariantMap))); | 370 | QSignalSpy messageSentSpy(mMockController, SIGNAL(MessageSent(QString,QVariantList,QVariantMap))); |
736 | 331 | 371 | ||
737 | 332 | // first send a message to a certain number so the handler request one channel | 372 | // first send a message to a certain number so the handler request one channel |
738 | 333 | HandlerController::instance()->sendMessage(mTpAccount->uniqueIdentifier(), QStringList() << recipient, message); | 373 | HandlerController::instance()->sendMessage(mTpAccount->uniqueIdentifier(), QStringList() << recipient, message); |
739 | @@ -403,6 +443,44 @@ | |||
740 | 403 | QCOMPARE(callStateSpy.last()[2].toString(), QString("initialised")); | 443 | QCOMPARE(callStateSpy.last()[2].toString(), QString("initialised")); |
741 | 404 | } | 444 | } |
742 | 405 | 445 | ||
743 | 446 | void HandlerTest::testMultimediaFallback() | ||
744 | 447 | { | ||
745 | 448 | QString recipient("22222222"); | ||
746 | 449 | QString message("Hello, world!"); | ||
747 | 450 | mMultimediaMockController->SetContactPresence(recipient, Tp::ConnectionPresenceTypeAvailable, "available", ""); | ||
748 | 451 | // We have to make sure the handler already has the new state | ||
749 | 452 | QTest::qWait(1000); | ||
750 | 453 | |||
751 | 454 | QSignalSpy messageSentOfonoSpy(mOfonoMockController, SIGNAL(MessageSent(QString,QVariantList,QVariantMap))); | ||
752 | 455 | QSignalSpy messageSentMultimediaSpy(mMultimediaMockController, SIGNAL(MessageSent(QString,QVariantList,QVariantMap))); | ||
753 | 456 | |||
754 | 457 | QString accountId = HandlerController::instance()->sendMessage(mOfonoTpAccount->uniqueIdentifier(), QStringList() << recipient, message); | ||
755 | 458 | QCOMPARE(accountId, mMultimediaTpAccount->uniqueIdentifier()); | ||
756 | 459 | TRY_COMPARE(messageSentMultimediaSpy.count(), 1); | ||
757 | 460 | QCOMPARE(messageSentOfonoSpy.count(), 0); | ||
758 | 461 | QString sentMessage = messageSentMultimediaSpy.first().first().toString(); | ||
759 | 462 | QVariantMap messageProperties = messageSentMultimediaSpy.first().last().value<QVariantMap>(); | ||
760 | 463 | QCOMPARE(sentMessage, message); | ||
761 | 464 | QCOMPARE(messageProperties["Recipients"].value<QStringList>().count(), 1); | ||
762 | 465 | QCOMPARE(messageProperties["Recipients"].value<QStringList>().first(), recipient); | ||
763 | 466 | |||
764 | 467 | messageSentMultimediaSpy.clear(); | ||
765 | 468 | messageSentOfonoSpy.clear(); | ||
766 | 469 | |||
767 | 470 | mMultimediaMockController->SetContactPresence(recipient, Tp::ConnectionPresenceTypeUnknown, "offline", ""); | ||
768 | 471 | // We have to make sure the handler already has the new state | ||
769 | 472 | QTest::qWait(1000); | ||
770 | 473 | HandlerController::instance()->sendMessage(mOfonoTpAccount->uniqueIdentifier(), QStringList() << recipient, message); | ||
771 | 474 | TRY_COMPARE(messageSentOfonoSpy.count(), 1); | ||
772 | 475 | QCOMPARE(messageSentMultimediaSpy.count(), 0); | ||
773 | 476 | |||
774 | 477 | sentMessage = messageSentOfonoSpy.first().first().toString(); | ||
775 | 478 | messageProperties = messageSentOfonoSpy.first().last().value<QVariantMap>(); | ||
776 | 479 | QCOMPARE(sentMessage, message); | ||
777 | 480 | QCOMPARE(messageProperties["Recipients"].value<QStringList>().count(), 1); | ||
778 | 481 | QCOMPARE(messageProperties["Recipients"].value<QStringList>().first(), recipient); | ||
779 | 482 | } | ||
780 | 483 | |||
781 | 406 | void HandlerTest::registerApprover() | 484 | void HandlerTest::registerApprover() |
782 | 407 | { | 485 | { |
783 | 408 | // register the approver | 486 | // register the approver |
784 | 409 | 487 | ||
785 | === modified file 'tests/handler/handlercontroller.cpp' | |||
786 | --- tests/handler/handlercontroller.cpp 2015-08-09 03:49:08 +0000 | |||
787 | +++ tests/handler/handlercontroller.cpp 2015-12-09 13:28:53 +0000 | |||
788 | @@ -73,6 +73,11 @@ | |||
789 | 73 | return map["CallIndicatorVisible"].toBool(); | 73 | return map["CallIndicatorVisible"].toBool(); |
790 | 74 | } | 74 | } |
791 | 75 | 75 | ||
792 | 76 | void HandlerController::startChat(const QString &accountId, const QStringList &recipients) | ||
793 | 77 | { | ||
794 | 78 | mHandlerInterface.call("StartChat", accountId, recipients); | ||
795 | 79 | } | ||
796 | 80 | |||
797 | 76 | void HandlerController::startCall(const QString &number, const QString &accountId) | 81 | void HandlerController::startCall(const QString &number, const QString &accountId) |
798 | 77 | { | 82 | { |
799 | 78 | mHandlerInterface.call("StartCall", number, accountId); | 83 | mHandlerInterface.call("StartCall", number, accountId); |
800 | @@ -124,9 +129,13 @@ | |||
801 | 124 | mHandlerInterface.call("SplitCall", objectPath); | 129 | mHandlerInterface.call("SplitCall", objectPath); |
802 | 125 | } | 130 | } |
803 | 126 | 131 | ||
805 | 127 | void HandlerController::sendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const AttachmentList &attachments, const QVariantMap &properties) | 132 | QString HandlerController::sendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const AttachmentList &attachments, const QVariantMap &properties) |
806 | 128 | { | 133 | { |
808 | 129 | mHandlerInterface.call("SendMessage", accountId, recipients, message, QVariant::fromValue(attachments), properties); | 134 | QDBusReply<QString> reply = mHandlerInterface.call("SendMessage", accountId, recipients, message, QVariant::fromValue(attachments), properties); |
809 | 135 | if (reply.isValid()) { | ||
810 | 136 | return reply.value(); | ||
811 | 137 | } | ||
812 | 138 | return QString(); | ||
813 | 130 | } | 139 | } |
814 | 131 | 140 | ||
815 | 132 | void HandlerController::acknowledgeMessages(const QString &number, const QStringList &messageIds, const QString &accountId) | 141 | void HandlerController::acknowledgeMessages(const QString &number, const QStringList &messageIds, const QString &accountId) |
816 | 133 | 142 | ||
817 | === modified file 'tests/handler/handlercontroller.h' | |||
818 | --- tests/handler/handlercontroller.h 2015-08-09 03:49:08 +0000 | |||
819 | +++ tests/handler/handlercontroller.h 2015-12-09 13:28:53 +0000 | |||
820 | @@ -36,6 +36,7 @@ | |||
821 | 36 | 36 | ||
822 | 37 | public Q_SLOTS: | 37 | public Q_SLOTS: |
823 | 38 | // call methods | 38 | // call methods |
824 | 39 | void startChat(const QString &accountId, const QStringList &recipients); | ||
825 | 39 | void startCall(const QString &number, const QString &accountId); | 40 | void startCall(const QString &number, const QString &accountId); |
826 | 40 | void hangUpCall(const QString &objectPath); | 41 | void hangUpCall(const QString &objectPath); |
827 | 41 | void setHold(const QString &objectPath, bool hold); | 42 | void setHold(const QString &objectPath, bool hold); |
828 | @@ -50,7 +51,7 @@ | |||
829 | 50 | void splitCall(const QString &objectPath); | 51 | void splitCall(const QString &objectPath); |
830 | 51 | 52 | ||
831 | 52 | // messaging methods | 53 | // messaging methods |
833 | 53 | void sendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const AttachmentList &attachments = AttachmentList(), const QVariantMap &properties = QVariantMap()); | 54 | QString sendMessage(const QString &accountId, const QStringList &recipients, const QString &message, const AttachmentList &attachments = AttachmentList(), const QVariantMap &properties = QVariantMap()); |
834 | 54 | void acknowledgeMessages(const QString &number, const QStringList &messageIds, const QString &accountId); | 55 | void acknowledgeMessages(const QString &number, const QStringList &messageIds, const QString &accountId); |
835 | 55 | 56 | ||
836 | 56 | // active call indicator | 57 | // active call indicator |
837 | 57 | 58 | ||
838 | === modified file 'tests/libtelephonyservice/ChatManagerTest.cpp' | |||
839 | --- tests/libtelephonyservice/ChatManagerTest.cpp 2015-11-17 14:30:19 +0000 | |||
840 | +++ tests/libtelephonyservice/ChatManagerTest.cpp 2015-12-09 13:28:53 +0000 | |||
841 | @@ -101,14 +101,14 @@ | |||
842 | 101 | qSort(recipients); | 101 | qSort(recipients); |
843 | 102 | 102 | ||
844 | 103 | MockController *controller = accountId.startsWith("mock/mock") ? mGenericMockController : mPhoneMockController; | 103 | MockController *controller = accountId.startsWith("mock/mock") ? mGenericMockController : mPhoneMockController; |
846 | 104 | QSignalSpy controllerMessageSentSpy(controller, SIGNAL(MessageSent(QString,QVariantMap))); | 104 | QSignalSpy controllerMessageSentSpy(controller, SIGNAL(MessageSent(QString,QVariantList,QVariantMap))); |
847 | 105 | QSignalSpy messageSentSpy(ChatManager::instance(), SIGNAL(messageSent(QStringList,QString))); | 105 | QSignalSpy messageSentSpy(ChatManager::instance(), SIGNAL(messageSent(QStringList,QString))); |
848 | 106 | 106 | ||
849 | 107 | ChatManager::instance()->sendMessage(accountId, recipients, message); | 107 | ChatManager::instance()->sendMessage(accountId, recipients, message); |
850 | 108 | 108 | ||
851 | 109 | TRY_COMPARE(controllerMessageSentSpy.count(), 1); | 109 | TRY_COMPARE(controllerMessageSentSpy.count(), 1); |
852 | 110 | QString messageText = controllerMessageSentSpy.first()[0].toString(); | 110 | QString messageText = controllerMessageSentSpy.first()[0].toString(); |
854 | 111 | QVariantMap messageProperties = controllerMessageSentSpy.first()[1].toMap(); | 111 | QVariantMap messageProperties = controllerMessageSentSpy.first()[2].toMap(); |
855 | 112 | QStringList messageRecipients = messageProperties["Recipients"].toStringList(); | 112 | QStringList messageRecipients = messageProperties["Recipients"].toStringList(); |
856 | 113 | qSort(messageRecipients); | 113 | qSort(messageRecipients); |
857 | 114 | QCOMPARE(messageText, message); | 114 | QCOMPARE(messageText, message); |
858 | @@ -218,7 +218,7 @@ | |||
859 | 218 | 218 | ||
860 | 219 | MockController *controller = accountId.startsWith("mock/mock") ? mGenericMockController : mPhoneMockController; | 219 | MockController *controller = accountId.startsWith("mock/mock") ? mGenericMockController : mPhoneMockController; |
861 | 220 | 220 | ||
863 | 221 | QSignalSpy controllerMessageSentSpy(controller, SIGNAL(MessageSent(QString,QVariantMap))); | 221 | QSignalSpy controllerMessageSentSpy(controller, SIGNAL(MessageSent(QString,QVariantList,QVariantMap))); |
864 | 222 | 222 | ||
865 | 223 | QVariantList attachmentList; | 223 | QVariantList attachmentList; |
866 | 224 | QVariantList attachment; | 224 | QVariantList attachment; |
867 | @@ -230,7 +230,7 @@ | |||
868 | 230 | 230 | ||
869 | 231 | TRY_COMPARE(controllerMessageSentSpy.count(), 1); | 231 | TRY_COMPARE(controllerMessageSentSpy.count(), 1); |
870 | 232 | QString messageText = controllerMessageSentSpy.first()[0].toString(); | 232 | QString messageText = controllerMessageSentSpy.first()[0].toString(); |
872 | 233 | QVariantMap messageProperties = controllerMessageSentSpy.first()[1].toMap(); | 233 | QVariantMap messageProperties = controllerMessageSentSpy.first()[2].toMap(); |
873 | 234 | QStringList messageRecipients = messageProperties["Recipients"].toStringList(); | 234 | QStringList messageRecipients = messageProperties["Recipients"].toStringList(); |
874 | 235 | qSort(messageRecipients); | 235 | qSort(messageRecipients); |
875 | 236 | QCOMPARE(messageText, message); | 236 | QCOMPARE(messageText, message); |
876 | 237 | 237 | ||
877 | === modified file 'tests/libtelephonyservice/ProtocolTest.cpp' | |||
878 | --- tests/libtelephonyservice/ProtocolTest.cpp 2015-06-10 22:04:22 +0000 | |||
879 | +++ tests/libtelephonyservice/ProtocolTest.cpp 2015-12-09 13:28:53 +0000 | |||
880 | @@ -27,8 +27,8 @@ | |||
881 | 27 | { | 27 | { |
882 | 28 | Q_OBJECT | 28 | Q_OBJECT |
883 | 29 | public: | 29 | public: |
886 | 30 | TestProtocol(const QString &name, Protocol::Features features, const QString &fallbackProtocol, QObject *parent = 0) | 30 | TestProtocol(const QString &name, Protocol::Features features, const QString &fallbackProtocol, const QString &backgroundFile, const QString &icon, const QString &serviceName = QString::null, QObject *parent = 0) |
887 | 31 | : Protocol(name, features, fallbackProtocol, parent) { } | 31 | : Protocol(name, features, fallbackProtocol, backgroundFile, icon, serviceName, parent) { } |
888 | 32 | }; | 32 | }; |
889 | 33 | 33 | ||
890 | 34 | class ProtocolTest : public QObject | 34 | class ProtocolTest : public QObject |
891 | @@ -45,11 +45,17 @@ | |||
892 | 45 | QString name("foobar"); | 45 | QString name("foobar"); |
893 | 46 | Protocol::Features features(Protocol::TextChats); | 46 | Protocol::Features features(Protocol::TextChats); |
894 | 47 | QString fallbackProtocol("theFallback"); | 47 | QString fallbackProtocol("theFallback"); |
895 | 48 | QString backgroundImage("/tmp/background.png"); | ||
896 | 49 | QString icon("/tmp/icon.png"); | ||
897 | 50 | QString serviceName("The service"); | ||
898 | 48 | 51 | ||
900 | 49 | TestProtocol protocol(name, features, fallbackProtocol, this); | 52 | TestProtocol protocol(name, features, fallbackProtocol, backgroundImage, icon, serviceName, this); |
901 | 50 | QCOMPARE(protocol.name(), name); | 53 | QCOMPARE(protocol.name(), name); |
902 | 51 | QCOMPARE(protocol.features(), features); | 54 | QCOMPARE(protocol.features(), features); |
903 | 52 | QCOMPARE(protocol.fallbackProtocol(), fallbackProtocol); | 55 | QCOMPARE(protocol.fallbackProtocol(), fallbackProtocol); |
904 | 56 | QCOMPARE(protocol.backgroundImage(), backgroundImage); | ||
905 | 57 | QCOMPARE(protocol.icon(), icon); | ||
906 | 58 | QCOMPARE(protocol.serviceName(), serviceName); | ||
907 | 53 | QCOMPARE(protocol.parent(), this); | 59 | QCOMPARE(protocol.parent(), this); |
908 | 54 | } | 60 | } |
909 | 55 | 61 | ||
910 | @@ -65,6 +71,9 @@ | |||
911 | 65 | QCOMPARE(protocol->name(), QString("foo")); | 71 | QCOMPARE(protocol->name(), QString("foo")); |
912 | 66 | QCOMPARE(protocol->features(), Protocol::Features(Protocol::TextChats | Protocol::VoiceCalls)); | 72 | QCOMPARE(protocol->features(), Protocol::Features(Protocol::TextChats | Protocol::VoiceCalls)); |
913 | 67 | QCOMPARE(protocol->fallbackProtocol(), QString("bar")); | 73 | QCOMPARE(protocol->fallbackProtocol(), QString("bar")); |
914 | 74 | QCOMPARE(protocol->backgroundImage(), QString("/tmp/background.png")); | ||
915 | 75 | QCOMPARE(protocol->icon(), QString("/tmp/icon.png")); | ||
916 | 76 | QCOMPARE(protocol->serviceName(), QString("The Service")); | ||
917 | 68 | } | 77 | } |
918 | 69 | 78 | ||
919 | 70 | QTEST_MAIN(ProtocolTest) | 79 | QTEST_MAIN(ProtocolTest) |
920 | 71 | 80 | ||
921 | === modified file 'tests/libtelephonyservice/testProtocols/foo.protocol' | |||
922 | --- tests/libtelephonyservice/testProtocols/foo.protocol 2015-06-10 22:04:22 +0000 | |||
923 | +++ tests/libtelephonyservice/testProtocols/foo.protocol 2015-12-09 13:28:53 +0000 | |||
924 | @@ -2,3 +2,6 @@ | |||
925 | 2 | Name=foo | 2 | Name=foo |
926 | 3 | Features=text,voice | 3 | Features=text,voice |
927 | 4 | FallbackProtocol=bar | 4 | FallbackProtocol=bar |
928 | 5 | BackgroundImage=/tmp/background.png | ||
929 | 6 | Icon=/tmp/icon.png | ||
930 | 7 | ServiceName=The Service |
FAILED: Continuous integration, rev:1146 jenkins. qa.ubuntu. com/job/ telephony- service- ci/623/ jenkins. qa.ubuntu. com/job/ telephony- service- vivid-amd64- ci/295/ console jenkins. qa.ubuntu. com/job/ telephony- service- vivid-armhf- ci/291/ console jenkins. qa.ubuntu. com/job/ telephony- service- vivid-i386- ci/291/ console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/telephony- service- ci/623/ rebuild
http://