3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

relay: simplify is_relay_client()

This commit is contained in:
James Lu 2018-10-08 12:12:09 -07:00
parent 7fb4c8da04
commit 20b3a61cd6

View File

@ -695,16 +695,7 @@ def get_supported_umodes(irc, remoteirc, modes):
def is_relay_client(irc, user):
"""Returns whether the given user is a relay client."""
try:
if irc.users[user].remote:
# Is the .remote attribute set? If so, don't relay already
# relayed clients; that'll trigger an endless loop!
return True
except AttributeError: # Nope, it isn't.
pass
except KeyError: # The user doesn't exist?!?
return True
return False
return user in irc.users and hasattr(irc.users[user], 'remote')
isRelayClient = is_relay_client
def iterate_all(origirc, func, extra_args=(), kwargs=None):