Merge lp:~mefrio-g/cable/1201076 into lp:cable

Proposed by Mario Guerriero
Status: Merged
Merge reported by: Eduard Gotwig
Merged at revision: not available
Proposed branch: lp:~mefrio-g/cable/1201076
Merge into: lp:cable
Diff against target: 36 lines (+19/-1)
1 file modified
src/Widgets/ChatDisplay.vala (+19/-1)
To merge this branch: bzr merge lp:~mefrio-g/cable/1201076
Reviewer Review Type Date Requested Status
Eduard Gotwig (community) Needs Fixing
Review via email: mp+174603@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Eduard Gotwig (gotwig) wrote :

need to add www. to the RegEx.

review: Needs Fixing
Revision history for this message
Eduard Gotwig (gotwig) wrote :

No its not fine now.

Pinged messages to the user (which are normaly red) are not visible anymore.

They are not anymore red with this branch

review: Needs Fixing
Revision history for this message
Eduard Gotwig (gotwig) wrote :

This got fixed upstream, by julien.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Widgets/ChatDisplay.vala'
2--- src/Widgets/ChatDisplay.vala 2013-07-04 01:34:38 +0000
3+++ src/Widgets/ChatDisplay.vala 2013-07-14 09:38:27 +0000
4@@ -34,13 +34,31 @@
5 }
6
7 public void add_message (string user, string message) {
8+ StringBuilder msg = new StringBuilder ();
9+ var split = message.split (" ");
10+ for (int n = 0; n < split.length; n++) {
11+ try {
12+ var regex = new GLib.Regex ("^(?:http://)?([^/]+)(?:/?.*/?)/(.*)$");
13+ bool is_url = regex.match (split[n], 0);
14+ if (is_url)
15+ msg.append ("<a href=\"" + split[n] + "\">" + split[n] + "</a>");
16+ else
17+ msg.append (split[n]);
18+ msg.append (" ");
19+ } catch (GLib.RegexError error) {
20+ warning (error.message);
21+ }
22+ }
23+
24 var user_label = new Gtk.Label ("");
25 user_label.set_markup (user);
26 user_label.set_alignment (1, 0);
27 user_label.width_request = 80;
28 user_label.ellipsize = Pango.EllipsizeMode.END;
29 var message_label = new Granite.Widgets.WrapLabel ("");
30- message_label.set_markup (message);
31+ message_label.use_markup = true;
32+ debug (msg.str);
33+ message_label.set_markup (msg.str);
34 message_label.hexpand = true;
35 main_grid.attach (user_label, 0, line, 1, 1);
36 main_grid.attach (message_label, 1, line, 1, 1);

Subscribers

People subscribed via source and target branches

to all changes: