sip: follow API changes (incomingAccountMessage)

Change-Id: I55f58a36bb4b5840cba2942eff3922359d1845b6
parent 225f8db9
......@@ -139,10 +139,14 @@ Q_SIGNALS:
/**
* Connect this signal to know when a text message arrives for this account
* @param accountId
* @param msgId Interaction's id
* @param from peer uri
* @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
* @param dringId Daemon's ID for incoming transfer
......
......@@ -246,6 +246,7 @@ CallbacksHandler::subscribeToDebugReceived()
void
CallbacksHandler::slotNewAccountMessage(const QString& accountId,
const QString& msgId,
const QString& from,
const QMap<QString,QString>& payloads)
{
......@@ -257,8 +258,9 @@ CallbacksHandler::slotNewAccountMessage(const QString& accountId,
auto accountId2 = accountId.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
......
......@@ -59,10 +59,12 @@ Q_SIGNALS:
/**
* Connect this signal to get incoming text interaction from the DHT.
* @param accountId interaction receiver.
* @param from interaction sender.
* @param msgId interaction's id.
* @param from interaction sender.
* @param payloads.
*/
void newAccountMessage(std::string& accountId,
std::string& msgId,
std::string& from,
std::map<std::string,std::string> payloads);
/**
......@@ -296,10 +298,12 @@ private Q_SLOTS:
/**
* Emit newAccountMessage
* @param accountId
* @param msgId
* @param from
* @param payloads of the interaction
*/
void slotNewAccountMessage(const QString& accountId,
const QString& msgId,
const QString& from,
const QMap<QString,QString>& payloads);
/**
......
......@@ -166,10 +166,12 @@ public Q_SLOTS:
/**
* Listen from callbacksHandler for new account interaction and add pending contact if not present
* @param accountId
* @param msgId
* @param from
* @param payloads
*/
void slotNewAccountMessage(std::string& accountId,
std::string& msgId,
std::string& from,
std::map<std::string,std::string> payloads);
......@@ -847,6 +849,7 @@ ContactModelPimpl::slotIncomingCall(const std::string& fromId, const std::string
void
ContactModelPimpl::slotNewAccountMessage(std::string& accountId,
std::string& msgId,
std::string& from,
std::map<std::string,std::string> payloads)
{
......@@ -876,7 +879,7 @@ ContactModelPimpl::slotNewAccountMessage(std::string& accountId,
if (emitNewTrust) {
emit behaviorController.newTrustRequest(linked.owner.id, from);
}
emit linked.newAccountMessage(accountId, from, payloads);
emit linked.newAccountMessage(accountId, msgId, from, payloads);
}
std::string
......
......@@ -115,10 +115,11 @@ public:
* @param from the author uri
* @param body the content of the message
* @param timestamp the timestamp of the message
* @return msgId generated (in db)
*/
void addIncomingMessage(const std::string& from,
const std::string& body,
const uint64_t& timestamp = 0);
int addIncomingMessage(const std::string& from,
const std::string& body,
const uint64_t& timestamp = 0);
/**
* Change the status of an interaction. Listen from callbacksHandler
* @param accountId, account linked
......@@ -218,10 +219,12 @@ public Q_SLOTS:
/**
* Listen from CallbacksHandler for new incoming interactions;
* @param accountId
* @param msgId
* @param from uri
* @param payloads body
*/
void slotNewAccountMessage(std::string& accountId,
std::string& msgId,
std::string& from,
std::map<std::string,std::string> payloads);
/**
......@@ -1765,6 +1768,7 @@ ConversationModelPimpl::addOrUpdateCallMessage(const std::string& callId,
void
ConversationModelPimpl::slotNewAccountMessage(std::string& accountId,
std::string& msgId,
std::string& from,
std::map<std::string,std::string> payloads)
{
......@@ -1773,7 +1777,8 @@ ConversationModelPimpl::slotNewAccountMessage(std::string& accountId,
for (const auto &payload : payloads) {
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
}
void
int
ConversationModelPimpl::addIncomingMessage(const std::string& from,
const std::string& body,
const uint64_t& timestamp)
......@@ -1832,6 +1837,7 @@ ConversationModelPimpl::addIncomingMessage(const std::string& from,
emit linked.newInteraction(convIds[0], msgId, msg);
sortConversations();
emit linked.modelSorted();
return msgId;
}
void
......
......@@ -141,8 +141,8 @@ public:
Q_EMIT this->registeredNameFound(QString(accountId.c_str()), status, QString(address.c_str()), QString(name.c_str()));
}),
exportable_callback<ConfigurationSignal::IncomingAccountMessage>(
[this] (const std::string& account_id, 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));
[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(msgId.c_str()), QString(from.c_str()), convertMap(payloads));
}),
exportable_callback<ConfigurationSignal::MediaParametersChanged>(
[this] (const std::string& account_id) {
......@@ -722,7 +722,7 @@ Q_SIGNALS: // SIGNALS
void incomingTrustRequest(const QString& accountId, const QString& from, const QByteArray& payload, qulonglong timeStamp);
void knownDevicesChanged(const QString& accountId, const MapStringString& devices);
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 audioDeviceEvent();
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