Merge lp:~ken-vandine/gwibber/twitter-entities into lp:~markjtully/gwibber/twitter-entities

Proposed by Ken VanDine
Status: Merged
Approved by: Mark Tully
Approved revision: 1300
Merge reported by: Mark Tully
Merged at revision: not available
Proposed branch: lp:~ken-vandine/gwibber/twitter-entities
Merge into: lp:~markjtully/gwibber/twitter-entities
Diff against target: 58 lines (+22/-13)
1 file modified
libgwibber/streams.vala (+22/-13)
To merge this branch: bzr merge lp:~ken-vandine/gwibber/twitter-entities
Reviewer Review Type Date Requested Status
Mark Tully Approve
Review via email: mp+95482@code.launchpad.net

Description of the change

Better handling of link_description in the client

To post a comment you must log in.
Revision history for this message
Mark Tully (markjtully) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libgwibber/streams.vala'
2--- libgwibber/streams.vala 2012-02-23 04:46:15 +0000
3+++ libgwibber/streams.vala 2012-03-01 22:26:18 +0000
4@@ -675,25 +675,16 @@
5 /* escape markup in some strings, pango doesn't like it */
6 if (_link_name != null)
7 _link_name = GLib.Markup.escape_text (_link_name);
8- if (_link_description != null)
9- _link_description = GLib.Markup.escape_text (_link_description);
10 if (_image_name != null)
11 _image_name = GLib.Markup.escape_text (_image_name);
12 if (_video_name != null)
13 _video_name = GLib.Markup.escape_text (_video_name);
14
15- /* FIXME: hacky scrubbing of the html, we should find a
16- better way */
17 if (_html != null)
18- _html = _html.replace("&query", "&query");
19- _html = _html.replace("&name", "&name");
20- _html = _html.replace("class=\"nick\"", "");
21- _html = _html.replace("class=\"hash\"", "");
22- _html = _html.replace("<p>", "");
23- _html = _html.replace("</p>", "");
24- _html = _html.replace("<b>", "");
25- _html = _html.replace("</b>", "");
26- //debug ("_html: %s", _html);
27+ _html = scrub (_html);
28+
29+ if (_link_description != null)
30+ _link_description = scrub (_link_description);
31
32 string _t = utils.generate_time_string(_time);
33
34@@ -769,6 +760,24 @@
35 //debug ("_model has %u ROWS", _model.get_n_rows ());
36 }
37
38+ private string scrub (string content)
39+ {
40+ /* FIXME: hacky scrubbing of the html, we should find a
41+ better way */
42+ string res = content;
43+ res = res.replace("&query", "&amp;query");
44+ res = res.replace("&name", "&amp;name");
45+ res = res.replace("class=\"nick\"", "");
46+ res = res.replace("class=\"hash\"", "");
47+ res = res.replace("<p>", "");
48+ res = res.replace("</p>", "");
49+ res = res.replace("<b>", "");
50+ res = res.replace("</b>", "");
51+ //debug ("res: %s", res);
52+ return res;
53+ }
54+
55+
56
57 /**
58 * com.Gwibber.Streams

Subscribers

People subscribed via source and target branches

to all changes: