Skip to content

Commit

Permalink
Merge pull request #741 from DryByte/patch-10
Browse files Browse the repository at this point in the history
Truncate messages in os_info at VersionInfo
  • Loading branch information
NotAFile committed Jan 16, 2023
2 parents eeda381 + 80b60c2 commit 34ba06c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pyspades/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,15 +672,16 @@ def on_handshake_recieved(self, contained: loaders.HandShakeReturn) -> None:
@register_packet_handler(loaders.VersionResponse)
def on_version_info_recieved(self, contained: loaders.VersionResponse) -> None:
self.client_info["version"] = contained.version
self.client_info["os_info"] = contained.os_info
self.client_info["os_info"] = contained.os_info[:108]
# TODO: Make this a dict lookup instead
if contained.client == 'o':
self.client_info["client"] = "OpenSpades"
elif contained.client == 'B':
self.client_info["client"] = "BetterSpades"
# BetterSpades currently sends the client name in the OS info to
# deal with old scripts that don't recognize the 'B' indentifier
match = re.match(r"\ABetterSpades \((.*)\)\Z", contained.os_info)
match = re.match(r"\ABetterSpades \((.*)\)\Z",
contained.os_info[:108])
if match:
self.client_info["os_info"] = match.groups()[0]
elif contained.client == 'a':
Expand Down

0 comments on commit 34ba06c

Please sign in to comment.