mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
Move more IRC-specific attributes into IRCNetwork.init_vars()
This commit is contained in:
parent
62784a63e4
commit
928dbf80bb
22
classes.py
22
classes.py
@ -71,8 +71,6 @@ class PyLinkNetworkCore(utils.DeprecatedAttributesObject, utils.CamelCaseToSnake
|
|||||||
|
|
||||||
# These options depend on self.serverdata from above to be set.
|
# These options depend on self.serverdata from above to be set.
|
||||||
self.encoding = None
|
self.encoding = None
|
||||||
self.pingfreq = self.serverdata.get('pingfreq') or 90
|
|
||||||
self.pingtimeout = self.pingfreq * 2
|
|
||||||
|
|
||||||
self.connected = threading.Event()
|
self.connected = threading.Event()
|
||||||
self.aborted = threading.Event()
|
self.aborted = threading.Event()
|
||||||
@ -118,14 +116,9 @@ class PyLinkNetworkCore(utils.DeprecatedAttributesObject, utils.CamelCaseToSnake
|
|||||||
self.protoname = __name__.split('.')[-1] # Remove leading pylinkirc.protocols.
|
self.protoname = __name__.split('.')[-1] # Remove leading pylinkirc.protocols.
|
||||||
|
|
||||||
self.encoding = self.serverdata.get('encoding') or 'utf-8'
|
self.encoding = self.serverdata.get('encoding') or 'utf-8'
|
||||||
self.pingfreq = self.serverdata.get('pingfreq') or 90
|
|
||||||
self.pingtimeout = self.pingfreq * 3
|
|
||||||
|
|
||||||
|
# Tracks the main PyLink client's UID.
|
||||||
self.pseudoclient = None
|
self.pseudoclient = None
|
||||||
self.lastping = time.time()
|
|
||||||
|
|
||||||
self.maxsendq = self.serverdata.get('maxsendq', 4096)
|
|
||||||
self.queue = queue.Queue(self.maxsendq)
|
|
||||||
|
|
||||||
# Internal variable to set the place and caller of the last command (in PM
|
# Internal variable to set the place and caller of the last command (in PM
|
||||||
# or in a channel), used by fantasy command support.
|
# or in a channel), used by fantasy command support.
|
||||||
@ -137,7 +130,7 @@ class PyLinkNetworkCore(utils.DeprecatedAttributesObject, utils.CamelCaseToSnake
|
|||||||
# now.
|
# now.
|
||||||
self.servers = {}
|
self.servers = {}
|
||||||
self.users = {}
|
self.users = {}
|
||||||
self.channels = structures.KeyedDefaultdict(IrcChannel)
|
self.channels = structures.KeyedDefaultdict(Channel)
|
||||||
|
|
||||||
# This sets the list of supported channel and user modes: the default
|
# This sets the list of supported channel and user modes: the default
|
||||||
# RFC1459 modes are implied. Named modes are used here to make
|
# RFC1459 modes are implied. Named modes are used here to make
|
||||||
@ -1133,6 +1126,17 @@ class IRCNetwork(PyLinkNetworkCoreWithUtils):
|
|||||||
self.queue = None
|
self.queue = None
|
||||||
self.pingTimer = None
|
self.pingTimer = None
|
||||||
|
|
||||||
|
def init_vars(self, *args, **kwargs):
|
||||||
|
super().init_vars(*args, **kwargs)
|
||||||
|
|
||||||
|
# Set IRC specific variables for ping checking and queuing
|
||||||
|
self.lastping = time.time()
|
||||||
|
self.pingfreq = self.serverdata.get('pingfreq') or 90
|
||||||
|
self.pingtimeout = self.pingfreq * 3
|
||||||
|
|
||||||
|
self.maxsendq = self.serverdata.get('maxsendq', 4096)
|
||||||
|
self.queue = queue.Queue(self.maxsendq)
|
||||||
|
|
||||||
def _schedule_ping(self):
|
def _schedule_ping(self):
|
||||||
"""Schedules periodic pings in a loop."""
|
"""Schedules periodic pings in a loop."""
|
||||||
self.ping()
|
self.ping()
|
||||||
|
Loading…
Reference in New Issue
Block a user