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

chat: provide default account if not set

Change-Id: I19db105c07181f7763f964d7d263c6c3cb29c8e2
Tuleap: #202
parent 04e73a66
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "private/person_p.h" #include "private/person_p.h"
#include "private/contactmethod_p.h" #include "private/contactmethod_p.h"
#include "call.h" #include "call.h"
#include "availableaccountmodel.h"
#include "dbus/presencemanager.h" #include "dbus/presencemanager.h"
#include "numbercategorymodel.h" #include "numbercategorymodel.h"
#include "private/numbercategorymodel_p.h" #include "private/numbercategorymodel_p.h"
...@@ -806,8 +807,14 @@ void ContactMethodPrivate::setTextRecording(Media::TextRecording* r) ...@@ -806,8 +807,14 @@ void ContactMethodPrivate::setTextRecording(Media::TextRecording* r)
bool ContactMethod::sendOfflineTextMessage(const QMap<QString,QString>& payloads) bool ContactMethod::sendOfflineTextMessage(const QMap<QString,QString>& payloads)
{ {
if (!account()) 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; 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(account()->id(),uri(),payloads);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment