summaryrefslogtreecommitdiff
path: root/include/server.h
blob: 1aacdc2d97a9514f4235e71183e81b904de5700c (plain)
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
/*
 * InspIRCd -- Internet Relay Chat Daemon
 *
 *   Copyright (C) 2019-2020 Sadie Powell <sadie@witchery.services>
 *   Copyright (C) 2018 Matt Schatz <genius3000@g3k.solutions>
 *   Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
 *
 * This file is part of InspIRCd.  InspIRCd is free software: you can
 * redistribute it and/or modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation, version 2.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */


#pragma once

class CoreExport Server : public classbase
{
 protected:
	/** The unique identifier for this server. */
	const std::string id;

	/** The name of this server
	 */
	const std::string name;

	/** The description of this server.
	 * This can be updated by the protocol module (for remote servers) or by a rehash (for the local server).
	 */
	std::string description;

	/** True if this server is ulined
	 */
	bool uline;

	/** True if this server is a silent uline, i.e. silent="yes" in the uline block
	 */
	bool silentuline;

	/** Allow ConfigReaderThread to update the description on a rehash
	 */
	friend class ConfigReaderThread;

 public:
	Server(const std::string& srvid, const std::string& srvname, const std::string& srvdesc)
		: id(srvid)
		, name(srvname)
		, description(srvdesc)
		, uline(false)
		, silentuline(false)
	{
	}

	DEPRECATED_METHOD(Server(const std::string& srvname, const std::string& srvdesc))
		: name(srvname)
		, description(srvdesc)
		, uline(false)
		, silentuline(false)
	{
	}

	/** Retrieves the unique identifier for this server (e.g. 36C). */
	const std::string& GetId() const { return id; }

	/**
	 * Returns the name of this server
	 * @return The name of this server, for example "irc.inspircd.org".
	 */
	const std::string& GetName() const { return name; }

	/** Returns the description of this server
	 * @return The description of this server
	 */
	const std::string& GetDesc() const { return description; }

	/**
	 * Checks whether this server is ulined
	 * @return True if this server is ulined, false otherwise.
	 */
	bool IsULine() const { return uline; }

	/**
	 * Checks whether this server is a silent uline
	 * Silent uline servers introduce, quit and oper up users without a snotice being generated.
	 * @return True if this server is a silent uline, false otherwise.
	 */
	bool IsSilentULine() const { return silentuline; }
};