#include <chat.hpp>
Public Types | |
| typedef ptr_iterator< message, std::list< message * >, std::list< message * >::const_iterator > | message_iterator |
| typedef sigc::signal< void, const message & > | signal_message_type |
Public Member Functions | |
| template<typename Buffer> | |
| chat (const Buffer &buffer, unsigned int max_messages) | |
| ~chat () | |
| void | serialise (serialise::object &obj) const |
| void | deserialise (const serialise::object &obj, const user_table &user_table) |
| void | clear () |
| void | add_user_message (const std::string &text, const user &from) |
| void | add_emote_message (const std::string &text, const user &from) |
| Adds a new emote message to the history. | |
| void | add_server_message (const std::string &text) |
| message_iterator | message_begin () const |
| message_iterator | message_end () const |
| signal_message_type | message_event () const |
Protected Member Functions | |
| void | add_message (message *msg) |
| void | on_sync_init (unsigned int) |
| void | on_sync_final () |
| void | on_user_join (const user &user) |
| void | on_user_part (const user &user) |
| template<typename DocumentInfo> | |
| void | on_document_insert (DocumentInfo &document) |
| template<typename DocumentInfo> | |
| void | on_document_remove (DocumentInfo &document) |
Protected Attributes | |
| unsigned int | m_max_messages |
| std::list< message * > | m_messages |
| signal_message_type | m_signal_message |
| sigc::connection | m_user_join_conn |
| sigc::connection | m_user_part_conn |
| sigc::connection | m_document_insert_conn |
| sigc::connection | m_document_remove_conn |
Classes | |
| class | emote_message |
| Emote message by /me command. More... | |
| class | message |
| class | server_message |
| class | system_message |
| class | user_message |
Definition at line 35 of file chat.hpp.
| typedef ptr_iterator< message, std::list<message*>, std::list<message*>::const_iterator > obby::chat::message_iterator |
| typedef sigc::signal<void, const message&> obby::chat::signal_message_type |
| obby::chat::chat | ( | const Buffer & | buffer, | |
| unsigned int | max_messages | |||
| ) |
Chat constructor.
| buffer | Buffer owning this chat. TODO: Just take user_table and connect to user_table's signals | |
| max_messages | How many messages to store before deleting old ones. |
Definition at line 209 of file chat.hpp.
References m_document_insert_conn, m_document_remove_conn, m_user_join_conn, m_user_part_conn, on_sync_final(), on_sync_init(), on_user_join(), and on_user_part().
| void obby::chat::serialise | ( | serialise::object & | obj | ) | const |
Serialises the chat history to a serialisation object.
| obj | Object to serialise to. |
Definition at line 197 of file chat.cpp.
References obby::serialise::object::add_child(), message_begin(), message_end(), and obby::serialise::object::set_name().
Referenced by obby::basic_buffer< Document, Selector >::serialise().
| void obby::chat::deserialise | ( | const serialise::object & | obj, | |
| const user_table & | user_table | |||
| ) |
Deserialises a chat history from a serialisation object.
| obj | Object to deserialise from. | |
| user_table | user_table where to read user information from. |
Definition at line 223 of file chat.cpp.
References obby::_(), add_message(), obby::serialise::object::children_begin(), obby::serialise::object::children_end(), clear(), and obby::basic_format_string< string_type, stream_type >::str().
| void obby::chat::clear | ( | ) |
Clears the whole history.
Definition at line 260 of file chat.cpp.
References m_messages.
Referenced by deserialise(), and ~chat().
| void obby::chat::add_user_message | ( | const std::string & | text, | |
| const user & | from | |||
| ) |
Adds a new user message to the history.
Definition at line 272 of file chat.cpp.
References add_message().
| void obby::chat::add_emote_message | ( | const std::string & | text, | |
| const user & | from | |||
| ) |
Adds a new emote message to the history.
Definition at line 278 of file chat.cpp.
References add_message().
| void obby::chat::add_server_message | ( | const std::string & | text | ) |
Adds a new server message to the history.
Definition at line 284 of file chat.cpp.
References add_message().
| obby::chat::message_iterator obby::chat::message_begin | ( | ) | const |
Returns an iterator pointing at the beginning of the chat history.
Definition at line 289 of file chat.cpp.
References m_messages.
Referenced by serialise().
| obby::chat::message_iterator obby::chat::message_end | ( | ) | const |
Returns an iterator pointing at the end of the chat history.
Definition at line 294 of file chat.cpp.
References m_messages.
Referenced by serialise().
| obby::chat::signal_message_type obby::chat::message_event | ( | ) | const |
Signal that will be emitted if a user message arrived.
Definition at line 299 of file chat.cpp.
References m_signal_message.
| void obby::chat::add_message | ( | message * | msg | ) | [protected] |
Definition at line 304 of file chat.cpp.
References m_max_messages, m_messages, and m_signal_message.
Referenced by add_emote_message(), add_server_message(), add_user_message(), deserialise(), on_document_insert(), on_document_remove(), on_user_join(), and on_user_part().
| void obby::chat::on_sync_init | ( | unsigned | int | ) | [protected] |
Definition at line 311 of file chat.cpp.
References m_document_insert_conn, m_document_remove_conn, m_user_join_conn, and m_user_part_conn.
Referenced by chat().
| void obby::chat::on_sync_final | ( | ) | [protected] |
Definition at line 319 of file chat.cpp.
References m_document_insert_conn, m_document_remove_conn, m_user_join_conn, and m_user_part_conn.
Referenced by chat().
| void obby::chat::on_user_join | ( | const user & | user | ) | [protected] |
Definition at line 327 of file chat.cpp.
References obby::_(), add_message(), obby::user::flags::CONNECTED, obby::user::get_flags(), obby::user::get_name(), and obby::basic_format_string< string_type, stream_type >::str().
Referenced by chat().
| void obby::chat::on_user_part | ( | const user & | user | ) | [protected] |
Definition at line 337 of file chat.cpp.
References obby::_(), add_message(), obby::user::get_name(), and obby::basic_format_string< string_type, stream_type >::str().
Referenced by chat().
| void obby::chat::on_document_insert | ( | DocumentInfo & | document | ) | [protected] |
Definition at line 239 of file chat.hpp.
References obby::_(), add_message(), and obby::basic_format_string< string_type, stream_type >::str().
| void obby::chat::on_document_remove | ( | DocumentInfo & | document | ) | [protected] |
Definition at line 263 of file chat.hpp.
References obby::_(), add_message(), and obby::basic_format_string< string_type, stream_type >::str().
unsigned int obby::chat::m_max_messages [protected] |
std::list<message*> obby::chat::m_messages [protected] |
Definition at line 198 of file chat.hpp.
Referenced by add_message(), clear(), message_begin(), and message_end().
signal_message_type obby::chat::m_signal_message [protected] |
sigc::connection obby::chat::m_user_join_conn [protected] |
sigc::connection obby::chat::m_user_part_conn [protected] |
sigc::connection obby::chat::m_document_insert_conn [protected] |
sigc::connection obby::chat::m_document_remove_conn [protected] |
1.5.1