[smuxi/experiments/gtk2_builder_pref_dialog: 13/25] only initialize non-local (remote) engines in smuxi-server



commit ab440e02c48abcf906c4b6e4c63965e6136d182b
Author: Mirco Bauer <meebey meebey net>
Date:   Tue May 24 19:32:52 2016 +0200

    only initialize non-local (remote) engines in smuxi-server
    
    All frontends always initialized all available sessions. Nobody noticed this
    incorrect behavior as the initialized sessions never connected to any servers
    till 1ac2edf80d28d0e72d24c0a99b7f10d13faaf3d0.

 src/Engine/Engine.cs         |   13 +++++++++++--
 src/Engine/SessionManager.cs |    2 +-
 src/Server/Server.cs         |    1 +
 3 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/Engine/Engine.cs b/src/Engine/Engine.cs
index 27485ec..d2f4827 100644
--- a/src/Engine/Engine.cs
+++ b/src/Engine/Engine.cs
@@ -1,7 +1,7 @@
 /*
  * Smuxi - Smart MUltipleXed Irc
  *
- * Copyright (c) 2005-2015 Mirco Bauer <meebey meebey net>
+ * Copyright (c) 2005-2016 Mirco Bauer <meebey meebey net>
  *
  * Full GPL License: <http://www.gnu.org/licenses/gpl.txt>
  *
@@ -133,7 +133,16 @@ namespace Smuxi.Engine
             }
             _ProtocolManagerFactory = new ProtocolManagerFactory();
             _ProtocolManagerFactory.LoadAllProtocolManagers(location);
-            
+        }
+
+        public static void InitSessionManager()
+        {
+            if (_SessionManager != null) {
+                return;
+            }
+            if (_Config == null || _ProtocolManagerFactory == null) {
+                throw new InvalidOperationException("Init() must be called first!");
+            }
             _SessionManager = new SessionManager(_Config, _ProtocolManagerFactory);
         }
 
diff --git a/src/Engine/SessionManager.cs b/src/Engine/SessionManager.cs
index 21011de..96e2ba3 100644
--- a/src/Engine/SessionManager.cs
+++ b/src/Engine/SessionManager.cs
@@ -1,7 +1,7 @@
 /*
  * Smuxi - Smart MUltipleXed Irc
  *
- * Copyright (c) 2005-2007, 2014-2015 Mirco Bauer <meebey meebey net>
+ * Copyright (c) 2005-2007, 2014-2016 Mirco Bauer <meebey meebey net>
  *
  * Full GPL License: <http://www.gnu.org/licenses/gpl.txt>
  *
diff --git a/src/Server/Server.cs b/src/Server/Server.cs
index 570ae3b..ea9a8a7 100644
--- a/src/Server/Server.cs
+++ b/src/Server/Server.cs
@@ -54,6 +54,7 @@ namespace Smuxi.Server
         public static void Init(string[] args)
         {
             Engine.Engine.Init();
+            Engine.Engine.InitSessionManager();
             string channel = (string)Engine.Engine.Config["Server/Channel"];
             string formatter = (string)Engine.Engine.Config["Server/Formatter"];
             string host = (string)Engine.Engine.Config["Server/Host"];


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