[spice-xpi/f19] Add support for setting SPICE proxy through spice-xpi

Christophe Fergeau teuf at fedoraproject.org
Fri Sep 13 14:47:31 UTC 2013


commit 3aee17b0bd2e81f9b161f39b813c4dc8403e2b9b
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Fri Sep 13 15:55:17 2013 +0200

    Add support for setting SPICE proxy through spice-xpi

 0001-xpi-add-Proxy-member.patch |  157 +++++++++++++++++++++++++++++++++++++++
 spice-xpi.spec                  |    7 ++-
 2 files changed, 163 insertions(+), 1 deletions(-)
---
diff --git a/0001-xpi-add-Proxy-member.patch b/0001-xpi-add-Proxy-member.patch
new file mode 100644
index 0000000..49b0e27
--- /dev/null
+++ b/0001-xpi-add-Proxy-member.patch
@@ -0,0 +1,157 @@
+From 382694b204c201b900899d650b44f279e26b7cf5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau at redhat.com>
+Date: Fri, 13 Sep 2013 15:58:56 +0200
+Subject: [PATCH] xpi: add Proxy member
+
+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           | 20 ++++++++++++++++++++
+ SpiceXPI/src/plugin/plugin.h             |  5 +++++
+ 5 files changed, 35 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 caab9b7..fe8e48f 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;
+ 
+@@ -310,6 +315,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 cb4bc8e..496c333 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);
+@@ -613,6 +625,14 @@ void nsPluginInstance::Connect()
+         g_critical("could not set SPICE_XPI_SOCKET env variable");
+         return;
+     }
++    if (!m_proxy.empty())
++    {
++         if (setenv("SPICE_PROXY", m_proxy.c_str(), 1))
++         {
++             g_critical("could not set SPICE_PROXY env variable");
++             return;
++         }
++    }
+ 
+     /* use a pipe for the children to wait until it gets tracked */
+     int pipe_fds[2] = { -1, -1 };
+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; */
++    char *GetProxy() const;
++    void SetProxy(const char *aProxy);
++
+     NPObject *GetScriptablePeer();
+     
+ private:
+@@ -212,6 +216,7 @@ private:
+     std::map<std::string, std::string> m_language;
+     std::string m_color_depth;
+     std::string m_disable_effects;
++    std::string m_proxy;
+     
+     NPObject *m_scriptable_peer;
+     std::string m_tmp_dir;
+-- 
+1.8.3.1
+
diff --git a/spice-xpi.spec b/spice-xpi.spec
index a7fee6a..fc6c7f5 100644
--- a/spice-xpi.spec
+++ b/spice-xpi.spec
@@ -1,11 +1,12 @@
 Name:           spice-xpi
 Version:        2.8
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        SPICE extension for Mozilla
 Group:          Applications/Internet
 License:        MPLv1.1 or GPLv2+ or LGPLv2+
 URL:            http://spice-space.org
 Source0:        http://spice-space.org/download/releases/%{name}-%{version}.tar.bz2
+Patch0:         0001-xpi-add-Proxy-member.patch
 
 BuildRequires:  xulrunner-devel >= 8.0
 
@@ -18,6 +19,7 @@ Spice extension for Mozilla allows the client to be used from a web browser.
 
 %prep
 %setup -q -n %{name}-%{version}
+%patch0 -p1
 
 %build
 
@@ -36,6 +38,9 @@ make install DESTDIR=$RPM_BUILD_ROOT
 %exclude %{_libdir}/mozilla/plugins/*.la
 
 %changelog
+* Fri Sep 13 2013 Christophe Fergeau <cfergeau at redhat.com> 2.8-4
+- Add support for setting SPICE proxy through spice-xpi
+
 * Fri Feb 15 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.8-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
 


More information about the scm-commits mailing list