comparison src/browser/libervia_main.py @ 549:cd56f2b0e85b

browser_side: disable OTR if the browser is too old to offer crypto.getRandomValues (CSPRNG)
author souliane <souliane@mailoo.org>
date Wed, 17 Sep 2014 17:15:03 +0200
parents 530f3fc3e3d7
children 7a823c6568e2
comparison
equal deleted inserted replaced
548:530f3fc3e3d7 549:cd56f2b0e85b
47 from sat_browser import html_tools 47 from sat_browser import html_tools
48 from sat_browser import notification 48 from sat_browser import notification
49 49
50 from sat_browser.constants import Const as C 50 from sat_browser.constants import Const as C
51 51
52 # FIXME: import plugin dynamically 52 try:
53 from sat_browser import plugin_sec_otr 53 # FIXME: import plugin dynamically
54 from sat_browser import plugin_sec_otr
55 except ImportError:
56 pass
54 57
55 MAX_MBLOG_CACHE = 500 # Max microblog entries kept in memories 58 MAX_MBLOG_CACHE = 500 # Max microblog entries kept in memories
56 59
57 # Set to true to not create a new LiberviaWidget when a similar one 60 # Set to true to not create a new LiberviaWidget when a similar one
58 # already exist (i.e. a chat panel with the same target). Instead 61 # already exist (i.e. a chat panel with the same target). Instead
201 self.init_cache = [] # used to cache events until initialisation is done 204 self.init_cache = [] # used to cache events until initialisation is done
202 self.cached_params = {} 205 self.cached_params = {}
203 206
204 def importPlugins(self): 207 def importPlugins(self):
205 self.plugins = {} 208 self.plugins = {}
209 inhibited_menus = []
206 # FIXME: plugins import should be dynamic and generic like in sat 210 # FIXME: plugins import should be dynamic and generic like in sat
207 self.plugins['otr'] = plugin_sec_otr.OTR(self) 211 try:
212 self.plugins['otr'] = plugin_sec_otr.OTR(self)
213 except TypeError: # plugin_sec_otr has not been imported
214 inhibited_menus.append('OTR')
215
216 class DummyPlugin(object):
217 def inhibitMenus(self):
218 return inhibited_menus
219
220 self.plugins['dummy_plugin'] = DummyPlugin()
208 221
209 def addSelectedListener(self, callback): 222 def addSelectedListener(self, callback):
210 self._selected_listeners.add(callback) 223 self._selected_listeners.add(callback)
211 224
212 def getSelected(self): 225 def getSelected(self):