From f5f287bed57949df1a429e2f4889e613c27ca353 Mon Sep 17 00:00:00 2001 From: FreezyLemon Date: Fri, 1 Dec 2017 20:25:02 +0100 Subject: [PATCH] Rolled back the idea that there should be a separate class for formatted messages --- osu.Game/Online/Chat/Message.cs | 4 ++++ osu.Game/Online/Chat/MessageFormatter.cs | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game/Online/Chat/Message.cs b/osu.Game/Online/Chat/Message.cs index 79b5c4fc1a..355abfda59 100644 --- a/osu.Game/Online/Chat/Message.cs +++ b/osu.Game/Online/Chat/Message.cs @@ -2,6 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections; +using System.Collections.Generic; using System.ComponentModel; using Newtonsoft.Json; using osu.Game.Users; @@ -40,6 +42,8 @@ namespace osu.Game.Online.Chat { } + public List Links; + public Message(long? id) { Id = id; diff --git a/osu.Game/Online/Chat/MessageFormatter.cs b/osu.Game/Online/Chat/MessageFormatter.cs index df77b5d058..a712cb1f2b 100644 --- a/osu.Game/Online/Chat/MessageFormatter.cs +++ b/osu.Game/Online/Chat/MessageFormatter.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) 2007-2017 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -56,8 +59,6 @@ namespace osu.Game.Online.Chat m.Groups.Count > 1 ? m.Groups[1].Value : "", m.Groups.Count > 2 ? m.Groups[2].Value : "").Trim(); - var testText = string.Format(link, m.Groups).Trim(); - if (displayText.Length == 0 || linkText.Length == 0) continue; // Check for encapsulated links @@ -130,11 +131,11 @@ namespace osu.Game.Online.Chat return result; } - public static FormattedMessage FormatMessage(Message inputMessage) + public static Message FormatMessage(Message inputMessage) { var result = format(inputMessage.Content); + var formatted = inputMessage; - FormattedMessage formatted = inputMessage as FormattedMessage; formatted.Content = result.Text; formatted.Links = result.Links; return formatted;