22static constexpr std::chrono::steady_clock::duration
COMPOSING_TIMEOUT {std::chrono::seconds(12)};
27 : ioContext_(
Manager::instance().ioContext())
29 , accountId_(acc->getAccountID())
31 , selfUri_(acc->getUsername())
38 for (
auto&
watcher : watcher_) {
48 return fmt::format(
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n"
49 "<isComposing><state>{}</state>{}</isComposing>",
51 conversationId.empty()
53 :
"<conversation>" + conversationId +
"</conversation>");
59 auto acc = acc_.lock();
60 if (!acc || !acc->isComposingEnabled())
62 auto [
it,
res] = watcher_.emplace(
typer, asio::steady_timer {*ioContext_});
68 std::bind(&Typers::onTyperTimeout,
70 std::placeholders::_1,
73 if (
typer != selfUri_)
81 acc->sendInstantMessage(convId_,
89 auto acc = acc_.lock();
90 if (!acc || !acc->isComposingEnabled())
92 if (watcher_.erase(
typer)) {
94 acc->sendInstantMessage(convId_,
97 if (
typer != selfUri_) {
107Typers::onTyperTimeout(
const asio::error_code&
ec,
const std::string &
typer)
109 if (
ec == asio::error::operation_aborted)
Manager (controller) of daemon.
void removeTyper(const std::string &typer, bool sendMessage=false)
void addTyper(const std::string &typer, bool sendMessage=false)
Add typer to the list of typers.
Typers(const std::shared_ptr< JamiAccount > &acc, const std::string &convId)
void emitSignal(Args... args)
static constexpr const char MIME_TYPE_IM_COMPOSING[]
std::string getIsComposing(const std::string &conversationId, bool isWriting)
static constexpr std::chrono::steady_clock::duration COMPOSING_TIMEOUT