diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2013-01-28 19:02:17 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2013-01-29 13:17:10 +0100 |
commit | e518db3700ed23d3ccc7026b922b236158e501cc (patch) | |
tree | 7ae3a7d5d0edc9db5854e41dece17a90e35641a1 /SpiceXPI | |
parent | 1f0edd021b56462d58f594f60c9031f61dc67f40 (diff) |
Set SPICE_PROXY environment variable accordingly.
Diffstat (limited to 'SpiceXPI')
-rw-r--r-- | SpiceXPI/src/plugin/nsISpicec.idl | 1 | ||||
-rw-r--r-- | SpiceXPI/src/plugin/nsScriptablePeer.cpp | 9 | ||||
-rw-r--r-- | SpiceXPI/src/plugin/nsScriptablePeer.h | 1 | ||||
-rw-r--r-- | SpiceXPI/src/plugin/plugin.cpp | 14 | ||||
-rw-r--r-- | SpiceXPI/src/plugin/plugin.h | 5 |
5 files changed, 29 insertions, 1 deletions
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); 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 6305dcc..b30d946 100644 --- a/SpiceXPI/src/plugin/plugin.h +++ b/SpiceXPI/src/plugin/plugin.h @@ -169,6 +169,10 @@ public: char *GetDisableEffects() const; void SetDisableEffects(const char *aDisableEffects); + /* attribute ing Proxy; */ + char *GetProxy() const; + void SetProxy(const char *aProxy); + NPObject *GetScriptablePeer(); private: @@ -213,6 +217,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; |