From 77e3f8893c39c10a0465780fb3046ce57c55f141 Mon Sep 17 00:00:00 2001
From: mathieui <mathieui@mathieui.net>
Date: Tue, 3 Jul 2012 13:44:15 +0200
Subject: Do not reload plugins on reconnection

If the plugins_autoload list was not empty, it caused the plugins to be
reloaded upon each reconnection (with /connect or not). Now it does not.
---
 src/core.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/core.py b/src/core.py
index 6a0bff13..d272fe82 100644
--- a/src/core.py
+++ b/src/core.py
@@ -133,6 +133,7 @@ class Core(object):
 
         self.own_nick = config.get('default_nick', '') or self.xmpp.boundjid.user
 
+        self.plugins_autoloaded = False
         self.plugin_manager = PluginManager(self)
         self.events = events.EventHandler()
 
@@ -305,6 +306,7 @@ class Core(object):
         plugins = config.get('plugins_autoload', '')
         for plugin in plugins.split():
             self.plugin_manager.load(plugin)
+        self.plugins_autoloaded = True
 
     def validate_ssl(self, pem):
         """
@@ -764,7 +766,8 @@ class Core(object):
         Called when we are connected and authenticated
         """
         self.connection_time = time.time()
-        self.autoload_plugins()
+        if not self.plugins_autoloaded: # Do not reload plugins on reconnection
+            self.autoload_plugins()
         self.information(_("Authentication success."))
         self.information(_("Your JID is %s") % self.xmpp.boundjid.full)
         if not self.xmpp.anon:
-- 
cgit v1.2.3