added code to allow you to keep a server in the database but not connect to it.
This commit is contained in:
parent
52deab53aa
commit
863bebb14e
1 changed files with 5 additions and 2 deletions
|
@ -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):
|
||||||
|
|
Loading…
Reference in a new issue