mirror of
https://github.com/markqvist/NomadNet.git
synced 2026-10-26 02:48:48 -04:00
Change AutoWho regex to match partial hashes
This commit is contained in:
parent
6e0d8b9f4c
commit
1c117507c4
2 changed files with 3 additions and 3 deletions
|
|
@ -104,7 +104,7 @@ def _msg_id():
|
|||
# greedy .+ intentionally captures nicks containing parens like "user (alt) (deadbeefcafe)"
|
||||
_WHO_ENTRY_RE = re.compile(
|
||||
r"(?:^|,\s)"
|
||||
r"(?:(?P<nick>.+?)\s\((?P<np>[0-9a-fA-F]+)\)|(?P<bh>[0-9a-fA-F]+))"
|
||||
r"(?:(?P<bh>[0-9a-fA-F]{32})|(?P<nick>.+?)\s\((?P<np>[0-9a-fA-F]{12})\))"
|
||||
r"(?=,\s|$)"
|
||||
)
|
||||
|
||||
|
|
@ -279,7 +279,7 @@ class RRCHub:
|
|||
nick = self.nicks.get(ph)
|
||||
if nick:
|
||||
return nick
|
||||
return ph.hex()[:10]
|
||||
return ph.hex()[:12]
|
||||
|
||||
def mark_read(self, room):
|
||||
r = self._normalize_room(room)
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ def _body_markup(body, body_attr="body_text", own_nick=None):
|
|||
return out, has_links
|
||||
|
||||
|
||||
def _short_hash(b, n=10):
|
||||
def _short_hash(b, n=12):
|
||||
if isinstance(b, (bytes, bytearray)):
|
||||
return bytes(b).hex()[:n]
|
||||
return "?"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue