[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/asobj/System.cpp libbase...
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] gnash ChangeLog server/asobj/System.cpp libbase... |
Date: |
Thu, 13 Dec 2007 01:08:06 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Benjamin Wolsey <bwy> 07/12/13 01:08:06
Modified files:
. : ChangeLog
server/asobj : System.cpp
libbase : URL.cpp URL.h
Log message:
* libbase/URL.{h,cpp}: add another encode() function to return
a new escaped string.
* server/asobj/System.cpp: implement capabilities.serverString.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5155&r2=1.5156
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/System.cpp?cvsroot=gnash&r1=1.18&r2=1.19
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/URL.cpp?cvsroot=gnash&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/URL.h?cvsroot=gnash&r1=1.17&r2=1.18
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5155
retrieving revision 1.5156
diff -u -b -r1.5155 -r1.5156
--- ChangeLog 13 Dec 2007 00:54:29 -0000 1.5155
+++ ChangeLog 13 Dec 2007 01:08:05 -0000 1.5156
@@ -1,3 +1,9 @@
+2007-12-12 Benjamin Wolsey <address@hidden>
+
+ * libbase/URL.{h,cpp}: add another encode() function to return
+ a new escaped string.
+ * server/asobj/System.cpp: implement capabilities.serverString.
+
2007-12-12 Rob Savoye <address@hidden>
* cygnal/http.{cpp,h}: Extract the fields with multiple values
Index: server/asobj/System.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/System.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- server/asobj/System.cpp 12 Dec 2007 18:19:27 -0000 1.18
+++ server/asobj/System.cpp 13 Dec 2007 01:08:06 -0000 1.19
@@ -27,6 +27,9 @@
#include "builtin_function.h"
#include "VM.h" // for getPlayerVersion()
#include "Object.h" // for getObjectInterface
+#include "URL.h" // for encoding serverString
+
+#define TF(x) (x ? "t" : "f")
namespace gnash {
@@ -59,36 +62,88 @@
{
static RcInitFile& rcfile = RcInitFile::getDefaultInstance();
- static boost::intrusive_ptr<as_object> proto;
- if ( proto == NULL )
- {
- int flags = as_prop_flags::dontDelete;
- flags |= as_prop_flags::dontEnum;
- flags |= as_prop_flags::readOnly;
-
- proto = new as_object(getObjectInterface());
-
- proto->init_member("version", VM::get().getPlayerVersion(),
flags);
-
- // TODO:
- // "stand-alone", "external", "plug-in", or "ActiveX".
- proto->init_member("playerType", "stand-alone", flags);
+ // "LNX 9,0,22,0", "MAC 8,0,99,0"
+ // Override in gnashrc
+ static const std::string version = VM::get().getPlayerVersion();
+
+ // Flash 7: "StandAlone", "External", "PlugIn", "ActiveX"
+ // TODO: Implement properly
+ static const std::string playerType = "StandAlone";
// "Windows XP", "Windows 2000", "Windows NT", "Windows 98/ME",
"Windows 95", "Windows CE", "Linux", "MacOS"
- proto->init_member("os", VM::get().getOSName(), flags);
+ // Override in gnashrc
+ static const std::string os = VM::get().getOSName();
// "Macromedia Windows", "Macromedia Linux", "Macromedia MacOS"
- proto->init_member("manufacturer",
rcfile.getFlashSystemManufacturer(), flags);
+ // Override in gnashrc
+ static const std::string manufacturer =
rcfile.getFlashSystemManufacturer();
+
/* Human Interface */
- // Two-letter language code ('en', 'de')
- proto->init_member("language", VM::get().getSystemLanguage(),
flags);
+ // Two-letter language code ('en', 'de') corresponding to ISO 639-1
+ // TODO: Chinese should be either zh-CN or zh-TW
+ // TODO: Are there more than the 20 officially documented?
+ // TODO: Other / unknown should return 'xu'.
+ static const std::string language = VM::get().getSystemLanguage();
+
/* Media */
// Is audio available?
- proto->init_member("hasAudio", (get_sound_handler() != NULL),
flags);
+ static const bool hasAudio = (get_sound_handler() != NULL);
+
+
+ /* A URL-encoded string to send system info to a server.*/
+ /* Boolean values are represented as t or f. */
+ /* Privacy concerns should probably be addressed by */
+ /* allowing this string to be sent or not; individual */
+ /* values that might affect privacy can be overridden */
+ /* in gnashrc. */
+
+ std::string serverString =
+ + "OS=" + URL::encode(os)
+ + "&A=" + TF(hasAudio)
+ + "&V=" + URL::encode(version)
+ + "&PT=" + playerType
+ + "&L=" + language
+ + "&AVD=" // avHardwareDisable (bool)
+ + "&ACC" // hasAccessibility (bool)
+ + "&AE=" // hasAudioEncoder (bool)
+ + "&EV=" // hasEmbeddedVideo (bool)
+ + "&IME=" // hasIME (bool)
+ + "&MP3=" // hasMP3 (bool)
+ + "&PR=" // hasPrinting (bool)
+ + "&SB=" // hasScreenBroadcast (bool)
+ + "&SP=" // hasScreenPlayback (bool)
+ + "&SA=" // hasStreamingAudio (bool)
+ + "&SV=" // hasStreamingVideo (bool)
+ + "&VE=" // hasVideoEncoder (bool)
+ + "&DEB=" // isDebugger (bool)
+ + "&LFD=" // localFileReadDisable (bool)
+ + "&M=" + URL::encode(manufacturer)
+ + "&AR=" // pixelAspectRatio (double)
+ + "&COL=" // screenColor (?)
+ + "&DP=" // screenDPI (int?)
+ + "&R=" // + screenResolutionX + "x" + screenResolutionY
+ ;
+
+ static boost::intrusive_ptr<as_object> proto;
+ if ( proto == NULL )
+ {
+ int flags = as_prop_flags::dontDelete;
+ flags |= as_prop_flags::dontEnum;
+ flags |= as_prop_flags::readOnly;
+
+ proto = new as_object(getObjectInterface());
+
+ proto->init_member("version", version, flags);
+ proto->init_member("playerType", playerType, flags);
+ proto->init_member("os", os, flags);
+ proto->init_member("manufacturer", manufacturer, flags);
+ proto->init_member("language", language, flags);
+ proto->init_member("hasAudio", hasAudio, flags);
+ proto->init_member("serverString", serverString, flags);
}
return proto.get();
Index: libbase/URL.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/URL.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- libbase/URL.cpp 10 Aug 2007 14:06:35 -0000 1.40
+++ libbase/URL.cpp 13 Dec 2007 01:08:06 -0000 1.41
@@ -426,6 +426,14 @@
}
}
+std::string
+URL::encode (const std::string& str)
+{
+ std::string escapestring(str);
+ encode(escapestring);
+ return escapestring;
+}
+
/* public static */
void
URL::decode(std::string& input)
Index: libbase/URL.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/URL.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- libbase/URL.h 1 Jul 2007 10:54:07 -0000 1.17
+++ libbase/URL.h 13 Dec 2007 01:08:06 -0000 1.18
@@ -128,6 +128,17 @@
static void encode(std::string& str);
/// \brief
+ /// Encode a string to URL-encoded format
+ /// converting all dodgy characters to %AB hex sequences. This
+ /// merely uses the void encode() function on a new string.
+ ///
+ /// @ param str
+ /// The input string
+ /// @ return
+ /// An encoded version of the input string
+ static std::string encode(const std::string& str);
+
+ /// \brief
/// Decode a string from URL-encoded format
/// converting all hexadecimal sequences to ASCII characters.
//
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/asobj/System.cpp libbase...,
Benjamin Wolsey <=