1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 21:42:55 +08:00

Rolled back the idea that there should be a separate class for formatted messages

This commit is contained in:
FreezyLemon 2017-12-01 20:25:02 +01:00
parent 01bea3bada
commit f5f287bed5
2 changed files with 10 additions and 5 deletions

View File

@ -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<MessageFormatter.Link> Links;
public Message(long? id)
{
Id = id;

View File

@ -1,4 +1,7 @@
using System;
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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;