[smuxi/stable: 282/301] Engine, Frontend-GNOME: restored ABI compat with smuxi-servers < 0.8.11 (closes: #893)



commit cabaeae8453a18803b989b24d88527ea2f315306
Author: Mirco Bauer <meebey meebey net>
Date:   Fri Dec 6 21:01:47 2013 +0100

    Engine, Frontend-GNOME: restored ABI compat with smuxi-servers < 0.8.11 (closes: #893)

 src/Engine/Config/ServerModel.cs       |    7 ++++++-
 src/Frontend-GNOME/Views/MenuWidget.cs |    7 +++++++
 2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/src/Engine/Config/ServerModel.cs b/src/Engine/Config/ServerModel.cs
index 0d6ef65..d8994b5 100644
--- a/src/Engine/Config/ServerModel.cs
+++ b/src/Engine/Config/ServerModel.cs
@@ -109,7 +109,12 @@ namespace Smuxi.Engine
 
         public virtual void GetObjectData(SerializationInfo info, StreamingContext ctx) 
         {
-            info.AddValue("_ServerID", ServerID);
+            // HACK: skip ServerID if it has no value as it breaks older
+            // ServerModel implementations that relied on automatic
+            // serialization which was the case in < 0.8.11
+            if (ServerID != null) {
+                info.AddValue("_ServerID", ServerID);
+            }
             info.AddValue("_Protocol", Protocol);
             info.AddValue("_Hostname", Hostname);
             info.AddValue("_Port", Port);
diff --git a/src/Frontend-GNOME/Views/MenuWidget.cs b/src/Frontend-GNOME/Views/MenuWidget.cs
index f6f73bf..c05c7bd 100644
--- a/src/Frontend-GNOME/Views/MenuWidget.cs
+++ b/src/Frontend-GNOME/Views/MenuWidget.cs
@@ -219,6 +219,13 @@ 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)) {
+                            // 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:
+                            // ServerModel.GetObjectData()
+                            server.ServerID = null;
+                        }
                         Frontend.Session.Connect(server, Frontend.FrontendManager);
                     } catch (Exception ex) {
                         Frontend.ShowException(Parent, ex);


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