Commit 3e2c8637 authored by Adrien Béraud's avatar Adrien Béraud

call: send text message on main thread

Change-Id: Ic2d9de6e6af09cabc0838da88afedfa16af174d1
parent 13a9fcba
......@@ -539,9 +539,12 @@ Call::checkPendingIM()
Manager::instance().incomingMessage(getCallId(), getPeerNumber(), msg.first);
pendingInMessages_.clear();
for (const auto& msg : pendingOutMessages_)
sendTextMessage(msg.first, msg.second);
pendingOutMessages_.clear();
std::weak_ptr<Call> callWkPtr = shared_from_this();
runOnMainThread([callWkPtr, pending = std::move(pendingOutMessages_)]{
if (auto call = callWkPtr.lock())
for (const auto& msg : pending)
call->sendTextMessage(msg.first, msg.second);
});
}
}
}
......
......@@ -317,7 +317,9 @@ switchInput(const std::string& callID, const std::string& resource)
void
sendTextMessage(const std::string& callID, const std::map<std::string, std::string>& messages, const std::string& from, bool isMixed)
{
jami::Manager::instance().sendCallTextMessage(callID, messages, from, isMixed);
jami::runOnMainThread([callID, messages, from, isMixed]{
jami::Manager::instance().sendCallTextMessage(callID, messages, from, isMixed);
});
}
} // namespace DRing
......@@ -706,6 +706,7 @@ void
SIPCall::sendTextMessage(const std::map<std::string, std::string>& messages,
const std::string& from)
{
std::lock_guard<std::recursive_mutex> lk {callMutex_};
//TODO: for now we ignore the "from" (the previous implementation for sending this info was
// buggy and verbose), another way to send the original message sender will be implemented
// in the future
......
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