Sun, 26 Aug 2007 06:51:17 +0000
In msimprpl, move formatting functions to a markup module. It only exposes
two functions to convert between MySpaceIM markup and Purple HTML markup.
|
19618
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
1 | /* MySpaceIM Protocol Plugin - markup |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
2 | * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
3 | * Copyright (C) 2007, Jeff Connelly <jeff2@soc.pidgin.im> |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
4 | * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
5 | * This program is free software; you can redistribute it and/or modify |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
7 | * the Free Software Foundation; either version 2 of the License, or |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
9 | * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
14 | * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
16 | * along with this program; if not, write to the Free Software |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
18 | */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
19 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
20 | #include "myspace.h" |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
21 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
22 | /* Internal functions */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
23 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
24 | static guint msim_point_to_purple_size(MsimSession *session, guint point); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
25 | static guint msim_purple_size_to_point(MsimSession *session, guint size); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
26 | static guint msim_height_to_point(MsimSession *session, guint height); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
27 | static guint msim_point_to_height(MsimSession *session, guint point); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
28 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
29 | static void msim_markup_tag_to_html(MsimSession *, xmlnode *root, gchar **begin, gchar **end); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
30 | static void html_tag_to_msim_markup(MsimSession *, xmlnode *root, gchar **begin, gchar **end); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
31 | static gchar *msim_convert_xml(MsimSession *, const gchar *raw, MSIM_XMLNODE_CONVERT f); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
32 | static gchar *msim_convert_smileys_to_markup(gchar *before); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
33 | static double msim_round(double round); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
34 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
35 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
36 | /* Globals */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
37 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
38 | /* The names in in emoticon_names (for <i n=whatever>) map to corresponding |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
39 | * entries in emoticon_symbols (for the ASCII representation of the emoticon). |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
40 | * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
41 | * Multiple emoticon symbols in Pidgin can map to one name. List the |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
42 | * canonical form, as inserted by the "Smile!" dialog, first. For example, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
43 | * :) comes before :-), because although both are recognized as 'happy', |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
44 | * the first is inserted by the smiley button (first symbol in theme). |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
45 | * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
46 | * Note that symbols are case-sensitive in Pidgin -- :-X is not :-x. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
47 | static struct MSIM_EMOTICON |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
48 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
49 | gchar *name; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
50 | gchar *symbol; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
51 | } msim_emoticons[] = { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
52 | /* Unfortunately, this list duplicates much of the file |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
53 | * pidgin/pidgin/pixmaps/emotes/default/22/default.theme.in, because |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
54 | * that file is part of Pidgin, but we're part of libpurple. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
55 | */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
56 | { "bigsmile", ":D" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
57 | { "bigsmile", ":-D" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
58 | { "devil", "}:)" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
59 | { "frazzled", ":Z" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
60 | { "geek", "B)" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
61 | { "googles", "%)" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
62 | { "growl", ":E" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
63 | { "laugh", ":))" }, /* Must be before ':)' */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
64 | { "happy", ":)" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
65 | { "happy", ":-)" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
66 | { "happi", ":)" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
67 | { "heart", ":X" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
68 | { "mohawk", "-:" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
69 | { "mad", "X(" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
70 | { "messed", "X)" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
71 | { "nerd", "Q)" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
72 | { "oops", ":G" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
73 | { "pirate", "P)" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
74 | { "scared", ":O" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
75 | { "sidefrown", ":{" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
76 | { "sinister", ":B" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
77 | { "smirk", ":," }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
78 | { "straight", ":|" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
79 | { "tongue", ":P" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
80 | { "tongue", ":p" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
81 | { "tongy", ":P" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
82 | { "upset", "B|" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
83 | { "wink", ";-)" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
84 | { "wink", ";)" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
85 | { "winc", ";)" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
86 | { "worried", ":[" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
87 | { "kiss", ":x" }, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
88 | { NULL, NULL } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
89 | }; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
90 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
91 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
92 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
93 | /* Indexes of this array + 1 map HTML font size to scale of normal font size. * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
94 | * Based on _point_sizes from libpurple/gtkimhtml.c |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
95 | * 1 2 3 4 5 6 7 */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
96 | static gdouble _font_scale[] = { .85, .95, 1, 1.2, 1.44, 1.728, 2.0736 }; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
97 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
98 | #define MAX_FONT_SIZE 7 /* Purple maximum font size */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
99 | #define POINTS_PER_INCH 72 /* How many pt's in an inch */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
100 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
101 | /* round is part of C99, but sometimes is unavailable before then. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
102 | * Based on http://forums.belution.com/en/cpp/000/050/13.shtml |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
103 | */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
104 | double msim_round(double value) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
105 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
106 | if (value < 0) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
107 | return -(floor(-value + 0.5)); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
108 | } else { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
109 | return floor( value + 0.5); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
110 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
111 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
112 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
113 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
114 | /** Convert typographical font point size to HTML font size. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
115 | * Based on libpurple/gtkimhtml.c */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
116 | static guint |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
117 | msim_point_to_purple_size(MsimSession *session, guint point) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
118 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
119 | guint size, this_point, base; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
120 | gdouble scale; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
121 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
122 | base = purple_account_get_int(session->account, "base_font_size", MSIM_BASE_FONT_POINT_SIZE); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
123 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
124 | for (size = 0; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
125 | size < sizeof(_font_scale) / sizeof(_font_scale[0]); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
126 | ++size) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
127 | scale = _font_scale[CLAMP(size, 1, MAX_FONT_SIZE) - 1]; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
128 | this_point = (guint)msim_round(scale * base); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
129 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
130 | if (this_point >= point) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
131 | purple_debug_info("msim", "msim_point_to_purple_size: %d pt -> size=%d\n", |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
132 | point, size); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
133 | return size; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
134 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
135 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
136 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
137 | /* No HTML font size was this big; return largest possible. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
138 | return this_point; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
139 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
140 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
141 | /** Convert HTML font size to point size. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
142 | static guint |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
143 | msim_purple_size_to_point(MsimSession *session, guint size) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
144 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
145 | gdouble scale; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
146 | guint point; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
147 | guint base; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
148 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
149 | scale = _font_scale[CLAMP(size, 1, MAX_FONT_SIZE) - 1]; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
150 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
151 | base = purple_account_get_int(session->account, "base_font_size", MSIM_BASE_FONT_POINT_SIZE); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
152 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
153 | point = (guint)msim_round(scale * base); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
154 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
155 | purple_debug_info("msim", "msim_purple_size_to_point: size=%d -> %d pt\n", |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
156 | size, point); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
157 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
158 | return point; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
159 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
160 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
161 | /** Convert a msim markup font pixel height to the more usual point size, for incoming messages. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
162 | static guint |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
163 | msim_height_to_point(MsimSession *session, guint height) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
164 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
165 | guint dpi; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
166 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
167 | dpi = purple_account_get_int(session->account, "port", MSIM_DEFAULT_DPI); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
168 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
169 | return (guint)msim_round((POINTS_PER_INCH * 1. / dpi) * height); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
170 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
171 | /* See also: libpurple/protocols/bonjour/jabber.c |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
172 | * _font_size_ichat_to_purple */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
173 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
174 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
175 | /** Convert point size to msim pixel height font size specification, for outgoing messages. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
176 | static guint |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
177 | msim_point_to_height(MsimSession *session, guint point) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
178 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
179 | guint dpi; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
180 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
181 | dpi = purple_account_get_int(session->account, "port", MSIM_DEFAULT_DPI); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
182 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
183 | return (guint)msim_round((dpi * 1. / POINTS_PER_INCH) * point); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
184 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
185 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
186 | /** Convert the msim markup <f> (font) tag into HTML. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
187 | static void |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
188 | msim_markup_f_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
189 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
190 | const gchar *face, *height_str, *decor_str; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
191 | GString *gs_end, *gs_begin; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
192 | guint decor, height; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
193 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
194 | face = xmlnode_get_attrib(root, "f"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
195 | height_str = xmlnode_get_attrib(root, "h"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
196 | decor_str = xmlnode_get_attrib(root, "s"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
197 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
198 | if (height_str) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
199 | height = atol(height_str); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
200 | } else { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
201 | height = 12; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
202 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
203 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
204 | if (decor_str) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
205 | decor = atol(decor_str); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
206 | } else { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
207 | decor = 0; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
208 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
209 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
210 | gs_begin = g_string_new(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
211 | /* TODO: get font size working */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
212 | if (height && !face) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
213 | g_string_printf(gs_begin, "<font size='%d'>", |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
214 | msim_point_to_purple_size(session, msim_height_to_point(session, height))); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
215 | } else if (height && face) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
216 | g_string_printf(gs_begin, "<font face='%s' size='%d'>", face, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
217 | msim_point_to_purple_size(session, msim_height_to_point(session, height))); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
218 | } else { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
219 | g_string_printf(gs_begin, "<font>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
220 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
221 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
222 | /* No support for font-size CSS? */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
223 | /* g_string_printf(gs_begin, "<span style='font-family: %s; font-size: %dpt'>", face, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
224 | msim_height_to_point(height)); */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
225 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
226 | gs_end = g_string_new("</font>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
227 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
228 | if (decor & MSIM_TEXT_BOLD) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
229 | g_string_append(gs_begin, "<b>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
230 | g_string_prepend(gs_end, "</b>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
231 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
232 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
233 | if (decor & MSIM_TEXT_ITALIC) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
234 | g_string_append(gs_begin, "<i>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
235 | g_string_append(gs_end, "</i>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
236 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
237 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
238 | if (decor & MSIM_TEXT_UNDERLINE) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
239 | g_string_append(gs_begin, "<u>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
240 | g_string_append(gs_end, "</u>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
241 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
242 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
243 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
244 | *begin = gs_begin->str; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
245 | *end = gs_end->str; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
246 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
247 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
248 | /** Convert a msim markup color to a color suitable for libpurple. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
249 | * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
250 | * @param msim Either a color name, or an rgb(x,y,z) code. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
251 | * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
252 | * @return A new string, either a color name or #rrggbb code. Must g_free(). |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
253 | */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
254 | static char * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
255 | msim_color_to_purple(const char *msim) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
256 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
257 | guint red, green, blue; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
258 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
259 | if (!msim) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
260 | return g_strdup("black"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
261 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
262 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
263 | if (sscanf(msim, "rgb(%d,%d,%d)", &red, &green, &blue) != 3) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
264 | /* Color name. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
265 | return g_strdup(msim); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
266 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
267 | /* TODO: rgba (alpha). */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
268 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
269 | return g_strdup_printf("#%.2x%.2x%.2x", red, green, blue); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
270 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
271 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
272 | /** Convert the msim markup <a> (anchor) tag into HTML. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
273 | static void |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
274 | msim_markup_a_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
275 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
276 | const gchar *href; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
277 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
278 | href = xmlnode_get_attrib(root, "h"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
279 | if (!href) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
280 | href = ""; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
281 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
282 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
283 | *begin = g_strdup_printf("<a href=\"%s\">%s", href, href); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
284 | *end = g_strdup("</a>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
285 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
286 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
287 | /** Convert the msim markup <p> (paragraph) tag into HTML. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
288 | static void |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
289 | msim_markup_p_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
290 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
291 | /* Just pass through unchanged. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
292 | * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
293 | * Note: attributes currently aren't passed, if there are any. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
294 | *begin = g_strdup("<p>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
295 | *end = g_strdup("</p>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
296 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
297 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
298 | /** Convert the msim markup <c> tag (text color) into HTML. TODO: Test */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
299 | static void |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
300 | msim_markup_c_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
301 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
302 | const gchar *color; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
303 | gchar *purple_color; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
304 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
305 | color = xmlnode_get_attrib(root, "v"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
306 | if (!color) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
307 | purple_debug_info("msim", "msim_markup_c_to_html: <c> tag w/o v attr"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
308 | *begin = g_strdup(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
309 | *end = g_strdup(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
310 | /* TODO: log as unrecognized */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
311 | return; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
312 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
313 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
314 | purple_color = msim_color_to_purple(color); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
315 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
316 | *begin = g_strdup_printf("<font color='%s'>", purple_color); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
317 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
318 | g_free(purple_color); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
319 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
320 | /* *begin = g_strdup_printf("<span style='color: %s'>", color); */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
321 | *end = g_strdup("</font>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
322 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
323 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
324 | /** Convert the msim markup <b> tag (background color) into HTML. TODO: Test */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
325 | static void |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
326 | msim_markup_b_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
327 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
328 | const gchar *color; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
329 | gchar *purple_color; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
330 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
331 | color = xmlnode_get_attrib(root, "v"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
332 | if (!color) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
333 | *begin = g_strdup(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
334 | *end = g_strdup(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
335 | purple_debug_info("msim", "msim_markup_b_to_html: <b> w/o v attr"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
336 | /* TODO: log as unrecognized. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
337 | return; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
338 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
339 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
340 | purple_color = msim_color_to_purple(color); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
341 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
342 | /* TODO: find out how to set background color. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
343 | *begin = g_strdup_printf("<span style='background-color: %s'>", |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
344 | purple_color); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
345 | g_free(purple_color); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
346 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
347 | *end = g_strdup("</p>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
348 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
349 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
350 | /** Convert the msim markup <i> tag (emoticon image) into HTML. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
351 | static void |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
352 | msim_markup_i_to_html(MsimSession *session, xmlnode *root, gchar **begin, gchar **end) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
353 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
354 | const gchar *name; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
355 | guint i; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
356 | struct MSIM_EMOTICON *emote; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
357 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
358 | name = xmlnode_get_attrib(root, "n"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
359 | if (!name) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
360 | purple_debug_info("msim", "msim_markup_i_to_html: <i> w/o n"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
361 | *begin = g_strdup(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
362 | *end = g_strdup(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
363 | /* TODO: log as unrecognized */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
364 | return; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
365 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
366 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
367 | /* Find and use canonical form of smiley symbol. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
368 | for (i = 0; (emote = &msim_emoticons[i]) && emote->name != NULL; ++i) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
369 | if (g_str_equal(name, emote->name)) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
370 | *begin = g_strdup(emote->symbol); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
371 | *end = g_strdup(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
372 | return; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
373 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
374 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
375 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
376 | /* Couldn't find it, sorry. Try to degrade gracefully. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
377 | *begin = g_strdup_printf("**%s**", name); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
378 | *end = g_strdup(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
379 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
380 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
381 | /** Convert an individual msim markup tag to HTML. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
382 | static void |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
383 | msim_markup_tag_to_html(MsimSession *session, xmlnode *root, gchar **begin, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
384 | gchar **end) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
385 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
386 | if (g_str_equal(root->name, "f")) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
387 | msim_markup_f_to_html(session, root, begin, end); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
388 | } else if (g_str_equal(root->name, "a")) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
389 | msim_markup_a_to_html(session, root, begin, end); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
390 | } else if (g_str_equal(root->name, "p")) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
391 | msim_markup_p_to_html(session, root, begin, end); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
392 | } else if (g_str_equal(root->name, "c")) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
393 | msim_markup_c_to_html(session, root, begin, end); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
394 | } else if (g_str_equal(root->name, "b")) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
395 | msim_markup_b_to_html(session, root, begin, end); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
396 | } else if (g_str_equal(root->name, "i")) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
397 | msim_markup_i_to_html(session, root, begin, end); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
398 | } else { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
399 | purple_debug_info("msim", "msim_markup_tag_to_html: " |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
400 | "unknown tag name=%s, ignoring", |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
401 | (root && root->name) ? root->name : "(NULL)"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
402 | *begin = g_strdup(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
403 | *end = g_strdup(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
404 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
405 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
406 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
407 | /** Convert an individual HTML tag to msim markup. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
408 | static void |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
409 | html_tag_to_msim_markup(MsimSession *session, xmlnode *root, gchar **begin, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
410 | gchar **end) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
411 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
412 | /* TODO: Coalesce nested tags into one <f> tag! |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
413 | * Currently, the 's' value will be overwritten when b/i/u is nested |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
414 | * within another one, and only the inner-most formatting will be |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
415 | * applied to the text. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
416 | if (!purple_utf8_strcasecmp(root->name, "root")) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
417 | *begin = g_strdup(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
418 | *end = g_strdup(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
419 | } else if (!purple_utf8_strcasecmp(root->name, "b")) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
420 | *begin = g_strdup_printf("<f s='%d'>", MSIM_TEXT_BOLD); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
421 | *end = g_strdup("</f>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
422 | } else if (!purple_utf8_strcasecmp(root->name, "i")) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
423 | *begin = g_strdup_printf("<f s='%d'>", MSIM_TEXT_ITALIC); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
424 | *end = g_strdup("</f>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
425 | } else if (!purple_utf8_strcasecmp(root->name, "u")) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
426 | *begin = g_strdup_printf("<f s='%d'>", MSIM_TEXT_UNDERLINE); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
427 | *end = g_strdup("</f>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
428 | } else if (!purple_utf8_strcasecmp(root->name, "a")) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
429 | const gchar *href, *link_text; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
430 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
431 | href = xmlnode_get_attrib(root, "href"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
432 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
433 | if (!href) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
434 | href = xmlnode_get_attrib(root, "HREF"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
435 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
436 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
437 | link_text = xmlnode_get_data(root); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
438 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
439 | if (href) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
440 | if (g_str_equal(link_text, href)) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
441 | /* Purple gives us: <a href="URL">URL</a> |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
442 | * Translate to <a h='URL' /> |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
443 | * Displayed as text of URL with link to URL |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
444 | */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
445 | *begin = g_strdup_printf("<a h='%s' />", href); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
446 | } else { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
447 | /* But if we get: <a href="URL">text</a> |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
448 | * Translate to: text: <a h='URL' /> |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
449 | * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
450 | * Because official client only supports self-closed <a> |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
451 | * tags; you can't change the link text. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
452 | */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
453 | *begin = g_strdup_printf("%s: <a h='%s' />", link_text, href); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
454 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
455 | } else { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
456 | *begin = g_strdup("<a />"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
457 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
458 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
459 | /* Sorry, kid. MySpace doesn't support you within <a> tags. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
460 | xmlnode_free(root->child); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
461 | root->child = NULL; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
462 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
463 | *end = g_strdup(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
464 | } else if (!purple_utf8_strcasecmp(root->name, "font")) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
465 | const gchar *size; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
466 | const gchar *face; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
467 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
468 | size = xmlnode_get_attrib(root, "size"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
469 | face = xmlnode_get_attrib(root, "face"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
470 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
471 | if (face && size) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
472 | *begin = g_strdup_printf("<f f='%s' h='%d'>", face, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
473 | msim_point_to_height(session, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
474 | msim_purple_size_to_point(session, atoi(size)))); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
475 | } else if (face) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
476 | *begin = g_strdup_printf("<f f='%s'>", face); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
477 | } else if (size) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
478 | *begin = g_strdup_printf("<f h='%d'>", |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
479 | msim_point_to_height(session, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
480 | msim_purple_size_to_point(session, atoi(size)))); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
481 | } else { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
482 | *begin = g_strdup("<f>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
483 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
484 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
485 | *end = g_strdup("</f>"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
486 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
487 | /* TODO: color (bg uses <body>), emoticons */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
488 | } else { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
489 | *begin = g_strdup_printf("[%s]", root->name); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
490 | *end = g_strdup_printf("[/%s]", root->name); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
491 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
492 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
493 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
494 | /** Convert an xmlnode of msim markup or HTML to an HTML string or msim markup. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
495 | * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
496 | * @param f Function to convert tags. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
497 | * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
498 | * @return An HTML string. Caller frees. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
499 | */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
500 | static gchar * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
501 | msim_convert_xmlnode(MsimSession *session, xmlnode *root, MSIM_XMLNODE_CONVERT f) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
502 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
503 | xmlnode *node; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
504 | gchar *begin, *inner, *end; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
505 | GString *final; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
506 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
507 | if (!root || !root->name) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
508 | return g_strdup(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
509 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
510 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
511 | purple_debug_info("msim", "msim_convert_xmlnode: got root=%s\n", |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
512 | root->name); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
513 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
514 | begin = inner = end = NULL; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
515 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
516 | final = g_string_new(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
517 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
518 | f(session, root, &begin, &end); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
519 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
520 | g_string_append(final, begin); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
521 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
522 | /* Loop over all child nodes. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
523 | for (node = root->child; node != NULL; node = node->next) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
524 | switch (node->type) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
525 | case XMLNODE_TYPE_ATTRIB: |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
526 | /* Attributes handled above. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
527 | break; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
528 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
529 | case XMLNODE_TYPE_TAG: |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
530 | /* A tag or tag with attributes. Recursively descend. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
531 | inner = msim_convert_xmlnode(session, node, f); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
532 | g_return_val_if_fail(inner != NULL, NULL); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
533 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
534 | purple_debug_info("msim", " ** node name=%s\n", |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
535 | (node && node->name) ? node->name : "(NULL)"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
536 | break; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
537 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
538 | case XMLNODE_TYPE_DATA: |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
539 | /* Literal text. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
540 | inner = g_new0(char, node->data_sz + 1); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
541 | strncpy(inner, node->data, node->data_sz); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
542 | inner[node->data_sz] = 0; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
543 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
544 | purple_debug_info("msim", " ** node data=%s\n", |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
545 | inner ? inner : "(NULL)"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
546 | break; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
547 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
548 | default: |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
549 | purple_debug_info("msim", |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
550 | "msim_convert_xmlnode: strange node\n"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
551 | inner = g_strdup(""); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
552 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
553 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
554 | if (inner) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
555 | g_string_append(final, inner); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
556 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
557 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
558 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
559 | /* TODO: Note that msim counts each piece of text enclosed by <f> as |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
560 | * a paragraph and will display each on its own line. You actually have |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
561 | * to _nest_ <f> tags to intersperse different text in one paragraph! |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
562 | * Comment out this line below to see. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
563 | g_string_append(final, end); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
564 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
565 | purple_debug_info("msim", "msim_markup_xmlnode_to_gtkhtml: RETURNING %s\n", |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
566 | (final && final->str) ? final->str : "(NULL)"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
567 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
568 | return final->str; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
569 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
570 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
571 | /** Convert XML to something based on MSIM_XMLNODE_CONVERT. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
572 | static gchar * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
573 | msim_convert_xml(MsimSession *session, const gchar *raw, MSIM_XMLNODE_CONVERT f) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
574 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
575 | xmlnode *root; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
576 | gchar *str; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
577 | gchar *enclosed_raw; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
578 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
579 | g_return_val_if_fail(raw != NULL, NULL); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
580 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
581 | /* Enclose text in one root tag, to try to make it valid XML for parsing. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
582 | enclosed_raw = g_strconcat("<root>", raw, "</root>", NULL); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
583 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
584 | root = xmlnode_from_str(enclosed_raw, -1); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
585 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
586 | if (!root) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
587 | purple_debug_info("msim", "msim_markup_to_html: couldn't parse " |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
588 | "%s as XML, returning raw: %s\n", enclosed_raw, raw); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
589 | /* TODO: msim_unrecognized */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
590 | g_free(enclosed_raw); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
591 | return g_strdup(raw); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
592 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
593 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
594 | g_free(enclosed_raw); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
595 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
596 | str = msim_convert_xmlnode(session, root, f); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
597 | g_return_val_if_fail(str != NULL, NULL); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
598 | purple_debug_info("msim", "msim_markup_to_html: returning %s\n", str); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
599 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
600 | xmlnode_free(root); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
601 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
602 | return str; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
603 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
604 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
605 | /** Convert plaintext smileys to <i> markup tags. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
606 | * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
607 | * @param before Original text with ASCII smileys. Will be freed. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
608 | * @return A new string with <i> tags, if applicable. Must be g_free()'d. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
609 | */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
610 | static gchar * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
611 | msim_convert_smileys_to_markup(gchar *before) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
612 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
613 | gchar *old, *new, *replacement; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
614 | guint i; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
615 | struct MSIM_EMOTICON *emote; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
616 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
617 | old = before; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
618 | new = NULL; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
619 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
620 | for (i = 0; (emote = &msim_emoticons[i]) && emote->name != NULL; ++i) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
621 | gchar *name, *symbol; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
622 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
623 | name = emote->name; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
624 | symbol = emote->symbol; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
625 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
626 | replacement = g_strdup_printf("<i n=\"%s\"/>", name); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
627 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
628 | purple_debug_info("msim", "msim_convert_smileys_to_markup: %s->%s\n", |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
629 | symbol ? symbol : "(NULL)", |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
630 | replacement ? replacement : "(NULL)"); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
631 | new = str_replace(old, symbol, replacement); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
632 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
633 | g_free(replacement); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
634 | g_free(old); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
635 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
636 | old = new; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
637 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
638 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
639 | return new; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
640 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
641 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
642 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
643 | /** High-level function to convert MySpaceIM markup to Purple (HTML) markup. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
644 | * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
645 | * @return Purple markup string, must be g_free()'d. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
646 | gchar * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
647 | msim_markup_to_html(MsimSession *session, const gchar *raw) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
648 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
649 | return msim_convert_xml(session, raw, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
650 | (MSIM_XMLNODE_CONVERT)(msim_markup_tag_to_html)); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
651 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
652 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
653 | /** High-level function to convert Purple (HTML) to MySpaceIM markup. |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
654 | * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
655 | * @return HTML markup string, must be g_free()'d. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
656 | gchar * |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
657 | html_to_msim_markup(MsimSession *session, const gchar *raw) |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
658 | { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
659 | gchar *markup; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
660 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
661 | markup = msim_convert_xml(session, raw, |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
662 | (MSIM_XMLNODE_CONVERT)(html_tag_to_msim_markup)); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
663 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
664 | if (purple_account_get_bool(session->account, "emoticons", TRUE)) { |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
665 | /* Frees markup and allocates a new one. */ |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
666 | markup = msim_convert_smileys_to_markup(markup); |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
667 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
668 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
669 | return markup; |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
670 | } |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
671 | |
|
6c85c0b3b101
In msimprpl, move formatting functions to a markup module. It only exposes
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
diff
changeset
|
672 |