The Battle for Wesnoth  1.19.0-dev
Public Types | Public Member Functions | Protected Member Functions | Friends | List of all members
events::chat_handler Class Referenceabstract

#include <chat_events.hpp>

Inheritance diagram for events::chat_handler:

Public Types

enum  MESSAGE_TYPE { MESSAGE_PUBLIC , MESSAGE_PRIVATE }
 

Public Member Functions

 chat_handler ()
 
virtual ~chat_handler ()
 
void send_command (const std::string &cmd, const std::string &args="")
 
virtual void send_to_server (const config &cfg)=0
 

Protected Member Functions

void do_speak (const std::string &message, bool allies_only=false)
 
virtual void add_chat_message (const std::time_t &time, const std::string &speaker, int side, const std::string &message, MESSAGE_TYPE type=MESSAGE_PRIVATE)=0
 
virtual void send_chat_message (const std::string &message, bool allies_only=false)=0
 
virtual void send_whisper (const std::string &receiver, const std::string &message)
 
virtual void add_whisper_sent (const std::string &receiver, const std::string &message)
 
virtual void add_whisper_received (const std::string &sender, const std::string &message)
 
virtual void send_chat_room_message (const std::string &room, const std::string &message)
 
virtual void add_chat_room_message_sent (const std::string &room, const std::string &message)
 
virtual void add_chat_room_message_received (const std::string &room, const std::string &speaker, const std::string &message)
 
virtual void user_relation_changed (const std::string &name)
 Called when a processed command results in a relation (friend/ignore) change for a user whose name is passed as the 'name' arg. More...
 
void change_logging (const std::string &data)
 Change the log level of a log domain. More...
 
virtual void clear_messages ()=0
 

Friends

class chat_command_handler
 

Detailed Description

Definition at line 25 of file chat_events.hpp.

Member Enumeration Documentation

◆ MESSAGE_TYPE

Enumerator
MESSAGE_PUBLIC 
MESSAGE_PRIVATE 

Definition at line 31 of file chat_events.hpp.

Constructor & Destructor Documentation

◆ chat_handler()

events::chat_handler::chat_handler ( )

Definition at line 29 of file chat_events.cpp.

◆ ~chat_handler()

events::chat_handler::~chat_handler ( )
virtual

Definition at line 33 of file chat_events.cpp.

Member Function Documentation

◆ add_chat_message()

virtual void events::chat_handler::add_chat_message ( const std::time_t &  time,
const std::string &  speaker,
int  side,
const std::string &  message,
MESSAGE_TYPE  type = MESSAGE_PRIVATE 
)
protectedpure virtual

◆ add_chat_room_message_received()

void events::chat_handler::add_chat_room_message_received ( const std::string &  room,
const std::string &  speaker,
const std::string &  message 
)
protectedvirtual

Reimplemented in gui2::chatbox.

Definition at line 171 of file chat_events.cpp.

References add_chat_message(), and MESSAGE_PRIVATE.

Referenced by add_chat_room_message_sent().

◆ add_chat_room_message_sent()

void events::chat_handler::add_chat_room_message_sent ( const std::string &  room,
const std::string &  message 
)
protectedvirtual

Reimplemented in gui2::chatbox.

Definition at line 166 of file chat_events.cpp.

References add_chat_room_message_received(), and preferences::login().

◆ add_whisper_received()

void events::chat_handler::add_whisper_received ( const std::string &  sender,
const std::string &  message 
)
protectedvirtual

Reimplemented in gui2::chatbox.

Definition at line 148 of file chat_events.cpp.

References add_chat_message(), and VGETTEXT.

◆ add_whisper_sent()

void events::chat_handler::add_whisper_sent ( const std::string &  receiver,
const std::string &  message 
)
protectedvirtual

Reimplemented in gui2::chatbox.

Definition at line 141 of file chat_events.cpp.

References add_chat_message(), and VGETTEXT.

Referenced by events::chat_command_handler::do_whisper().

◆ change_logging()

void events::chat_handler::change_logging ( const std::string &  data)
protected

Change the log level of a log domain.

Parameters
datastring of the form: "@<level@> @<domain@>"

Definition at line 42 of file chat_events.cpp.

References _(), add_chat_message(), data, lg::debug(), lg::err(), ERR_NG, lg::logger::get_severity(), lg::info(), game_config::images::level, LOG_NG, wfl::msg(), lg::set_log_domain_severity(), VGETTEXT, and lg::warn().

Referenced by events::chat_command_handler::do_log().

◆ clear_messages()

virtual void events::chat_handler::clear_messages ( )
protectedpure virtual

◆ do_speak()

void events::chat_handler::do_speak ( const std::string &  message,
bool  allies_only = false 
)
protected

◆ send_chat_message()

virtual void events::chat_handler::send_chat_message ( const std::string &  message,
bool  allies_only = false 
)
protectedpure virtual

◆ send_chat_room_message()

void events::chat_handler::send_chat_room_message ( const std::string &  room,
const std::string &  message 
)
protectedvirtual

◆ send_command()

void events::chat_handler::send_command ( const std::string &  cmd,
const std::string &  args = "" 
)

◆ send_to_server()

virtual void events::chat_handler::send_to_server ( const config cfg)
pure virtual

◆ send_whisper()

void events::chat_handler::send_whisper ( const std::string &  receiver,
const std::string &  message 
)
protectedvirtual

◆ user_relation_changed()

void events::chat_handler::user_relation_changed ( const std::string &  name)
protectedvirtual

Called when a processed command results in a relation (friend/ignore) change for a user whose name is passed as the 'name' arg.

Reimplemented in gui2::chatbox.

Definition at line 127 of file chat_events.cpp.

Referenced by events::chat_command_handler::do_friend(), events::chat_command_handler::do_ignore(), and events::chat_command_handler::do_remove().

Friends And Related Function Documentation

◆ chat_command_handler

friend class chat_command_handler
friend

Definition at line 69 of file chat_events.hpp.


The documentation for this class was generated from the following files: