", face,
+ msim_point_to_purple_size(session, msim_height_to_point(session, height)));
+ } else {
+ g_string_printf(gs_begin, "");
+ }
+
+ /* No support for font-size CSS? */
+ /* g_string_printf(gs_begin, "", face,
+ msim_height_to_point(height)); */
+
+ gs_end = g_string_new("");
+
+ if (decor & MSIM_TEXT_BOLD) {
+ g_string_append(gs_begin, "");
+ g_string_prepend(gs_end, "");
+ }
+
+ if (decor & MSIM_TEXT_ITALIC) {
+ g_string_append(gs_begin, "");
+ g_string_append(gs_end, "");
+ }
+
+ if (decor & MSIM_TEXT_UNDERLINE) {
+ g_string_append(gs_begin, "");
+ g_string_append(gs_end, "");
+ }
+
+
+ *begin = gs_begin->str;
+ *end = gs_end->str;
+}
+
+/** Convert a msim markup color to a color suitable for libpurple.
+ *
+ * @param msim Either a color name, or an rgb(x,y,z) code.
+ *
+ * @return A new string, either a color name or #rrggbb code. Must g_free().
+ */
+static char *
+msim_color_to_purple(const char *msim)
+{
+ guint red, green, blue;
+
+ if (!msim) {
+ return g_strdup("black");
+ }
+
+ if (sscanf(msim, "rgb(%d,%d,%d)", &red, &green, &blue) != 3) {
+ /* Color name. */
+ return g_strdup(msim);
+ }
+ /* TODO: rgba (alpha). */
+
+ return g_strdup_printf("#%.2x%.2x%.2x", red, green, blue);
+}
+
+/** Convert the msim markup (anchor) tag into HTML. */
+static void
+msim_markup_a_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end)
+{
+ const gchar *href;
+
+ href = xmlnode_get_attrib(root, "h");
+ if (!href) {
+ href = "";
+ }
+
+ *begin = g_strdup_printf("%s", href, href);
+ *end = g_strdup("");
+}
+
+/** Convert the msim markup (paragraph) tag into HTML. */
+static void
+msim_markup_p_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end)
+{
+ /* Just pass through unchanged.
+ *
+ * Note: attributes currently aren't passed, if there are any. */
+ *begin = g_strdup("
");
+ *end = g_strdup("
");
+}
+
+/** Convert the msim markup tag (text color) into HTML. TODO: Test */
+static void
+msim_markup_c_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end)
+{
+ const gchar *color;
+ gchar *purple_color;
+
+ color = xmlnode_get_attrib(root, "v");
+ if (!color) {
+ purple_debug_info("msim", "msim_markup_c_to_html: tag w/o v attr");
+ *begin = g_strdup("");
+ *end = g_strdup("");
+ /* TODO: log as unrecognized */
+ return;
+ }
+
+ purple_color = msim_color_to_purple(color);
+
+ *begin = g_strdup_printf("", purple_color);
+
+ g_free(purple_color);
+
+ /* *begin = g_strdup_printf("", color); */
+ *end = g_strdup("");
+}
+
+/** Convert the msim markup tag (background color) into HTML. TODO: Test */
+static void
+msim_markup_b_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end)
+{
+ const gchar *color;
+ gchar *purple_color;
+
+ color = xmlnode_get_attrib(root, "v");
+ if (!color) {
+ *begin = g_strdup("");
+ *end = g_strdup("");
+ purple_debug_info("msim", "msim_markup_b_to_html: w/o v attr");
+ /* TODO: log as unrecognized. */
+ return;
+ }
+
+ purple_color = msim_color_to_purple(color);
+
+ /* TODO: find out how to set background color. */
+ *begin = g_strdup_printf("",
+ purple_color);
+ g_free(purple_color);
+
+ *end = g_strdup("