Ring Daemon 16.0.0
Loading...
Searching...
No Matches
typers.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2004-2025 Savoir-faire Linux Inc.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17#pragma once
18
19#include <asio.hpp>
20#include <map>
21#include <memory>
22#include <set>
23#include <string>
24
25namespace jami {
26
27class JamiAccount;
28
29class Typers: public std::enable_shared_from_this<Typers>
30{
31public:
32 Typers(const std::shared_ptr<JamiAccount>& acc, const std::string &convId);
33 ~Typers();
34
40 void addTyper(const std::string &typer, bool sendMessage = false);
41 void removeTyper(const std::string &typer, bool sendMessage = false);
42
43private:
44 void onTyperTimeout(const asio::error_code& ec, const std::string &typer);
45
46 std::shared_ptr<asio::io_context> ioContext_;
47 std::map<std::string, asio::steady_timer> watcher_;
48
49 std::weak_ptr<JamiAccount> acc_;
50 std::string accountId_;
51 std::string convId_;
52 std::string selfUri_;
53};
54
55} // namespace jami
void removeTyper(const std::string &typer, bool sendMessage=false)
Definition typers.cpp:87
void addTyper(const std::string &typer, bool sendMessage=false)
Add typer to the list of typers.
Definition typers.cpp:57
void emitSignal(Args... args)
Definition ring_signal.h:64