Commit 76f7d45b authored by Martin's avatar Martin

Imported upstream master from 2017-09-25

parent 30cce49d
......@@ -29,11 +29,12 @@ run-build:
- tar xzf $FN.gz
- rm $FN.gz
- export GF=$(find . -maxdepth 1 -type d -name 'gajim-*')
- cd $GF/gajim/plugins/
- mkdir -p $GF/gajim/data/plugins/
- cd $GF/gajim/data/plugins/
- curl -O https://ftp.gajim.org/plugins_1/plugin_installer.zip
- unzip plugin_installer.zip
- rm plugin_installer.zip
- cd ../../..
- cd ../../../..
- tar czf ../$FN.gz gajim-*
- cd ..
- rm -rf tmp_add_plugins
......
......@@ -556,8 +556,8 @@ class ZeroConfPage(GenericOptionPage):
def __init__(self, account, parent=None):
options = [
Option(OptionKind.DIALOG, _('Credentials'),
OptionType.DIALOG, props={'dialog': CredentialsDialog}),
Option(OptionKind.DIALOG, _('Profile'),
OptionType.DIALOG, props={'dialog': ZeroconfProfileDialog}),
Option(OptionKind.SWITCH, _('Connect on startup'),
OptionType.ACCOUNT_CONFIG, 'autoconnect',
......@@ -578,7 +578,7 @@ class ZeroConfPage(GenericOptionPage):
GenericOptionPage.__init__(self, account, parent, options)
class CredentialsDialog(OptionsDialog):
class ZeroconfProfileDialog(OptionsDialog):
def __init__(self, account, parent):
options = [
......@@ -595,7 +595,7 @@ class CredentialsDialog(OptionsDialog):
OptionType.ACCOUNT_CONFIG, 'zeroconf_email'),
]
OptionsDialog.__init__(self, parent, _('Credential Options'),
OptionsDialog.__init__(self, parent, _('Profile'),
Gtk.DialogFlags.MODAL, options, account)
......
......@@ -266,3 +266,9 @@ class AppActions():
else:
interface.instances['logs'] = history_window.\
HistoryWindow()
def on_open_event(self, action, param):
dict_ = param.unpack()
app.interface.handle_event(dict_['account'], dict_['jid'],
dict_['type_'])
......@@ -856,18 +856,18 @@ class ChatControl(ChatControlBase):
self._show_lock_image(**encryption_state)
def _show_lock_image(self, visible, enc_type='',
authenticated=False):
def _show_lock_image(self, visible, enc_type='', authenticated=False):
"""
Set lock icon visibility and create tooltip
"""
if authenticated:
authenticated_string = _('and authenticated')
img_path = gtkgui_helpers.get_icon_path('security-high')
self.lock_image.set_from_icon_name(
'security-high', Gtk.IconSize.MENU)
else:
authenticated_string = _('and NOT authenticated')
img_path = gtkgui_helpers.get_icon_path('security-low')
self.lock_image.set_from_file(img_path)
self.lock_image.set_from_icon_name(
'security-low', Gtk.IconSize.MENU)
tooltip = _('%(type)s encryption is active %(authenticated)s.') % {'type': enc_type, 'authenticated': authenticated_string}
......
......@@ -53,7 +53,7 @@ ged = ged_module.GlobalEventsDispatcher() # Global Events Dispatcher
nec = None # Network Events Controller
plugin_manager = None # Plugins Manager
log = logging.getLogger('gajim')
glog = logging.getLogger('gajim')
logger = None
......@@ -174,7 +174,7 @@ try:
'''
v_gnupg = gnupg.__version__
if V(v_gnupg) < V('0.3.8') or V(v_gnupg) > V('1.0.0'):
log.info('Gajim needs python-gnupg >= 0.3.8')
glog.info('Gajim needs python-gnupg >= 0.3.8')
HAVE_GPG = False
except ImportError:
HAVE_GPG = False
......@@ -245,7 +245,7 @@ try:
if sleepy.SUPPORTED:
HAVE_IDLE = True
except Exception:
log.debug(_('Unable to load idle module'))
glog.info(_('Unable to load idle module'))
HAVE_IDLE = False
......@@ -259,7 +259,8 @@ gajim_common_features = [nbxmpp.NS_BYTESTREAM, nbxmpp.NS_SI, nbxmpp.NS_FILE,
nbxmpp.NS_SSN, nbxmpp.NS_MOOD, nbxmpp.NS_ACTIVITY, nbxmpp.NS_NICK,
nbxmpp.NS_ROSTERX, nbxmpp.NS_SECLABEL, nbxmpp.NS_HASHES_2,
nbxmpp.NS_HASHES_MD5, nbxmpp.NS_HASHES_SHA1, nbxmpp.NS_HASHES_SHA256,
nbxmpp.NS_HASHES_SHA512, nbxmpp.NS_CONFERENCE, nbxmpp.NS_CORRECT]
nbxmpp.NS_HASHES_SHA512, nbxmpp.NS_CONFERENCE, nbxmpp.NS_CORRECT,
nbxmpp.NS_EME]
# Optional features gajim supports per account
gajim_optional_features = {}
......@@ -491,3 +492,7 @@ def get_priority(account, show):
elif prio > 127:
prio = 127
return prio
def log(domain):
root = 'gajim.'
return logging.getLogger(root + domain)
......@@ -75,7 +75,6 @@ class Config:
'autopopupaway': [ opt_bool, False ],
'autopopup_chat_opened': [ opt_bool, False, _('Show desktop notification even when a chat window is opened for this contact and does not have focus') ],
'sounddnd': [ opt_bool, False, _('Play sound when user is busy')],
'use_notif_daemon': [ opt_bool, True, _('Use D-Bus and Notification-Daemon to show notifications') ],
'showoffline': [ opt_bool, False ],
'show_only_chat_and_online': [ opt_bool, False, _('Show only online and free for chat contacts in roster.')],
'show_transports_group': [ opt_bool, True ],
......
......@@ -103,7 +103,7 @@ class ConfigPaths:
self.add('GUI', None, os.path.join(basedir, 'data', 'gui'))
self.add('ICONS', None, os.path.join(basedir, 'data', 'icons'))
self.add('HOME', None, os.path.expanduser('~'))
self.add('PLUGINS_BASE', None, os.path.join(basedir, 'plugins'))
self.add('PLUGINS_BASE', None, os.path.join(basedir, 'data', 'plugins'))
def add(self, name, type_, path):
self.paths[name] = (type_, path)
......
......@@ -1080,6 +1080,27 @@ class ConnectionHandlersBase:
app.plugin_manager.extension_point(
'decrypt', self, obj, self._on_message_received)
if not obj.encrypted:
# XEP-0380
enc_tag = obj.stanza.getTag('encryption', namespace=nbxmpp.NS_EME)
if enc_tag:
ns = enc_tag.getAttr('namespace')
if ns:
if ns == 'urn:xmpp:otr:0':
obj.msgtxt = _('This message was encrypted with OTR '
'and could not be decrypted.')
elif ns == 'jabber:x:encrypted':
obj.msgtxt = _('This message was encrypted with Legacy '
'OpenPGP and could not be decrypted. You can install '
'the PGP plugin to handle those messages.')
elif ns == 'urn:xmpp:openpgp:0':
obj.msgtxt = _('This message was encrypted with '
'OpenPGP for XMPP and could not be decrypted.')
else:
enc_name = enc_tag.getAttr('name')
if not enc_name:
enc_name = ns
obj.msgtxt = _('This message was encrypted with %s '
'and could not be decrypted.') % enc_name
self._on_message_received(obj)
def _on_message_received(self, obj):
......
......@@ -159,27 +159,6 @@ def get_interface(interface, path, start_service=True):
return None
def get_notifications_interface(notif=None):
"""
Get the notifications interface
:param notif: DesktopNotification instance
"""
# try to see if KDE notifications are available
iface = get_interface('org.kde.VisualNotifications', '/VisualNotifications',
start_service=False)
if iface != None:
if notif != None:
notif.kde_notifications = True
return iface
# KDE notifications don't seem to be available, falling back to
# notification-daemon
else:
if notif != None:
notif.kde_notifications = False
return get_interface('org.freedesktop.Notifications',
'/org/freedesktop/Notifications')
if supported:
class MissingArgument(dbus.DBusException):
_dbus_error_name = _GAJIM_ERROR_IFACE + '.MissingArgument'
......
......@@ -50,6 +50,8 @@ from gajim.common.zeroconf import zeroconf
from gajim.common.zeroconf.connection_handlers_zeroconf import *
from gajim.common.connection_handlers_events import *
log = logging.getLogger('gajim.c.connection_zeroconf')
class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf):
def __init__(self, name):
ConnectionHandlersZeroconf.__init__(self)
......@@ -73,7 +75,7 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf):
values
"""
if not app.config.get_per('accounts', app.ZEROCONF_ACC_NAME, 'name'):
app.log.debug('Creating zeroconf account')
log.debug('Creating zeroconf account')
app.config.add_per('accounts', app.ZEROCONF_ACC_NAME)
app.config.set_per('accounts', app.ZEROCONF_ACC_NAME,
'autoconnect', True)
......@@ -123,7 +125,7 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf):
def reconnect(self):
# Do not try to reco while we are already trying
self.time_to_reconnect = None
app.log.debug('reconnect')
log.debug('reconnect')
self.disconnect()
self.change_status(self.old_show, self.status)
......
......@@ -73,10 +73,6 @@ class FeaturesWindow:
_('Spellchecking of composed messages.'),
_('Requires libgtkspell.'),
_('Requires libgtkspell and libenchant.')),
_('Notification'): (self.notification_available,
_('Passive popups notifying for new events.'),
_('Requires python-notify or instead python-dbus in conjunction with notification-daemon.'),
_('Feature not available under Windows.')),
_('Automatic status'): (self.idle_available,
_('Ability to measure idle time, in order to set auto status.'),
_('Requires libxss library.'),
......@@ -199,18 +195,6 @@ class FeaturesWindow:
return False
return True
def notification_available(self):
if os.name == 'nt':
return False
from gajim.common import dbus_support
if self.dbus_available() and dbus_support.get_notifications_interface():
return True
try:
__import__('pynotify')
except Exception:
return False
return True
def idle_available(self):
from gajim.common import sleepy
return sleepy.SUPPORTED
......
......@@ -314,7 +314,8 @@ class GajimApplication(Gtk.Application):
('-delete-motd', action.on_delete_motd, 'online', 's'),
('-activate-bookmark',
action.on_activate_bookmark, 'online', 'a{sv}'),
('-import-contacts', action.on_import_contacts, 'online', 's')
('-open-event', action.on_open_event, 'always', 'a{sv}'),
('-import-contacts', action.on_import_contacts, 'online', 's'),
]
# General Stateful Actions
......@@ -347,7 +348,7 @@ class GajimApplication(Gtk.Application):
('features', action.on_features),
('content', action.on_contents),
('about', action.on_about),
('faq', action.on_faq)
('faq', action.on_faq),
]
for action in self.general_actions:
......
......@@ -785,18 +785,18 @@ class GroupchatControl(ChatControlBase):
self._show_lock_image(**encryption_state)
def _show_lock_image(self, visible, enc_type='',
authenticated=False):
def _show_lock_image(self, visible, enc_type='', authenticated=False):
"""
Set lock icon visibility and create tooltip
"""
if authenticated:
authenticated_string = _('and authenticated')
img_path = gtkgui_helpers.get_icon_path('security-high')
self.lock_image.set_from_icon_name(
'security-high', Gtk.IconSize.MENU)
else:
authenticated_string = _('and NOT authenticated')
img_path = gtkgui_helpers.get_icon_path('security-low')
self.lock_image.set_from_file(img_path)
self.lock_image.set_from_icon_name(
'security-low', Gtk.IconSize.MENU)
tooltip = _('%(type)s encryption is active %(authenticated)s.') % {
'type': enc_type, 'authenticated': authenticated_string}
......
......@@ -2309,7 +2309,12 @@ class Interface:
app.idlequeue.process()
except Exception:
# Otherwise, an exception will stop our loop
timeout, in_seconds = app.idlequeue.PROCESS_TIMEOUT
if sys.platform == 'win32':
timeout, in_seconds = 20, None
else:
timeout, in_seconds = app.idlequeue.PROCESS_TIMEOUT
if in_seconds:
GLib.timeout_add_seconds(timeout, self.process_connections)
else:
......@@ -2566,7 +2571,11 @@ class Interface:
self.instances['file_transfers'] = dialogs.FileTransfersWindow()
GLib.timeout_add(100, self.autoconnect)
timeout, in_seconds = app.idlequeue.PROCESS_TIMEOUT
if sys.platform == 'win32':
timeout, in_seconds = 20, None
else:
timeout, in_seconds = app.idlequeue.PROCESS_TIMEOUT
if in_seconds:
GLib.timeout_add_seconds(timeout, self.process_connections)
else:
......
This diff is collapsed.
......@@ -219,7 +219,7 @@ package_data_moods = ['data/moods/*/*.png']
package_data_other = ['data/other/*']
package_data_sounds = ['data/sounds/*.wav']
package_data_style = ['data/style/gajim.css']
package_plugins_data = ['plugins/*/*']
package_plugins_data = ['data/plugins/*/*']
package_data = (package_data_activities
+ package_data_emoticons
+ package_data_gui
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment