[esessions] Fix dependency check

- remove unused imports
This commit is contained in:
Philipp Hörist
2018-04-24 19:40:24 +02:00
parent 16e776f405
commit e3764509cd

View File

@@ -18,11 +18,8 @@ You should have received a copy of the GNU General Public License
along with Gajim. If not, see <http://www.gnu.org/licenses/>. along with Gajim. If not, see <http://www.gnu.org/licenses/>.
''' '''
import os
import logging import logging
import time
import threading
import queue
import nbxmpp import nbxmpp
@@ -37,7 +34,13 @@ from gajim.plugins import GajimPlugin
log = logging.getLogger('gajim.plugin_system.esessions') log = logging.getLogger('gajim.plugin_system.esessions')
ERROR_MSG = '' ERROR_MSG = ''
if not app.HAVE_PYCRYPTO: if hasattr(app, 'HAVE_PYCRYPTO'):
# Gajim 1.0.0
CRYPTO_AVAILABLE = app.HAVE_PYCRYPTO
else:
# Gajim 1.0.3+
CRYPTO_AVAILABLE = app.is_installed('PYCRYPTO')
if not CRYPTO_AVAILABLE:
ERROR_MSG = 'Please install pycrypto' ERROR_MSG = 'Please install pycrypto'
@@ -120,7 +123,7 @@ class ESessionsPlugin(GajimPlugin):
# Esessions cant decrypt Carbon Copys # Esessions cant decrypt Carbon Copys
return return
if obj.stanza.getTag('feature', namespace=nbxmpp.NS_FEATURE): if obj.stanza.getTag('feature', namespace=nbxmpp.NS_FEATURE):
if app.HAVE_PYCRYPTO: if CRYPTO_AVAILABLE:
feature = obj.stanza.getTag(name='feature', feature = obj.stanza.getTag(name='feature',
namespace=nbxmpp.NS_FEATURE) namespace=nbxmpp.NS_FEATURE)
form = nbxmpp.DataForm(node=feature.getTag('x')) form = nbxmpp.DataForm(node=feature.getTag('x'))