The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
chat_events.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006 - 2016 by Joerg Hinrichs <[email protected]>
3  wesnoth playturn Copyright (C) 2003 by David White <[email protected]>
4  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 #ifndef CHAT_EVENTS_H_INCLUDED
17 #define CHAT_EVENTS_H_INCLUDED
18 
19 #include "global.hpp"
20 class config;
21 #include <ctime>
22 #include <string>
23 
24 namespace events {
25 
27 {
28 public:
29  chat_handler();
30  virtual ~chat_handler();
31 
33 
34  void send_command(const std::string& cmd, const std::string& args="");
35 
36  virtual void send_to_server(const config& cfg) = 0;
37 protected:
38  void do_speak(const std::string& message, bool allies_only=false);
39 
40  //called from do_speak
41  virtual void add_chat_message(const time_t& time,
42  const std::string& speaker, int side, const std::string& message,
44  virtual void send_chat_message(const std::string& message, bool allies_only=false)=0;
45 
46  //Why are these virtual?
47  virtual void send_whisper(const std::string& receiver, const std::string& message);
48 
49  virtual void add_whisper_sent(const std::string& receiver, const std::string& message);
50 
51  virtual void add_whisper_received(const std::string& sender, const std::string& message);
52 
53  virtual void send_chat_room_message(const std::string& room, const std::string& message);
54 
55  virtual void add_chat_room_message_sent(const std::string& room, const std::string& message);
56 
57  virtual void add_chat_room_message_received(const std::string& room,
58  const std::string& speaker, const std::string& message);
59 
60  /**
61  * Called when a processed command results in a relation (friend/ignore) change
62  * for a user whose name is passed as the 'name' arg
63  */
64  virtual void user_relation_changed(const std::string& name);
65 
66  void change_logging(const std::string& data);
67 
68  friend class chat_command_handler;
69 };
70 
71 }
72 #endif
virtual void add_chat_room_message_received(const std::string &room, const std::string &speaker, const std::string &message)
GLuint GLuint GLsizei GLenum type
Definition: glew.h:1221
virtual void send_to_server(const config &cfg)=0
virtual void add_chat_room_message_sent(const std::string &room, const std::string &message)
void send_command(const std::string &cmd, const std::string &args="")
Definition: chat_events.cpp:75
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
Definition: glew.h:1347
virtual void add_whisper_received(const std::string &sender, const std::string &message)
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)
void do_speak(const std::string &message, bool allies_only=false)
void change_logging(const std::string &data)
Change the log level of a log domain.
Definition: chat_events.cpp:35
virtual void add_chat_message(const time_t &time, const std::string &speaker, int side, const std::string &message, MESSAGE_TYPE type=MESSAGE_PRIVATE)=0
Handling of system events.
Definition: manager.hpp:42
GLuint const GLchar * name
Definition: glew.h:1782
virtual void add_whisper_sent(const std::string &receiver, const std::string &message)
GLsizei GLenum GLuint GLuint GLsizei char * message
Definition: glew.h:2499
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...
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83
virtual void send_chat_room_message(const std::string &room, const std::string &message)
GLsizei const GLcharARB ** string
Definition: glew.h:4503