Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""LICENSE
2Copyright 2016 Hermann Krumrey <hermann@krumreyh.com>
4This file is part of xdcc-dl.
6xdcc-dl is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
11xdcc-dl is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
16You should have received a copy of the GNU General Public License
17along with xdcc-dl. If not, see <http://www.gnu.org/licenses/>.
18LICENSE"""
21class IrcServer(object):
22 """
23 Class that models an IRC server
24 """
26 def __init__(self, server_address: str, server_port: int = 6667):
27 """
28 Initializes the Server's information
30 :param server_address: the address of the IRC Server
31 :param server_port: the port of the server, which defaults to 6667
32 and can usually safely stay that way
33 """
34 self.address = server_address
35 self.port = server_port
37 def get_address(self) -> str:
38 """
39 :return: the server address
40 """
41 return self.address
43 def get_port(self) -> int:
44 """
45 :return: the server port
46 """
47 return self.port
49 def __eq__(self, other) -> bool:
50 """
51 Checks two IrcServer objects for equality
52 :param other: The other object to check
53 :return: True if the objects are equal, False otherwise
54 """
55 # noinspection PyBroadException
56 try:
57 return self.address == other.address and self.port == other.port
58 except Exception:
59 return False