mirror of
https://github.com/markqvist/NomadNet.git
synced 2026-10-23 02:11:27 +00:00
Change AutoWho regex to match partial hashes
This commit is contained in:
1 parent
6e0d8b9f4c
commit
1c117507c4
2 files changed
+3
-3
No files matched your search
+2
-2
@@ -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 "?"
|
||||
|
||||
Reference in new issue
Block a user