|
@@ -22,6 +22,7 @@ except ModuleNotFoundError:
|
|
|
from config import *
|
|
|
|
|
|
# Extract the version information from git.
|
|
|
+# The match gives us only tags starting with v[0-9]* Using anything else trips up on double digits.
|
|
|
version = check_output(
|
|
|
[
|
|
|
"git",
|
|
@@ -192,12 +193,7 @@ class GlueFactory(protocol.ClientFactory):
|
|
|
class Player(protocol.Protocol):
|
|
|
def __init__(self):
|
|
|
self.buffer = ""
|
|
|
- self.fpRaw = None
|
|
|
- self.fpLines = None
|
|
|
- self.action = None
|
|
|
- self.username = ""
|
|
|
- self.game = ""
|
|
|
- self.passon = True
|
|
|
+ self.user = None
|
|
|
|
|
|
def connectionMade(self):
|
|
|
""" connected, setup queues.
|
|
@@ -234,6 +230,20 @@ class Player(protocol.Protocol):
|
|
|
self.setGameReceived()
|
|
|
|
|
|
def dataReceived(self, chunk):
|
|
|
+ if self.user is None:
|
|
|
+ self.buffer += chunk.decode("utf-8", "ignore")
|
|
|
+
|
|
|
+ parts = self.buffer.split("\x00")
|
|
|
+ if len(parts) >= 5:
|
|
|
+ # rlogin we have the username
|
|
|
+ self.user = parts[1]
|
|
|
+ log.msg("User: {0}".format(self.user))
|
|
|
+ zpos = self.buffer.rindex("\x00")
|
|
|
+ self.buffer = self.buffer[zpos + 1 :]
|
|
|
+ # but I don't need the buffer anymore, so:
|
|
|
+ self.buffer = ""
|
|
|
+ # Pass user value on to whatever needs it.
|
|
|
+
|
|
|
self.queue_player.put(chunk)
|
|
|
|
|
|
def connectionLost(self, why):
|