[Spice-devel] [PATCH spice-xpi 2/2] xpi: add Proxy member

Christophe Fergeau cfergeau at redhat.com
Tue Jan 29 02:01:01 PST 2013


On Mon, Jan 28, 2013 at 07:03:57PM +0100, Marc-André Lureau wrote:
> Set SPICE_PROXY environment variable accordingly.
> ---
>  SpiceXPI/src/plugin/nsISpicec.idl        |  1 +
>  SpiceXPI/src/plugin/nsScriptablePeer.cpp |  9 ++++++++-
>  SpiceXPI/src/plugin/nsScriptablePeer.h   |  1 +
>  SpiceXPI/src/plugin/plugin.cpp           | 14 ++++++++++++++
>  SpiceXPI/src/plugin/plugin.h             |  5 +++++
>  5 files changed, 29 insertions(+), 1 deletion(-)
> 
> diff --git a/SpiceXPI/src/plugin/nsISpicec.idl b/SpiceXPI/src/plugin/nsISpicec.idl
> index 001b387..ce4c677 100644
> --- a/SpiceXPI/src/plugin/nsISpicec.idl
> +++ b/SpiceXPI/src/plugin/nsISpicec.idl
> @@ -65,6 +65,7 @@ interface nsISpicec : nsISupports {
>      attribute string ColorDepth;
>      attribute string DisableEffects;
>      attribute string TrustStore;
> +    attribute string Proxy;
>  
>      void connect();
>      void show();
> diff --git a/SpiceXPI/src/plugin/nsScriptablePeer.cpp b/SpiceXPI/src/plugin/nsScriptablePeer.cpp
> index 622659c..249e7a3 100644
> --- a/SpiceXPI/src/plugin/nsScriptablePeer.cpp
> +++ b/SpiceXPI/src/plugin/nsScriptablePeer.cpp
> @@ -88,6 +88,7 @@ NPIdentifier ScriptablePluginObject::m_id_set_language_strings;
>  NPIdentifier ScriptablePluginObject::m_id_set_usb_filter;
>  NPIdentifier ScriptablePluginObject::m_id_connect_status;
>  NPIdentifier ScriptablePluginObject::m_id_plugin_instance;
> +NPIdentifier ScriptablePluginObject::m_id_proxy;
>  
>  NPObject *AllocateScriptablePluginObject(NPP npp, NPClass *aClass)
>  {
> @@ -140,6 +141,7 @@ void ScriptablePluginObject::Init()
>      m_id_set_usb_filter = NPN_GetStringIdentifier("SetUsbFilter");
>      m_id_connect_status = NPN_GetStringIdentifier("ConnectedStatus");
>      m_id_plugin_instance = NPN_GetStringIdentifier("PluginInstance");
> +    m_id_proxy = NPN_GetStringIdentifier("Proxy");
>      m_id_set = true;
>  }
>  
> @@ -176,7 +178,8 @@ bool ScriptablePluginObject::HasProperty(NPIdentifier name)
>             name == m_id_usb_listen_port ||
>             name == m_id_usb_auto_share ||
>             name == m_id_color_depth ||
> -           name == m_id_disable_effects);
> +           name == m_id_disable_effects ||
> +           name == m_id_proxy);
>  }
>  
>  bool ScriptablePluginObject::GetProperty(NPIdentifier name, NPVariant *result)
> @@ -230,6 +233,8 @@ bool ScriptablePluginObject::GetProperty(NPIdentifier name, NPVariant *result)
>          STRINGZ_TO_NPVARIANT(m_plugin->GetColorDepth(), *result);
>      else if (name == m_id_disable_effects)
>          STRINGZ_TO_NPVARIANT(m_plugin->GetDisableEffects(), *result);
> +    else if (name == m_id_proxy)
> +        STRINGZ_TO_NPVARIANT(m_plugin->GetProxy(), *result);
>      else
>          return false;
>  
> @@ -316,6 +321,8 @@ bool ScriptablePluginObject::SetProperty(NPIdentifier name, const NPVariant *val
>          m_plugin->SetColorDepth(str.c_str());
>      else if (name == m_id_disable_effects)
>          m_plugin->SetDisableEffects(str.c_str());
> +    else if (name == m_id_proxy)
> +        m_plugin->SetProxy(str.c_str());
>      else
>          return false;
>  
> diff --git a/SpiceXPI/src/plugin/nsScriptablePeer.h b/SpiceXPI/src/plugin/nsScriptablePeer.h
> index 44bd53c..7488726 100644
> --- a/SpiceXPI/src/plugin/nsScriptablePeer.h
> +++ b/SpiceXPI/src/plugin/nsScriptablePeer.h
> @@ -105,6 +105,7 @@ private:
>      static NPIdentifier m_id_set_usb_filter;
>      static NPIdentifier m_id_connect_status;
>      static NPIdentifier m_id_plugin_instance;
> +    static NPIdentifier m_id_proxy;
>  };
>  
>  #define DECLARE_NPOBJECT_CLASS_WITH_BASE(_class, ctor)                        \
> diff --git a/SpiceXPI/src/plugin/plugin.cpp b/SpiceXPI/src/plugin/plugin.cpp
> index 8233885..fa04726 100644
> --- a/SpiceXPI/src/plugin/plugin.cpp
> +++ b/SpiceXPI/src/plugin/plugin.cpp
> @@ -249,6 +249,7 @@ NPBool nsPluginInstance::init(NPWindow *aWindow)
>      m_trust_store_file.clear();
>      m_color_depth.clear();
>      m_disable_effects.clear();
> +    m_proxy.clear();
>  
>      m_fullscreen = PR_FALSE;
>      m_smartcard = PR_FALSE;
> @@ -544,6 +545,17 @@ void nsPluginInstance::SetDisableEffects(const char *aDisableEffects)
>      m_disable_effects = aDisableEffects;
>  }
>  
> +/* attribute string Proxy; */
> +char *nsPluginInstance::GetProxy() const
> +{
> +    return stringCopy(m_proxy);
> +}
> +
> +void nsPluginInstance::SetProxy(const char *aProxy)
> +{
> +    m_proxy = aProxy;
> +}
> +
>  void nsPluginInstance::WriteToPipe(const void *data, uint32_t size)
>  {
>      m_external_controller.Write(data, size);
> @@ -633,6 +645,8 @@ void nsPluginInstance::Connect()
>  
>          gchar **env = g_get_environ();
>          env = g_environ_setenv(env, "SPICE_XPI_SOCKET", socket_file.c_str(), TRUE);
> +        if (!m_proxy.empty())
> +            env = g_environ_setenv(env, "SPICE_PROXY", m_proxy.c_str(), TRUE);

Same concern with g_environ_setenv as with the previous patch

>  
>          execle("/usr/libexec/spice-xpi-client",
>                 "/usr/libexec/spice-xpi-client", NULL,
> diff --git a/SpiceXPI/src/plugin/plugin.h b/SpiceXPI/src/plugin/plugin.h
> index 38a8c82..07296a8 100644
> --- a/SpiceXPI/src/plugin/plugin.h
> +++ b/SpiceXPI/src/plugin/plugin.h
> @@ -168,6 +168,10 @@ public:
>      char *GetDisableEffects() const;
>      void SetDisableEffects(const char *aDisableEffects);
>  
> +     /* attribute ing Proxy; */

Any idea what the 'ing' stands for? At first I thought this was a typo, but
this is present in all other attributes.

Patch looks good apart from these small points.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130129/03d894c1/attachment.pgp>


More information about the Spice-devel mailing list