3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 03:33:10 +01:00

protocols: reword error text

This commit is contained in:
James Lu 2016-01-09 17:44:05 -08:00
parent 0c48ea6791
commit 48203ff321
4 changed files with 34 additions and 34 deletions

View File

@ -41,7 +41,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
up to plugins to make sure they don't introduce anything invalid."""
server = server or self.irc.sid
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 server!' % server)
# Create an UIDGenerator instance for every SID, so that each gets
# distinct values.
uid = self.uidgen.setdefault(server, utils.TS6UIDGenerator(server)).next_uid()
@ -70,8 +70,8 @@ class InspIRCdProtocol(TS6BaseProtocol):
channel = utils.toLower(self.irc, channel)
server = self.irc.isInternalClient(client)
if not server:
log.error('(%s) Error trying to join client %r to %r (no such pseudoclient exists)', self.irc.name, client, channel)
raise LookupError('No such PyLink PseudoClient exists.')
log.error('(%s) Error trying to join %r to %r (no such client exists)', self.irc.name, client, channel)
raise LookupError('No such PyLink client exists.')
# Strip out list-modes, they shouldn't be ever sent in FJOIN.
modes = [m for m in self.irc.channels[channel].modes if m[0] not in self.irc.cmodes['*A']]
self._send(server, "FJOIN {channel} {ts} {modes} :,{uid}".format(
@ -96,7 +96,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
assert users, "sjoinServer: No users sent?"
log.debug('(%s) sjoinServer: got %r for users', self.irc.name, users)
if not server:
raise LookupError('No such PyLink PseudoClient exists.')
raise LookupError('No such PyLink client exists.')
orig_ts = self.irc.channels[channel].ts
ts = ts or orig_ts
@ -177,7 +177,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
a list of (mode, arg) tuples, i.e. the format of utils.parseModes() output.
"""
if not self.irc.isInternalClient(numeric):
raise LookupError('No such PyLink PseudoClient exists.')
raise LookupError('No such PyLink client exists.')
self._sendModes(numeric, target, modes, ts=ts)
def modeServer(self, numeric, target, modes, ts=None):
@ -186,7 +186,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
a list of (mode, arg) tuples, i.e. the format of utils.parseModes() output.
"""
if not self.irc.isInternalServer(numeric):
raise LookupError('No such PyLink PseudoServer exists.')
raise LookupError('No such PyLink server exists.')
self._sendModes(numeric, target, modes, ts=ts)
def _sendKill(self, numeric, target, reason):
@ -200,19 +200,19 @@ class InspIRCdProtocol(TS6BaseProtocol):
def killServer(self, numeric, target, reason):
"""Sends a kill from a PyLink server."""
if not self.irc.isInternalServer(numeric):
raise LookupError('No such PyLink PseudoServer exists.')
raise LookupError('No such PyLink server exists.')
self._sendKill(numeric, target, reason)
def killClient(self, numeric, target, reason):
"""Sends a kill from a PyLink client."""
if not self.irc.isInternalClient(numeric):
raise LookupError('No such PyLink PseudoClient exists.')
raise LookupError('No such PyLink client exists.')
self._sendKill(numeric, target, reason)
def topicServer(self, numeric, target, text):
"""Sends a topic change from a PyLink server. This is usually used on burst."""
if not self.irc.isInternalServer(numeric):
raise LookupError('No such PyLink PseudoServer exists.')
raise LookupError('No such PyLink server exists.')
ts = int(time.time())
servername = self.irc.servers[numeric].name
self._send(numeric, 'FTOPIC %s %s %s :%s' % (target, ts, servername, text))
@ -222,13 +222,13 @@ class InspIRCdProtocol(TS6BaseProtocol):
def inviteClient(self, numeric, target, channel):
"""Sends an INVITE from a PyLink client.."""
if not self.irc.isInternalClient(numeric):
raise LookupError('No such PyLink PseudoClient exists.')
raise LookupError('No such PyLink client exists.')
self._send(numeric, 'INVITE %s %s' % (target, channel))
def knockClient(self, numeric, target, text):
"""Sends a KNOCK from a PyLink client."""
if not self.irc.isInternalClient(numeric):
raise LookupError('No such PyLink PseudoClient exists.')
raise LookupError('No such PyLink client exists.')
self._send(numeric, 'ENCAP * KNOCK %s :%s' % (target, text))
def updateClient(self, target, field, text):
@ -322,7 +322,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
if name == server.name:
raise ValueError('A server named %r already exists!' % name)
if not self.irc.isInternalServer(uplink):
raise ValueError('Server %r is not a PyLink internal PseudoServer!' % uplink)
raise ValueError('Server %r is not a PyLink server!' % uplink)
if not utils.isServerName(name):
raise ValueError('Invalid server name %r' % name)
self._send(uplink, 'SERVER %s * 1 %s :%s' % (name, sid, desc))

View File

@ -34,7 +34,7 @@ class TS6Protocol(TS6BaseProtocol):
up to plugins to make sure they don't introduce anything invalid."""
server = server or self.irc.sid
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 server!' % server)
# Create an UIDGenerator instance for every SID, so that each gets
# distinct values.
uid = self.uidgen.setdefault(server, utils.TS6UIDGenerator(server)).next_uid()
@ -62,8 +62,8 @@ class TS6Protocol(TS6BaseProtocol):
# JOIN:
# parameters: channelTS, channel, '+' (a plus sign)
if not self.irc.isInternalClient(client):
log.error('(%s) Error trying to join client %r to %r (no such pseudoclient exists)', self.irc.name, client, channel)
raise LookupError('No such PyLink PseudoClient exists.')
log.error('(%s) Error trying to join %r to %r (no such client exists)', self.irc.name, client, channel)
raise LookupError('No such PyLink client exists.')
self._send(client, "JOIN {ts} {channel} +".format(ts=self.irc.channels[channel].ts, channel=channel))
self.irc.channels[channel].users.add(client)
self.irc.users[client].channels.add(channel)
@ -93,7 +93,7 @@ class TS6Protocol(TS6BaseProtocol):
assert users, "sjoinServer: No users sent?"
log.debug('(%s) sjoinServer: got %r for users', self.irc.name, users)
if not server:
raise LookupError('No such PyLink PseudoClient exists.')
raise LookupError('No such PyLink client exists.')
orig_ts = self.irc.channels[channel].ts
ts = ts or orig_ts
@ -157,7 +157,7 @@ class TS6Protocol(TS6BaseProtocol):
a list of (mode, arg) tuples, i.e. the format of utils.parseModes() output.
"""
if not self.irc.isInternalClient(numeric):
raise LookupError('No such PyLink PseudoClient exists.')
raise LookupError('No such PyLink client exists.')
self._sendModes(numeric, target, modes, ts=ts)
def modeServer(self, numeric, target, modes, ts=None):
@ -166,13 +166,13 @@ class TS6Protocol(TS6BaseProtocol):
a list of (mode, arg) tuples, i.e. the format of utils.parseModes() output.
"""
if not self.irc.isInternalServer(numeric):
raise LookupError('No such PyLink PseudoServer exists.')
raise LookupError('No such PyLink server exists.')
self._sendModes(numeric, target, modes, ts=ts)
def killServer(self, numeric, target, reason):
"""Sends a kill from a PyLink server."""
if not self.irc.isInternalServer(numeric):
raise LookupError('No such PyLink PseudoServer exists.')
raise LookupError('No such PyLink server exists.')
# KILL:
# parameters: target user, path
@ -187,7 +187,7 @@ class TS6Protocol(TS6BaseProtocol):
def killClient(self, numeric, target, reason):
"""Sends a kill from a PyLink client."""
if not self.irc.isInternalClient(numeric):
raise LookupError('No such PyLink PseudoClient exists.')
raise LookupError('No such PyLink client exists.')
assert target in self.irc.users, "Unknown target %r for killClient!" % target
self._send(numeric, 'KILL %s :Killed (%s)' % (target, reason))
self.removeClient(target)
@ -195,7 +195,7 @@ class TS6Protocol(TS6BaseProtocol):
def topicServer(self, numeric, target, text):
"""Sends a topic change from a PyLink server. This is usually used on burst."""
if not self.irc.isInternalServer(numeric):
raise LookupError('No such PyLink PseudoServer exists.')
raise LookupError('No such PyLink server exists.')
# TB
# capab: TB
# source: server
@ -210,7 +210,7 @@ class TS6Protocol(TS6BaseProtocol):
def inviteClient(self, numeric, target, channel):
"""Sends an INVITE from a PyLink client.."""
if not self.irc.isInternalClient(numeric):
raise LookupError('No such PyLink PseudoClient exists.')
raise LookupError('No such PyLink client exists.')
self._send(numeric, 'INVITE %s %s %s' % (target, channel, self.irc.channels[channel].ts))
def knockClient(self, numeric, target, text):
@ -220,7 +220,7 @@ class TS6Protocol(TS6BaseProtocol):
'doesn\'t support it.', self.irc.name, target)
return
if not self.irc.isInternalClient(numeric):
raise LookupError('No such PyLink PseudoClient exists.')
raise LookupError('No such PyLink client exists.')
# No text value is supported here; drop it.
self._send(numeric, 'KNOCK %s' % target)

View File

@ -55,19 +55,19 @@ class TS6BaseProtocol(Protocol):
def kickClient(self, numeric, channel, target, reason=None):
"""Sends a kick from a PyLink client."""
if not self.irc.isInternalClient(numeric):
raise LookupError('No such PyLink PseudoClient exists.')
raise LookupError('No such PyLink client exists.')
self._sendKick(numeric, channel, target, reason=reason)
def kickServer(self, numeric, channel, target, reason=None):
"""Sends a kick from a PyLink server."""
if not self.irc.isInternalServer(numeric):
raise LookupError('No such PyLink PseudoServer exists.')
raise LookupError('No such PyLink server exists.')
self._sendKick(numeric, channel, target, reason=reason)
def nickClient(self, numeric, newnick):
"""Changes the nick of a PyLink client."""
if not self.irc.isInternalClient(numeric):
raise LookupError('No such PyLink PseudoClient exists.')
raise LookupError('No such PyLink client exists.')
self._send(numeric, 'NICK %s %s' % (newnick, int(time.time())))
self.irc.users[numeric].nick = newnick
@ -75,8 +75,8 @@ class TS6BaseProtocol(Protocol):
"""Sends a part from a PyLink client."""
channel = utils.toLower(self.irc, channel)
if not self.irc.isInternalClient(client):
log.error('(%s) Error trying to part client %r to %r (no such pseudoclient exists)', self.irc.name, client, channel)
raise LookupError('No such PyLink PseudoClient exists.')
log.error('(%s) Error trying to part %r from %r (no such client exists)', self.irc.name, client, channel)
raise LookupError('No such PyLink client exists.')
msg = "PART %s" % channel
if reason:
msg += " :%s" % reason
@ -89,24 +89,24 @@ class TS6BaseProtocol(Protocol):
self._send(numeric, "QUIT :%s" % reason)
self.removeClient(numeric)
else:
raise LookupError("No such PyLink PseudoClient exists.")
raise LookupError("No such PyLink client exists.")
def messageClient(self, numeric, target, text):
"""Sends a PRIVMSG from a PyLink client."""
if not self.irc.isInternalClient(numeric):
raise LookupError('No such PyLink PseudoClient exists.')
raise LookupError('No such PyLink client exists.')
self._send(numeric, 'PRIVMSG %s :%s' % (target, text))
def noticeClient(self, numeric, target, text):
"""Sends a NOTICE from a PyLink client."""
if not self.irc.isInternalClient(numeric):
raise LookupError('No such PyLink PseudoClient exists.')
raise LookupError('No such PyLink client exists.')
self._send(numeric, 'NOTICE %s :%s' % (target, text))
def topicClient(self, numeric, target, text):
"""Sends a TOPIC change from a PyLink client."""
if not self.irc.isInternalClient(numeric):
raise LookupError('No such PyLink PseudoClient exists.')
raise LookupError('No such PyLink client exists.')
self._send(numeric, 'TOPIC %s :%s' % (target, text))
self.irc.channels[target].topic = text
self.irc.channels[target].topicset = True
@ -134,7 +134,7 @@ class TS6BaseProtocol(Protocol):
if name == server.name:
raise ValueError('A server named %r already exists!' % name)
if not self.irc.isInternalServer(uplink):
raise ValueError('Server %r is not a PyLink internal PseudoServer!' % uplink)
raise ValueError('Server %r is not a PyLink server!' % uplink)
if not utils.isServerName(name):
raise ValueError('Invalid server name %r' % name)
self._send(uplink, 'SID %s 1 %s :%s' % (name, sid, desc))

View File

@ -59,7 +59,7 @@ class UnrealProtocol(TS6BaseProtocol):
up to plugins to make sure they don't introduce anything invalid."""
server = server or self.irc.sid
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 server!' % server)
# Unreal 3.4 uses TS6-style UIDs. They don't start from AAAAAA like other IRCd's
# do, but we can do that fine...
uid = self.uidgen.setdefault(server, utils.TS6UIDGenerator(server)).next_uid()