Skip to content

Commit

Permalink
Merge pull request #367 from piqueserver/rewrite-betterspades-version
Browse files Browse the repository at this point in the history
Rewrite Betterspades os info
  • Loading branch information
NotAFile committed Aug 12, 2018
2 parents 0b37f6a + 95b05d1 commit d91c097
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pyspades/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import shlex
from itertools import product
import textwrap
import re

from twisted.internet import reactor
from twisted.logger import Logger
Expand Down Expand Up @@ -633,17 +634,22 @@ 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
# 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)
if match:
self.client_info["os_info"] = match.groups()[0]
elif contained.client == 'a':
self.client_info["client"] = "ACE"
else:
self.client_info["client"] = "Unknown({})".format(contained.client)
self.client_info["version"] = contained.version
self.client_info["os_info"] = contained.os_info

@property
def client_string(self):
Expand Down

0 comments on commit d91c097

Please sign in to comment.