[smuxi] Engine, Frontend*: introduced engine protocol version



commit e11d17d57cced079a4d82eb794a2ecb4e83421a8
Author: Mirco Bauer <meebey meebey net>
Date:   Mon Apr 27 23:36:02 2015 +0200

    Engine, Frontend*: introduced engine protocol version
    
    Do not couple the release/assembly version with the protocol version as we can't
    bump the Smuxi version 1.0 without this. All frontends would think the protocol
    is no longer compatible because the major component of the assembly version does
    not match with the frontend assembly version (0.x). Also refactored all code
    that queried the now obsolete EngineVersion but still fallbacks to that for
    backwards compatibility in case the smuxi-server is older than protocol 0.13.

 src/Engine/Engine.cs                               |   28 +++++++++++--------
 src/Engine/SessionManager.cs                       |   23 +++++++--------
 src/Frontend-GNOME-Twitter/TwitterGroupChatView.cs |    4 +-
 src/Frontend-GNOME-XMPP/XmppGroupChatView.cs       |   12 ++++----
 src/Frontend-GNOME-XMPP/XmppPersonChatView.cs      |    8 +++---
 src/Frontend-GNOME/AboutDialog.cs                  |    2 +-
 src/Frontend-GNOME/ChatViewManager.cs              |    2 +-
 src/Frontend-GNOME/EngineManagerDialog.cs          |   27 ++++++++++--------
 src/Frontend-GNOME/Entry.cs                        |    4 +-
 src/Frontend-GNOME/FindGroupChatDialog.cs          |    2 +-
 src/Frontend-GNOME/Frontend.cs                     |   16 +++-------
 src/Frontend-GNOME/Notebook.cs                     |    4 +-
 .../Preferences/PreferencesDialog.cs               |   16 +++++-----
 src/Frontend-GNOME/Views/Chats/ChatView.cs         |    4 +-
 src/Frontend-GNOME/Views/MenuWidget.cs             |    2 +-
 src/Frontend-GNOME/Views/ServerWidget.cs           |    4 +-
 src/Frontend-STFL/Frontend.cs                      |   16 +---------
 src/Frontend/CommandManager.cs                     |    4 +-
 src/Frontend/EngineManager.cs                      |   29 +++++++++-----------
 19 files changed, 96 insertions(+), 111 deletions(-)
---
diff --git a/src/Engine/Engine.cs b/src/Engine/Engine.cs
index 5a3f4b5..5c29ef7 100644
--- a/src/Engine/Engine.cs
+++ b/src/Engine/Engine.cs
@@ -1,13 +1,7 @@
 /*
- * $Id$
- * $URL$
- * $Rev$
- * $Author$
- * $Date$
- *
  * Smuxi - Smart MUltipleXed Irc
  *
- * Copyright (c) 2005-2013 Mirco Bauer <meebey meebey net>
+ * Copyright (c) 2005-2015 Mirco Bauer <meebey meebey net>
  *
  * Full GPL License: <http://www.gnu.org/licenses/gpl.txt>
  *
@@ -43,10 +37,13 @@ namespace Smuxi.Engine
         private static Config           _Config;
         private static SessionManager   _SessionManager;
         private static ProtocolManagerFactory _ProtocolManagerFactory;
-        
+
+        public static Version AssemblyVersion { get; private set; }
+
+        [Obsolete("Use AssemblyVersion or ProtocolVersion instead.")]
         public static Version Version {
             get {
-                return _Version;
+                return AssemblyVersion;
             }
         }
     
@@ -55,7 +52,15 @@ namespace Smuxi.Engine
                 return _VersionString;
             }
         }
-        
+
+        public static Version ProtocolVersion {
+            get {
+                // major == compatibility
+                // minor == features
+                return new Version("0.13");
+            }
+        }
+
         public static Config Config {
             get {
                 return _Config;
@@ -92,8 +97,7 @@ namespace Smuxi.Engine
                 asm = Assembly.GetAssembly(typeof(Engine));
             }
             var asm_name = asm.GetName(false);
-            _Version = asm_name.Version;
-            _VersionNumber = asm_name.Version.ToString();
+            AssemblyVersion = asm_name.Version;
 
             var distVersion = Defines.DistVersion;
             if (!String.IsNullOrEmpty(distVersion)) {
diff --git a/src/Engine/SessionManager.cs b/src/Engine/SessionManager.cs
index a6c38f1..d281036 100644
--- a/src/Engine/SessionManager.cs
+++ b/src/Engine/SessionManager.cs
@@ -1,13 +1,7 @@
 /*
- * $Id$
- * $URL$
- * $Rev$
- * $Author$
- * $Date$
- *
  * Smuxi - Smart MUltipleXed Irc
  *
- * Copyright (c) 2005-2006 Mirco Bauer <meebey meebey net>
+ * Copyright (c) 2005-2007, 2014-2015 Mirco Bauer <meebey meebey net>
  *
  * Full GPL License: <http://www.gnu.org/licenses/gpl.txt>
  *
@@ -38,13 +32,18 @@ namespace Smuxi.Engine
         private static readonly log4net.ILog _Logger = 
log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
 #endif
         private Hashtable _Sessions = Hashtable.Synchronized(new Hashtable());
-        private Version   _EngineVersion;
         private Config    _Config;
         private ProtocolManagerFactory _ProtocolManagerFactory;
-        
+
+        public Version EngineAssemblyVersion { get; private set; }
+        public Version EngineProtocolVersion { get; private set; }
+
         public Version EngineVersion {
             get {
-                return _EngineVersion;
+                // HACK: since older frontend compare/check the engine version
+                // for protocol compatibility we expose the protocol version
+                // here instead for backwards compatibility
+                return EngineProtocolVersion;
             }
         }
         
@@ -62,8 +61,8 @@ namespace Smuxi.Engine
             _Config = config;
             _ProtocolManagerFactory = protocolManagerFactory;
 
-            // BUG: out of scope?
-            _EngineVersion = Engine.Version;
+            EngineAssemblyVersion = Engine.AssemblyVersion;
+            EngineProtocolVersion = Engine.ProtocolVersion;
 
             string[] users = (string[])Engine.Config["Engine/Users/Users"];
             if (users == null) {
diff --git a/src/Frontend-GNOME-Twitter/TwitterGroupChatView.cs 
b/src/Frontend-GNOME-Twitter/TwitterGroupChatView.cs
index 67e81d8..bd0f640 100644
--- a/src/Frontend-GNOME-Twitter/TwitterGroupChatView.cs
+++ b/src/Frontend-GNOME-Twitter/TwitterGroupChatView.cs
@@ -48,7 +48,7 @@ namespace Smuxi.Frontend.Gnome
             base.OnPersonMenuShown(sender, e);
 
             Gtk.MenuItem item;
-            if (Frontend.EngineVersion >= new Version(0, 7)) {
+            if (Frontend.EngineProtocolVersion >= new Version(0, 7)) {
                 item = new Gtk.ImageMenuItem(_("Direct Message"));
                 item.Activated += OnUserListMenuDirectMessageActivated;
                 PersonMenu.Append(item);
@@ -56,7 +56,7 @@ namespace Smuxi.Frontend.Gnome
                 PersonMenu.Append(new Gtk.SeparatorMenuItem());
             }
 
-            if (Frontend.EngineVersion >= new Version(0, 10)) {
+            if (Frontend.EngineProtocolVersion >= new Version(0, 10)) {
                 item = new Gtk.ImageMenuItem(_("Timeline"));
                 item.Activated += OnUserListMenuTimelineActivated;
                 PersonMenu.Append(item);
diff --git a/src/Frontend-GNOME-XMPP/XmppGroupChatView.cs b/src/Frontend-GNOME-XMPP/XmppGroupChatView.cs
index 0c51e0a..4f53cea 100644
--- a/src/Frontend-GNOME-XMPP/XmppGroupChatView.cs
+++ b/src/Frontend-GNOME-XMPP/XmppGroupChatView.cs
@@ -239,11 +239,11 @@ namespace Smuxi.Frontend.Gnome
             base.OnPersonMenuShown(sender, e);
 
             // minimum version of any command below
-            if (Frontend.EngineVersion < new Version(0, 8, 9)) {
+            if (Frontend.EngineProtocolVersion < new Version(0, 8, 9)) {
                 return;
             }
 
-            if (Frontend.EngineVersion >= new Version(0, 8, 9)) {
+            if (Frontend.EngineProtocolVersion >= new Version(0, 8, 9)) {
                 Gtk.ImageMenuItem query_item = new Gtk.ImageMenuItem(_("Query"));
                 query_item.Activated += _OnUserListMenuQueryActivated;
                 PersonMenu.Append(query_item);
@@ -251,19 +251,19 @@ namespace Smuxi.Frontend.Gnome
 
             PersonMenu.Append(new Gtk.SeparatorMenuItem());
 
-            if (Frontend.EngineVersion >= new Version(0, 8, 12)) {
+            if (Frontend.EngineProtocolVersion >= new Version(0, 8, 12)) {
                 Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois"));
                 whois_item.Activated += _OnUserListMenuWhoisActivated;
                 PersonMenu.Append(whois_item);
             }
 
-            if (!IsContactList && Frontend.EngineVersion >= new Version(0, 8, 11)) {
+            if (!IsContactList && Frontend.EngineProtocolVersion >= new Version(0, 8, 11)) {
                 var add_to_contacts_item = new Gtk.ImageMenuItem(_("Add To Contacts"));
                 add_to_contacts_item.Activated += _OnMenuAddToContactsItemActivated;
                 PersonMenu.Append(add_to_contacts_item);
             }
 
-            if (Frontend.EngineVersion >= new Version(0, 8, 12)) {
+            if (Frontend.EngineProtocolVersion >= new Version(0, 8, 12)) {
                 Gtk.MenuItem invite_to_item = new Gtk.MenuItem(_("Invite to"));
                 Gtk.Menu invite_to_menu_item = new InviteToMenu(
                     XmppProtocolManager,
@@ -274,7 +274,7 @@ namespace Smuxi.Frontend.Gnome
                 PersonMenu.Append(invite_to_item);
             }
 
-            if (IsContactList && Frontend.EngineVersion >= new Version(0, 8, 11)) {
+            if (IsContactList && Frontend.EngineProtocolVersion >= new Version(0, 8, 11)) {
                 // cleanup old handlers
                 IdentityNameCellRenderer.EditingStarted -= OnPersonRenameEditingStarted;
                 IdentityNameCellRenderer.Edited -= OnPersonRenameEdited;
diff --git a/src/Frontend-GNOME-XMPP/XmppPersonChatView.cs b/src/Frontend-GNOME-XMPP/XmppPersonChatView.cs
index e03e8c5..6fba387 100644
--- a/src/Frontend-GNOME-XMPP/XmppPersonChatView.cs
+++ b/src/Frontend-GNOME-XMPP/XmppPersonChatView.cs
@@ -205,25 +205,25 @@ namespace Smuxi.Frontend.Gnome
             Gtk.Menu popup = args.Menu;
 
             // minimum version of any command below
-            if (Frontend.EngineVersion < new Version(0, 8, 11)) {
+            if (Frontend.EngineProtocolVersion < new Version(0, 8, 11)) {
                 return;
             }
 
             popup.Append(new Gtk.SeparatorMenuItem());
 
-            if (Frontend.EngineVersion >= new Version(0, 8, 12)) {
+            if (Frontend.EngineProtocolVersion >= new Version(0, 8, 12)) {
                 Gtk.ImageMenuItem whois_item = new Gtk.ImageMenuItem(_("Whois"));
                 whois_item.Activated += _OnMenuWhoisItemActivated;
                 popup.Append(whois_item);
             }
 
-            if (Frontend.EngineVersion >= new Version(0, 8, 11)) {
+            if (Frontend.EngineProtocolVersion >= new Version(0, 8, 11)) {
                 Gtk.ImageMenuItem AddToContacts_item = new Gtk.ImageMenuItem(_("Add To Contacts"));
                 AddToContacts_item.Activated += _OnMenuAddToContactsItemActivated;
                 popup.Append(AddToContacts_item);
             }
 
-            if (Frontend.EngineVersion >= new Version(0, 8, 12)) {
+            if (Frontend.EngineProtocolVersion >= new Version(0, 8, 12)) {
                 Gtk.ImageMenuItem invite_to_item = new Gtk.ImageMenuItem(_("Invite to"));
                 Gtk.Menu invite_to_menu_item = new InviteToMenu(XmppProtocolManager,
                                                                 Frontend.MainWindow.ChatViewManager,
diff --git a/src/Frontend-GNOME/AboutDialog.cs b/src/Frontend-GNOME/AboutDialog.cs
index b7a5bab..d65f9c7 100644
--- a/src/Frontend-GNOME/AboutDialog.cs
+++ b/src/Frontend-GNOME/AboutDialog.cs
@@ -42,7 +42,7 @@ namespace Smuxi.Frontend.Gnome
                 Version = String.Format("\n Vendor: {0}", distVersion);
             }
             Version += "\n Frontend: " + Frontend.UIName + " " + version  +
-                       "\n Engine: " + Frontend.EngineVersion;
+                       "\n Engine: " + Frontend.EngineAssemblyVersion;
             Copyright = "Copyright © 2005-2015 Mirco Bauer <meebey meebey net> and other contributors";
             Authors = new string[] {
                 "Mirco Bauer <meebey meebey net>",
diff --git a/src/Frontend-GNOME/ChatViewManager.cs b/src/Frontend-GNOME/ChatViewManager.cs
index afae62a..9ea4f65 100644
--- a/src/Frontend-GNOME/ChatViewManager.cs
+++ b/src/Frontend-GNOME/ChatViewManager.cs
@@ -385,7 +385,7 @@ namespace Smuxi.Frontend.Gnome
         int GetSortedChatPosition(ChatView chatView)
         {
             // starting with > 0.8 the Engine supplies ChatModel.Position for us
-            if (Frontend.EngineVersion > new Version("0.8")) {
+            if (Frontend.EngineProtocolVersion > new Version("0.8")) {
                 return chatView.Position;
             }
 
diff --git a/src/Frontend-GNOME/EngineManagerDialog.cs b/src/Frontend-GNOME/EngineManagerDialog.cs
index cda0be0..a86cf53 100644
--- a/src/Frontend-GNOME/EngineManagerDialog.cs
+++ b/src/Frontend-GNOME/EngineManagerDialog.cs
@@ -1,7 +1,7 @@
 /*
  * Smuxi - Smart MUltipleXed Irc
  *
- * Copyright (c) 2005-2013 Mirco Bauer <meebey meebey net>
+ * Copyright (c) 2005-2013, 2015 Mirco Bauer <meebey meebey net>
  *
  * Full GPL License: <http://www.gnu.org/licenses/gpl.txt>
  *
@@ -204,21 +204,24 @@ namespace Smuxi.Frontend.Gnome
             string engine = _SelectedEngine;
             try {
                 _EngineManager.Connect(engine);
-                var engineVersion = _EngineManager.EngineVersion;
-                var frontendVersion = Frontend.Version;
-                if ((engineVersion >= new Version("0.8") &&
-                     engineVersion.Major != frontendVersion.Major) ||
-                    (engineVersion < new Version("0.8") &&
-                     (engineVersion.Major != frontendVersion.Major ||
-                      engineVersion.Minor != frontendVersion.Minor))) {
-                    throw new ApplicationException(String.Format(
-                                _("Your frontend version ({0}) does not match the engine version ({1})!"),
-                                Frontend.Version, _EngineManager.EngineVersion));
+                var engineProtocolVersion = _EngineManager.EngineProtocolVersion;
+                var frontendProtocolVersion = new Version(0, 0);
+                if (engineProtocolVersion.Major != frontendProtocolVersion.Major) {
+                    throw new ApplicationException(
+                        String.Format(
+                            _("Your frontend is not compatible with the engine!\n" +
+                              "Engine Version: {0} Frontend Version: {1}\n" +
+                              "Engine Protocol: {2} Frontend Protocol: {3}"),
+                            _EngineManager.EngineAssemblyVersion, Frontend.Version,
+                            engineProtocolVersion, frontendProtocolVersion
+                        )
+                    );
                 }
                 
                 Frontend.Session = _EngineManager.Session;
                 Frontend.UserConfig = _EngineManager.UserConfig;
-                Frontend.EngineVersion = _EngineManager.EngineVersion;
+                Frontend.EngineAssemblyVersion = _EngineManager.EngineAssemblyVersion;
+                Frontend.EngineProtocolVersion = _EngineManager.EngineProtocolVersion;
                 Frontend.ConnectEngineToGUI();
             } catch (Exception ex) {
 #if LOG4NET
diff --git a/src/Frontend-GNOME/Entry.cs b/src/Frontend-GNOME/Entry.cs
index 1fdc580..571fc31 100644
--- a/src/Frontend-GNOME/Entry.cs
+++ b/src/Frontend-GNOME/Entry.cs
@@ -496,7 +496,7 @@ namespace Smuxi.Frontend.Gnome
                             return;
                         }
                     }
-                    if (Frontend.EngineVersion < new Version(0,8,11)) {
+                    if (Frontend.EngineProtocolVersion < new Version(0,8,11)) {
                         foreach (string msg in msgParts) {
                             ExecuteCommand(msg);
                         }
@@ -849,7 +849,7 @@ namespace Smuxi.Frontend.Gnome
                 _CommandManager = null;
             } else {
                 _CommandManager = new CommandManager(Frontend.Session);
-                _CommandManager.EngineVersion = Frontend.EngineVersion;
+                _CommandManager.EngineProtocolVersion = Frontend.EngineProtocolVersion;
                 _CommandManager.ExceptionEvent +=
                 delegate(object sender, CommandExceptionEventArgs e) {
                     Gtk.Application.Invoke(delegate {
diff --git a/src/Frontend-GNOME/FindGroupChatDialog.cs b/src/Frontend-GNOME/FindGroupChatDialog.cs
index 49a754f..36ef935 100644
--- a/src/Frontend-GNOME/FindGroupChatDialog.cs
+++ b/src/Frontend-GNOME/FindGroupChatDialog.cs
@@ -105,7 +105,7 @@ namespace Smuxi.Frontend.Gnome
             
             try {
                 string nameFilter = f_NameEntry.Text.Trim();
-                if (!(Frontend.EngineVersion >= new Version("0.8.1")) &&
+                if (!(Frontend.EngineProtocolVersion >= new Version("0.8.1")) &&
                     String.IsNullOrEmpty(nameFilter)) {
                     Gtk.MessageDialog md = new Gtk.MessageDialog(
                         this,
diff --git a/src/Frontend-GNOME/Frontend.cs b/src/Frontend-GNOME/Frontend.cs
index 14ba9bb..f9f3ce8 100644
--- a/src/Frontend-GNOME/Frontend.cs
+++ b/src/Frontend-GNOME/Frontend.cs
@@ -67,6 +67,8 @@ namespace Smuxi.Frontend.Gnome
         public static bool IsWindows { get; private set; }
         public static bool IsUnity { get; private set; }
         public static bool IsMacOSX { get; private set; }
+        public static Version EngineAssemblyVersion { get; set; }
+        public static Version EngineProtocolVersion { get; set; }
 
         public static event EventHandler  SessionPropertyChanged;
 
@@ -94,15 +96,6 @@ namespace Smuxi.Frontend.Gnome
             }
         }
         
-        public static Version EngineVersion {
-            get {
-                return _EngineVersion;
-            }
-            set {
-                _EngineVersion = value;
-            }
-        }
-        
         public static string VersionString {
             get {
                 return _VersionString;
@@ -461,7 +454,8 @@ namespace Smuxi.Frontend.Gnome
                         }
                     }
                     _UserConfig = _MainWindow.EngineManager.UserConfig;
-                    EngineVersion = _MainWindow.EngineManager.EngineVersion;
+                    EngineAssemblyVersion = _MainWindow.EngineManager.EngineProtocolVersion;
+                    EngineProtocolVersion = _MainWindow.EngineManager.EngineAssemblyVersion;
                     Session = _MainWindow.EngineManager.Session;
 
                     Gtk.Application.Invoke(delegate {
@@ -1191,7 +1185,7 @@ namespace Smuxi.Frontend.Gnome
         {
             Trace.Call();
 
-            if (EngineVersion >= new Version("0.8.1.1")) {
+            if (EngineProtocolVersion >= new Version("0.8.1.1")) {
                 var config = UserConfig;
                 ThreadPool.QueueUserWorkItem(delegate {
                     try {
diff --git a/src/Frontend-GNOME/Notebook.cs b/src/Frontend-GNOME/Notebook.cs
index 1df0e48..36faea4 100644
--- a/src/Frontend-GNOME/Notebook.cs
+++ b/src/Frontend-GNOME/Notebook.cs
@@ -147,7 +147,7 @@ namespace Smuxi.Frontend.Gnome
         {
             Trace.Call();
 
-            if (Frontend.EngineVersion >= new Version("0.8.1.2")) {
+            if (Frontend.EngineProtocolVersion >= new Version("0.8.1.2")) {
                 // no need to sync chat positions with 0.8.1.2 as they get
                 // updated via Session.MoveChat()
                 return;
@@ -281,7 +281,7 @@ namespace Smuxi.Frontend.Gnome
         {
             Trace.Call(sender, e);
 
-            if (Frontend.EngineVersion < new Version("0.8.1.2")) {
+            if (Frontend.EngineProtocolVersion < new Version("0.8.1.2")) {
                 // Session.MoveChat() was added in >= 0.8.1.2
                 return;
             }
diff --git a/src/Frontend-GNOME/Preferences/PreferencesDialog.cs 
b/src/Frontend-GNOME/Preferences/PreferencesDialog.cs
index 9f9a748..52c76ed 100644
--- a/src/Frontend-GNOME/Preferences/PreferencesDialog.cs
+++ b/src/Frontend-GNOME/Preferences/PreferencesDialog.cs
@@ -147,7 +147,7 @@ namespace Smuxi.Frontend.Gnome
             };
 
             ((Gtk.TextView)_Glade["HighlightWordsTextView"]).Buffer.Changed += _OnChanged;
-            if (Frontend.EngineVersion < new Version("0.7.2")) {
+            if (Frontend.EngineProtocolVersion < new Version("0.7.2")) {
                 // feature introduced in >= 0.7.2
                 ((Gtk.TextView)_Glade["HighlightWordsTextView"]).Sensitive = false;
             }
@@ -207,7 +207,7 @@ namespace Smuxi.Frontend.Gnome
                                _("Volatile"));
             store.AppendValues(MessageBufferPersistencyType.Persistent,
                                _("Persistent (Preview)"));
-            if (Frontend.EngineVersion >= new Version("0.12")) {
+            if (Frontend.EngineProtocolVersion >= new Version("0.12")) {
                 store.AppendValues(MessageBufferPersistencyType.PersistentDb4o,
                                    _("Persistent: Db4o (Deprecated)"));
                 store.AppendValues(MessageBufferPersistencyType.PersistentSqlite,
@@ -215,7 +215,7 @@ namespace Smuxi.Frontend.Gnome
             }
             persistencyTypeComboBox.Model = store;
             persistencyTypeComboBox.Active = 0;
-            if (Frontend.EngineVersion < new Version("0.8.1")) {
+            if (Frontend.EngineProtocolVersion < new Version("0.8.1")) {
                 persistencyTypeComboBox.Sensitive = false;
                 ((Gtk.SpinButton) _Glade["VolatileMaxCapacitySpinButton"]).Sensitive = false;
                 ((Gtk.SpinButton) _Glade["PersistentMaxCapacitySpinButton"]).Sensitive = false;
@@ -261,7 +261,7 @@ namespace Smuxi.Frontend.Gnome
                                                 Gtk.IconSize.SmallToolbar, null),
                             _("Servers"));
 
-            if (Frontend.EngineVersion >= new Version("0.7.2")) {
+            if (Frontend.EngineProtocolVersion >= new Version("0.7.2")) {
                 // features introduced in >= 0.7.2
                 ls.AppendValues(Page.Filters, _Dialog.RenderIcon(
                                                     Gtk.Stock.Delete,
@@ -316,7 +316,7 @@ namespace Smuxi.Frontend.Gnome
             ((Gtk.TextView)_Glade["OnConnectCommandsTextView"]).Buffer.Text = connect_commands;
 
             var autoConvertUTF8CheckButton = (Gtk.CheckButton) _Glade["AutoConvertUTF8CheckButton"];
-            if (Frontend.EngineVersion >= new Version("0.8.12")) {
+            if (Frontend.EngineProtocolVersion >= new Version("0.8.12")) {
                 autoConvertUTF8CheckButton.Active =
                     (bool) Frontend.UserConfig["Connection/AutoConvertUTF8"];
             } else {
@@ -419,7 +419,7 @@ namespace Smuxi.Frontend.Gnome
             CheckProxyShowPasswordCheckButton();
 
             // MessageBuffer
-            if (Frontend.EngineVersion >= new Version("0.8.1")) {
+            if (Frontend.EngineProtocolVersion >= new Version("0.8.1")) {
                 // feature introduced in >= 0.8.1
                 Gtk.ComboBox persistencyTypeComboBox =
                     ((Gtk.ComboBox)_Glade["PersistencyTypeComboBox"]);
@@ -708,7 +708,7 @@ namespace Smuxi.Frontend.Gnome
             Frontend.UserConfig["Connection/OnConnectCommands"] = 
                 ((Gtk.TextView)_Glade["OnConnectCommandsTextView"]).Buffer.Text.Split(new char[] {'\n'});
 
-            if (Frontend.EngineVersion >= new Version("0.8.12")) {
+            if (Frontend.EngineProtocolVersion >= new Version("0.8.12")) {
                 Frontend.UserConfig["Connection/AutoConvertUTF8"] =
                     ((Gtk.CheckButton)_Glade["AutoConvertUTF8CheckButton"]).Active;
             }
@@ -735,7 +735,7 @@ namespace Smuxi.Frontend.Gnome
 
             int i;
             // MessageBuffer
-            if (Frontend.EngineVersion >= new Version("0.8.1")) {
+            if (Frontend.EngineProtocolVersion >= new Version("0.8.1")) {
                 var persistencyTypeComboBox = (Gtk.ComboBox) _Glade["PersistencyTypeComboBox"];
                 // for forward compatibility with newer engines
                 if (persistencyTypeComboBox.Active != -1) {
diff --git a/src/Frontend-GNOME/Views/Chats/ChatView.cs b/src/Frontend-GNOME/Views/Chats/ChatView.cs
index 6f7104b..5804307 100644
--- a/src/Frontend-GNOME/Views/Chats/ChatView.cs
+++ b/src/Frontend-GNOME/Views/Chats/ChatView.cs
@@ -521,7 +521,7 @@ namespace Smuxi.Frontend.Gnome
             // REMOTING CALL
             SyncedLastSeenHighlight = _ChatModel.LastSeenHighlight;
             
-            if (Frontend.EngineVersion >= new Version(0, 12)) {
+            if (Frontend.EngineProtocolVersion >= new Version(0, 12)) {
                 // REMOTING CALL
                 SyncedLastSeenMessage = _ChatModel.LastSeenMessage;
             }
@@ -589,7 +589,7 @@ namespace Smuxi.Frontend.Gnome
         {
             _OutputMessageTextView.UpdateMarkerline();
             
-            if (Frontend.EngineVersion < new Version(0, 12)) {
+            if (Frontend.EngineProtocolVersion < new Version(0, 12)) {
                 return;
             }
             
diff --git a/src/Frontend-GNOME/Views/MenuWidget.cs b/src/Frontend-GNOME/Views/MenuWidget.cs
index 06efdee..c81662d 100644
--- a/src/Frontend-GNOME/Views/MenuWidget.cs
+++ b/src/Frontend-GNOME/Views/MenuWidget.cs
@@ -219,7 +219,7 @@ namespace Smuxi.Frontend.Gnome
                 // do connect as background task as it might take a while
                 ThreadPool.QueueUserWorkItem(delegate {
                     try {
-                        if (Frontend.EngineVersion < new Version(0, 8, 11)) {
+                        if (Frontend.EngineProtocolVersion < new Version(0, 8, 11)) {
                             // HACK: Smuxi < 0.8.11 used auto serialization for
                             // ServerModel and thus breaks on unknown fields,
                             // which we skip by setting this to null, see:
diff --git a/src/Frontend-GNOME/Views/ServerWidget.cs b/src/Frontend-GNOME/Views/ServerWidget.cs
index 4fa4a5a..dc30d01 100644
--- a/src/Frontend-GNOME/Views/ServerWidget.cs
+++ b/src/Frontend-GNOME/Views/ServerWidget.cs
@@ -110,7 +110,7 @@ namespace Smuxi.Frontend.Gnome
         public bool ShowNickname {
             set {
                 // Smuxi < 0.11 does not support server specific nickname
-                if (Frontend.EngineVersion < new Version(0, 11)) {
+                if (Frontend.EngineProtocolVersion < new Version(0, 11)) {
                     value = false;
                 }
                 f_NicknameLabel.Visible = value;
@@ -121,7 +121,7 @@ namespace Smuxi.Frontend.Gnome
         public bool ShowRealname {
             set {
                 // Smuxi < 0.11 does not support server specific realname
-                if (Frontend.EngineVersion < new Version(0, 11)) {
+                if (Frontend.EngineProtocolVersion < new Version(0, 11)) {
                     value = false;
                 }
                 f_RealnameLabel.Visible = value;
diff --git a/src/Frontend-STFL/Frontend.cs b/src/Frontend-STFL/Frontend.cs
index 327b68f..507a14c 100644
--- a/src/Frontend-STFL/Frontend.cs
+++ b/src/Frontend-STFL/Frontend.cs
@@ -39,7 +39,6 @@ namespace Smuxi.Frontend.Stfl
         private static readonly string    _UIName = "STFL";
         private static Version            _Version;
         private static string             _VersionString;
-        private static Version            _EngineVersion;
         private static MainWindow         _MainWindow;
         private static FrontendConfig     _FrontendConfig;
         private static Session            _LocalSession;
@@ -47,7 +46,7 @@ namespace Smuxi.Frontend.Stfl
         private static UserConfig         _UserConfig;
         private static FrontendManager    _FrontendManager;
         public static EngineManager EngineManager { get; private set; }
-        
+
         public static event EventHandler SessionPropertyChanged;
 
         public static string Name {
@@ -67,16 +66,7 @@ namespace Smuxi.Frontend.Stfl
                 return _Version;
             }
         }
-        
-        public static Version EngineVersion {
-            get {
-                return _EngineVersion;
-            }
-            set {
-                _EngineVersion = value;
-            }
-        }
-        
+
         public static string VersionString {
             get {
                 return _VersionString;
@@ -183,7 +173,6 @@ namespace Smuxi.Frontend.Stfl
         public static void InitLocalEngine()
         {
             Engine.Engine.Init();
-            _EngineVersion = Engine.Engine.Version;
             _LocalSession = new Engine.Session(Engine.Engine.Config,
                                          Engine.Engine.ProtocolManagerFactory,
                                          "local");
@@ -218,7 +207,6 @@ namespace Smuxi.Frontend.Stfl
 
                 Session = EngineManager.Session;
                 _UserConfig = EngineManager.UserConfig;
-                _EngineVersion = EngineManager.EngineVersion;
                 ConnectEngineToGUI();
             } catch (Exception ex) {
 #if LOG4NET
diff --git a/src/Frontend/CommandManager.cs b/src/Frontend/CommandManager.cs
index b21ea0d..baf66de 100644
--- a/src/Frontend/CommandManager.cs
+++ b/src/Frontend/CommandManager.cs
@@ -53,7 +53,7 @@ namespace Smuxi.Frontend
         TaskQueue       f_TaskQueue;
         TimeSpan        f_LastCommandTimeSpan;
 
-        public Version EngineVersion { get; set; }
+        public Version EngineProtocolVersion { get; set; }
 
         public TimeSpan LastCommandTimeSpan {
             get {
@@ -491,7 +491,7 @@ namespace Smuxi.Frontend
                 throw new ArgumentNullException("msg");
             }
 
-            if (EngineVersion != null && EngineVersion >= new Version(0, 10)) {
+            if (EngineProtocolVersion != null && EngineProtocolVersion >= new Version(0, 10)) {
                 f_Session.AddMessageToFrontend(cmd, msg);
             } else {
                 f_Session.AddMessageToChat(cmd.Chat, msg);
diff --git a/src/Frontend/EngineManager.cs b/src/Frontend/EngineManager.cs
index d280429..7a22fe0 100644
--- a/src/Frontend/EngineManager.cs
+++ b/src/Frontend/EngineManager.cs
@@ -1,13 +1,7 @@
 /*
- * $Id: Frontend.cs 73 2005-06-27 12:42:06Z meebey $
- * $URL: svn+ssh://svn.qnetp.net/svn/smuxi/smuxi/trunk/src/Frontend-GtkGnome/Frontend.cs $
- * $Rev: 73 $
- * $Author: meebey $
- * $Date: 2005-06-27 14:42:06 +0200 (Mon, 27 Jun 2005) $
- *
  * Smuxi - Smart MUltipleXed Irc
  *
- * Copyright (c) 2008 Mirco Bauer <meebey meebey net>
+ * Copyright (c) 2008-2013, 2015 Mirco Bauer <meebey meebey net>
  *
  * Full GPL License: <http://www.gnu.org/licenses/gpl.txt>
  *
@@ -60,12 +54,14 @@ namespace Smuxi.Frontend
         private IFrontendUI     f_FrontendUI;
         private string          f_Engine;
         private string          f_EngineUrl;
-        private Version         f_EngineVersion;
         private UserConfig      f_UserConfig;
         private Session         f_Session;
         private SshTunnelManager f_SshTunnelManager;
         private string          f_ChannelName;
 
+        public Version EngineAssemblyVersion { get; private set; }
+        public Version EngineProtocolVersion { get; private set; }
+
         public SessionManager SessionManager {
             get {
                 return f_SessionManager;
@@ -77,13 +73,7 @@ namespace Smuxi.Frontend
                 return f_EngineUrl;
             }
         }
-        
-        public Version EngineVersion {
-            get {
-                return f_EngineVersion;
-            }
-        }
-        
+
         public Session Session {
             get {
                 return f_Session;
@@ -333,7 +323,14 @@ namespace Smuxi.Frontend
                                "The username and/or password were wrong - please verify them."));
             }
             
-            f_EngineVersion = sessm.EngineVersion;
+            var engineVersion = sessm.EngineVersion;
+            if (engineVersion >= new Version("0.13")) {
+                EngineAssemblyVersion = sessm.EngineAssemblyVersion;
+                EngineProtocolVersion = sessm.EngineProtocolVersion;
+            } else {
+                EngineAssemblyVersion = engineVersion;
+                EngineProtocolVersion = engineVersion;
+            }
             f_UserConfig = new UserConfig(f_Session.Config,
                                          username);
             f_UserConfig.IsCaching = true;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]