-
Notifications
You must be signed in to change notification settings - Fork 1
/
ircconfig.h
95 lines (75 loc) · 2.15 KB
/
ircconfig.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
* Copyright (C) 2001-2009 Jan Vidar Krey, [email protected]
* See the file "COPYING" for licensing details.
*/
#ifndef HAVE_IRC_CONFIG_H
#define HAVE_IRC_CONFIG_H
#include <string>
#include <vector>
namespace IRC
{
class ServerChannelConfig
{
public:
ServerChannelConfig(const std::string& channel, const std::string& password = "", bool autojoin = true);
virtual ~ServerChannelConfig();
std::string getChannel() const { return channel; }
std::string getPassword() const { return password; }
bool hasPassword() const { return password != ""; }
bool isAutoJoin() const { return autojoin; }
protected:
std::string channel;
std::string password;
bool autojoin;
};
class ServerConfig
{
public:
ServerConfig(const std::string& address, uint16_t port = 6667, bool ssl = false, const std::string& password = "");
void setIdentity(const std::string& nick, const std::string& altnick, const std::string& ident, const std::string& fullname);
void addChannel(const std::string& channel, bool autojoin = true, const std::string& password = "");
std::string getHost() const { return address; }
uint16_t getPort() const { return port; }
std::string getIdent() const { return ident; }
std::string getNick() const { return nick; }
std::string getAltNick() const { return altnick; }
std::string getAwayNick() const { return awaynick; }
std::string getFullName() const { return fullname; }
std::string getPassword() const { return password; }
bool hasPassword() const { return password != ""; }
void getChannels(std::vector<ServerChannelConfig>& chans);
protected:
std::string address;
uint16_t port;
bool ssl;
std::string password;
bool autojoin;
std::string nick;
std::string altnick;
std::string awaynick;
std::string ident;
std::string fullname;
std::vector<ServerChannelConfig> channels;
};
class LocalConfig
{
public:
LocalConfig();
virtual ~LocalConfig();
protected:
uint16_t port;
// TODO: SSL stuff
};
class Config
{
public:
Config();
virtual ~Config();
bool load();
bool save();
protected:
std::vector<ServerConfig> servers;
LocalConfig local;
};
}
#endif // HAVE_IRC_CONFIG_H