sip: follow API changes (incomingAccountMessage)

Change-Id: I55f58a36bb4b5840cba2942eff3922359d1845b6
parent 225f8db9
...@@ -139,10 +139,14 @@ Q_SIGNALS: ...@@ -139,10 +139,14 @@ Q_SIGNALS:
/** /**
* Connect this signal to know when a text message arrives for this account * Connect this signal to know when a text message arrives for this account
* @param accountId * @param accountId
* @param msgId Interaction's id
* @param from peer uri * @param from peer uri
* @param payloads content of the message * @param payloads content of the message
*/ */
void newAccountMessage(std::string& accountId, std::string& from, std::map<std::string,std::string> payloads) const; void newAccountMessage(std::string& accountId,
std::string& msgId,
std::string& from,
std::map<std::string,std::string> payloads) const;
/** /**
* Connect this signal to know when a file transfer interaction is incoming * Connect this signal to know when a file transfer interaction is incoming
* @param dringId Daemon's ID for incoming transfer * @param dringId Daemon's ID for incoming transfer
......
...@@ -246,6 +246,7 @@ CallbacksHandler::subscribeToDebugReceived() ...@@ -246,6 +246,7 @@ CallbacksHandler::subscribeToDebugReceived()
void void
CallbacksHandler::slotNewAccountMessage(const QString& accountId, CallbacksHandler::slotNewAccountMessage(const QString& accountId,
const QString& msgId,
const QString& from, const QString& from,
const QMap<QString,QString>& payloads) const QMap<QString,QString>& payloads)
{ {
...@@ -257,8 +258,9 @@ CallbacksHandler::slotNewAccountMessage(const QString& accountId, ...@@ -257,8 +258,9 @@ CallbacksHandler::slotNewAccountMessage(const QString& accountId,
auto accountId2 = accountId.toStdString(); auto accountId2 = accountId.toStdString();
auto from2 = QString(from).replace("@ring.dht", "").toStdString(); auto from2 = QString(from).replace("@ring.dht", "").toStdString();
auto msgId2 = QString(msgId).toStdString();
emit newAccountMessage(accountId2, from2, stdPayloads); emit newAccountMessage(accountId2, msgId2, from2, stdPayloads);
} }
void void
......
...@@ -59,10 +59,12 @@ Q_SIGNALS: ...@@ -59,10 +59,12 @@ Q_SIGNALS:
/** /**
* Connect this signal to get incoming text interaction from the DHT. * Connect this signal to get incoming text interaction from the DHT.
* @param accountId interaction receiver. * @param accountId interaction receiver.
* @param from interaction sender. * @param msgId interaction's id.
* @param from interaction sender.
* @param payloads. * @param payloads.
*/ */
void newAccountMessage(std::string& accountId, void newAccountMessage(std::string& accountId,
std::string& msgId,
std::string& from, std::string& from,
std::map<std::string,std::string> payloads); std::map<std::string,std::string> payloads);
/** /**
...@@ -296,10 +298,12 @@ private Q_SLOTS: ...@@ -296,10 +298,12 @@ private Q_SLOTS:
/** /**
* Emit newAccountMessage * Emit newAccountMessage
* @param accountId * @param accountId
* @param msgId
* @param from * @param from
* @param payloads of the interaction * @param payloads of the interaction
*/ */
void slotNewAccountMessage(const QString& accountId, void slotNewAccountMessage(const QString& accountId,
const QString& msgId,
const QString& from, const QString& from,
const QMap<QString,QString>& payloads); const QMap<QString,QString>& payloads);
/** /**
......
...@@ -166,10 +166,12 @@ public Q_SLOTS: ...@@ -166,10 +166,12 @@ public Q_SLOTS:
/** /**
* Listen from callbacksHandler for new account interaction and add pending contact if not present * Listen from callbacksHandler for new account interaction and add pending contact if not present
* @param accountId * @param accountId
* @param msgId
* @param from * @param from
* @param payloads * @param payloads
*/ */
void slotNewAccountMessage(std::string& accountId, void slotNewAccountMessage(std::string& accountId,
std::string& msgId,
std::string& from, std::string& from,
std::map<std::string,std::string> payloads); std::map<std::string,std::string> payloads);
...@@ -847,6 +849,7 @@ ContactModelPimpl::slotIncomingCall(const std::string& fromId, const std::string ...@@ -847,6 +849,7 @@ ContactModelPimpl::slotIncomingCall(const std::string& fromId, const std::string
void void
ContactModelPimpl::slotNewAccountMessage(std::string& accountId, ContactModelPimpl::slotNewAccountMessage(std::string& accountId,
std::string& msgId,
std::string& from, std::string& from,
std::map<std::string,std::string> payloads) std::map<std::string,std::string> payloads)
{ {
...@@ -876,7 +879,7 @@ ContactModelPimpl::slotNewAccountMessage(std::string& accountId, ...@@ -876,7 +879,7 @@ ContactModelPimpl::slotNewAccountMessage(std::string& accountId,
if (emitNewTrust) { if (emitNewTrust) {
emit behaviorController.newTrustRequest(linked.owner.id, from); emit behaviorController.newTrustRequest(linked.owner.id, from);
} }
emit linked.newAccountMessage(accountId, from, payloads); emit linked.newAccountMessage(accountId, msgId, from, payloads);
} }
std::string std::string
......
...@@ -115,10 +115,11 @@ public: ...@@ -115,10 +115,11 @@ public:
* @param from the author uri * @param from the author uri
* @param body the content of the message * @param body the content of the message
* @param timestamp the timestamp of the message * @param timestamp the timestamp of the message
* @return msgId generated (in db)
*/ */
void addIncomingMessage(const std::string& from, int addIncomingMessage(const std::string& from,
const std::string& body, const std::string& body,
const uint64_t& timestamp = 0); const uint64_t& timestamp = 0);
/** /**
* Change the status of an interaction. Listen from callbacksHandler * Change the status of an interaction. Listen from callbacksHandler
* @param accountId, account linked * @param accountId, account linked
...@@ -218,10 +219,12 @@ public Q_SLOTS: ...@@ -218,10 +219,12 @@ public Q_SLOTS:
/** /**
* Listen from CallbacksHandler for new incoming interactions; * Listen from CallbacksHandler for new incoming interactions;
* @param accountId * @param accountId
* @param msgId
* @param from uri * @param from uri
* @param payloads body * @param payloads body
*/ */
void slotNewAccountMessage(std::string& accountId, void slotNewAccountMessage(std::string& accountId,
std::string& msgId,
std::string& from, std::string& from,
std::map<std::string,std::string> payloads); std::map<std::string,std::string> payloads);
/** /**
...@@ -1765,6 +1768,7 @@ ConversationModelPimpl::addOrUpdateCallMessage(const std::string& callId, ...@@ -1765,6 +1768,7 @@ ConversationModelPimpl::addOrUpdateCallMessage(const std::string& callId,
void void
ConversationModelPimpl::slotNewAccountMessage(std::string& accountId, ConversationModelPimpl::slotNewAccountMessage(std::string& accountId,
std::string& msgId,
std::string& from, std::string& from,
std::map<std::string,std::string> payloads) std::map<std::string,std::string> payloads)
{ {
...@@ -1773,7 +1777,8 @@ ConversationModelPimpl::slotNewAccountMessage(std::string& accountId, ...@@ -1773,7 +1777,8 @@ ConversationModelPimpl::slotNewAccountMessage(std::string& accountId,
for (const auto &payload : payloads) { for (const auto &payload : payloads) {
if (payload.first.find("text/plain") != std::string::npos) { if (payload.first.find("text/plain") != std::string::npos) {
addIncomingMessage(from, payload.second); auto dbId = addIncomingMessage(from, payload.second);
storage::addDaemonMsgId(db, std::to_string(dbId), msgId);
} }
} }
} }
...@@ -1801,7 +1806,7 @@ ConversationModelPimpl::slotIncomingCallMessage(const std::string& callId, const ...@@ -1801,7 +1806,7 @@ ConversationModelPimpl::slotIncomingCallMessage(const std::string& callId, const
} }
void int
ConversationModelPimpl::addIncomingMessage(const std::string& from, ConversationModelPimpl::addIncomingMessage(const std::string& from,
const std::string& body, const std::string& body,
const uint64_t& timestamp) const uint64_t& timestamp)
...@@ -1832,6 +1837,7 @@ ConversationModelPimpl::addIncomingMessage(const std::string& from, ...@@ -1832,6 +1837,7 @@ ConversationModelPimpl::addIncomingMessage(const std::string& from,
emit linked.newInteraction(convIds[0], msgId, msg); emit linked.newInteraction(convIds[0], msgId, msg);
sortConversations(); sortConversations();
emit linked.modelSorted(); emit linked.modelSorted();
return msgId;
} }
void void
......
...@@ -141,8 +141,8 @@ public: ...@@ -141,8 +141,8 @@ public:
Q_EMIT this->registeredNameFound(QString(accountId.c_str()), status, QString(address.c_str()), QString(name.c_str())); Q_EMIT this->registeredNameFound(QString(accountId.c_str()), status, QString(address.c_str()), QString(name.c_str()));
}), }),
exportable_callback<ConfigurationSignal::IncomingAccountMessage>( exportable_callback<ConfigurationSignal::IncomingAccountMessage>(
[this] (const std::string& account_id, const std::string& from, const std::map<std::string, std::string>& payloads) { [this] (const std::string& account_id, const std::string& msgId, const std::string& from, const std::map<std::string, std::string>& payloads) {
Q_EMIT this->incomingAccountMessage(QString(account_id.c_str()), QString(from.c_str()), convertMap(payloads)); Q_EMIT this->incomingAccountMessage(QString(account_id.c_str()), QString(msgId.c_str()), QString(from.c_str()), convertMap(payloads));
}), }),
exportable_callback<ConfigurationSignal::MediaParametersChanged>( exportable_callback<ConfigurationSignal::MediaParametersChanged>(
[this] (const std::string& account_id) { [this] (const std::string& account_id) {
...@@ -722,7 +722,7 @@ Q_SIGNALS: // SIGNALS ...@@ -722,7 +722,7 @@ Q_SIGNALS: // SIGNALS
void incomingTrustRequest(const QString& accountId, const QString& from, const QByteArray& payload, qulonglong timeStamp); void incomingTrustRequest(const QString& accountId, const QString& from, const QByteArray& payload, qulonglong timeStamp);
void knownDevicesChanged(const QString& accountId, const MapStringString& devices); void knownDevicesChanged(const QString& accountId, const MapStringString& devices);
void exportOnRingEnded(const QString& accountId, int status, const QString& pin); void exportOnRingEnded(const QString& accountId, int status, const QString& pin);
void incomingAccountMessage(const QString& accountId, const QString& from, const MapStringString& payloads); void incomingAccountMessage(const QString& accountId, const QString msgId, const QString& from, const MapStringString& payloads);
void mediaParametersChanged(const QString& accountId); void mediaParametersChanged(const QString& accountId);
void audioDeviceEvent(); void audioDeviceEvent();
void audioMeter(const QString& id, float level); void audioMeter(const QString& id, float level);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment