mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-24 11:42:51 +01:00
core: make hostmask fetching a shared function
This commit is contained in:
parent
63f40c9565
commit
a76bd8c5b2
11
classes.py
11
classes.py
@ -276,7 +276,7 @@ class Irc():
|
||||
self.proto.connect()
|
||||
|
||||
log.info('(%s) Enumerating our own SID %s', self.name, self.sid)
|
||||
host = self.serverdata.get('hostname', world.fallback_hostname)
|
||||
host = self.hostname()
|
||||
|
||||
self.servers[self.sid] = IrcServer(None, host, internal=True,
|
||||
desc=self.serverdata.get('serverdesc')
|
||||
@ -810,10 +810,15 @@ class Irc():
|
||||
Returns a detailed version string including the PyLink daemon version,
|
||||
the protocol module in use, and the server hostname.
|
||||
"""
|
||||
fullversion = 'PyLink-%s. %s :[protocol:%s]' % (__version__, self.serverdata.get('hostname', world.fallback_hostname),
|
||||
self.protoname)
|
||||
fullversion = 'PyLink-%s. %s :[protocol:%s]' % (__version__, self.hostname(), self.protoname)
|
||||
return fullversion
|
||||
|
||||
def hostname(self):
|
||||
"""
|
||||
Returns the server hostname used by PyLink on the given server.
|
||||
"""
|
||||
return self.serverdata.get('hostname', world.fallback_hostname)
|
||||
|
||||
### State checking functions
|
||||
def nickToUid(self, nick):
|
||||
"""Looks up the UID of a user with the given nick, if one is present."""
|
||||
|
@ -27,7 +27,7 @@ def spawn_service(irc, source, command, args):
|
||||
ident = irc.serverdata.get("%s_ident" % name) or conf.conf.get(name, {}).get('ident') or sbot.ident or name
|
||||
|
||||
# TODO: make this configurable?
|
||||
host = irc.serverdata.get("hostname", world.fallback_hostname)
|
||||
host = irc.hostname()
|
||||
|
||||
# Spawning service clients with these umodes where supported. servprotect usage is a
|
||||
# configuration option.
|
||||
|
Loading…
Reference in New Issue
Block a user