Merge lp:~phablet-team/history-service/roles-client-interface into lp:history-service/staging
- roles-client-interface
- Merge into staging
Status: | Merged |
---|---|
Approved by: | Gustavo Pichorim Boiko |
Approved revision: | 305 |
Merged at revision: | 239 |
Proposed branch: | lp:~phablet-team/history-service/roles-client-interface |
Merge into: | lp:history-service/staging |
Prerequisite: | lp:~phablet-team/history-service/end-group-info-event |
Diff against target: |
598 lines (+402/-27) 9 files modified
daemon/CMakeLists.txt (+1/-0) daemon/historydaemon.cpp (+75/-23) daemon/historydaemon.h (+4/-1) daemon/rolesinterface.cpp (+71/-0) daemon/rolesinterface.h (+210/-0) debian/rules (+0/-3) plugins/sqlite/sqlitehistoryplugin.cpp (+39/-0) plugins/sqlite/sqlitehistoryplugin.h (+1/-0) src/plugin.h (+1/-0) |
To merge this branch: | bzr merge lp:~phablet-team/history-service/roles-client-interface |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gustavo Pichorim Boiko (community) | Approve | ||
system-apps-ci-bot | continuous-integration | Pending | |
Review via email: mp+308434@code.launchpad.net |
This proposal supersedes a proposal from 2016-09-22.
Commit message
RolesClientInte
Received events when roles changes
write roles event information only when received updates for roles (isolating roles updates from members updates)
added db plugin method to update roles for members
Description of the change
RolesClientInte
Received events when roles changes
write roles event information only when received updates for roles (isolating roles updates from members updates)
added db plugin method to update roles for members
system-apps-ci-bot (system-apps-ci-bot) wrote : Posted in a previous version of this proposal | # |
system-apps-ci-bot (system-apps-ci-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:303
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
system-apps-ci-bot (system-apps-ci-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:304
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
system-apps-ci-bot (system-apps-ci-bot) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:305
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
Gustavo Pichorim Boiko (boiko) wrote : | # |
Looks good!
Preview Diff
1 | === modified file 'daemon/CMakeLists.txt' |
2 | --- daemon/CMakeLists.txt 2015-09-30 13:17:52 +0000 |
3 | +++ daemon/CMakeLists.txt 2016-10-13 18:23:21 +0000 |
4 | @@ -4,6 +4,7 @@ |
5 | historydaemon.cpp |
6 | historyservicedbus.cpp |
7 | pluginmanager.cpp |
8 | + rolesinterface.cpp |
9 | textchannelobserver.cpp |
10 | ) |
11 | |
12 | |
13 | === modified file 'daemon/historydaemon.cpp' |
14 | --- daemon/historydaemon.cpp 2016-10-13 18:23:21 +0000 |
15 | +++ daemon/historydaemon.cpp 2016-10-13 18:23:21 +0000 |
16 | @@ -36,6 +36,9 @@ |
17 | #include <TelepathyQt/PendingVariantMap> |
18 | #include <TelepathyQt/ReferencedHandles> |
19 | |
20 | +#include <TelepathyQt/PendingVariant> |
21 | +#include <TelepathyQt/PendingOperation> |
22 | + |
23 | Q_DECLARE_METATYPE(RolesMap) |
24 | |
25 | const constexpr static int AdminRole = 2; |
26 | @@ -104,8 +107,8 @@ |
27 | HistoryDaemon::HistoryDaemon(QObject *parent) |
28 | : QObject(parent), mCallObserver(this), mTextObserver(this) |
29 | { |
30 | - qRegisterMetaType<RolesMap>(); |
31 | - qDBusRegisterMetaType<RolesMap>(); |
32 | + qRegisterMetaType<HandleRolesMap>(); |
33 | + qDBusRegisterMetaType<HandleRolesMap>(); |
34 | // get the first plugin |
35 | if (!History::PluginManager::instance()->plugins().isEmpty()) { |
36 | mBackend = History::PluginManager::instance()->plugins().first(); |
37 | @@ -153,17 +156,37 @@ |
38 | return self; |
39 | } |
40 | |
41 | +void HistoryDaemon::onRolesChanged(const HandleRolesMap &added, const HandleRolesMap &removed) |
42 | +{ |
43 | + Q_UNUSED(added); |
44 | + Q_UNUSED(removed); |
45 | + |
46 | + ChannelInterfaceRolesInterface *roles_interface = qobject_cast<ChannelInterfaceRolesInterface*>(sender()); |
47 | + RolesMap roles = roles_interface->getRoles(); |
48 | + |
49 | + Tp::TextChannelPtr channel(qobject_cast<Tp::TextChannel*>(sender()->parent())); |
50 | + QVariantMap properties = propertiesFromChannel(channel); |
51 | + QVariantMap thread = threadForProperties(channel->property(History::FieldAccountId).toString(), |
52 | + History::EventTypeText, |
53 | + properties, |
54 | + matchFlagsForChannel(channel), |
55 | + false); |
56 | + |
57 | + writeRolesInformationEvents(thread, channel, roles); |
58 | + |
59 | + updateRoomRoles(channel, roles); |
60 | +} |
61 | + |
62 | QVariantMap HistoryDaemon::propertiesFromChannel(const Tp::ChannelPtr &textChannel) |
63 | { |
64 | QVariantMap properties; |
65 | QVariantList participants; |
66 | QStringList participantIds; |
67 | + |
68 | + ChannelInterfaceRolesInterface *roles_interface = textChannel->optionalInterface<ChannelInterfaceRolesInterface>(); |
69 | RolesMap roles; |
70 | - |
71 | - QDBusInterface propsInterface(textChannel->busName(), textChannel->objectPath(), "org.freedesktop.DBus.Properties"); |
72 | - if (propsInterface.isValid()) { |
73 | - QDBusMessage result = propsInterface.call("Get", "org.freedesktop.Telepathy.Channel.Interface.Roles", "Roles"); |
74 | - roles = qdbus_cast<RolesMap>(result.arguments().at(0).value<QDBusVariant>().variant().value<QDBusArgument>()); |
75 | + if (roles_interface) { |
76 | + roles = roles_interface->getRoles(); |
77 | } |
78 | |
79 | Q_FOREACH(const Tp::ContactPtr contact, textChannel->groupContacts(false)) { |
80 | @@ -622,7 +645,7 @@ |
81 | |
82 | // update participants only if the thread is not available previously. Otherwise we'll wait for membersChanged event |
83 | // for reflect in conversation information events for modified participants. |
84 | - updateRoomParticipants(channel, thread); |
85 | + updateRoomParticipants(channel); |
86 | } |
87 | |
88 | // write an entry saying you joined the group if 'joined' flag in thread is false and modify that flag. |
89 | @@ -635,9 +658,10 @@ |
90 | Tp::AbstractInterface *room_interface = channel->optionalInterface<Tp::Client::ChannelInterfaceRoomInterface>(); |
91 | Tp::AbstractInterface *room_config_interface = channel->optionalInterface<Tp::Client::ChannelInterfaceRoomConfigInterface>(); |
92 | Tp::AbstractInterface *subject_interface = channel->optionalInterface<Tp::Client::ChannelInterfaceSubjectInterface>(); |
93 | + ChannelInterfaceRolesInterface *roles_interface = channel->optionalInterface<ChannelInterfaceRolesInterface>(); |
94 | |
95 | QList<Tp::AbstractInterface*> interfaces; |
96 | - interfaces << room_interface << room_config_interface << subject_interface; |
97 | + interfaces << room_interface << room_config_interface << subject_interface << roles_interface; |
98 | for (auto interface : interfaces) { |
99 | if (interface) { |
100 | interface->setMonitorProperties(true); |
101 | @@ -653,6 +677,8 @@ |
102 | |
103 | connect(channel.data(), SIGNAL(groupMembersChanged(const Tp::Contacts &, const Tp::Contacts &, const Tp::Contacts &, const Tp::Contacts &, const Tp::Channel::GroupMemberChangeDetails &)), |
104 | SLOT(onGroupMembersChanged(const Tp::Contacts &, const Tp::Contacts &, const Tp::Contacts &, const Tp::Contacts &, const Tp::Channel::GroupMemberChangeDetails &))); |
105 | + |
106 | + connect(roles_interface, SIGNAL(RolesChanged(const HandleRolesMap&, const HandleRolesMap&)), SLOT(onRolesChanged(const HandleRolesMap&, const HandleRolesMap&))); |
107 | } |
108 | } |
109 | |
110 | @@ -729,10 +755,10 @@ |
111 | } |
112 | } |
113 | |
114 | - updateRoomParticipants(channel, thread); |
115 | + updateRoomParticipants(channel); |
116 | } |
117 | |
118 | -void HistoryDaemon::updateRoomParticipants(const Tp::TextChannelPtr channel, const QVariantMap &thread) |
119 | +void HistoryDaemon::updateRoomParticipants(const Tp::TextChannelPtr channel) |
120 | { |
121 | if (!channel) { |
122 | return; |
123 | @@ -740,13 +766,13 @@ |
124 | |
125 | QVariantList participants; |
126 | QStringList contactsAdded; |
127 | + |
128 | + ChannelInterfaceRolesInterface *roles_interface = channel->optionalInterface<ChannelInterfaceRolesInterface>(); |
129 | RolesMap roles; |
130 | - |
131 | - QDBusInterface propsInterface(channel->busName(), channel->objectPath(), "org.freedesktop.DBus.Properties"); |
132 | - if (propsInterface.isValid()) { |
133 | - QDBusMessage result = propsInterface.call("Get", "org.freedesktop.Telepathy.Channel.Interface.Roles", "Roles"); |
134 | - roles = qdbus_cast<RolesMap>(result.arguments().at(0).value<QDBusVariant>().variant().value<QDBusArgument>()); |
135 | + if (roles_interface) { |
136 | + roles = roles_interface->getRoles(); |
137 | } |
138 | + |
139 | Q_FOREACH(const Tp::ContactPtr contact, channel->groupRemotePendingContacts(false)) { |
140 | QVariantMap participant; |
141 | contactsAdded << contact->id(); |
142 | @@ -779,19 +805,45 @@ |
143 | participants << QVariant::fromValue(participant); |
144 | } |
145 | |
146 | - // write roles information events only if already joined to the group |
147 | - if (!thread.isEmpty() && thread[History::FieldChatRoomInfo].toMap()["Joined"].toBool()) { |
148 | - writeRolesInformationEvents(thread, channel, roles); |
149 | - } |
150 | - |
151 | QString accountId = channel->property(History::FieldAccountId).toString(); |
152 | QString threadId = channel->targetId(); |
153 | if (mBackend->updateRoomParticipants(accountId, threadId, History::EventTypeText, participants)) { |
154 | QVariantMap updatedThread = getSingleThread(History::EventTypeText, accountId, threadId, QVariantMap()); |
155 | mDBus.notifyThreadsModified(QList<QVariantMap>() << updatedThread); |
156 | } |
157 | - |
158 | - uint selfRoles = roles[channel->groupSelfContact()->handle().at(0)]; |
159 | +} |
160 | + |
161 | +void HistoryDaemon::updateRoomRoles(const Tp::TextChannelPtr &channel, const RolesMap &rolesMap) |
162 | +{ |
163 | + if (!channel) { |
164 | + return; |
165 | + } |
166 | + |
167 | + QVariantMap participantsRoles; |
168 | + |
169 | + Q_FOREACH(const Tp::ContactPtr contact, channel->groupRemotePendingContacts(false)) { |
170 | + participantsRoles[contact->id()] = rolesMap[contact->handle().at(0)]; |
171 | + } |
172 | + Q_FOREACH(const Tp::ContactPtr contact, channel->groupLocalPendingContacts(false)) { |
173 | + participantsRoles[contact->id()] = rolesMap[contact->handle().at(0)]; |
174 | + } |
175 | + |
176 | + Q_FOREACH(const Tp::ContactPtr contact, channel->groupContacts(false)) { |
177 | + if (!participantsRoles.contains(contact->id())) { |
178 | + participantsRoles[contact->id()] = rolesMap[contact->handle().at(0)]; |
179 | + } |
180 | + } |
181 | + |
182 | + // update participants roles |
183 | + QString accountId = channel->property(History::FieldAccountId).toString(); |
184 | + QString threadId = channel->targetId(); |
185 | + if (mBackend->updateRoomParticipantsRoles(accountId, threadId, History::EventTypeText, participantsRoles)) { |
186 | + QVariantMap updatedThread = getSingleThread(History::EventTypeText, accountId, threadId, QVariantMap()); |
187 | + mDBus.notifyThreadsModified(QList<QVariantMap>() << updatedThread); |
188 | + } |
189 | + |
190 | + // update self roles in room properties |
191 | + uint selfRoles = rolesMap[channel->groupSelfContact()->handle().at(0)]; |
192 | updateRoomProperties(channel, QVariantMap{{"SelfRoles", selfRoles}}); |
193 | } |
194 | |
195 | |
196 | === modified file 'daemon/historydaemon.h' |
197 | --- daemon/historydaemon.h 2016-10-13 18:23:21 +0000 |
198 | +++ daemon/historydaemon.h 2016-10-13 18:23:21 +0000 |
199 | @@ -30,6 +30,7 @@ |
200 | #include "callchannelobserver.h" |
201 | #include "historyservicedbus.h" |
202 | #include "plugin.h" |
203 | +#include "rolesinterface.h" |
204 | |
205 | typedef QMap<uint,uint> RolesMap; |
206 | |
207 | @@ -68,10 +69,12 @@ |
208 | void onGroupMembersChanged(const Tp::Contacts &groupMembersAdded, const Tp::Contacts &groupLocalPendingMembersAdded, |
209 | const Tp::Contacts &groupRemotePendingMembersAdded, const Tp::Contacts &groupMembersRemoved, |
210 | const Tp::Channel::GroupMemberChangeDetails &details); |
211 | + void onRolesChanged(const HandleRolesMap &added, const HandleRolesMap &removed); |
212 | |
213 | protected: |
214 | History::MatchFlags matchFlagsForChannel(const Tp::ChannelPtr &channel); |
215 | - void updateRoomParticipants(const Tp::TextChannelPtr channel, const QVariantMap &thread); |
216 | + void updateRoomParticipants(const Tp::TextChannelPtr channel); |
217 | + void updateRoomRoles(const Tp::TextChannelPtr &channel, const RolesMap &rolesMap); |
218 | QString hashThread(const QVariantMap &thread); |
219 | static QVariantMap getInterfaceProperties(const Tp::AbstractInterface *interface); |
220 | void updateRoomProperties(const Tp::TextChannelPtr &channel, const QVariantMap &properties); |
221 | |
222 | === added file 'daemon/rolesinterface.cpp' |
223 | --- daemon/rolesinterface.cpp 1970-01-01 00:00:00 +0000 |
224 | +++ daemon/rolesinterface.cpp 2016-10-13 18:23:21 +0000 |
225 | @@ -0,0 +1,71 @@ |
226 | +/* |
227 | + * Copyright (C) 2016 Canonical, Ltd. |
228 | + * |
229 | + * Authors: |
230 | + * Roberto Mier Escandon <roberto.escandon@canonical.com> |
231 | + * |
232 | + * This file is part of history-service. |
233 | + * |
234 | + * history-service is free software; you can redistribute it and/or modify |
235 | + * it under the terms of the GNU General Public License as published by |
236 | + * the Free Software Foundation; version 3. |
237 | + * |
238 | + * history-service is distributed in the hope that it will be useful, |
239 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
240 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
241 | + * GNU General Public License for more details. |
242 | + * |
243 | + * You should have received a copy of the GNU General Public License |
244 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
245 | + */ |
246 | + |
247 | +#include <daemon/rolesinterface.h> |
248 | + |
249 | +ChannelInterfaceRolesInterface::ChannelInterfaceRolesInterface(const QString& busName, const QString& objectPath, QObject *parent) |
250 | + : Tp::AbstractInterface(busName, objectPath, staticInterfaceName(), QDBusConnection::sessionBus(), parent) |
251 | +{ |
252 | +} |
253 | + |
254 | +ChannelInterfaceRolesInterface::ChannelInterfaceRolesInterface(const QDBusConnection& connection, const QString& busName, const QString& objectPath, QObject *parent) |
255 | + : Tp::AbstractInterface(busName, objectPath, staticInterfaceName(), connection, parent) |
256 | +{ |
257 | +} |
258 | + |
259 | +ChannelInterfaceRolesInterface::ChannelInterfaceRolesInterface(Tp::DBusProxy *proxy) |
260 | + : Tp::AbstractInterface(proxy, staticInterfaceName()) |
261 | +{ |
262 | +} |
263 | + |
264 | +ChannelInterfaceRolesInterface::ChannelInterfaceRolesInterface(const Tp::Client::ChannelInterface& mainInterface) |
265 | + : Tp::AbstractInterface(mainInterface.service(), mainInterface.path(), staticInterfaceName(), mainInterface.connection(), mainInterface.parent()) |
266 | +{ |
267 | +} |
268 | + |
269 | +ChannelInterfaceRolesInterface::ChannelInterfaceRolesInterface(const Tp::Client::ChannelInterface& mainInterface, QObject *parent) |
270 | + : Tp::AbstractInterface(mainInterface.service(), mainInterface.path(), staticInterfaceName(), mainInterface.connection(), parent) |
271 | +{ |
272 | +} |
273 | + |
274 | +void ChannelInterfaceRolesInterface::invalidate(Tp::DBusProxy *proxy, |
275 | + const QString &error, const QString &message) |
276 | +{ |
277 | + Tp::AbstractInterface::invalidate(proxy, error, message); |
278 | +} |
279 | + |
280 | +HandleRolesMap ChannelInterfaceRolesInterface::getRoles() const |
281 | +{ |
282 | + QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), |
283 | + TP_QT_IFACE_PROPERTIES, QLatin1String("Get")); |
284 | + msg << interface() << QLatin1String("Roles"); |
285 | + QDBusMessage result = connection().call(msg); |
286 | + return qdbus_cast<HandleRolesMap>(result.arguments().at(0).value<QDBusVariant>().variant()); |
287 | +} |
288 | + |
289 | +bool ChannelInterfaceRolesInterface::getCanUpdateRoles() const |
290 | +{ |
291 | + QDBusMessage msg = QDBusMessage::createMethodCall(service(), path(), |
292 | + TP_QT_IFACE_PROPERTIES, QLatin1String("Get")); |
293 | + msg << interface() << QLatin1String("CanUpdateRoles"); |
294 | + QDBusMessage result = connection().call(msg); |
295 | + return qdbus_cast<bool>(result.arguments().at(0).value<QDBusVariant>().variant()); |
296 | +} |
297 | |
298 | === added file 'daemon/rolesinterface.h' |
299 | --- daemon/rolesinterface.h 1970-01-01 00:00:00 +0000 |
300 | +++ daemon/rolesinterface.h 2016-10-13 18:23:21 +0000 |
301 | @@ -0,0 +1,210 @@ |
302 | +/* |
303 | + * Copyright (C) 2016 Canonical, Ltd. |
304 | + * |
305 | + * Authors: |
306 | + * Roberto Mier Escandon <roberto.escandon@canonical.com> |
307 | + * |
308 | + * This file is part of history-service. |
309 | + * |
310 | + * history-service is free software; you can redistribute it and/or modify |
311 | + * it under the terms of the GNU General Public License as published by |
312 | + * the Free Software Foundation; version 3. |
313 | + * |
314 | + * history-service is distributed in the hope that it will be useful, |
315 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
316 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
317 | + * GNU General Public License for more details. |
318 | + * |
319 | + * You should have received a copy of the GNU General Public License |
320 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
321 | + */ |
322 | + |
323 | +#ifndef CHANNELINTERFACEROLESINTERFACE_H |
324 | +#define CHANNELINTERFACEROLESINTERFACE_H |
325 | + |
326 | +#include <QMap> |
327 | + |
328 | +#include <TelepathyQt/AbstractInterface> |
329 | +#include <TelepathyQt/ChannelInterface> |
330 | + |
331 | +/** |
332 | + * \struct HandleRolesMap |
333 | + * \ingroup mapping |
334 | + * \headerfile TelepathyQt/types.h <TelepathyQt/Types> |
335 | + * |
336 | + * Convertible with |
337 | + * QMap<uint, uint>, but needed to have a discrete type in the Qt type system. |
338 | + * |
339 | + * A map from channel-specific handles to their owners. |
340 | + */ |
341 | +struct HandleRolesMap : public QMap<uint, uint> |
342 | +{ |
343 | + inline HandleRolesMap() : QMap<uint, uint>() {} |
344 | + inline HandleRolesMap(const QMap<uint, uint>& a) : QMap<uint, uint>(a) {} |
345 | + |
346 | + inline HandleRolesMap& operator=(const QMap<uint, uint>& a) |
347 | + { |
348 | + *(static_cast<QMap<uint, uint>*>(this)) = a; |
349 | + return *this; |
350 | + } |
351 | +}; |
352 | + |
353 | +Q_DECLARE_METATYPE(HandleRolesMap) |
354 | + |
355 | +class ChannelInterfaceRolesInterface : public Tp::AbstractInterface |
356 | +{ |
357 | + Q_OBJECT |
358 | +public: |
359 | + |
360 | + /** |
361 | + * Returns the name of the interface "org.freedesktop.Telepathy.Channel.Interface.Roles", which this class |
362 | + * represents. |
363 | + * |
364 | + * \return The D-Bus interface name. |
365 | + */ |
366 | + static inline QLatin1String staticInterfaceName() |
367 | + { |
368 | + return QLatin1String("org.freedesktop.Telepathy.Channel.Interface.Roles"); |
369 | + } |
370 | + |
371 | + /** |
372 | + * Creates a ChannelInterfaceRolesInterface associated with the given object on the session bus. |
373 | + * |
374 | + * \param busName Name of the service the object is on. |
375 | + * \param objectPath Path to the object on the service. |
376 | + * \param parent Passed to the parent class constructor. |
377 | + */ |
378 | + ChannelInterfaceRolesInterface( |
379 | + const QString& busName, |
380 | + const QString& objectPath, |
381 | + QObject* parent = 0 |
382 | + ); |
383 | + |
384 | + /** |
385 | + * Creates a ChannelInterfaceRolesInterface associated with the given object on the given bus. |
386 | + * |
387 | + * \param connection The bus via which the object can be reached. |
388 | + * \param busName Name of the service the object is on. |
389 | + * \param objectPath Path to the object on the service. |
390 | + * \param parent Passed to the parent class constructor. |
391 | + */ |
392 | + ChannelInterfaceRolesInterface( |
393 | + const QDBusConnection& connection, |
394 | + const QString& busName, |
395 | + const QString& objectPath, |
396 | + QObject* parent = 0 |
397 | + ); |
398 | + |
399 | + /** |
400 | + * Creates a ChannelInterfaceRolesInterface associated with the same object as the given proxy. |
401 | + * |
402 | + * \param proxy The proxy to use. It will also be the QObject::parent() |
403 | + * for this object. |
404 | + */ |
405 | + ChannelInterfaceRolesInterface(Tp::DBusProxy *proxy); |
406 | + |
407 | + /** |
408 | + * Creates a ChannelInterfaceRolesInterface associated with the same object as the given proxy. |
409 | + * Additionally, the created proxy will have the same parent as the given |
410 | + * proxy. |
411 | + * |
412 | + * \param mainInterface The proxy to use. |
413 | + */ |
414 | + explicit ChannelInterfaceRolesInterface(const Tp::Client::ChannelInterface& mainInterface); |
415 | + |
416 | + /** |
417 | + * Creates a ChannelInterfaceRolesInterface associated with the same object as the given proxy. |
418 | + * However, a different parent object can be specified. |
419 | + * |
420 | + * \param mainInterface The proxy to use. |
421 | + * \param parent Passed to the parent class constructor. |
422 | + */ |
423 | + ChannelInterfaceRolesInterface(const Tp::Client::ChannelInterface& mainInterface, QObject* parent); |
424 | + |
425 | + /** |
426 | + * Asynchronous getter for the remote object property \c Roles of type \c HandleRolesMap. |
427 | + * |
428 | + * \return A pending variant which will emit finished when the property has been |
429 | + * retrieved. |
430 | + */ |
431 | + inline Tp::PendingVariant *requestPropertyRoles() const |
432 | + { |
433 | + return internalRequestProperty(QLatin1String("Roles")); |
434 | + } |
435 | + |
436 | + /** |
437 | + * Asynchronous getter for the remote object property \c CanUpdateRoles of type \c bool. |
438 | + * |
439 | + * \return A pending variant which will emit finished when the property has been |
440 | + * retrieved. |
441 | + */ |
442 | + inline Tp::PendingVariant *requestPropertyCanUpdateRoles() const |
443 | + { |
444 | + return internalRequestProperty(QLatin1String("CanUpdateRoles")); |
445 | + } |
446 | + |
447 | + /** |
448 | + * Request all of the DBus properties on the interface. |
449 | + * |
450 | + * \return A pending variant map which will emit finished when the properties have |
451 | + * been retrieved. |
452 | + */ |
453 | + Tp::PendingVariantMap *requestAllProperties() const |
454 | + { |
455 | + return internalRequestAllProperties(); |
456 | + } |
457 | + |
458 | + /** |
459 | + * Synchronous version to get Roles property |
460 | + */ |
461 | + HandleRolesMap getRoles() const; |
462 | + |
463 | + /** |
464 | + * Synchronous version to get CanUpdateRoles property |
465 | + */ |
466 | + bool getCanUpdateRoles() const; |
467 | + |
468 | +public Q_SLOTS: |
469 | + /** |
470 | + * Begins a call to the D-Bus method \c UpdateRoles on the remote object. |
471 | + * |
472 | + * Update the roles in the server |
473 | + * |
474 | + */ |
475 | + inline QDBusPendingReply<> UpdateRoles(const HandleRolesMap &contactRoles, int timeout = -1) |
476 | + { |
477 | + if (!invalidationReason().isEmpty()) { |
478 | + return QDBusPendingReply<>(QDBusMessage::createError( |
479 | + invalidationReason(), |
480 | + invalidationMessage() |
481 | + )); |
482 | + } |
483 | + |
484 | + QDBusMessage callMessage = QDBusMessage::createMethodCall(this->service(), this->path(), |
485 | + this->staticInterfaceName(), QLatin1String("UpdateRoles")); |
486 | + callMessage << QVariant::fromValue(contactRoles); |
487 | + return this->connection().asyncCall(callMessage, timeout); |
488 | + } |
489 | + |
490 | +Q_SIGNALS: |
491 | + /** |
492 | + * Represents the signal \c RolesChanged on the remote object. |
493 | + * |
494 | + * Emitted when the state the roles of the channel has changed. |
495 | + * |
496 | + * \param added |
497 | + * |
498 | + * map of handles and related roles added |
499 | + * |
500 | + * \param removed |
501 | + * |
502 | + * map of handles and related roles removed |
503 | + */ |
504 | + void RolesChanged(const HandleRolesMap &added, const HandleRolesMap& removed); |
505 | + |
506 | +protected: |
507 | + virtual void invalidate(Tp::DBusProxy *, const QString &, const QString &); |
508 | + |
509 | +}; |
510 | + |
511 | +#endif // CHANNELINTERFACEROLESINTERFACE_H |
512 | |
513 | === modified file 'debian/rules' |
514 | --- debian/rules 2016-10-13 18:23:21 +0000 |
515 | +++ debian/rules 2015-11-03 14:25:26 +0000 |
516 | @@ -10,9 +10,6 @@ |
517 | %: |
518 | dh $@ --parallel --with translations |
519 | |
520 | -override_dh_shlibdeps: |
521 | - dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info |
522 | - |
523 | override_dh_auto_test: |
524 | ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) |
525 | CTEST_OUTPUT_ON_FAILURE=1 make -C obj-$(DEB_HOST_GNU_TYPE) test |
526 | |
527 | === modified file 'plugins/sqlite/sqlitehistoryplugin.cpp' |
528 | --- plugins/sqlite/sqlitehistoryplugin.cpp 2016-10-13 18:23:21 +0000 |
529 | +++ plugins/sqlite/sqlitehistoryplugin.cpp 2016-10-13 18:23:21 +0000 |
530 | @@ -566,6 +566,45 @@ |
531 | return true; |
532 | } |
533 | |
534 | +bool SQLiteHistoryPlugin::updateRoomParticipantsRoles(const QString &accountId, const QString &threadId, History::EventType type, const QVariantMap &participantsRoles) |
535 | +{ |
536 | + QSqlQuery query(SQLiteDatabase::instance()->database()); |
537 | + if (accountId.isEmpty() || threadId.isEmpty()) { |
538 | + return false; |
539 | + } |
540 | + |
541 | + SQLiteDatabase::instance()->beginTransation(); |
542 | + Q_FOREACH(const QString &participantId, participantsRoles.keys()) { |
543 | + query.prepare("UPDATE thread_participants SET roles=:roles WHERE accountId=:accountId AND threadId=:threadId AND type=:type AND participantId=:participantId"); |
544 | + query.bindValue(":roles", participantsRoles.value(participantId).toUInt()); |
545 | + query.bindValue(":accountId", accountId); |
546 | + query.bindValue(":threadId", threadId); |
547 | + query.bindValue(":type", type); |
548 | + query.bindValue(":participantId", participantId); |
549 | + if (!query.exec()) { |
550 | + qCritical() << "Error:" << query.lastError() << query.lastQuery(); |
551 | + SQLiteDatabase::instance()->rollbackTransaction(); |
552 | + return false; |
553 | + } |
554 | + } |
555 | + |
556 | + if (!SQLiteDatabase::instance()->finishTransaction()) { |
557 | + qCritical() << "Failed to commit the transaction."; |
558 | + return false; |
559 | + } |
560 | + |
561 | + QVariantMap existingThread = getSingleThread(type, |
562 | + accountId, |
563 | + threadId, |
564 | + QVariantMap()); |
565 | + |
566 | + if (!existingThread.isEmpty()) { |
567 | + addThreadsToCache(QList<QVariantMap>() << existingThread); |
568 | + } |
569 | + |
570 | + return true; |
571 | +} |
572 | + |
573 | bool SQLiteHistoryPlugin::updateRoomInfo(const QString &accountId, const QString &threadId, History::EventType type, const QVariantMap &properties, const QStringList &invalidated) |
574 | { |
575 | QSqlQuery query(SQLiteDatabase::instance()->database()); |
576 | |
577 | === modified file 'plugins/sqlite/sqlitehistoryplugin.h' |
578 | --- plugins/sqlite/sqlitehistoryplugin.h 2016-10-13 18:23:21 +0000 |
579 | +++ plugins/sqlite/sqlitehistoryplugin.h 2016-10-13 18:23:21 +0000 |
580 | @@ -70,6 +70,7 @@ |
581 | QVariantMap createThreadForParticipants(const QString &accountId, History::EventType type, const QStringList &participants); |
582 | |
583 | bool updateRoomParticipants(const QString &accountId, const QString &threadId, History::EventType type, const QVariantList &participants); |
584 | + bool updateRoomParticipantsRoles(const QString &accountId, const QString &threadId, History::EventType type, const QVariantMap &participantsRoles); |
585 | bool updateRoomInfo(const QString &accountId, const QString &threadId, History::EventType type, const QVariantMap &properties, const QStringList &invalidated = QStringList()); |
586 | bool removeThread(const QVariantMap &thread); |
587 | |
588 | |
589 | === modified file 'src/plugin.h' |
590 | --- src/plugin.h 2016-10-13 18:23:21 +0000 |
591 | +++ src/plugin.h 2016-10-13 18:23:21 +0000 |
592 | @@ -72,6 +72,7 @@ |
593 | virtual QVariantMap createThreadForParticipants(const QString &accountId, EventType type, const QStringList &participants) { return QVariantMap(); } |
594 | virtual QVariantMap createThreadForProperties(const QString &accountId, EventType type, const QVariantMap &properties) { return QVariantMap(); } |
595 | virtual bool updateRoomParticipants(const QString &accountId, const QString &threadId, History::EventType type, const QVariantList &participants) { return false; }; |
596 | + virtual bool updateRoomParticipantsRoles(const QString &accountId, const QString &threadId, History::EventType type, const QVariantMap &participantsRoles) { return false; }; |
597 | virtual bool updateRoomInfo(const QString &accountId, const QString &threadId, EventType type, const QVariantMap &properties, const QStringList &invalidated = QStringList()) { return false; }; |
598 | virtual bool removeThread(const QVariantMap &thread) { return false; } |
599 |
FAILED: Continuous integration, rev:302 /jenkins. canonical. com/system- apps/job/ lp-history- service- ci/23/ /jenkins. canonical. com/system- apps/job/ build/1623/ console /jenkins. canonical. com/system- apps/job/ build-0- fetch/1623 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 1470 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 1470/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 1470 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 1470/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 1470 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 1470/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 1470 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 1470/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 1470 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 1470/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 1470 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 1470/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 1470/console /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 1470 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 1470/artifact/ output/ *zip*/output. zip /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=i386, release= yakkety/ 1470 /jenkins. canonical. com/system- apps/job/ build-2- binpkg/ arch=i386, release= yakkety/ 1470/artifact/ output/ *zip*/output. zip
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/system- apps/job/ lp-history- service- ci/23/rebuild
https:/