mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-25 20:22:45 +01:00
hybrid: Update for new methods
This commit is contained in:
parent
6ff06cb881
commit
3cd2dbac5a
@ -107,7 +107,7 @@ class HybridProtocol(TS6BaseProtocol):
|
|||||||
Note: No nick collision / valid nickname checks are done here; it is
|
Note: No nick collision / valid nickname checks are done here; it is
|
||||||
up to plugins to make sure they don't introduce anything invalid."""
|
up to plugins to make sure they don't introduce anything invalid."""
|
||||||
server = server or self.irc.sid
|
server = server or self.irc.sid
|
||||||
if not utils.isInternalServer(self.irc, server):
|
if not self.irc.isInternalServer(server):
|
||||||
raise ValueError('Server %r is not a PyLink internal PseudoServer!' % server)
|
raise ValueError('Server %r is not a PyLink internal PseudoServer!' % server)
|
||||||
# Create an UIDGenerator instance for every SID, so that each gets
|
# Create an UIDGenerator instance for every SID, so that each gets
|
||||||
# distinct values.
|
# distinct values.
|
||||||
@ -144,16 +144,16 @@ class HybridProtocol(TS6BaseProtocol):
|
|||||||
else:
|
else:
|
||||||
raise NotImplementedError("Changing field %r of a client is unsupported by this protocol." % field)
|
raise NotImplementedError("Changing field %r of a client is unsupported by this protocol." % field)
|
||||||
|
|
||||||
def joinClient(self, client, channel):
|
def join(self, client, channel):
|
||||||
"""Joins a PyLink client to a channel."""
|
"""Joins a PyLink client to a channel."""
|
||||||
channel = utils.toLower(self.irc, channel)
|
channel = utils.toLower(self.irc, channel)
|
||||||
if not utils.isInternalClient(self.irc, client):
|
if not self.irc.isInternalClient(client):
|
||||||
raise LookupError('No such PyLink client exists.')
|
raise LookupError('No such PyLink client exists.')
|
||||||
self._send(client, "JOIN %s" % channel)
|
self._send(client, "JOIN %s" % channel)
|
||||||
self.irc.channels[channel].users.add(client)
|
self.irc.channels[channel].users.add(client)
|
||||||
self.irc.users[client].channels.add(channel)
|
self.irc.users[client].channels.add(channel)
|
||||||
|
|
||||||
def pingServer(self, source=None, target=None):
|
def ping(self, source=None, target=None):
|
||||||
"""Sends a PING to a target server. Periodic PINGs are sent to our uplink
|
"""Sends a PING to a target server. Periodic PINGs are sent to our uplink
|
||||||
automatically by the Irc() internals; plugins shouldn't have to use this."""
|
automatically by the Irc() internals; plugins shouldn't have to use this."""
|
||||||
source = source or self.irc.sid
|
source = source or self.irc.sid
|
||||||
@ -204,15 +204,6 @@ class HybridProtocol(TS6BaseProtocol):
|
|||||||
if parsed_args is not None:
|
if parsed_args is not None:
|
||||||
return [numeric, command, parsed_args]
|
return [numeric, command, parsed_args]
|
||||||
|
|
||||||
def _getNick(self, target):
|
|
||||||
"""Converts a nick argument to its matching UID. This differs from utils.nickToUid()
|
|
||||||
in that it returns the original text instead of None, if no matching nick is found."""
|
|
||||||
target = utils.nickToUid(self.irc, target) or target
|
|
||||||
if target not in self.irc.users and not utils.isChannel(target):
|
|
||||||
log.debug("(%s) Possible desync? Got command target %s, who "
|
|
||||||
"isn't in our user list!", self.irc.name, target)
|
|
||||||
return target
|
|
||||||
|
|
||||||
# command handlers
|
# command handlers
|
||||||
def handle_pass(self, numeric, command, args):
|
def handle_pass(self, numeric, command, args):
|
||||||
# <- PASS $somepassword TS 6 42X
|
# <- PASS $somepassword TS 6 42X
|
||||||
@ -329,7 +320,7 @@ class HybridProtocol(TS6BaseProtocol):
|
|||||||
destination = args[1]
|
destination = args[1]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
destination = self.irc.sid
|
destination = self.irc.sid
|
||||||
if utils.isInternalServer(self.irc, destination):
|
if self.irc.isInternalServer(destination):
|
||||||
self._send(destination, 'PONG %s :%s' % (self.irc.servers[destination].name, source))
|
self._send(destination, 'PONG %s :%s' % (self.irc.servers[destination].name, source))
|
||||||
|
|
||||||
def handle_pong(self, source, command, args):
|
def handle_pong(self, source, command, args):
|
||||||
|
Loading…
Reference in New Issue
Block a user