mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-30 23:09:23 +01:00
classes: split match_host() into match_host() and match_text()
This commit is contained in:
parent
6085b21e48
commit
f4de604b7d
16
classes.py
16
classes.py
@ -1363,6 +1363,9 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
|
|||||||
hosts.add(self.get_hostmask(target, realhost=True))
|
hosts.add(self.get_hostmask(target, realhost=True))
|
||||||
|
|
||||||
else: # We were given a host, use that.
|
else: # We were given a host, use that.
|
||||||
|
if '@' not in text:
|
||||||
|
log.warning('(%s) Using match_host() on non-hostlike globs is deprecated as of 2.0-alpha4 - '
|
||||||
|
'use match_text() instead', self.name)
|
||||||
hosts = [target]
|
hosts = [target]
|
||||||
|
|
||||||
# Iterate over the hosts to match using ircmatch.
|
# Iterate over the hosts to match using ircmatch.
|
||||||
@ -1377,6 +1380,19 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
|
|||||||
result = not result
|
result = not result
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def match_text(self, glob, text):
|
||||||
|
"""
|
||||||
|
Returns whether the given glob matches the given text under the network's
|
||||||
|
current case mapping.
|
||||||
|
"""
|
||||||
|
# Get the corresponding casemapping value used by ircmatch.
|
||||||
|
if self.casemapping == 'rfc1459':
|
||||||
|
casemapping = 0
|
||||||
|
else:
|
||||||
|
casemapping = 1
|
||||||
|
|
||||||
|
return ircmatch.match(casemapping, glob, text)
|
||||||
|
|
||||||
def match_all(self, banmask, channel=None):
|
def match_all(self, banmask, channel=None):
|
||||||
"""
|
"""
|
||||||
Returns all users matching the target hostmask/exttarget. Users can also be filtered by channel.
|
Returns all users matching the target hostmask/exttarget. Users can also be filtered by channel.
|
||||||
|
Loading…
Reference in New Issue
Block a user