Merge lp:~phablet-team/telephony-service/change_group_title into lp:telephony-service

Proposed by Gustavo Pichorim Boiko
Status: Superseded
Proposed branch: lp:~phablet-team/telephony-service/change_group_title
Merge into: lp:telephony-service
Prerequisite: lp:~phablet-team/telephony-service/destroy_chatrooms
Diff against target: 276 lines (+114/-12)
9 files modified
handler/Handler.xml (+7/-0)
handler/handlerdbus.cpp (+5/-0)
handler/handlerdbus.h (+2/-2)
handler/messagesendingjob.cpp (+40/-1)
handler/messagesendingjob.h (+1/-0)
handler/texthandler.cpp (+33/-8)
handler/texthandler.h (+2/-0)
libtelephonyservice/chatentry.cpp (+22/-0)
libtelephonyservice/chatentry.h (+2/-1)
To merge this branch: bzr merge lp:~phablet-team/telephony-service/change_group_title
Reviewer Review Type Date Requested Status
system-apps-ci-bot continuous-integration Needs Fixing
Roberto Mier Escandon (community) Approve
PS Jenkins bot continuous-integration Pending
Review via email: mp+297168@code.launchpad.net

This proposal has been superseded by a proposal from 2016-06-15.

Commit message

Make it possible to change the group title.

Description of the change

Make it possible to change the group title.

To post a comment you must log in.
Revision history for this message
Roberto Mier Escandon (rmescandon) :
review: Approve
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1220
https://jenkins.canonical.com/system-apps/job/lp-telephony-service-ci/10/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/545/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/545
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/533
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/533
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/529
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/529/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/529
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/529/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/529
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/529/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/529
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/529/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/529
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/529/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/529/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-telephony-service-ci/10/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
1224. By Gustavo Pichorim Boiko

Make sure we fetch the initial values of the group title from the channel.

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1224
https://jenkins.canonical.com/system-apps/job/lp-telephony-service-ci/19/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/603/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/603
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/573
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/573
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/566/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/566/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/566
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/566/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/566
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/566/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/566
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/566/artifact/output/*zip*/output.zip
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/566/console

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-telephony-service-ci/19/rebuild

review: Needs Fixing (continuous-integration)
1225. By Gustavo Pichorim Boiko

Use values instead of references

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :

FAILED: Continuous integration, rev:1225
https://jenkins.canonical.com/system-apps/job/lp-telephony-service-ci/20/
Executed test runs:
    FAILURE: https://jenkins.canonical.com/system-apps/job/build/609/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-0-fetch/609
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=vivid+overlay/579
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-1-sourcepkg/release=xenial/579
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=vivid+overlay/572/console
    FAILURE: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=amd64,release=xenial/572/console
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/572
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=vivid+overlay/572/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/572
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=armhf,release=xenial/572/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/572
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=vivid+overlay/572/artifact/output/*zip*/output.zip
    SUCCESS: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/572
        deb: https://jenkins.canonical.com/system-apps/job/build-2-binpkg/arch=i386,release=xenial/572/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://jenkins.canonical.com/system-apps/job/lp-telephony-service-ci/20/rebuild

review: Needs Fixing (continuous-integration)
1226. By Gustavo Pichorim Boiko

merge parent

1227. By Gustavo Pichorim Boiko

Merge parent

1228. By Tiago Salem Herrmann

merge parent branch

1229. By Tiago Salem Herrmann

merge parent branch

1230. By Tiago Salem Herrmann

merge parent branch

1231. By Tiago Salem Herrmann

merge parent branch

1232. By Tiago Salem Herrmann

merge parent branch

1233. By Tiago Salem Herrmann

merge parent branch

1234. By Gustavo Pichorim Boiko

Merge parent

1235. By Tiago Salem Herrmann

merge parent branch

1236. By Tiago Salem Herrmann

merge parent branch

1237. By Tiago Salem Herrmann

merge parent branch

1238. By Tiago Salem Herrmann

merge parent branch

1239. By Tiago Salem Herrmann

merge parent branch

1240. By Tiago Salem Herrmann

merge parent branch

1241. By Gustavo Pichorim Boiko

merge parent

1242. By Tiago Salem Herrmann

merge parent branch

1243. By Tiago Salem Herrmann

merge parent branch

1244. By Tiago Salem Herrmann

merge parent branch

1245. By Tiago Salem Herrmann

merge parent branch

1246. By Tiago Salem Herrmann

merge parent branch

1247. By Tiago Salem Herrmann

merge parent branch

1248. By Tiago Salem Herrmann

merge parent branch

1249. By Gustavo Pichorim Boiko

Merge parent branch

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'handler/Handler.xml'
2--- handler/Handler.xml 2016-06-15 09:41:11 +0000
3+++ handler/Handler.xml 2016-06-15 09:41:11 +0000
4@@ -53,6 +53,13 @@
5 <arg name="objectPath" type="s" direction="in"/>
6 <arg name="result" type="b" direction="out"/>
7 </method>
8+ <method name="ChangeRoomTitle">
9+ <dox:d><![CDATA[
10+ Changes the title of a group.
11+ ]]></dox:d>
12+ <arg name="objectPath" type="s" direction="in"/>
13+ <arg name="title" type="s" direction="in"/>
14+ </method>
15 <!-- Call Related -->
16 <method name="StartCall">
17 <dox:d><![CDATA[
18
19=== modified file 'handler/handlerdbus.cpp'
20--- handler/handlerdbus.cpp 2016-06-15 09:41:11 +0000
21+++ handler/handlerdbus.cpp 2016-06-15 09:41:11 +0000
22@@ -106,6 +106,11 @@
23 return TextHandler::instance()->destroyTextChannel(objectPath);
24 }
25
26+void HandlerDBus::ChangeRoomTitle(const QString &objectPath, const QString &title)
27+{
28+ TextHandler::instance()->changeRoomTitle(objectPath, title);
29+}
30+
31 bool HandlerDBus::connectToBus()
32 {
33 bool ok = QDBusConnection::sessionBus().registerService(DBUS_SERVICE);
34
35=== modified file 'handler/handlerdbus.h'
36--- handler/handlerdbus.h 2016-06-15 09:41:11 +0000
37+++ handler/handlerdbus.h 2016-06-15 09:41:11 +0000
38@@ -56,8 +56,6 @@
39
40 static HandlerDBus *instance();
41
42- bool DestroyTextChannel(const QString &objectPath);
43-
44 public Q_SLOTS:
45 bool connectToBus();
46
47@@ -66,6 +64,8 @@
48 Q_NOREPLY void AcknowledgeMessages(const QVariantList &messages);
49 Q_NOREPLY void StartChat(const QString &accountId, const QVariantMap &properties);
50 Q_NOREPLY void AcknowledgeAllMessages(const QVariantMap &properties);
51+ bool DestroyTextChannel(const QString &objectPath);
52+ Q_NOREPLY void ChangeRoomTitle(const QString &objectPath, const QString &title);
53
54 // call related
55 Q_NOREPLY void StartCall(const QString &number, const QString &accountId);
56
57=== modified file 'handler/messagesendingjob.cpp'
58--- handler/messagesendingjob.cpp 2016-06-15 09:41:11 +0000
59+++ handler/messagesendingjob.cpp 2016-06-15 09:41:11 +0000
60@@ -214,7 +214,28 @@
61 void MessageSendingJob::sendMessage()
62 {
63 qDebug() << __PRETTY_FUNCTION__;
64- Tp::PendingSendMessage *op = mTextChannel->send(buildMessage(mMessage));
65+
66+ Tp::MessagePartList messageParts = buildMessage(mMessage);
67+ Tp::PendingSendMessage *op = NULL;
68+ // some protocols can't sent multipart messages, so we check here
69+ // and split the parts if needed
70+ if (canSendMultiPartMessages()) {
71+ op = mTextChannel->send(messageParts);
72+ } else {
73+ bool messageSent = false;
74+ Tp::MessagePart header = messageParts.takeFirst();
75+ Q_FOREACH(const Tp::MessagePart &part, messageParts) {
76+ Tp::MessagePartList newMessage;
77+ newMessage << header;
78+ newMessage << part;
79+ Tp::PendingSendMessage *thisOp = mTextChannel->send(newMessage);
80+ if (messageSent) {
81+ continue;
82+ }
83+ messageSent = true;
84+ op = thisOp;
85+ }
86+ }
87 connect(op, &Tp::PendingOperation::finished, [this, op]() {
88 if (op->isError()) {
89 setStatus(Failed);
90@@ -228,6 +249,24 @@
91 scheduleDeletion();
92 });
93 }
94+
95+bool MessageSendingJob::canSendMultiPartMessages()
96+{
97+ if (!mAccount) {
98+ return false;
99+ }
100+ switch (mAccount->type()) {
101+ case AccountEntry::PhoneAccount:
102+ return true;
103+ // TODO check in telepathy if multipart is supported
104+ // currently we just return false to be on the safe side
105+ case AccountEntry::GenericAccount:
106+ case AccountEntry::MultimediaAccount:
107+ default:
108+ return false;
109+ }
110+ return false;
111+}
112
113 void MessageSendingJob::setAccountId(const QString &accountId)
114 {
115
116=== modified file 'handler/messagesendingjob.h'
117--- handler/messagesendingjob.h 2016-06-15 09:41:11 +0000
118+++ handler/messagesendingjob.h 2016-06-15 09:41:11 +0000
119@@ -89,6 +89,7 @@
120 MessageSendingJobAdaptor *mAdaptor;
121
122 Tp::MessagePartList buildMessage(const PendingMessage &pendingMessage);
123+ bool canSendMultiPartMessages();
124
125 };
126
127
128=== modified file 'handler/texthandler.cpp'
129--- handler/texthandler.cpp 2016-06-15 09:41:11 +0000
130+++ handler/texthandler.cpp 2016-06-15 09:41:11 +0000
131@@ -99,14 +99,7 @@
132
133 bool TextHandler::destroyTextChannel(const QString &objectPath)
134 {
135- Tp::TextChannelPtr channelToDestroy;
136- Q_FOREACH(Tp::TextChannelPtr channel, mChannels) {
137- if (channel->objectPath() == objectPath) {
138- channelToDestroy = channel;
139- break;
140- }
141- }
142-
143+ Tp::TextChannelPtr channelToDestroy = existingChannelFromObjectPath(objectPath);
144 if (!channelToDestroy ||
145 !channelToDestroy->hasInterface(TP_QT_IFACE_CHANNEL_INTERFACE_DESTROYABLE)) {
146 return false;
147@@ -123,6 +116,28 @@
148 return !reply.isError();
149 }
150
151+void TextHandler::changeRoomTitle(const QString &objectPath, const QString &title)
152+{
153+ qDebug() << __PRETTY_FUNCTION__;
154+ Tp::TextChannelPtr channel = existingChannelFromObjectPath(objectPath);
155+ if (!channel) {
156+ qWarning() << "Could not find channel for object path" << objectPath;
157+ return;
158+ }
159+
160+ Tp::Client::ChannelInterfaceRoomConfigInterface *roomConfigInterface;
161+ roomConfigInterface = channel->optionalInterface<Tp::Client::ChannelInterfaceRoomConfigInterface>();
162+ if (!roomConfigInterface) {
163+ qWarning() << "Could not find RoomConfig interface in the channel" << objectPath;
164+ return;
165+ }
166+
167+ QVariantMap properties;
168+ properties["Title"] = title;
169+ // FIXME: we better check for the result here and maybe notify the app
170+ roomConfigInterface->UpdateConfiguration(properties);
171+}
172+
173 void TextHandler::onTextChannelInvalidated()
174 {
175 Tp::TextChannelPtr textChannel(qobject_cast<Tp::TextChannel*>(sender()));
176@@ -201,3 +216,13 @@
177 }
178 return channels;
179 }
180+
181+Tp::TextChannelPtr TextHandler::existingChannelFromObjectPath(const QString &objectPath)
182+{
183+ Q_FOREACH(Tp::TextChannelPtr channel, mChannels) {
184+ if (channel->objectPath() == objectPath) {
185+ return channel;
186+ }
187+ }
188+ return Tp::TextChannelPtr();
189+}
190
191=== modified file 'handler/texthandler.h'
192--- handler/texthandler.h 2016-06-15 09:41:11 +0000
193+++ handler/texthandler.h 2016-06-15 09:41:11 +0000
194@@ -43,6 +43,7 @@
195 void acknowledgeMessages(const QVariantList &messages);
196 void acknowledgeAllMessages(const QVariantMap &properties);
197 bool destroyTextChannel(const QString &objectPath);
198+ void changeRoomTitle(const QString &objectPath, const QString &title);
199
200 protected Q_SLOTS:
201 void onTextChannelAvailable(Tp::TextChannelPtr channel);
202@@ -50,6 +51,7 @@
203
204 protected:
205 QList<Tp::TextChannelPtr> existingChannels(const QString &accountId, const QVariantMap &properties);
206+ Tp::TextChannelPtr existingChannelFromObjectPath(const QString &objectPath);
207
208 private:
209 explicit TextHandler(QObject *parent = 0);
210
211=== modified file 'libtelephonyservice/chatentry.cpp'
212--- libtelephonyservice/chatentry.cpp 2016-06-15 09:41:11 +0000
213+++ libtelephonyservice/chatentry.cpp 2016-06-15 09:41:11 +0000
214@@ -30,6 +30,7 @@
215 #include <TelepathyQt/Contact>
216 #include <TelepathyQt/PendingReady>
217 #include <TelepathyQt/Connection>
218+#include <TelepathyQt/PendingVariantMap>
219
220 Q_DECLARE_METATYPE(ContactChatStates)
221
222@@ -115,6 +116,21 @@
223 return mTitle;
224 }
225
226+void ChatEntry::setTitle(const QString &title)
227+{
228+ // FIXME: remove this debug before going into production.
229+ qDebug() << __PRETTY_FUNCTION__ << "Changing group title to" << title;
230+ QDBusInterface *handlerIface = TelepathyHelper::instance()->handlerInterface();
231+ Q_FOREACH(const Tp::TextChannelPtr channel, mChannels) {
232+ if (!channel->hasInterface(TP_QT_IFACE_CHANNEL_INTERFACE_ROOM_CONFIG)) {
233+ qWarning() << "Channel doesn't have the RoomConfig interface";
234+ return;
235+ }
236+
237+ handlerIface->asyncCall("ChangeRoomTitle", channel->objectPath(), title);
238+ }
239+}
240+
241 ChatEntry::~ChatEntry()
242 {
243 QMap<QString, ContactChatState*> tmp = mChatStates;
244@@ -296,6 +312,12 @@
245 }
246 if (roomConfigInterface) {
247 roomConfigInterface->setMonitorProperties(true);
248+ Tp::PendingVariantMap *pendingResult = roomConfigInterface->requestAllProperties();
249+ connect(pendingResult, &Tp::PendingOperation::finished, [=](){
250+ if (!pendingResult->isError()) {
251+ onRoomPropertiesChanged(pendingResult->result(), QStringList());
252+ }
253+ });
254 connect(roomConfigInterface, SIGNAL(propertiesChanged(const QVariantMap &,const QStringList &)),
255 SLOT(onRoomPropertiesChanged(const QVariantMap &,const QStringList &)));
256 }
257
258=== modified file 'libtelephonyservice/chatentry.h'
259--- libtelephonyservice/chatentry.h 2016-06-15 09:41:11 +0000
260+++ libtelephonyservice/chatentry.h 2016-06-15 09:41:11 +0000
261@@ -59,7 +59,7 @@
262 Q_PROPERTY(QString roomName READ roomName WRITE setRoomName NOTIFY roomNameChanged)
263 Q_PROPERTY(QString chatId READ chatId WRITE setChatId NOTIFY chatIdChanged)
264 Q_PROPERTY(QString accountId READ accountId WRITE setAccountId NOTIFY accountIdChanged)
265- Q_PROPERTY(QString title READ title NOTIFY titleChanged)
266+ Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged)
267 Q_PROPERTY(QQmlListProperty<ContactChatState> chatStates
268 READ chatStates
269 NOTIFY chatStatesChanged)
270@@ -95,6 +95,7 @@
271 QString roomName() const;
272 void setRoomName(const QString &name);
273 QString title() const;
274+ void setTitle(const QString & title);
275 static int chatStatesCount(QQmlListProperty<ContactChatState> *p);
276 static ContactChatState *chatStatesAt(QQmlListProperty<ContactChatState> *p, int index);
277

Subscribers

People subscribed via source and target branches

to all changes: