[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-client-cvs
Subject:    [Client-cvs] core corshare.cpp, 1.14, 1.15 hxcleng.cpp, 1.130,
From:       ping () helixcommunity ! org
Date:       2008-06-24 16:48:03
Message-ID: 200806241649.m5OGnQ2j005745 () mailer ! progressive-comp ! com
[Download RAW message or body]

Update of /cvsroot/client/core
In directory cvs01.internal.helixcommunity.org:/tmp/cvs-serv13710

Modified Files:
	corshare.cpp hxcleng.cpp hxntsrc.cpp 
Log Message:
Consolidated setting of "ClientID" into ONE place ::SetRequest() if it's not \
overwritten by the application.



Index: corshare.cpp
===================================================================
RCS file: /cvsroot/client/core/corshare.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- corshare.cpp	6 Jul 2007 21:58:11 -0000	1.14
+++ corshare.cpp	24 Jun 2008 16:48:00 -0000	1.15
@@ -83,6 +83,10 @@
 #include "srcinfo.h"
 #include "pckunpck.h"
 
+#include "clntcore.ver"
+#include "hxver.h"
+#include "hxwinver.h"
+
 // will be taken out once flags are defined in a separate file
 #include "rmfftype.h"	
 #include "hxplay.h"
@@ -154,7 +158,20 @@
 	strTemp += ".Language";
 	pRegistry->GetStrByName(strTemp, pLanguage);
     }
-
+    else
+    {
+        // Encode the client ID with the pieces of interest.
+        HXVERSIONINFO verInfo;
+        HXGetWinVer(&verInfo);
+        const char* pszClientID = HXGetVerEncodedName(&verInfo,
+                                                      PRODUCT_ID,
+                                                      TARVER_STRING_VERSION,
+                                                      LANGUAGE_CODE,
+                                                      "RN01");
+        // Set clientID
+        CreateStringBufferCCF(pClientID, pszClientID, pCCF);
+    }
+ 
     if(bCanSendGuid &&
        pPreferences && 
        pPreferences->ReadPref(CLIENT_GUID_REGNAME, pGUID) == HXR_OK)

Index: hxcleng.cpp
===================================================================
RCS file: /cvsroot/client/core/hxcleng.cpp,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- hxcleng.cpp	28 May 2008 22:52:19 -0000	1.130
+++ hxcleng.cpp	24 Jun 2008 16:48:00 -0000	1.131
@@ -2398,29 +2398,6 @@
     }
     HX_RELEASE(pStats);
 
-    // generate client ID
-    // Get the platform information for use in the client ID
-    strTemp.Format("%s.%s",HXREGISTRY_PREFPROPNAME,CLIENT_ID_REGNAME);
-    if(m_pRegistry->GetStrByName(strTemp,pBuffer) != HXR_OK)
-    {
-        HXVERSIONINFO verInfo;
-        HXGetWinVer(&verInfo);
-
-        // Encode the client ID with the pieces of interest.
-        const char* pszClientID = HXGetVerEncodedName
-            (&verInfo,
-            PRODUCT_ID,
-            TARVER_STRING_VERSION,
-            LANGUAGE_CODE,
-            "RN01");
-
-        // Set clientID
-        pBuffer = CreateBufferAndSetToString(pszClientID);
-        m_pRegistry->AddStr(strTemp,pBuffer);
-    }
-
-    HX_RELEASE(pBuffer);
-
     // RegionData
     strTemp.Format("%s.%s",HXREGISTRY_PREFPROPNAME,"RegionData");
     if(m_pRegistry->GetStrByName(strTemp,pBuffer) != HXR_OK)

Index: hxntsrc.cpp
===================================================================
RCS file: /cvsroot/client/core/hxntsrc.cpp,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -d -r1.163 -r1.164
--- hxntsrc.cpp	19 Jun 2008 22:52:23 -0000	1.163
+++ hxntsrc.cpp	24 Jun 2008 16:48:00 -0000	1.164
@@ -3271,15 +3271,16 @@
 
     HX_RESULT       theErr = HXR_OK;
     UINT32          un16Temp = 0;
-    theErr = HXSource::ReadPreferences();
+    IHXValues*      pRequestHeaders = NULL;
+    IHXBuffer*      pValue = NULL;
 
+    theErr = HXSource::ReadPreferences();
     if (theErr)
     {
             return theErr;
     }
 
     // Read Client ID
-    IHXBuffer* pBuffer = NULL;
     IHXBuffer* pProxyHost = NULL;
     IHXBuffer* pProxyPort = NULL;
 
@@ -3295,54 +3296,44 @@
         ReadPrefBOOL(m_pPreferences, "PerfectPlay", m_bPerfectPlay);         
     }
 
-    const char* pcszClientID = NULL;
-
-    IHXRegistry* pRegistry = NULL;
-    if (m_pEngine->QueryInterface(IID_IHXRegistry, (void**)&pRegistry) == HXR_OK)
-    {
-        // Form clientID registry string
-        CHXString strTemp;
-        strTemp = HXREGISTRY_PREFPROPNAME;
-        strTemp += '.';
-        strTemp += CLIENT_ID_REGNAME;
-        if (pRegistry->GetStrByName(strTemp, pBuffer) == HXR_OK)
-        {
-            pcszClientID = (const char*)pBuffer->GetBuffer();
-        }
-        pRegistry->Release();
-    }
-    else
+    if (m_pRequest &&
+        SUCCEEDED(m_pRequest->GetRequestHeaders(pRequestHeaders)))
     {
-        // Encode the client ID with the pieces of interest.
-        HXVERSIONINFO verInfo;
-        HXGetWinVer(&verInfo);
-        pcszClientID = HXGetVerEncodedName(&verInfo,
-                                           PRODUCT_ID,
-                                           TARVER_STRING_VERSION,
-                                           LANGUAGE_CODE,
-                                           "RN01");
+        pRequestHeaders->GetPropertyCString("ClientID", pValue);
     }
 
-    if (pcszClientID)
+    if (pValue)
     {
-        UINT32 ulSizeof_mClientID = sizeof(mClientID);
-        UINT32 ulSafeStrlenClientId = HX_SAFESIZE_T(strlen(pcszClientID));
-
-        HX_ASSERT(ulSafeStrlenClientId < ulSizeof_mClientID);
+        const char* pcszClientID = (const char*)pValue->GetBuffer();
 
-        if (ulSafeStrlenClientId >= ulSizeof_mClientID)
+        if (pcszClientID)
         {
-            // /Limiting too-large string fixes PR 86928 (but whatever
-            // writes to props|prefs needs to be sure not to overflow
-            // the max size):
-            ulSafeStrlenClientId = ulSizeof_mClientID - 1;
+            UINT32 ulSizeof_mClientID = sizeof(mClientID);
+            UINT32 ulSafeStrlenClientId = HX_SAFESIZE_T(strlen(pcszClientID));
+
+            HX_ASSERT(ulSafeStrlenClientId < ulSizeof_mClientID);
+
+            if (ulSafeStrlenClientId >= ulSizeof_mClientID)
+            {
+                // /Limiting too-large string fixes PR 86928 (but whatever
+                // writes to props|prefs needs to be sure not to overflow
+                // the max size):
+                ulSafeStrlenClientId = ulSizeof_mClientID - 1;
+            }
+            
+            memcpy(mClientID, pcszClientID, ulSafeStrlenClientId); /* Flawfinder: \
ignore */ +            mClientID[ulSafeStrlenClientId] = '\0';
         }
-        
-        memcpy(mClientID, pcszClientID, ulSafeStrlenClientId); /* Flawfinder: ignore \
                */
-        mClientID[ulSafeStrlenClientId] = '\0';
+    }
+    else
+    {
+        // ClientID is expected to be set by ::SetRequest() if it's not
+        // overwritten by the application
+        HX_ASSERT(FALSE);
     }
 
-    HX_RELEASE(pBuffer);
+    HX_RELEASE(pValue);
+    HX_RELEASE(pRequestHeaders);
 
     ReadPrefUINT32(m_pPreferences, "ServerTimeOut", m_ulServerTimeOut);
     if (m_ulServerTimeOut < MINIMUM_TIMEOUT)


_______________________________________________
Client-cvs mailing list
Client-cvs@helixcommunity.org
http://lists.helixcommunity.org/mailman/listinfo/client-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic