[smuxi] Engine, Frontend-GNOME: integrated SqliteMessageBuffer into preferences
- From: Mirco M. M. Bauer <mmmbauer src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [smuxi] Engine, Frontend-GNOME: integrated SqliteMessageBuffer into preferences
- Date: Fri, 28 Feb 2014 20:26:27 +0000 (UTC)
commit fce5cc587d6298836981fde2a00dac7e7e1d5777
Author: Mirco Bauer <meebey meebey net>
Date: Thu Feb 27 00:49:42 2014 +0100
Engine, Frontend-GNOME: integrated SqliteMessageBuffer into preferences
src/Engine/Chats/ChatModel.cs | 30 +++++++++++++++++++-
.../MessageBuffers/MessageBufferPersistencyType.cs | 4 ++-
.../Preferences/PreferencesDialog.cs | 6 ++++
3 files changed, 38 insertions(+), 2 deletions(-)
---
diff --git a/src/Engine/Chats/ChatModel.cs b/src/Engine/Chats/ChatModel.cs
index 3ecbebe..962fd55 100644
--- a/src/Engine/Chats/ChatModel.cs
+++ b/src/Engine/Chats/ChatModel.cs
@@ -204,6 +204,10 @@ namespace Smuxi.Engine
var maxCapacityKey = String.Format("MessageBuffer/{0}/MaxCapacity",
persistency.ToString());
+ if (config[maxCapacityKey] == null &&
+ persistency.ToString().StartsWith("Persistent")) {
+ maxCapacityKey = "MessageBuffer/Persistent/MaxCapacity";
+ }
MessageBuffer.MaxCapacity = (int) config[maxCapacityKey];
}
@@ -268,7 +272,8 @@ namespace Smuxi.Engine
case MessageBufferPersistencyType.Volatile:
MessageBuffer = new ListMessageBuffer();
break;
- case MessageBufferPersistencyType.Persistent:
+ case Smuxi.Engine.MessageBufferPersistencyType.Persistent:
+ case Smuxi.Engine.MessageBufferPersistencyType.PersistentDb4o:
try {
var start = DateTime.UtcNow;
MessageBuffer = new Db4oMessageBuffer(
@@ -310,6 +315,29 @@ namespace Smuxi.Engine
MessageBuffer.Add(builder.ToMessage());
}
break;
+ case Smuxi.Engine.MessageBufferPersistencyType.PersistentSqlite: {
+ var start = DateTime.UtcNow;
+ MessageBuffer = new SqliteMessageBuffer(
+ ProtocolManager.Session.Username,
+ ProtocolManager.Protocol,
+ ProtocolManager.NetworkID,
+ ID
+ );
+ var stop = DateTime.UtcNow;
+#if LOG4NET
+ _Logger.DebugFormat(
+ "InitMessageBuffer(): initializing " +
+ "SqliteMessageBuffer({0}, {1}, {2}, {3}) " +
+ "took: {4:0.00} ms",
+ ProtocolManager.Session.Username,
+ ProtocolManager.Protocol,
+ ProtocolManager.NetworkID,
+ ID,
+ (stop - start).TotalMilliseconds
+ );
+#endif
+ }
+ break;
}
}
diff --git a/src/Engine/MessageBuffers/MessageBufferPersistencyType.cs
b/src/Engine/MessageBuffers/MessageBufferPersistencyType.cs
index d2aacb7..d54534a 100644
--- a/src/Engine/MessageBuffers/MessageBufferPersistencyType.cs
+++ b/src/Engine/MessageBuffers/MessageBufferPersistencyType.cs
@@ -25,6 +25,8 @@ namespace Smuxi.Engine
public enum MessageBufferPersistencyType
{
Volatile,
- Persistent
+ Persistent,
+ PersistentDb4o,
+ PersistentSqlite
}
}
diff --git a/src/Frontend-GNOME/Preferences/PreferencesDialog.cs
b/src/Frontend-GNOME/Preferences/PreferencesDialog.cs
index c59402c..f665154 100644
--- a/src/Frontend-GNOME/Preferences/PreferencesDialog.cs
+++ b/src/Frontend-GNOME/Preferences/PreferencesDialog.cs
@@ -203,6 +203,12 @@ namespace Smuxi.Frontend.Gnome
_("Volatile"));
store.AppendValues(MessageBufferPersistencyType.Persistent,
_("Persistent"));
+ if (Frontend.EngineVersion >= new Version("0.12")) {
+ store.AppendValues(MessageBufferPersistencyType.PersistentDb4o,
+ _("Persistent (Db4o)"));
+ store.AppendValues(MessageBufferPersistencyType.PersistentSqlite,
+ _("Persistent (SQLite)"));
+ }
persistencyTypeComboBox.Model = store;
persistencyTypeComboBox.Active = 0;
if (Frontend.EngineVersion < new Version("0.8.1")) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]