mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-23 10:44:09 +01:00
protocols: convert IrcServer usage to Server
This commit is contained in:
parent
a204d2b2db
commit
54d7fe6dc5
@ -4,7 +4,7 @@ import base64
|
||||
|
||||
from pylinkirc import utils, conf
|
||||
from pylinkirc.log import log
|
||||
from pylinkirc.classes import Protocol, User, IrcServer, ProtocolError
|
||||
from pylinkirc.classes import Protocol, User, Server, ProtocolError
|
||||
|
||||
FALLBACK_REALNAME = 'PyLink Relay Mirror Client'
|
||||
COMMON_PREFIXMODES = [('h', 'halfop'), ('a', 'admin'), ('q', 'owner'), ('y', 'owner')]
|
||||
@ -123,7 +123,7 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
|
||||
"""
|
||||
name = name.lower()
|
||||
sid = self.sidgen.next_sid(prefix=name)
|
||||
self.servers[sid] = IrcServer(uplink, name, internal=internal)
|
||||
self.servers[sid] = Server(uplink, name, internal=internal)
|
||||
return sid
|
||||
|
||||
def away(self, source, text):
|
||||
|
@ -368,7 +368,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
||||
if not utils.isServerName(name):
|
||||
raise ValueError('Invalid server name %r' % name)
|
||||
self._send_with_prefix(uplink, 'SERVER %s * 1 %s :%s' % (name, sid, desc))
|
||||
self.servers[sid] = IrcServer(uplink, name, internal=True, desc=desc)
|
||||
self.servers[sid] = Server(uplink, name, internal=True, desc=desc)
|
||||
|
||||
def endburstf():
|
||||
# Delay ENDBURST by X seconds if requested.
|
||||
@ -604,7 +604,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
||||
raise ProtocolError('Error: recvpass from uplink server %s does not match configuration!' % servername)
|
||||
|
||||
sdesc = args[-1]
|
||||
self.servers[numeric] = IrcServer(None, servername, desc=sdesc)
|
||||
self.servers[numeric] = Server(None, servername, desc=sdesc)
|
||||
self.uplink = numeric
|
||||
return
|
||||
|
||||
@ -613,7 +613,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
||||
servername = args[0].lower()
|
||||
sid = args[3]
|
||||
sdesc = args[-1]
|
||||
self.servers[sid] = IrcServer(numeric, servername, desc=sdesc)
|
||||
self.servers[sid] = Server(numeric, servername, desc=sdesc)
|
||||
|
||||
return {'name': servername, 'sid': args[3], 'text': sdesc}
|
||||
|
||||
|
@ -659,7 +659,7 @@ class P10Protocol(IRCS2SProtocol):
|
||||
self._send_with_prefix(uplink, 'SERVER %s 1 %s %s P10 %s]]] +h6 :%s' % \
|
||||
(name, self.start_ts, int(time.time()), sid, desc))
|
||||
|
||||
self.servers[sid] = IrcServer(uplink, name, internal=True, desc=desc)
|
||||
self.servers[sid] = Server(uplink, name, internal=True, desc=desc)
|
||||
return sid
|
||||
|
||||
def squit(self, source, target, text='No reason given'):
|
||||
@ -829,7 +829,7 @@ class P10Protocol(IRCS2SProtocol):
|
||||
servername = args[0].lower()
|
||||
sid = args[5][:2]
|
||||
sdesc = args[-1]
|
||||
self.servers[sid] = IrcServer(source, servername, desc=sdesc)
|
||||
self.servers[sid] = Server(source, servername, desc=sdesc)
|
||||
|
||||
if self.uplink is None:
|
||||
# If we haven't already found our uplink, this is probably it.
|
||||
|
@ -364,7 +364,7 @@ class TS6Protocol(TS6BaseProtocol):
|
||||
|
||||
# Server name and SID are sent in different messages, so we fill this
|
||||
# with dummy information until we get the actual sid.
|
||||
self.servers[numeric] = IrcServer(None, '')
|
||||
self.servers[numeric] = Server(None, '')
|
||||
self.uplink = numeric
|
||||
|
||||
def handle_capab(self, numeric, command, args):
|
||||
@ -555,7 +555,7 @@ class TS6Protocol(TS6BaseProtocol):
|
||||
servername = args[0].lower()
|
||||
sid = args[2]
|
||||
sdesc = args[-1]
|
||||
self.servers[sid] = IrcServer(numeric, servername, desc=sdesc)
|
||||
self.servers[sid] = Server(numeric, servername, desc=sdesc)
|
||||
return {'name': servername, 'sid': sid, 'text': sdesc}
|
||||
|
||||
def handle_server(self, numeric, command, args):
|
||||
@ -580,7 +580,7 @@ class TS6Protocol(TS6BaseProtocol):
|
||||
# <- :services.int SERVER a.bc 2 :(H) [GL] a
|
||||
servername = args[0].lower()
|
||||
sdesc = args[-1]
|
||||
self.servers[servername] = IrcServer(numeric, servername, desc=sdesc)
|
||||
self.servers[servername] = Server(numeric, servername, desc=sdesc)
|
||||
return {'name': servername, 'sid': None, 'text': sdesc}
|
||||
|
||||
def handle_tmode(self, numeric, command, args):
|
||||
|
@ -273,7 +273,7 @@ class TS6BaseProtocol(IRCS2SProtocol):
|
||||
if not utils.isServerName(name):
|
||||
raise ValueError('Invalid server name %r' % name)
|
||||
self._send_with_prefix(uplink, 'SID %s 1 %s :%s' % (name, sid, desc))
|
||||
self.servers[sid] = IrcServer(uplink, name, internal=True, desc=desc)
|
||||
self.servers[sid] = Server(uplink, name, internal=True, desc=desc)
|
||||
return sid
|
||||
|
||||
def squit(self, source, target, text='No reason given'):
|
||||
|
@ -485,7 +485,7 @@ class UnrealProtocol(TS6BaseProtocol):
|
||||
if protover < self.min_proto_ver:
|
||||
raise ProtocolError("Protocol version too old! (needs at least %s "
|
||||
"(Unreal 4.x), got %s)" % (self.min_proto_ver, protover))
|
||||
self.servers[numeric] = IrcServer(None, sname, desc=sdesc)
|
||||
self.servers[numeric] = Server(None, sname, desc=sdesc)
|
||||
|
||||
# Set irc.connected to True, meaning that protocol negotiation passed.
|
||||
log.debug('(%s) self.connected set!', self.name)
|
||||
@ -495,7 +495,7 @@ class UnrealProtocol(TS6BaseProtocol):
|
||||
# <- :services.int SERVER a.bc 2 :(H) [GL] a
|
||||
servername = args[0].lower()
|
||||
sdesc = args[-1]
|
||||
self.servers[servername] = IrcServer(numeric, servername, desc=sdesc)
|
||||
self.servers[servername] = Server(numeric, servername, desc=sdesc)
|
||||
return {'name': servername, 'sid': None, 'text': sdesc}
|
||||
|
||||
def handle_sid(self, numeric, command, args):
|
||||
@ -504,7 +504,7 @@ class UnrealProtocol(TS6BaseProtocol):
|
||||
sname = args[0].lower()
|
||||
sid = args[2]
|
||||
sdesc = args[-1]
|
||||
self.servers[sid] = IrcServer(numeric, sname, desc=sdesc)
|
||||
self.servers[sid] = Server(numeric, sname, desc=sdesc)
|
||||
return {'name': sname, 'sid': sid, 'text': sdesc}
|
||||
|
||||
def handle_squit(self, numeric, command, args):
|
||||
|
Loading…
Reference in New Issue
Block a user