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
No related branches found
No related tags found
No related merge requests found
......@@ -807,17 +807,15 @@ void ContactMethodPrivate::setTextRecording(Media::TextRecording* r)
bool ContactMethod::sendOfflineTextMessage(const QMap<QString,QString>& payloads)
{
if (!account()) {
qDebug() << "Account is not set, taking the first registered.";
setAccount(AvailableAccountModel::currentDefaultAccount(this));
if (!account()) {
qDebug() << "No account registered for this contactmethod!";
return false;
}
auto selectedAccount = account() ? account() : AvailableAccountModel::currentDefaultAccount(this);
if (!selectedAccount) {
qDebug() << "No account available for this contactmethod!";
return false;
}
auto txtRecording = textRecording();
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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment