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

List:       helix-protocol-cvs
Subject:    [Protocol-cvs] sdp sdpmdgen.cpp,1.12.10.7,1.12.10.8
From:       murali () helixcommunity ! org
Date:       2004-12-14 19:21:06
[Download RAW message or body]

Update of /cvsroot/protocol/sdp
In directory cvs-new:/tmp/cvs-serv26321

Modified Files:
      Tag: SERVER_10_1_STABLE
	sdpmdgen.cpp 
Log Message:
Modifed to get fix default Title


Index: sdpmdgen.cpp
===================================================================
RCS file: /cvsroot/protocol/sdp/sdpmdgen.cpp,v
retrieving revision 1.12.10.7
retrieving revision 1.12.10.8
diff -u -d -r1.12.10.7 -r1.12.10.8
--- sdpmdgen.cpp	26 Aug 2004 02:00:47 -0000	1.12.10.7
+++ sdpmdgen.cpp	14 Dec 2004 19:21:04 -0000	1.12.10.8
@@ -582,11 +582,64 @@
         }
     }   
      
-
     if (!pszTitle)
     {
-       SafeSprintf(psz256, 256,"s=<No title>%s", pszEOL); 
+        IHXBuffer* pDefaultTitleBuf = NULL;
+        IHXBuffer* pURLBuf = NULL;
+        const char* pURL = NULL;
+        const char* pTitleStart = NULL;
+        const char* pTitleEnd = NULL;
+        INT32 lDefaultNoChars = sizeof(psz256) - 5; //Account for extra chars
+        if (m_pRegistry)
+        {
+            m_pRegistry->GetStrByName("config.SDPDefaultTitle", pDefaultTitleBuf);
+            m_pRegistry->GetIntByName("config.SDPTitleNumCharsOfFilename", lDefaultNoChars);
+        }
+
+        if (pDefaultTitleBuf == NULL)
+        {
+            pValueArray[1]->GetPropertyCString("URL", pURLBuf);
+            if (pURLBuf != NULL)
+            {
+                pURL = (char*)pURLBuf->GetBuffer();
+            }
+            else
+            {
+                // Nothing we can do, set title as a single space
+                pURL = " ";
+            }
+
+            pTitleEnd = strchr(pURL, '?');
+	    if (pTitleEnd == NULL)
+            {
+		 pTitleEnd = pURL + strlen(pURL)+1;
+            }
+
+	     pTitleStart = pTitleEnd-1;
+	     while (pTitleStart > pURL && *(pTitleStart-1) != '/')
+             {
+                 --pTitleStart;
+             }
+	     if (lDefaultNoChars > 0 && lDefaultNoChars < 251)
+             {
+	          if (pTitleEnd > pTitleStart + lDefaultNoChars + 1)
+                  {
+		      pTitleEnd = pTitleStart + lDefaultNoChars;
+                  }
+             }
+	}
+	else
+	{
+	    pTitleStart = (char*)pDefaultTitleBuf->GetBuffer();
+	    pTitleEnd = pTitleStart + strlen(pTitleStart) + 1;
+	}
+    
+        SafeSprintf(psz256, 256, "s=%.*s%s", pTitleEnd-pTitleStart, pTitleStart, pszEOL);
        mDesc += psz256;
+
+	HX_RELEASE(pDefaultTitleBuf);
+	HX_RELEASE(pURLBuf);
+
     }
     else
     {



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

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