1 /**
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * logging/chatlog.h
8  * (c) 2007-2008 Murat Deligonul
9  **/
10 
11 #ifndef __LOGGING_CHATLOG_H
12 #define __LOGGING_CHATLOG_H
13 
14 #include "logging/logger.h"
15 #include "logging/vfs_logfile.h"
16 #include "io/filter_types.h"
17 #include "irc/fwd.h"
18 #include "irc/event.h"
19 #include "fs/fwd.h"
20 
21 
22 namespace logging {
23 
24 /**
25  * An IRC chat log (which will reside in the VFS).
26  */
27 class chatlog : public vfs_logfile {
28 public:
29 	/**
30 	 * Type of the log
31 	 */
32 	enum log_type {
33 		LOG_PRIVATE,
34 		LOG_CHANNEL,
35 		LOG_PUBLIC = LOG_CHANNEL
36 	};
37 
38 	/**
39 	 * Logging options.
40 	 */
41 	enum log_option {
42 		LOG_FULL_ADDRS = (logging::LAST_OPTION << 1)
43 	};
44 
45 private:
46 	const log_type		type;		/* Type of the log (private or channel) */
47 
48 public:
49 	chatlog(const handle_t&, const std::string&, fs::flib_key *, log_type, int, const io::filter_list&);
50 
51 	virtual ~chatlog();
52 
53 //	virtual void set_options(int);
54 
55 	int  write(irc::event, const irc::address *, const char *, const char *, const char *);
56 
57 protected:
58 	virtual void start_message(std::string&) const;
59 	virtual void stop_message(std::string&) const;
60 
61 private:
62 	static void strip_color_codes(const char *, char **);
63 
64 private:
65 	// non-copyable
66 	chatlog(const chatlog&);
67 	chatlog& operator=(const chatlog&);
68 };
69 
70 } /* namespace logging */
71 #endif	/* LOGGING_CHATLOG_H */
72 
73