From 29160bf7212ba310d95ec3fe444898bea03ab20e Mon Sep 17 00:00:00 2001 From: polaris Date: Wed, 9 Apr 2014 13:13:24 -0400 Subject: [PATCH] Store sig in database Also fixed some tabs. --- gamespy/gs_database.py | 7 ++++--- gamespy_server.py | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gamespy/gs_database.py b/gamespy/gs_database.py index 0481652..4d451b9 100644 --- a/gamespy/gs_database.py +++ b/gamespy/gs_database.py @@ -19,7 +19,7 @@ class GamespyDatabase(object): # but I'm not good with databases and I'm not 100% positive that, for instance, that all # user id's will be ints, or all passwords will be ints, etc, despite not seeing any # evidence yet to say otherwise as far as Nintendo DS games go. - c.execute('''CREATE TABLE users (profileid INT, userid TEXT, password TEXT, gsbrcd TEXT, email TEXT, uniquenick TEXT, pid TEXT, lon TEXT, lat TEXT, loc TEXT, firstname TEXT, lastname TEXT, stat TEXT, partnerid TEXT, console INT, csnum TEXT, cfc TEXT, bssid TEXT, devname TEXT, birth TEXT)''') + c.execute('''CREATE TABLE users (profileid INT, userid TEXT, password TEXT, gsbrcd TEXT, email TEXT, uniquenick TEXT, pid TEXT, lon TEXT, lat TEXT, loc TEXT, firstname TEXT, lastname TEXT, stat TEXT, partnerid TEXT, console INT, csnum TEXT, cfc TEXT, bssid TEXT, devname TEXT, birth TEXT, sig TEXT)''') c.execute('''CREATE TABLE sessions (session TEXT, profileid INT)''') c.execute('''CREATE TABLE buddies (userProfileid INT, buddyProfileId INT, status INT)''') self.conn.commit() @@ -113,6 +113,7 @@ class GamespyDatabase(object): lastname = "" stat = "" partnerid = "" + sig = utils.generate_random_hex_str(32) # Hash password before entering it into the database. # For now I'm using a very simple MD5 hash. @@ -122,8 +123,8 @@ class GamespyDatabase(object): password = md5.hexdigest() c = self.conn.cursor() - c.execute("INSERT INTO users VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", - [profileid, str(userid), password, gsbrcd, email, uniquenick, pid, lon, lat, loc, firstname, lastname, stat, partnerid, console, csnum, cfc, bssid, devname, birth]) + c.execute("INSERT INTO users VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", + [profileid, str(userid), password, gsbrcd, email, uniquenick, pid, lon, lat, loc, firstname, lastname, stat, partnerid, console, csnum, cfc, bssid, devname, birth, sig]) c.close() self.conn.commit() diff --git a/gamespy_server.py b/gamespy_server.py index 9f221cc..7dcdb35 100644 --- a/gamespy_server.py +++ b/gamespy_server.py @@ -199,7 +199,7 @@ class PlayerSession(LineReceiver): msg_d.append(('nick', profile['uniquenick'])) msg_d.append(('userid', profile['userid'])) msg_d.append(('email', profile['email'])) - msg_d.append(('sig', utils.generate_random_hex_str(32))) + msg_d.append(('sig', profile['sig'])) msg_d.append(('uniquenick', profile['uniquenick'])) msg_d.append(('pid', profile['pid'])) @@ -207,8 +207,8 @@ class PlayerSession(LineReceiver): msg_d.append(('firstname', profile['firstname'])) # Wii gets a firstname if profile['lastname'] != "": - msg_d.append(('lastname', profile['lastname'])) - + msg_d.append(('lastname', profile['lastname'])) + msg_d.append(('lon', profile['lon'])) msg_d.append(('lat', profile['lat'])) msg_d.append(('loc', profile['loc']))