Merge lp:~tiagosh/telephony-service/rtm-14.09-fix-1423942 into lp:telephony-service/rtm-14.09

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Pat McGowan
Approved revision: 945
Merged at revision: 944
Proposed branch: lp:~tiagosh/telephony-service/rtm-14.09-fix-1423942
Merge into: lp:telephony-service/rtm-14.09
Diff against target: 100 lines (+17/-5)
4 files modified
indicator/textchannelobserver.cpp (+2/-2)
libtelephonyservice/accountentry.cpp (+11/-0)
libtelephonyservice/accountentry.h (+3/-0)
libtelephonyservice/telepathyhelper.cpp (+1/-3)
To merge this branch: bzr merge lp:~tiagosh/telephony-service/rtm-14.09-fix-1423942
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
Review via email: mp+250498@code.launchpad.net

Commit message

Check if default sim is active before sending messages.

Description of the change

Check if default sim is active before sending messages.

To post a comment you must log in.
945. By Tiago Salem Herrmann

use the right accountId

Revision history for this message
Sebastien Bacher (seb128) wrote :

tested the change on rtm and it fixes the issue described in the bug indeed

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'indicator/textchannelobserver.cpp'
2--- indicator/textchannelobserver.cpp 2015-01-13 11:55:32 +0000
3+++ indicator/textchannelobserver.cpp 2015-02-20 20:51:00 +0000
4@@ -167,7 +167,7 @@
5 AccountEntry *account = TelepathyHelper::instance()->accountForId(accountId);
6 if (!account || accountId.isEmpty()) {
7 // fallback to the default account
8- if (TelepathyHelper::instance()->defaultMessagingAccount() && TelepathyHelper::instance()->activeAccounts().size() > 1) {
9+ if (TelepathyHelper::instance()->defaultMessagingAccount() && TelepathyHelper::instance()->defaultMessagingAccount()->active()) {
10 account = TelepathyHelper::instance()->defaultMessagingAccount();
11 } else if (TelepathyHelper::instance()->activeAccounts().size() > 0) {
12 account = TelepathyHelper::instance()->activeAccounts()[0];
13@@ -244,7 +244,7 @@
14 return;
15 }
16
17- ChatManager::instance()->sendMessage(phoneNumbers, text, accountId);
18+ ChatManager::instance()->sendMessage(phoneNumbers, text, account->accountId());
19 }
20
21 void TextChannelObserver::showNotificationForFlashMessage(const Tp::ReceivedMessage &message)
22
23=== modified file 'libtelephonyservice/accountentry.cpp'
24--- libtelephonyservice/accountentry.cpp 2015-02-06 20:55:57 +0000
25+++ libtelephonyservice/accountentry.cpp 2015-02-20 20:51:00 +0000
26@@ -39,6 +39,13 @@
27 return mAccount->uniqueIdentifier();
28 }
29
30+bool AccountEntry::active() const
31+{
32+ return (!mAccount->connection().isNull() &&
33+ !mAccount->connection()->selfContact().isNull() &&
34+ mAccount->connection()->selfContact()->presence().type() != Tp::ConnectionPresenceTypeOffline);
35+}
36+
37 QString AccountEntry::displayName() const
38 {
39 if (mAccount.isNull()) {
40@@ -199,6 +206,9 @@
41 connect(mAccount->connection()->selfContact().data(),
42 SIGNAL(presenceChanged(Tp::Presence)),
43 SIGNAL(simLockedChanged()));
44+ connect(mAccount->connection()->selfContact().data(),
45+ SIGNAL(presenceChanged(Tp::Presence)),
46+ SIGNAL(activeChanged()));
47 }
48
49 void AccountEntry::onConnectionChanged()
50@@ -276,6 +286,7 @@
51 Q_EMIT connectedChanged();
52 Q_EMIT simLockedChanged();
53 Q_EMIT serialChanged();
54+ Q_EMIT activeChanged();
55 }
56
57 void AccountEntry::onEmergencyNumbersChanged(const QStringList &numbers)
58
59=== modified file 'libtelephonyservice/accountentry.h'
60--- libtelephonyservice/accountentry.h 2015-02-06 20:55:57 +0000
61+++ libtelephonyservice/accountentry.h 2015-02-20 20:51:00 +0000
62@@ -35,6 +35,7 @@
63 {
64 Q_OBJECT
65 Q_PROPERTY(QString accountId READ accountId NOTIFY accountIdChanged)
66+ Q_PROPERTY(bool active READ active NOTIFY activeChanged)
67 Q_PROPERTY(QString displayName READ displayName WRITE setDisplayName NOTIFY displayNameChanged)
68 Q_PROPERTY(bool connected READ connected NOTIFY connectedChanged)
69 Q_PROPERTY(QStringList emergencyNumbers READ emergencyNumbers NOTIFY emergencyNumbersChanged)
70@@ -49,6 +50,7 @@
71 public:
72 explicit AccountEntry(const Tp::AccountPtr &account, QObject *parent = 0);
73 QString accountId() const;
74+ bool active() const;
75 QString displayName() const;
76 QString networkName() const;
77 bool simLocked() const;
78@@ -65,6 +67,7 @@
79 Q_SIGNALS:
80 void accountReady();
81 void accountIdChanged();
82+ void activeChanged();
83 void displayNameChanged();
84 void networkNameChanged();
85 void simLockedChanged();
86
87=== modified file 'libtelephonyservice/telepathyhelper.cpp'
88--- libtelephonyservice/telepathyhelper.cpp 2015-01-20 12:13:46 +0000
89+++ libtelephonyservice/telepathyhelper.cpp 2015-02-20 20:51:00 +0000
90@@ -135,9 +135,7 @@
91 {
92 QList<AccountEntry*> activeAccountList;
93 Q_FOREACH(AccountEntry *account, mAccounts) {
94- if (!account->account()->connection().isNull() &&
95- !account->account()->connection()->selfContact().isNull() &&
96- account->account()->connection()->selfContact()->presence().type() != Tp::ConnectionPresenceTypeOffline) {
97+ if (account->active()) {
98 activeAccountList << account;
99 }
100 }

Subscribers

People subscribed via source and target branches