Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/chat/src/orxonox/ChatHistory.h @ 6652

Last change on this file since 6652 was 6652, checked in by rgrieder, 14 years ago

svn:eol-style "native" for all text based files.

  • Property svn:eol-style set to native
File size: 2.8 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Sandro 'smerkli' Merkli
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include <list>
30#include <core/BaseObject.h>
31
32#ifndef _ChatHistory_H__
33#define _ChatHistory_H__
34
35/* Class to implement chat history */
36namespace orxonox
37{
38  class _OrxonoxExport ChatHistory : public BaseObject, public ChatListener
39  {
40    public:
41      /* constructors, destructors */
42      ChatHistory(BaseObject* creator);
43      virtual ~ChatHistory();
44
45 
46    protected:
47      /** what to do with incoming chat
48       *
49       * \param message The incoming message
50       * \param senderID Identification number of the sender
51       */
52      virtual void incomingChat(const std::string& message, 
53        unsigned int senderID);
54     
55      /** Synchronize logfile onto the hard drive
56       *
57       * \return 0 for success, other for error
58       */
59      int syncLog();
60     
61    private:
62      /* FIELDS */
63      /** Vector to store the history in */
64      list<std::string> hist_buffer;
65
66      /** Maximum number of lines stored in this history */
67      unsigned int hist_maxlines;
68
69      /** is logging enabled? */
70      bool hist_log_enabled;
71
72      /** path of logfile on the file system */
73      std::string hist_logfile_path;
74
75      /** Output file stream for logfile */
76      ofstream hist_logfile;
77
78
79
80
81      /* METHODS */
82      /** Append line to chat history
83       *
84       * \param toadd The line to add to the history
85       * \return 0 for success, other for error TODO: Throw exception
86       */
87      int chat_hist_addline( const std::string& toadd );
88
89      /** Append line to logfile
90       *
91       * \param toadd The line to add to the logfile
92       * \return 0 for success, other for error TODO: Throw exception
93       */
94      int chat_hist_logline( const std::string& toadd );
95
96      /** open logfile to log to
97       *
98       * \return 0 for success,s other for error
99       */
100      int chat_hist_openlog();
101  }
102}
103
104
105#endif /* _ChatHistory_H__ */
Note: See TracBrowser for help on using the repository browser.