Philipp Hörist pushed to branch master at gajim / gajim

Commits:
0fe78daa by Philipp Hörist at 2017-11-15T21:57:15+01:00
Init PluginManger earlier

- Plugins need the possibility to add caps before Gajim updates them

- - - - -
775fec2f by Philipp Hörist at 2017-11-15T22:26:55+01:00
Dont activate plugins in PluginManager init

Plugins maybe want to use in their activation Gajim methods that
use an extension point. But because the PluginManager Object is not fully
initialized, the extension point method is not available yet

First create the PluginManager Object, then load Plugins.

- - - - -
d5ddbe37 by Philipp Hörist at 2017-11-15T22:28:11+01:00
Add extension point for plugins to add their caps

- - - - -
9f0154ef by Philipp Hörist at 2017-11-15T22:28:57+01:00
Add caps to first presence

According to the XEP, caps hash has to be added to all presences

- - - - -


4 changed files:

- gajim/common/connection_handlers.py
- gajim/common/helpers.py
- gajim/gui_interface.py
- gajim/plugins/pluginmanager.py


Changes:

=====================================
gajim/common/connection_handlers.py
=====================================
--- a/gajim/common/connection_handlers.py
+++ b/gajim/common/connection_handlers.py
@@ -2039,6 +2039,7 @@ ConnectionHandlersBase, ConnectionJingle, 
ConnectionIBBytestream):
             p.setStatus(msg)
         if signed:
             p.setTag(nbxmpp.NS_SIGNED + ' x').setData(signed)
+        p = self.add_sha(p)
 
         if self.connection:
             self.connection.send(p)


=====================================
gajim/common/helpers.py
=====================================
--- a/gajim/common/helpers.py
+++ b/gajim/common/helpers.py
@@ -1354,6 +1354,10 @@ def update_optional_features(account = None):
         app.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_XTLS)
         app.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_BYTESTREAM)
         app.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_IBB)
+
+        # Give plugins the possibility to add their features
+        app.plugin_manager.extension_point('update_caps', a)
+
         app.caps_hash[a] = caps_cache.compute_caps_hash([app.gajim_identity],
                 app.gajim_common_features + app.gajim_optional_features[a])
         # re-send presence with new hash


=====================================
gajim/gui_interface.py
=====================================
--- a/gajim/gui_interface.py
+++ b/gajim/gui_interface.py
@@ -2562,10 +2562,6 @@ class Interface:
         MessageWindowMgr.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER:
             self.msg_win_mgr.create_window(None, None, None)
 
-        # Creating plugin manager
-        from gajim import plugins
-        app.plugin_manager = plugins.PluginManager()
-
         self.roster._before_fill()
         for account in app.connections:
             app.connections[account].load_roster_from_db()
@@ -2762,6 +2758,11 @@ class Interface:
             app.gajim_optional_features[a] = []
             app.caps_hash[a] = ''
 
+        # Creating plugin manager
+        from gajim import plugins
+        app.plugin_manager = plugins.PluginManager()
+        app.plugin_manager.init_plugins()
+
         helpers.update_optional_features()
         # prepopulate data which we are sure of; note: we do not log these info
         for account in app.connections:


=====================================
gajim/plugins/pluginmanager.py
=====================================
--- a/gajim/plugins/pluginmanager.py
+++ b/gajim/plugins/pluginmanager.py
@@ -110,7 +110,6 @@ class PluginManager(metaclass=Singleton):
         for path in [app.PLUGINS_DIRS[1], app.PLUGINS_DIRS[0]]:
             pc = PluginManager.scan_dir_for_plugins(path)
             self.add_plugins(pc)
-        self._activate_all_plugins_from_global_config()
 
     @log_calls('PluginManager')
     def _plugin_has_entry_in_global_config(self, plugin):
@@ -127,6 +126,10 @@ class PluginManager(metaclass=Singleton):
         app.config.del_per('plugins', plugin.short_name)
 
     @log_calls('PluginManager')
+    def init_plugins(self):
+        self._activate_all_plugins_from_global_config()
+
+    @log_calls('PluginManager')
     def add_plugin(self, plugin_class):
         '''
         :todo: what about adding plug-ins that are already added? Module reload



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/5236693df9f5855888411bcaaed41b01f3f0d411...9f0154ef84f442895af9947fa9526b31cd27cdf4

---
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/compare/5236693df9f5855888411bcaaed41b01f3f0d411...9f0154ef84f442895af9947fa9526b31cd27cdf4
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to