Skip to content
Snippets Groups Projects
Commit a9df8141 authored by Alexandre Lision's avatar Alexandre Lision Committed by gerrit2
Browse files

im: do not set account on CM

select a correct account if the CM is not associated to one, but
do not set it on the CM; it causes the sha1 to be regenerated and
text messages to  be saved in the wrong json file.

Change-Id: I293740bbce5e2cf1e53eee1905bc670c10b65d47
Tuleap: #260
parent cf4d305f
Branches
Tags
No related merge requests found
...@@ -807,17 +807,15 @@ void ContactMethodPrivate::setTextRecording(Media::TextRecording* r) ...@@ -807,17 +807,15 @@ void ContactMethodPrivate::setTextRecording(Media::TextRecording* r)
bool ContactMethod::sendOfflineTextMessage(const QMap<QString,QString>& payloads) bool ContactMethod::sendOfflineTextMessage(const QMap<QString,QString>& payloads)
{ {
if (!account()) { auto selectedAccount = account() ? account() : AvailableAccountModel::currentDefaultAccount(this);
qDebug() << "Account is not set, taking the first registered.";
setAccount(AvailableAccountModel::currentDefaultAccount(this)); if (!selectedAccount) {
if (!account()) { qDebug() << "No account available for this contactmethod!";
qDebug() << "No account registered for this contactmethod!";
return false; return false;
} }
}
auto txtRecording = textRecording(); auto txtRecording = textRecording();
txtRecording->d_ptr->insertNewMessage(payloads, this, Media::Media::Direction::OUT); txtRecording->d_ptr->insertNewMessage(payloads, this, Media::Media::Direction::OUT);
ConfigurationManager::instance().sendTextMessage(account()->id(),uri(),payloads); ConfigurationManager::instance().sendTextMessage(selectedAccount->id(),uri(),payloads);
return true; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment