<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small;color:rgb(0,0,0)">See here: <a href="http://lists.freedesktop.org/archives/spice-devel/2014-August/017180.html">http://lists.freedesktop.org/archives/spice-devel/2014-August/017180.html</a></div>
<div><br></div><div><div class="gmail_default" style><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif;font-size:small"></span><font color="#000000" face="arial, helvetica, sans-serif">---</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> gtk/channel-main.c | 45 +++++++++++++++++++++++++++++++++++++++++++--</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> 1 file changed, 43 insertions(+), 2 deletions(-)</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">diff --git a/gtk/channel-main.c b/gtk/channel-main.c</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">index 7a299a4..26dad7f 100644</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">--- a/gtk/channel-main.c</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+++ b/gtk/channel-main.c</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">@@ -2656,6 +2656,43 @@ static void file_xfer_completed(SpiceFileXferTask *task, GError *error)</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> task->pending = TRUE;</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> }</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> </font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+/**</font></div><div class="gmail_default" style>
<font color="#000000" face="arial, helvetica, sans-serif">+ * g_string_replace:</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ * @src: original string</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ * @old_string: substring you want to replace</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ * @new_string: string you want to replace with</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ *</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ * Replace all @old_string with @new_string in @src.</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ *</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ * Returns: %NULL if any of @src/@old_string/@new_string is illegal</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ **/</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+gchar *g_string_replace(const gchar *src, const gchar *old_string, const gchar *new_string)</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+{</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ if (!src || !old_string || !new_string || !g_strcmp0(src, "") ||</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ !g_strcmp0(old_string, ""))</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ return NULL;</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ gchar *retstr = NULL;</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ gchar *srcstr = g_strdup(src);</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ gchar *ptr = g_strstr_len(srcstr, strlen(srcstr), old_string);</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ if (ptr != NULL){</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ gchar *after = g_string_replace(ptr + strlen(old_string), old_string, new_string);</font></div><div class="gmail_default" style>
<font color="#000000" face="arial, helvetica, sans-serif">+ gchar *before = g_strndup(srcstr, ptr - srcstr);</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ retstr = g_strconcat(before, new_string, after, NULL);</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ g_free(after);</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ g_free(before);</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ g_free(srcstr);</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ return retstr;</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ }</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ return g_strdup(src);</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+}</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+</font></div><div class="gmail_default" style>
<font color="#000000" face="arial, helvetica, sans-serif">+gchar *g_key_string_replace(const gchar *string, const gchar *group_name)</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+{</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ gchar *old_group_name = g_strconcat("[", group_name, "]", NULL);</font></div><div class="gmail_default" style>
<font color="#000000" face="arial, helvetica, sans-serif">+ gchar *new_group_name = g_strconcat("<", group_name, ">", NULL);</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ return g_string_replace(string, old_group_name, new_group_name);</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+}</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+</font></div><div class="gmail_default" style>
<font color="#000000" face="arial, helvetica, sans-serif"> static void file_xfer_info_async_cb(GObject *obj, GAsyncResult *res, gpointer data)</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> {</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> GFileInfo *info;</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">@@ -2665,7 +2702,7 @@ static void file_xfer_info_async_cb(GObject *obj, GAsyncResult *res, gpointer da</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> gchar *basename = NULL;</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> VDAgentFileXferStartMessage msg;</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> gsize /*msg_size*/ data_len;</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">- gchar *string;</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ gchar *string, *new_string;</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> SpiceFileXferTask *task = (SpiceFileXferTask *)data;</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> </font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> task->pending = FALSE;</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">@@ -2687,6 +2724,9 @@ static void file_xfer_info_async_cb(GObject *obj, GAsyncResult *res, gpointer da</font></div><div class="gmail_default" style>
<font color="#000000" face="arial, helvetica, sans-serif"> /* Save keyfile content to memory. TODO: more file attributions</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> need to be sent to guest */</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> string = g_key_file_to_data(keyfile, &data_len, &error);</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ /* For each group_name do this */</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ new_string = g_key_string_replace(string, "vdagent-file-xfer");</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> g_key_file_free(keyfile);</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> if (error)</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> goto failed;</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">@@ -2695,8 +2735,9 @@ static void file_xfer_info_async_cb(GObject *obj, GAsyncResult *res, gpointer da</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> <a href="http://msg.id">msg.id</a> = task->id;</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> agent_msg_queue_many(task->channel, VD_AGENT_FILE_XFER_START,</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> &msg, sizeof(msg),</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">- string, data_len + 1, NULL);</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ new_string, data_len + 1, NULL);</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> g_free(string);</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">+ g_free(new_string);</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> spice_channel_wakeup(SPICE_CHANNEL(task->channel), FALSE);</font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> return;</font></div><div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif"> </font></div>
<div class="gmail_default" style><font color="#000000" face="arial, helvetica, sans-serif">-- </font><span style="color:rgb(0,0,0);font-family:arial,helvetica,sans-serif;font-size:small"></span></div><br></div>-- <br><div dir="ltr">
<font color="#cfe2f3">Q</font><font color="#9fc5e8">S</font><font color="#6fa8dc">B</font><font color="#3d85c6">D</font><font color="#0b5394">T</font><font color="#073763">0</font><font color="#0c343d">R</font><font color="#134f5c">F</font><font color="#45818e">U</font><font color="#76a5af">i</font><font color="#a2c4c9">B</font><font color="#d0e0e3">G</font><font color="#d9ead3">U</font><font color="#b6d7a8">k</font><font color="#93c47d">9</font><font color="#6aa84f">N</font><font color="#38761d">I</font><font color="#274e13">F</font><font color="#7f6000">J</font><font color="#bf9000">J</font><font color="#f1c232">R</font><font color="#ffd966">V</font><font color="#ffe599">N</font><font color="#fff2cc">U</font><font color="#fce5cd">I</font><font color="#f9cb9c">E</font><font color="#f6b26b">9</font><font color="#e69138">G</font><font color="#b45f06">I</font><font color="#783f04">E</font><font color="#660000">N</font><font color="#990000">U</font><font color="#cc0000">U</font><font color="#e06666">0V</font><font color="#ea9999">V</font></div>
</div>