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:
parent
7fb4c8da04
commit
20b3a61cd6
@ -695,16 +695,7 @@ def get_supported_umodes(irc, remoteirc, modes):
|
|||||||
|
|
||||||
def is_relay_client(irc, user):
|
def is_relay_client(irc, user):
|
||||||
"""Returns whether the given user is a relay client."""
|
"""Returns whether the given user is a relay client."""
|
||||||
try:
|
return user in irc.users and hasattr(irc.users[user], 'remote')
|
||||||
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
|
|
||||||
isRelayClient = is_relay_client
|
isRelayClient = is_relay_client
|
||||||
|
|
||||||
def iterate_all(origirc, func, extra_args=(), kwargs=None):
|
def iterate_all(origirc, func, extra_args=(), kwargs=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user