From 20b3a61cd658ff66e81ba1690ca1ff0db6c3dc2b Mon Sep 17 00:00:00 2001 From: James Lu Date: Mon, 8 Oct 2018 12:12:09 -0700 Subject: [PATCH] relay: simplify is_relay_client() --- plugins/relay.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/plugins/relay.py b/plugins/relay.py index 73c9840..bc52e88 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -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):