diff --git a/FLocal.Common/BBCodes/User.cs b/FLocal.Common/BBCodes/User.cs
index 0b2d914..7993deb 100644
--- a/FLocal.Common/BBCodes/User.cs
+++ b/FLocal.Common/BBCodes/User.cs
@@ -12,10 +12,7 @@ namespace FLocal.Common.BBCodes {
}
public override string Format(IPostParsingContext context, ITextFormatter formatter) {
- var user = dataobjects.User.LoadByName(this.DefaultOrValue);
- context.OnUserMention(user);
- var url = new URL.users.user.Info(user.id.ToString(), null);
- return String.Format("{2}", this.Safe(user.userGroup.name), url.canonical, this.Safe(user.name));
+ return UserMentionProcessor.ProcessUserMention(context, this.DefaultOrValue);
}
}
diff --git a/FLocal.Common/BBCodes/helpers/UserMentionProcessor.cs b/FLocal.Common/BBCodes/helpers/UserMentionProcessor.cs
new file mode 100644
index 0000000..4481653
--- /dev/null
+++ b/FLocal.Common/BBCodes/helpers/UserMentionProcessor.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace FLocal.Common.BBCodes {
+ class UserMentionProcessor {
+
+ private static string Safe(string str) {
+ return System.Web.HttpUtility.HtmlEncode(str);
+ }
+
+ public static string ProcessUserMention(IPostParsingContext context, string username) {
+ var user = dataobjects.User.LoadByName(username);
+ context.OnUserMention(user);
+ var url = new URL.users.user.Info(user.id.ToString(), null);
+ return String.Format("{2}", Safe(user.userGroup.name), url.canonical, Safe(user.name));
+ }
+
+ }
+}
diff --git a/FLocal.Common/FLocal.Common.csproj b/FLocal.Common/FLocal.Common.csproj
index add5180..bee8ce6 100644
--- a/FLocal.Common/FLocal.Common.csproj
+++ b/FLocal.Common/FLocal.Common.csproj
@@ -68,6 +68,7 @@
+