Skip to content
Snippets Groups Projects
Commit 7f5fa093 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

typers: do not emit message for remote device

Change-Id: I6c783563a0a58327012a3e2889ea78ea6c595d89
parent a07f0b39
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,7 @@ getIsComposing(const std::string& conversationId, bool isWriting)
}
void
Typers::addTyper(const std::string &typer)
Typers::addTyper(const std::string &typer, bool sendMessage)
{
auto acc = acc_.lock();
if (!acc || !acc->isComposingEnabled())
......@@ -73,27 +73,30 @@ Typers::addTyper(const std::string &typer)
if (typer != selfUri_)
emitSignal<libjami::ConfigurationSignal::ComposingStatusChanged>(accountId_,
convId_,
typer,
1);
convId_,
typer,
1);
return;
}
if (typer == selfUri_) {
if (sendMessage) {
// In this case we should emit for remote to update the timer
acc->sendInstantMessage(convId_,
{{MIME_TYPE_IM_COMPOSING, getIsComposing(convId_, true)}});
}
}
void
Typers::removeTyper(const std::string &typer)
Typers::removeTyper(const std::string &typer, bool sendMessage)
{
auto acc = acc_.lock();
if (!acc || !acc->isComposingEnabled())
return;
if (watcher_.erase(typer)) {
if (typer == selfUri_) {
if (sendMessage) {
acc->sendInstantMessage(convId_,
{{MIME_TYPE_IM_COMPOSING, getIsComposing(convId_, false)}});
} else {
}
if (typer != selfUri_) {
emitSignal<libjami::ConfigurationSignal::ComposingStatusChanged>(accountId_,
convId_,
typer,
......
......@@ -34,8 +34,13 @@ public:
Typers(const std::shared_ptr<JamiAccount>& acc, const std::string &convId);
~Typers();
void addTyper(const std::string &typer);
void removeTyper(const std::string &typer);
/**
* Add typer to the list of typers
* @param typer
* @param sendMessage (should be true for local typer, false for remote typer)
*/
void addTyper(const std::string &typer, bool sendMessage = false);
void removeTyper(const std::string &typer, bool sendMessage = false);
private:
void onTyperTimeout(const asio::error_code& ec, const std::string &typer);
......
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