Signed-off-by: Andrea Piccinelli <fra...@gmail.com>
---
switchboard.c | 40 ++++++++++++++++++++++++++++++++--------
1 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/switchboard.c b/switchboard.c
index b05073e..dae7c05 100644
--- a/switchboard.c
+++ b/switchboard.c
@@ -1316,29 +1316,53 @@ extract_wink(struct pn_peer_call *call, const guchar *data, gsize size)
emot_name = swf_msg = NULL;
if (swf_path)
{
- if ((f = purple_mkstemp(&html_path, FALSE)))
+ if (purple_mkstemp(&html_path, FALSE))
{
- g_fprintf(f, "<script type='text/javascript'>\n" \
+ char *htmldata, *flashaction, *html_path_full;
+
+ html_path_full = g_strconcat (html_path, ".html", NULL);
+ g_free(html_path);
+ f = fopen (html_path_full, "wb");
+
+#ifndef ADIUM
+ flashaction = g_strdup("location.href = 'file://%s';\n");
+#else
+ flashaction = g_strdup("swfobject.embedSWF('file://%s', 'wink', '400', '300', '9.0.0');\n");
+#endif /* ADIUM */
+
+ htmldata = g_strdup_printf("<script type='text/javascript'>\n" \
SWFOBJECT "\n</script>\n" \
"<script type='text/javascript'>\n" \
"setTimeout('Redirect()',0);\n" \
"function Redirect() {\n" \
- "if (swfobject.hasFlashPlayerVersion('9.0.0')) location.href = 'file://%s';\n" \
+ "if (swfobject.hasFlashPlayerVersion('9.0.0'))\n" \
+ "%s" \
"else document.getElementById('wink').style.visibility = '';\n" \
"}\n" \
"</script>\n" \
+ "<center>\n" \
"<div style='visibility:hidden' id='wink'>\n" \
"<h2>Your browser does not support Shockwave Flash.</h2>\n" \
- "This software is required to play winks.<p><img src='%s'/>\n" \
+ "This software is required to play winks.<p><img src='%%s'/>\n" \
"<a href='http://www.adobe.com/go/getflashplayer'>\n" \
"<img src='http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif' " \
"alt='Get Adobe Flash player' /></a></p>\n" \
- "</div>", swf_path, img_path);
+ "</div></center>", flashaction);
+ g_free(flashaction);
+
+ g_fprintf(f, htmldata, swf_path, img_path);
fclose(f);
+ g_free(htmldata);
+#ifndef ADIUM
swf_msg = g_strdup_printf(
_("<a href=\"file://%s\">Click here to view the wink in your web browser</a>"),
- html_path);
- g_free(html_path);
+ html_path_full);
+#else
+ swf_msg = g_strdup_printf(
+ _("Copy the following link in your web browser to view it: file://%s"),
+ html_path_full);
+#endif /* ADIUM */
+ g_free(html_path_full);
}
else
{
@@ -1365,7 +1389,7 @@ extract_wink(struct pn_peer_call *call, const guchar *data, gsize size)
conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, pn_peer_link_get_passport(call->link));
imgid = purple_imgstore_add_with_id(emot, emot_len, NULL);
- emot_name = g_strdup_printf ("<IMG ID=%d/>", imgid);
+ emot_name = g_strdup_printf (_("<IMG ID=\"%d\" src=\"%s\" alt=\"Wink Preview\">"), imgid, img_path);
}
else
--
1.6.0.4