~phablet-team/mfw-plugin-irc/trunk

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef IRC_CLI_GROUP_CHAT_H
#define IRC_CLI_GROUP_CHAT_H

#include <irc/visibility.h>

#include <irc/chat.h>

#include <libircclient.h>

namespace messaging
{
class Group;
class Interface;
}

namespace irc
{

// Handy fw declarations
class GroupManager;

class IRC_PUBLIC GroupChat
        : public Chat
{
public:

    /// @brief Creates a new instance translating the given recipient to a user.
    static std::shared_ptr<GroupChat> create(const std::shared_ptr<messaging::Group> &group,
                                             const std::shared_ptr<messaging::Chat::Observer>& observer, irc_session_t *session);

    /// @brief send_message enqueues the given message for delivery.
    /// @returns a numeric identifier referencing back to the delivery request.
    /// @throws std::runtime_error in case of issues.
    std::string send_message(const messaging::Message& message) override;
    void mark_message_as_read(const std::string& message_token) override;
    void start_typing() override;
    void end_typing() override;

    void mark_message_as_delivered(const std::string& message_token);
    std::string id();

private:
    /// @brief Creates a new instance translating the given recipient to a user.
    GroupChat(const std::shared_ptr<messaging::Group> &group,
              const std::shared_ptr<messaging::Chat::Observer>& observer, irc_session_t *session);

    irc_session_t *irc_session;
    std::string channel_id;

};

}

#endif // IRC_CLI_GROUP_CHAT_H