From f19cb010a0ba141a6eb9741538ab899f2588b3af Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Thu, 19 Feb 2009 19:28:50 +1300 Subject: [PATCH] Upgraded clientprefs to use the client serial API (bug 3616) --- extensions/clientprefs/cookie.cpp | 6 +++--- extensions/clientprefs/cookie.h | 2 +- extensions/clientprefs/query.cpp | 10 +++++----- extensions/clientprefs/query.h | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/extensions/clientprefs/cookie.cpp b/extensions/clientprefs/cookie.cpp index f05c57d3..38897734 100644 --- a/extensions/clientprefs/cookie.cpp +++ b/extensions/clientprefs/cookie.cpp @@ -205,7 +205,7 @@ void CookieManager::OnClientAuthorized(int client, const char *authstring) connected[client] = true; - TQueryOp *op = new TQueryOp(Query_SelectData, player->GetUserId()); + TQueryOp *op = new TQueryOp(Query_SelectData, player->GetSerial()); strcpy(op->m_params.steamId, authstring); g_ClientPrefs.AddQueryToQueue(op); @@ -268,13 +268,13 @@ void CookieManager::OnClientDisconnecting(int client) } } -void CookieManager::ClientConnectCallback(int userid, IQuery *data) +void CookieManager::ClientConnectCallback(int serial, IQuery *data) { int client; IResultSet *results; /* Check validity of client */ - if ((client = playerhelpers->GetClientOfUserId(userid)) == 0) + if ((client = playerhelpers->GetClientFromSerial(serial)) == 0) { return; } diff --git a/extensions/clientprefs/cookie.h b/extensions/clientprefs/cookie.h index c3cf75dc..8fe2376e 100644 --- a/extensions/clientprefs/cookie.h +++ b/extensions/clientprefs/cookie.h @@ -121,7 +121,7 @@ public: void Unload(); - void ClientConnectCallback(int userid, IQuery *data); + void ClientConnectCallback(int serial, IQuery *data); void InsertCookieCallback(Cookie *pCookie, int dbId); void SelectIdCallback(Cookie *pCookie, IQuery *data); diff --git a/extensions/clientprefs/query.cpp b/extensions/clientprefs/query.cpp index 555699ae..964b5133 100644 --- a/extensions/clientprefs/query.cpp +++ b/extensions/clientprefs/query.cpp @@ -51,7 +51,7 @@ void TQueryOp::RunThinkPart() case Query_SelectData: { - g_CookieManager.ClientConnectCallback(m_userid, m_pResult); + g_CookieManager.ClientConnectCallback(m_serial, m_pResult); break; } @@ -84,10 +84,10 @@ void TQueryOp::RunThreadPart() if (!BindParamsAndRun()) { g_pSM->LogError(myself, - "Failed SQL Query, Error: \"%s\" (Query id %i - userid %i)", + "Failed SQL Query, Error: \"%s\" (Query id %i - serial %i)", m_database->GetError(), m_type, - m_userid); + m_serial); } m_database->UnlockFromFullAtomicOperation(); @@ -115,10 +115,10 @@ void TQueryOp::Destroy() delete this; } -TQueryOp::TQueryOp(enum querytype type, int userid) +TQueryOp::TQueryOp(enum querytype type, int serial) { m_type = type; - m_userid = userid; + m_serial = serial; m_database = NULL; m_insertId = -1; m_pResult = NULL; diff --git a/extensions/clientprefs/query.h b/extensions/clientprefs/query.h index 29de40f2..e7c6ff39 100644 --- a/extensions/clientprefs/query.h +++ b/extensions/clientprefs/query.h @@ -68,7 +68,7 @@ struct ParamData class TQueryOp : public IDBThreadOperation { public: - TQueryOp(enum querytype type, int userid); + TQueryOp(enum querytype type, int serial); TQueryOp(enum querytype type, Cookie *cookie); ~TQueryOp() {} @@ -102,7 +102,7 @@ private: enum querytype m_type; /* Data to be passed to the callback */ - int m_userid; + int m_serial; int m_insertId; Cookie *m_pCookie; };