[smuxi] Engine: make Emojis opt-in for now (refs: #1043)
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi] Engine: make Emojis opt-in for now (refs: #1043)
- Date: Mon, 22 Jun 2015 17:49:41 +0000 (UTC)
commit 4b5dc76e3d0cbff7677b92ce955881c32f353ba4
Author: Mirco Bauer <meebey meebey net>
Date: Mon Jun 22 19:30:20 2015 +0200
Engine: make Emojis opt-in for now (refs: #1043)
src/Engine/Config/Config.cs | 4 +++-
src/Engine/Config/MessageBuilderSettings.cs | 17 ++++++++++-------
2 files changed, 13 insertions(+), 8 deletions(-)
---
diff --git a/src/Engine/Config/Config.cs b/src/Engine/Config/Config.cs
index 39cc91b..bc962a7 100644
--- a/src/Engine/Config/Config.cs
+++ b/src/Engine/Config/Config.cs
@@ -277,7 +277,8 @@ namespace Smuxi.Engine
Get(prefix+"FontStyle", String.Empty);
Get(prefix+"FontSize", 0);
Get(prefix+"WrapMode", "Word");
-
+ Get(prefix+"Emojis", false);
+
prefix = "Engine/Users/DEFAULT/Interface/Entry/";
Get(prefix+"CompletionCharacter", ":");
Get(prefix+"CommandCharacter", "/");
@@ -527,6 +528,7 @@ namespace Smuxi.Engine
LoadUserEntry(user, "Interface/Chat/FontStyle", null);
LoadUserEntry(user, "Interface/Chat/FontSize", null);
LoadUserEntry(user, "Interface/Chat/WrapMode", null);
+ LoadUserEntry(user, "Interface/Chat/Emojis", null);
LoadUserEntry(user, "Interface/Entry/CompletionCharacter", null);
LoadUserEntry(user, "Interface/Entry/CommandCharacter", null);
LoadUserEntry(user, "Interface/Entry/BashStyleCompletion", null);
diff --git a/src/Engine/Config/MessageBuilderSettings.cs b/src/Engine/Config/MessageBuilderSettings.cs
index db962a1..0dd15b4 100644
--- a/src/Engine/Config/MessageBuilderSettings.cs
+++ b/src/Engine/Config/MessageBuilderSettings.cs
@@ -34,6 +34,7 @@ namespace Smuxi.Engine
public bool StripColors { get; set; }
public TextColor HighlightColor { get; set; }
public List<string> HighlightWords { get; set; }
+ public bool Emojis { get; set; }
static MessageBuilderSettings()
{
@@ -333,13 +334,6 @@ namespace Smuxi.Engine
LinkFormat = "http://bugzilla.xamarin.com/show_bug.cgi?id={1}"
});
- // Emoji
- regex = new Regex(@":(\w+):", RegexOptions.Compiled);
- BuiltinPatterns.Add(new MessagePatternModel(regex) {
- MessagePartType = typeof(ImageMessagePartModel),
- LinkFormat = "smuxi-emoji://{1}",
- });
-
// TODO: msgid -> http://mid.gmane.org/{1}
// TODO: ISSN/ISBN
// TODO: Path: / or X:\
@@ -366,6 +360,7 @@ namespace Smuxi.Engine
HighlightWords = new List<string>(
(string[]) userConfig["Interface/Chat/HighlightWords"]
);
+ Emojis = (bool) userConfig["Interface/Chat/Emojis"];
var patternController = new MessagePatternListController(userConfig);
var userPatterns = patternController.GetList();
@@ -378,6 +373,14 @@ namespace Smuxi.Engine
// of MessageBuilderSettings is created via the static initializer.
patterns.AddRange(builtinPatterns);
patterns.AddRange(userPatterns);
+ if (Emojis) {
+ // Emoji
+ var regex = new Regex(@":(\w+):", RegexOptions.Compiled);
+ patterns.Add(new MessagePatternModel(regex) {
+ MessagePartType = typeof(ImageMessagePartModel),
+ LinkFormat = "smuxi-emoji://{1}",
+ });
+ }
Patterns = patterns;
UserPatterns = userPatterns;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]