added code to allow you to keep a server in the database but not connect to it.

This commit is contained in:
jesopo 2016-04-27 11:56:37 +01:00
parent 52deab53aa
commit 863bebb14e
No known key found for this signature in database
GPG key ID: 0BBDEB2AEFCFFCB3

View file

@ -20,9 +20,11 @@ class Bot(object):
nickname, username, realname, connect=False): nickname, username, realname, connect=False):
new_server = IRCServer.Server(id, hostname, port, password, new_server = IRCServer.Server(id, hostname, port, password,
ipv4, tls, nickname, username, realname, self) ipv4, tls, nickname, username, realname, self)
if not new_server.get_setting("connect", True):
return
self.events.on("new").on("server").call(server=new_server) self.events.on("new").on("server").call(server=new_server)
self.servers[new_server.fileno()] = new_server self.servers[new_server.fileno()] = new_server
if connect: if connect and new_server.get_setting("connect", True):
self.connect(new_server) self.connect(new_server)
def connect(self, server): def connect(self, server):
try: try:
@ -35,6 +37,7 @@ class Bot(object):
return True return True
def connect_all(self): def connect_all(self):
for server in self.servers.values(): for server in self.servers.values():
if server.get_setting("connect", True):
self.connect(server) self.connect(server)
def setup_timers(self, event): def setup_timers(self, event):