Fix unused-variable pylint errors
This commit is contained in:
parent
7c558d38a6
commit
cebd83d436
|
@ -612,13 +612,12 @@ class ChatControl(ChatControlBase):
|
||||||
self.update_toolbar()
|
self.update_toolbar()
|
||||||
|
|
||||||
def _update_banner_state_image(self):
|
def _update_banner_state_image(self):
|
||||||
contact = app.contacts.get_contact_with_highest_priority(self.account,
|
contact = app.contacts.get_contact_with_highest_priority(
|
||||||
self.contact.jid)
|
self.account, self.contact.jid)
|
||||||
if not contact or self.resource:
|
if not contact or self.resource:
|
||||||
# For transient contacts
|
# For transient contacts
|
||||||
contact = self.contact
|
contact = self.contact
|
||||||
show = contact.show
|
show = contact.show
|
||||||
jid = contact.jid
|
|
||||||
|
|
||||||
# Set banner image
|
# Set banner image
|
||||||
icon = gtkgui_helpers.get_iconset_name_for(show)
|
icon = gtkgui_helpers.get_iconset_name_for(show)
|
||||||
|
@ -727,10 +726,6 @@ class ChatControl(ChatControlBase):
|
||||||
getattr(self, 'update_' + jingle_type)()
|
getattr(self, 'update_' + jingle_type)()
|
||||||
|
|
||||||
def on_jingle_button_toggled(self, state, jingle_type):
|
def on_jingle_button_toggled(self, state, jingle_type):
|
||||||
img_name = 'gajim-%s_%s' % ({'audio': 'mic', 'video': 'cam'}[jingle_type],
|
|
||||||
{True: 'active', False: 'inactive'}[state])
|
|
||||||
path_to_img = gtkgui_helpers.get_icon_path(img_name)
|
|
||||||
|
|
||||||
if state:
|
if state:
|
||||||
if getattr(self, jingle_type + '_state') == \
|
if getattr(self, jingle_type + '_state') == \
|
||||||
self.JINGLE_STATE_NULL:
|
self.JINGLE_STATE_NULL:
|
||||||
|
@ -768,8 +763,6 @@ class ChatControl(ChatControlBase):
|
||||||
self.close_jingle_content(jingle_type)
|
self.close_jingle_content(jingle_type)
|
||||||
|
|
||||||
def set_lock_image(self):
|
def set_lock_image(self):
|
||||||
loggable = self.session and self.session.is_loggable()
|
|
||||||
|
|
||||||
encryption_state = {'visible': self.encryption is not None,
|
encryption_state = {'visible': self.encryption is not None,
|
||||||
'enc_type': self.encryption,
|
'enc_type': self.encryption,
|
||||||
'authenticated': False}
|
'authenticated': False}
|
||||||
|
@ -797,7 +790,6 @@ class ChatControl(ChatControlBase):
|
||||||
|
|
||||||
self.authentication_button.set_tooltip_text(tooltip)
|
self.authentication_button.set_tooltip_text(tooltip)
|
||||||
self.widget_set_visible(self.authentication_button, not visible)
|
self.widget_set_visible(self.authentication_button, not visible)
|
||||||
context = self.msg_scrolledwindow.get_style_context()
|
|
||||||
self.lock_image.set_sensitive(visible)
|
self.lock_image.set_sensitive(visible)
|
||||||
|
|
||||||
def _on_authentication_button_clicked(self, widget):
|
def _on_authentication_button_clicked(self, widget):
|
||||||
|
@ -903,9 +895,6 @@ class ChatControl(ChatControlBase):
|
||||||
contact = self.contact
|
contact = self.contact
|
||||||
keyID = contact.keyID
|
keyID = contact.keyID
|
||||||
|
|
||||||
chatstates_on = app.config.get('outgoing_chat_state_notifications') != \
|
|
||||||
'disabled'
|
|
||||||
|
|
||||||
chatstate_to_send = None
|
chatstate_to_send = None
|
||||||
if contact is not None:
|
if contact is not None:
|
||||||
if contact.supports(NS_CHATSTATES):
|
if contact.supports(NS_CHATSTATES):
|
||||||
|
@ -1480,7 +1469,7 @@ class ChatControl(ChatControlBase):
|
||||||
return
|
return
|
||||||
if not self.info_bar_queue:
|
if not self.info_bar_queue:
|
||||||
return
|
return
|
||||||
markup, buttons, args, type_ = self.info_bar_queue[0]
|
markup, buttons, _args, type_ = self.info_bar_queue[0]
|
||||||
self.info_bar_label.set_markup(markup)
|
self.info_bar_label.set_markup(markup)
|
||||||
|
|
||||||
# Remove old buttons
|
# Remove old buttons
|
||||||
|
|
|
@ -191,7 +191,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
lb.clear()
|
lb.clear()
|
||||||
i = 0
|
i = 0
|
||||||
sel = 0
|
sel = 0
|
||||||
label_, labellist, default = event.catalog
|
_label, labellist, default = event.catalog
|
||||||
for label in labellist:
|
for label in labellist:
|
||||||
lb.append([label])
|
lb.append([label])
|
||||||
if label == default:
|
if label == default:
|
||||||
|
@ -571,7 +571,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
|
|
||||||
def _conv_textview_key_press_event(self, widget, event):
|
def _conv_textview_key_press_event(self, widget, event):
|
||||||
# translate any layout to latin_layout
|
# translate any layout to latin_layout
|
||||||
valid, entries = self.keymap.get_entries_for_keyval(event.keyval)
|
_valid, entries = self.keymap.get_entries_for_keyval(event.keyval)
|
||||||
keycode = entries[0].keycode
|
keycode = entries[0].keycode
|
||||||
if (event.get_state() & Gdk.ModifierType.CONTROL_MASK and keycode in (
|
if (event.get_state() & Gdk.ModifierType.CONTROL_MASK and keycode in (
|
||||||
self.keycode_c, self.keycode_ins)):
|
self.keycode_c, self.keycode_ins)):
|
||||||
|
@ -916,7 +916,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
||||||
scroll = False if pos == size else True # are we scrolling?
|
scroll = False if pos == size else True # are we scrolling?
|
||||||
# we don't want size of the buffer to grow indefinitely
|
# we don't want size of the buffer to grow indefinitely
|
||||||
max_size = app.config.get('key_up_lines')
|
max_size = app.config.get('key_up_lines')
|
||||||
for i in range(size - max_size + 1):
|
for _i in range(size - max_size + 1):
|
||||||
if pos == 0:
|
if pos == 0:
|
||||||
break
|
break
|
||||||
history.pop(0)
|
history.pop(0)
|
||||||
|
|
|
@ -65,7 +65,7 @@ def parse_arguments(arguments):
|
||||||
"""
|
"""
|
||||||
Check if given span intersects with any of options.
|
Check if given span intersects with any of options.
|
||||||
"""
|
"""
|
||||||
for key, value, (start, end) in opts:
|
for _key, _value, (start, end) in opts:
|
||||||
if given_start >= start and given_end <= end:
|
if given_start >= start and given_end <= end:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -74,7 +74,7 @@ def parse_arguments(arguments):
|
||||||
"""
|
"""
|
||||||
Check if given span intersects with any of arguments.
|
Check if given span intersects with any of arguments.
|
||||||
"""
|
"""
|
||||||
for arg, (start, end) in args:
|
for _arg, (start, end) in args:
|
||||||
if given_start >= start and given_end <= end:
|
if given_start >= start and given_end <= end:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -124,7 +124,7 @@ def adapt_arguments(command, arguments, args, opts):
|
||||||
by an argument - then this argument will be treated just like a
|
by an argument - then this argument will be treated just like a
|
||||||
normal positional argument.
|
normal positional argument.
|
||||||
"""
|
"""
|
||||||
spec_args, spec_kwargs, var_args, var_kwargs = command.extract_specification()
|
spec_args, spec_kwargs, var_args, _var_kwargs = command.extract_specification()
|
||||||
norm_kwargs = dict(spec_kwargs)
|
norm_kwargs = dict(spec_kwargs)
|
||||||
|
|
||||||
# Quite complex piece of neck-breaking logic to extract raw
|
# Quite complex piece of neck-breaking logic to extract raw
|
||||||
|
@ -159,7 +159,7 @@ def adapt_arguments(command, arguments, args, opts):
|
||||||
|
|
||||||
if spec_len > 1:
|
if spec_len > 1:
|
||||||
try:
|
try:
|
||||||
stopper, (start, end) = args[spec_len - 2]
|
_stopper, (start, end) = args[spec_len - 2]
|
||||||
except IndexError:
|
except IndexError:
|
||||||
raise CommandError(_("Missing arguments"), command)
|
raise CommandError(_("Missing arguments"), command)
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ def adapt_arguments(command, arguments, args, opts):
|
||||||
# corresponding opt-in has been given.
|
# corresponding opt-in has been given.
|
||||||
if command.expand:
|
if command.expand:
|
||||||
expanded = []
|
expanded = []
|
||||||
for spec_key, spec_value in norm_kwargs.items():
|
for spec_key in norm_kwargs.keys():
|
||||||
letter = spec_key[0] if len(spec_key) > 1 else None
|
letter = spec_key[0] if len(spec_key) > 1 else None
|
||||||
if letter and letter not in expanded:
|
if letter and letter not in expanded:
|
||||||
for index, (key, value, position) in enumerate(opts):
|
for index, (key, value, position) in enumerate(opts):
|
||||||
|
@ -255,7 +255,7 @@ def adapt_arguments(command, arguments, args, opts):
|
||||||
if command.overlap:
|
if command.overlap:
|
||||||
overlapped = args[spec_len:]
|
overlapped = args[spec_len:]
|
||||||
args = args[:spec_len]
|
args = args[:spec_len]
|
||||||
for arg, (spec_key, spec_value) in zip(overlapped, spec_kwargs):
|
for arg, spec_key, _spec_value in zip(overlapped, spec_kwargs):
|
||||||
opts.append((spec_key, arg))
|
opts.append((spec_key, arg))
|
||||||
else:
|
else:
|
||||||
raise CommandError(_("Too many arguments"), command)
|
raise CommandError(_("Too many arguments"), command)
|
||||||
|
@ -288,7 +288,7 @@ def generate_usage(command, complete=True):
|
||||||
# Remove some special positional arguments from the specification,
|
# Remove some special positional arguments from the specification,
|
||||||
# but store their names so they can be used for usage info
|
# but store their names so they can be used for usage info
|
||||||
# generation.
|
# generation.
|
||||||
sp_source = spec_args.pop(0) if command.source else None
|
_sp_source = spec_args.pop(0) if command.source else None
|
||||||
sp_extra = spec_args.pop() if command.extra else None
|
sp_extra = spec_args.pop() if command.extra else None
|
||||||
|
|
||||||
kwargs = []
|
kwargs = []
|
||||||
|
|
|
@ -82,8 +82,6 @@ gc_passwords = {} # list of the pass required to enter a room
|
||||||
automatic_rooms = {} # list of rooms that must be automaticaly configured
|
automatic_rooms = {} # list of rooms that must be automaticaly configured
|
||||||
# and for which we have a list of invities
|
# and for which we have a list of invities
|
||||||
#{account: {room_jid: {'invities': []}}}
|
#{account: {room_jid: {'invities': []}}}
|
||||||
new_room_nick = None # if it's != None, use this nick instead of asking for
|
|
||||||
# a new nickname when there is a conflict.
|
|
||||||
|
|
||||||
groups = {} # list of groups
|
groups = {} # list of groups
|
||||||
newly_added = {} # list of contacts that has just signed in
|
newly_added = {} # list of contacts that has just signed in
|
||||||
|
@ -179,10 +177,10 @@ def detect_dependencies():
|
||||||
# ZEROCONF
|
# ZEROCONF
|
||||||
try:
|
try:
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
import pybonjour
|
import pybonjour # pylint: disable=unused-variable
|
||||||
_dependencies['PYBONJOUR'] = True
|
_dependencies['PYBONJOUR'] = True
|
||||||
else:
|
else:
|
||||||
import dbus
|
import dbus # pylint: disable=unused-variable
|
||||||
_dependencies['PYTHON-DBUS'] = True
|
_dependencies['PYTHON-DBUS'] = True
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
@ -238,7 +236,7 @@ def detect_dependencies():
|
||||||
try:
|
try:
|
||||||
Gst.init(None)
|
Gst.init(None)
|
||||||
conference = Gst.ElementFactory.make('fsrtpconference', None)
|
conference = Gst.ElementFactory.make('fsrtpconference', None)
|
||||||
session = conference.new_session(Farstream.MediaType.AUDIO)
|
conference.new_session(Farstream.MediaType.AUDIO)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
log('gajim').info(error)
|
log('gajim').info(error)
|
||||||
_dependencies['FARSTREAM'] = True
|
_dependencies['FARSTREAM'] = True
|
||||||
|
@ -248,7 +246,7 @@ def detect_dependencies():
|
||||||
# GEOCLUE
|
# GEOCLUE
|
||||||
try:
|
try:
|
||||||
gi.require_version('Geoclue', '2.0')
|
gi.require_version('Geoclue', '2.0')
|
||||||
from gi.repository import Geoclue
|
from gi.repository import Geoclue # pylint: disable=unused-variable
|
||||||
_dependencies['GEOCLUE'] = True
|
_dependencies['GEOCLUE'] = True
|
||||||
except (ImportError, ValueError):
|
except (ImportError, ValueError):
|
||||||
pass
|
pass
|
||||||
|
@ -257,14 +255,14 @@ def detect_dependencies():
|
||||||
try:
|
try:
|
||||||
gi.require_version('GUPnPIgd', '1.0')
|
gi.require_version('GUPnPIgd', '1.0')
|
||||||
from gi.repository import GUPnPIgd
|
from gi.repository import GUPnPIgd
|
||||||
gupnp_igd = GUPnPIgd.SimpleIgd()
|
GUPnPIgd.SimpleIgd()
|
||||||
_dependencies['UPNP'] = True
|
_dependencies['UPNP'] = True
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# PYCURL
|
# PYCURL
|
||||||
try:
|
try:
|
||||||
import pycurl
|
import pycurl # pylint: disable=unused-variable
|
||||||
_dependencies['PYCURL'] = True
|
_dependencies['PYCURL'] = True
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -1835,7 +1835,7 @@ class Connection(CommonConnection, ConnectionHandlers):
|
||||||
|
|
||||||
def accept_insecure_password(self):
|
def accept_insecure_password(self):
|
||||||
if self.pasword_callback:
|
if self.pasword_callback:
|
||||||
callback, type_ = self.pasword_callback
|
callback = self.pasword_callback[0]
|
||||||
callback(self.password)
|
callback(self.password)
|
||||||
self.pasword_callback = None
|
self.pasword_callback = None
|
||||||
|
|
||||||
|
|
|
@ -496,8 +496,7 @@ class ConnectionHandlers(ConnectionSocks5Bytestream,
|
||||||
else:
|
else:
|
||||||
self.awaiting_cids[cid] = [(callback, args, position)]
|
self.awaiting_cids[cid] = [(callback, args, position)]
|
||||||
iq = nbxmpp.Iq(to=to, typ='get')
|
iq = nbxmpp.Iq(to=to, typ='get')
|
||||||
data = iq.addChild(name='data', attrs={'cid': cid},
|
iq.addChild(name='data', attrs={'cid': cid}, namespace=nbxmpp.NS_BOB)
|
||||||
namespace=nbxmpp.NS_BOB)
|
|
||||||
self.connection.SendAndCallForResponse(iq, self._on_bob_received,
|
self.connection.SendAndCallForResponse(iq, self._on_bob_received,
|
||||||
{'cid': cid})
|
{'cid': cid})
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,11 @@ Global Events Dispatcher module.
|
||||||
:license: GPL
|
:license: GPL
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import logging
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
from nbxmpp import NodeProcessed
|
from nbxmpp import NodeProcessed
|
||||||
import logging
|
|
||||||
log = logging.getLogger('gajim.c.ged')
|
log = logging.getLogger('gajim.c.ged')
|
||||||
|
|
||||||
PRECORE = 10
|
PRECORE = 10
|
||||||
|
@ -61,8 +62,8 @@ class GlobalEventsDispatcher:
|
||||||
if event_name in self.handlers:
|
if event_name in self.handlers:
|
||||||
handlers_list = self.handlers[event_name]
|
handlers_list = self.handlers[event_name]
|
||||||
i = 0
|
i = 0
|
||||||
for i, h in enumerate(handlers_list):
|
for i, handler_tuple in enumerate(handlers_list):
|
||||||
if priority < h[0]:
|
if priority < handler_tuple[0]:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# no event with smaller prio found, put it at the end
|
# no event with smaller prio found, put it at the end
|
||||||
|
@ -86,7 +87,7 @@ class GlobalEventsDispatcher:
|
||||||
log.debug('%s Args: %s', event_name, str(args))
|
log.debug('%s Args: %s', event_name, str(args))
|
||||||
if event_name in self.handlers:
|
if event_name in self.handlers:
|
||||||
node_processed = False
|
node_processed = False
|
||||||
for priority, handler in self.handlers[event_name]:
|
for _priority, handler in self.handlers[event_name]:
|
||||||
try:
|
try:
|
||||||
if handler(*args, **kwargs):
|
if handler(*args, **kwargs):
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -685,8 +685,6 @@ def launch_browser_mailer(kind, uri):
|
||||||
|
|
||||||
|
|
||||||
def launch_file_manager(path_to_open):
|
def launch_file_manager(path_to_open):
|
||||||
if not path_to_open.startswith('file://'):
|
|
||||||
uri = 'file://' + path_to_open
|
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
try:
|
try:
|
||||||
os.startfile(path_to_open) # if pywin32 is installed we open
|
os.startfile(path_to_open) # if pywin32 is installed we open
|
||||||
|
@ -778,7 +776,7 @@ def play_sound_file(path_to_soundfile):
|
||||||
if app.config.get('soundplayer') == '':
|
if app.config.get('soundplayer') == '':
|
||||||
def _oss_play():
|
def _oss_play():
|
||||||
sndfile = wave.open(path_to_soundfile, 'rb')
|
sndfile = wave.open(path_to_soundfile, 'rb')
|
||||||
(nc, sw, fr, nf, comptype, compname) = sndfile.getparams()
|
nc, sw, fr, nf, _comptype, _compname = sndfile.getparams()
|
||||||
dev = oss.open('/dev/dsp', 'w')
|
dev = oss.open('/dev/dsp', 'w')
|
||||||
dev.setparameters(sw * 8, nc, fr)
|
dev.setparameters(sw * 8, nc, fr)
|
||||||
dev.write(sndfile.readframes(nf))
|
dev.write(sndfile.readframes(nf))
|
||||||
|
@ -1356,7 +1354,6 @@ def _get_img_direct(attrs):
|
||||||
f = urllib.request.urlopen(req)
|
f = urllib.request.urlopen(req)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log.debug('Error loading image %s ', attrs['src'] + str(ex))
|
log.debug('Error loading image %s ', attrs['src'] + str(ex))
|
||||||
pixbuf = None
|
|
||||||
alt = attrs.get('alt', 'Broken image')
|
alt = attrs.get('alt', 'Broken image')
|
||||||
else:
|
else:
|
||||||
# Wait 2s between each byte
|
# Wait 2s between each byte
|
||||||
|
@ -1404,7 +1401,7 @@ def _get_img_proxy(attrs, proxy):
|
||||||
"""
|
"""
|
||||||
if not app.is_installed('PYCURL'):
|
if not app.is_installed('PYCURL'):
|
||||||
return '', _('PyCURL is not installed')
|
return '', _('PyCURL is not installed')
|
||||||
mem, alt, max_size = '', '', 2*1024*1024
|
alt, max_size = '', 2*1024*1024
|
||||||
if 'max_size' in attrs:
|
if 'max_size' in attrs:
|
||||||
max_size = attrs['max_size']
|
max_size = attrs['max_size']
|
||||||
try:
|
try:
|
||||||
|
@ -1430,7 +1427,6 @@ def _get_img_proxy(attrs, proxy):
|
||||||
c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_HTTP)
|
c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_HTTP)
|
||||||
elif proxy['type'] == 'socks5':
|
elif proxy['type'] == 'socks5':
|
||||||
c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS5)
|
c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS5)
|
||||||
x = c.perform()
|
|
||||||
c.close()
|
c.close()
|
||||||
t = b.getvalue()
|
t = b.getvalue()
|
||||||
return (t, attrs.get('alt', ''))
|
return (t, attrs.get('alt', ''))
|
||||||
|
@ -1446,7 +1442,6 @@ def _get_img_proxy(attrs, proxy):
|
||||||
alt += _('Error loading image')
|
alt += _('Error loading image')
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
log.debug('Error loading image %s ', attrs['src'] + str(ex))
|
log.debug('Error loading image %s ', attrs['src'] + str(ex))
|
||||||
pixbuf = None
|
|
||||||
alt = attrs.get('alt', 'Broken image')
|
alt = attrs.get('alt', 'Broken image')
|
||||||
return ('', alt)
|
return ('', alt)
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,6 @@ class JingleFileTransfer(JingleContent):
|
||||||
self.continue_session_accept(stanza)
|
self.continue_session_accept(stanza)
|
||||||
|
|
||||||
def continue_session_accept(self, stanza):
|
def continue_session_accept(self, stanza):
|
||||||
con = self.session.connection
|
|
||||||
if self.state == State.TRANSPORT_REPLACE:
|
if self.state == State.TRANSPORT_REPLACE:
|
||||||
# If we are requesting we don't have the file
|
# If we are requesting we don't have the file
|
||||||
if self.session.werequest:
|
if self.session.werequest:
|
||||||
|
@ -300,7 +299,6 @@ class JingleFileTransfer(JingleContent):
|
||||||
app.socks5queue.listener.disconnect()
|
app.socks5queue.listener.disconnect()
|
||||||
if content.getTag('transport').getTag('activated'):
|
if content.getTag('transport').getTag('activated'):
|
||||||
self.state = State.TRANSFERING
|
self.state = State.TRANSFERING
|
||||||
jid = app.get_jid_without_resource(self.session.ourjid)
|
|
||||||
app.socks5queue.send_file(self.file_props,
|
app.socks5queue.send_file(self.file_props,
|
||||||
self.session.connection.name, 'client')
|
self.session.connection.name, 'client')
|
||||||
return
|
return
|
||||||
|
|
|
@ -213,7 +213,6 @@ class StateTransfering(JingleFileTransferStates):
|
||||||
= self.jft.transport._on_proxy_auth_ok
|
= self.jft.transport._on_proxy_auth_ok
|
||||||
# TODO: add on failure
|
# TODO: add on failure
|
||||||
else:
|
else:
|
||||||
jid = app.get_jid_without_resource(self.jft.session.ourjid)
|
|
||||||
app.socks5queue.send_file(self.jft.file_props,
|
app.socks5queue.send_file(self.jft.file_props,
|
||||||
self.jft.session.connection.name, mode)
|
self.jft.session.connection.name, mode)
|
||||||
|
|
||||||
|
|
|
@ -485,23 +485,22 @@ class JingleSession:
|
||||||
session-accept)
|
session-accept)
|
||||||
"""
|
"""
|
||||||
# check which contents are accepted
|
# check which contents are accepted
|
||||||
for content in jingle.iterTags('content'):
|
# for content in jingle.iterTags('content'):
|
||||||
creator = content['creator']
|
# creator = content['creator']
|
||||||
# TODO
|
# name = content['name']
|
||||||
name = content['name']
|
return
|
||||||
|
|
||||||
def __on_content_add(self, stanza, jingle, error, action):
|
def __on_content_add(self, stanza, jingle, error, action):
|
||||||
if self.state == JingleStates.ENDED:
|
if self.state == JingleStates.ENDED:
|
||||||
raise OutOfOrder
|
raise OutOfOrder
|
||||||
parse_result = self.__parse_contents(jingle)
|
parse_result = self.__parse_contents(jingle)
|
||||||
contents = parse_result[0]
|
contents = parse_result[0]
|
||||||
rejected_contents = parse_result[1]
|
# rejected_contents = parse_result[1]
|
||||||
# for name, creator in rejected_contents:
|
# for name, creator in rejected_contents:
|
||||||
# TODO
|
# content = JingleContent()
|
||||||
# content = JingleContent()
|
# self.add_content(name, content, creator)
|
||||||
# self.add_content(name, content, creator)
|
# self.__content_reject(content)
|
||||||
# self.__content_reject(content)
|
# self.contents[(content.creator, content.name)].destroy()
|
||||||
# self.contents[(content.creator, content.name)].destroy()
|
|
||||||
app.nec.push_incoming_event(JingleRequestReceivedEvent(None,
|
app.nec.push_incoming_event(JingleRequestReceivedEvent(None,
|
||||||
conn=self.connection,
|
conn=self.connection,
|
||||||
jingle_session=self,
|
jingle_session=self,
|
||||||
|
@ -523,7 +522,7 @@ class JingleSession:
|
||||||
# Jingle with unknown entities, it SHOULD return a <service-unavailable/>
|
# Jingle with unknown entities, it SHOULD return a <service-unavailable/>
|
||||||
# error.
|
# error.
|
||||||
# Lets check what kind of jingle session does the peer want
|
# Lets check what kind of jingle session does the peer want
|
||||||
contents, contents_rejected, reason_txt = self.__parse_contents(jingle)
|
contents, _contents_rejected, reason_txt = self.__parse_contents(jingle)
|
||||||
|
|
||||||
# If there's no content we understand...
|
# If there's no content we understand...
|
||||||
if not contents:
|
if not contents:
|
||||||
|
@ -626,7 +625,6 @@ class JingleSession:
|
||||||
contents_rejected = []
|
contents_rejected = []
|
||||||
reasons = set()
|
reasons = set()
|
||||||
for element in jingle.iterTags('content'):
|
for element in jingle.iterTags('content'):
|
||||||
senders = element.getAttr('senders')
|
|
||||||
transport = get_jingle_transport(element.getTag('transport'))
|
transport = get_jingle_transport(element.getTag('transport'))
|
||||||
if transport:
|
if transport:
|
||||||
transport.ourjid = self.ourjid
|
transport.ourjid = self.ourjid
|
||||||
|
|
|
@ -116,13 +116,13 @@ def get_context(fingerprint, verify_cb=None, remote_jid=None):
|
||||||
# First try user DH parameters, if this fails load the default DH parameters
|
# First try user DH parameters, if this fails load the default DH parameters
|
||||||
dh_params_name = os.path.join(configpaths.get('MY_CERT'), DH_PARAMS)
|
dh_params_name = os.path.join(configpaths.get('MY_CERT'), DH_PARAMS)
|
||||||
try:
|
try:
|
||||||
with open(dh_params_name, "r") as dh_params_file:
|
with open(dh_params_name, "r"):
|
||||||
ctx.load_tmp_dh(dh_params_name.encode('utf-8'))
|
ctx.load_tmp_dh(dh_params_name.encode('utf-8'))
|
||||||
except FileNotFoundError as err:
|
except FileNotFoundError as err:
|
||||||
default_dh_params_name = os.path.join(configpaths.get('DATA'),
|
default_dh_params_name = os.path.join(configpaths.get('DATA'),
|
||||||
'other', DEFAULT_DH_PARAMS)
|
'other', DEFAULT_DH_PARAMS)
|
||||||
try:
|
try:
|
||||||
with open(default_dh_params_name, "r") as default_dh_params_file:
|
with open(default_dh_params_name, "r"):
|
||||||
ctx.load_tmp_dh(default_dh_params_name.encode('utf-8'))
|
ctx.load_tmp_dh(default_dh_params_name.encode('utf-8'))
|
||||||
except FileNotFoundError as err:
|
except FileNotFoundError as err:
|
||||||
log.error('Unable to load default DH parameter file: %s, %s',
|
log.error('Unable to load default DH parameter file: %s, %s',
|
||||||
|
@ -193,7 +193,7 @@ def check_cert(jid, fingerprint):
|
||||||
try:
|
try:
|
||||||
digest_algo = cert.get_signature_algorithm().decode('utf-8').\
|
digest_algo = cert.get_signature_algorithm().decode('utf-8').\
|
||||||
split('With')[0]
|
split('With')[0]
|
||||||
except AttributeError as e:
|
except AttributeError:
|
||||||
# Old py-OpenSSL is missing get_signature_algorithm
|
# Old py-OpenSSL is missing get_signature_algorithm
|
||||||
digest_algo = "sha256"
|
digest_algo = "sha256"
|
||||||
if cert.digest(digest_algo) == fingerprint:
|
if cert.digest(digest_algo) == fingerprint:
|
||||||
|
|
|
@ -167,7 +167,7 @@ class Logger:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
con.executescript(statement)
|
con.executescript(statement)
|
||||||
except Exception as error:
|
except Exception:
|
||||||
log.exception('Error')
|
log.exception('Error')
|
||||||
con.close()
|
con.close()
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
|
@ -287,7 +287,7 @@ class Logger:
|
||||||
try:
|
try:
|
||||||
self._con.execute("ATTACH DATABASE '%s' AS cache" %
|
self._con.execute("ATTACH DATABASE '%s' AS cache" %
|
||||||
self._cache_db_path.replace("'", "''"))
|
self._cache_db_path.replace("'", "''"))
|
||||||
except Exception as error:
|
except Exception:
|
||||||
log.exception('Error')
|
log.exception('Error')
|
||||||
self._con.close()
|
self._con.close()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -298,7 +298,7 @@ class Logger:
|
||||||
self._con.execute("PRAGMA synchronous = NORMAL")
|
self._con.execute("PRAGMA synchronous = NORMAL")
|
||||||
else:
|
else:
|
||||||
self._con.execute("PRAGMA synchronous = OFF")
|
self._con.execute("PRAGMA synchronous = OFF")
|
||||||
except sqlite.Error as e:
|
except sqlite.Error:
|
||||||
log.exception('Error')
|
log.exception('Error')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -877,21 +877,20 @@ class Logger:
|
||||||
"""
|
"""
|
||||||
jids = self._get_family_jids(account, jid)
|
jids = self._get_family_jids(account, jid)
|
||||||
|
|
||||||
kinds = map(str, [KindConstant.STATUS,
|
|
||||||
KindConstant.GCSTATUS])
|
|
||||||
|
|
||||||
delta = datetime.timedelta(
|
delta = datetime.timedelta(
|
||||||
hours=23, minutes=59, seconds=59, microseconds=999999)
|
hours=23, minutes=59, seconds=59, microseconds=999999)
|
||||||
|
|
||||||
|
start = date.timestamp()
|
||||||
|
end = (date + delta).timestamp()
|
||||||
|
|
||||||
sql = '''
|
sql = '''
|
||||||
SELECT time
|
SELECT time
|
||||||
FROM logs NATURAL JOIN jids WHERE jid IN ({jids})
|
FROM logs NATURAL JOIN jids WHERE jid IN ({jids})
|
||||||
AND time BETWEEN ? AND ?
|
AND time BETWEEN ? AND ?
|
||||||
'''.format(jids=', '.join('?' * len(jids)))
|
'''.format(jids=', '.join('?' * len(jids)))
|
||||||
|
|
||||||
return self._con.execute(sql, tuple(jids) +
|
return self._con.execute(
|
||||||
(date.timestamp(),
|
sql, tuple(jids) + (start, end)).fetchone()
|
||||||
(date + delta).timestamp())).fetchone()
|
|
||||||
|
|
||||||
def get_room_last_message_time(self, account, jid):
|
def get_room_last_message_time(self, account, jid):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -338,7 +338,6 @@ class ConnectionSocks5Bytestream(ConnectionBytestream):
|
||||||
if file_props is None:
|
if file_props is None:
|
||||||
return
|
return
|
||||||
self.disconnect_transfer(file_props)
|
self.disconnect_transfer(file_props)
|
||||||
sid = file_props.sid
|
|
||||||
|
|
||||||
def disconnect_transfer(self, file_props):
|
def disconnect_transfer(self, file_props):
|
||||||
if file_props is None:
|
if file_props is None:
|
||||||
|
@ -434,7 +433,7 @@ class ConnectionSocks5Bytestream(ConnectionBytestream):
|
||||||
# check if we are connected with an IPv4 address
|
# check if we are connected with an IPv4 address
|
||||||
try:
|
try:
|
||||||
socket.inet_aton(my_ip)
|
socket.inet_aton(my_ip)
|
||||||
except socket.error as e:
|
except socket.error:
|
||||||
self.connection.send(iq)
|
self.connection.send(iq)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ class Proxy65Manager:
|
||||||
port = item.getAttr('port')
|
port = item.getAttr('port')
|
||||||
try:
|
try:
|
||||||
port = int(port)
|
port = int(port)
|
||||||
except (ValueError, TypeError) as e:
|
except (ValueError, TypeError):
|
||||||
port = 1080
|
port = 1080
|
||||||
if not host or not jid:
|
if not host or not jid:
|
||||||
self.proxies[proxy]._on_connect_failure()
|
self.proxies[proxy]._on_connect_failure()
|
||||||
|
|
|
@ -133,7 +133,7 @@ else:
|
||||||
"""
|
"""
|
||||||
self.pub.set_source(text, None)
|
self.pub.set_source(text, None)
|
||||||
self.pub.set_destination(destination, destination_path)
|
self.pub.set_destination(destination, destination_path)
|
||||||
output = self.pub.publish(enable_exit_status=enable_exit_status)
|
self.pub.publish(enable_exit_status=enable_exit_status)
|
||||||
# kludge until we can get docutils to stop generating (rare)
|
# kludge until we can get docutils to stop generating (rare)
|
||||||
# entities
|
# entities
|
||||||
return '\u00a0'.join(self.pub.writer.parts['fragment'].strip().split(
|
return '\u00a0'.join(self.pub.writer.parts['fragment'].strip().split(
|
||||||
|
|
|
@ -530,7 +530,7 @@ class Socks5:
|
||||||
self._sock.connect(self._server)
|
self._sock.connect(self._server)
|
||||||
self._send=self._sock.send
|
self._send=self._sock.send
|
||||||
self._recv=self._sock.recv
|
self._recv=self._sock.recv
|
||||||
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError) as e:
|
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError):
|
||||||
pass
|
pass
|
||||||
except Exception as ee:
|
except Exception as ee:
|
||||||
errnum = ee.errno
|
errnum = ee.errno
|
||||||
|
@ -1141,8 +1141,9 @@ class Socks5Server(Socks5):
|
||||||
self.idlequeue.set_read_timeout(self.fd, STALLED_TIMEOUT)
|
self.idlequeue.set_read_timeout(self.fd, STALLED_TIMEOUT)
|
||||||
result = self.start_transfer() # send
|
result = self.start_transfer() # send
|
||||||
self.queue.process_result(result, self)
|
self.queue.process_result(result, self)
|
||||||
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError,
|
except (OpenSSL.SSL.WantReadError,
|
||||||
OpenSSL.SSL.WantX509LookupError) as e:
|
OpenSSL.SSL.WantWriteError,
|
||||||
|
OpenSSL.SSL.WantX509LookupError):
|
||||||
log.info('caught SSL exception, ignored')
|
log.info('caught SSL exception, ignored')
|
||||||
else:
|
else:
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
|
@ -1179,8 +1180,9 @@ class Socks5Server(Socks5):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError,
|
except (OpenSSL.SSL.WantReadError,
|
||||||
OpenSSL.SSL.WantX509LookupError) as e:
|
OpenSSL.SSL.WantWriteError,
|
||||||
|
OpenSSL.SSL.WantX509LookupError):
|
||||||
log.info('caught SSL exception, ignored')
|
log.info('caught SSL exception, ignored')
|
||||||
return
|
return
|
||||||
if self.state < 5:
|
if self.state < 5:
|
||||||
|
@ -1221,15 +1223,17 @@ class Socks5Client(Socks5):
|
||||||
addrlen = 0
|
addrlen = 0
|
||||||
if address_type == 0x03:
|
if address_type == 0x03:
|
||||||
addrlen = buff[4]
|
addrlen = buff[4]
|
||||||
address = struct.unpack('!%ds' % addrlen, buff[5:addrlen + 5])
|
# address = struct.unpack('!%ds' % addrlen, buff[5:addrlen + 5])
|
||||||
portlen = len(buff[addrlen + 5:])
|
portlen = len(buff[addrlen + 5:])
|
||||||
if portlen == 1:
|
# if portlen == 1:
|
||||||
port, = struct.unpack('!B', buff[addrlen + 5])
|
# port, = struct.unpack('!B', buff[addrlen + 5])
|
||||||
elif portlen == 2:
|
# elif portlen == 2:
|
||||||
port, = struct.unpack('!H', buff[addrlen + 5:])
|
# port, = struct.unpack('!H', buff[addrlen + 5:])
|
||||||
else: # Gaim bug :)
|
# else: # Gaim bug :)
|
||||||
port, = struct.unpack('!H', buff[addrlen + 5:addrlen + 7])
|
# port, = struct.unpack('!H', buff[addrlen + 5:addrlen + 7])
|
||||||
|
if portlen not in (1, 2):
|
||||||
self.remaining_buff = buff[addrlen + 7:]
|
self.remaining_buff = buff[addrlen + 7:]
|
||||||
|
|
||||||
self.state = 5 # for senders: init file_props and send '\n'
|
self.state = 5 # for senders: init file_props and send '\n'
|
||||||
if self.queue.on_success:
|
if self.queue.on_success:
|
||||||
result = self.queue.send_success_reply(self.file_props,
|
result = self.queue.send_success_reply(self.file_props,
|
||||||
|
@ -1294,8 +1298,9 @@ class Socks5Client(Socks5):
|
||||||
self.idlequeue.set_read_timeout(self.fd, STALLED_TIMEOUT)
|
self.idlequeue.set_read_timeout(self.fd, STALLED_TIMEOUT)
|
||||||
result = self.start_transfer() # receive
|
result = self.start_transfer() # receive
|
||||||
self.queue.process_result(result, self)
|
self.queue.process_result(result, self)
|
||||||
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError,
|
except (OpenSSL.SSL.WantReadError,
|
||||||
OpenSSL.SSL.WantX509LookupError) as e:
|
OpenSSL.SSL.WantWriteError,
|
||||||
|
OpenSSL.SSL.WantX509LookupError):
|
||||||
log.info('caught SSL exception, ignored')
|
log.info('caught SSL exception, ignored')
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
@ -1318,8 +1323,9 @@ class Socks5Client(Socks5):
|
||||||
result = self.start_transfer() # send
|
result = self.start_transfer() # send
|
||||||
self.queue.process_result(result, self)
|
self.queue.process_result(result, self)
|
||||||
return
|
return
|
||||||
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError,
|
except (OpenSSL.SSL.WantReadError,
|
||||||
OpenSSL.SSL.WantX509LookupError) as e:
|
OpenSSL.SSL.WantWriteError,
|
||||||
|
OpenSSL.SSL.WantX509LookupError):
|
||||||
log.info('caught SSL exception, ignored')
|
log.info('caught SSL exception, ignored')
|
||||||
return
|
return
|
||||||
self.state += 1
|
self.state += 1
|
||||||
|
@ -1430,7 +1436,6 @@ class Socks5Listener(IdleObject):
|
||||||
# will fail when port as busy, or we don't have rights to bind
|
# will fail when port as busy, or we don't have rights to bind
|
||||||
try:
|
try:
|
||||||
self._serv.bind(ai[4])
|
self._serv.bind(ai[4])
|
||||||
f = ai[4]
|
|
||||||
self.ai = ai
|
self.ai = ai
|
||||||
break
|
break
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
@ -212,7 +212,7 @@ class P2PClient(IdleObject):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_message_sent(self, connection_id):
|
def on_message_sent(self, connection_id):
|
||||||
id_, thread_id = \
|
id_, _thread_id = \
|
||||||
self.conn_holder.ids_of_awaiting_messages[connection_id].pop(0)
|
self.conn_holder.ids_of_awaiting_messages[connection_id].pop(0)
|
||||||
if self.on_ok:
|
if self.on_ok:
|
||||||
self.on_ok(id_)
|
self.on_ok(id_)
|
||||||
|
@ -452,7 +452,7 @@ class P2PConnection(IdleObject, PlugIn):
|
||||||
def read_timeout(self):
|
def read_timeout(self):
|
||||||
ids = self.client.conn_holder.ids_of_awaiting_messages
|
ids = self.client.conn_holder.ids_of_awaiting_messages
|
||||||
if self.fd in ids and ids[self.fd]:
|
if self.fd in ids and ids[self.fd]:
|
||||||
for (id_, thread_id) in ids[self.fd]:
|
for (_id, thread_id) in ids[self.fd]:
|
||||||
if hasattr(self._owner, 'Dispatcher'):
|
if hasattr(self._owner, 'Dispatcher'):
|
||||||
self._owner.Dispatcher.Event('', DATA_ERROR, (
|
self._owner.Dispatcher.Event('', DATA_ERROR, (
|
||||||
self.client.to, thread_id))
|
self.client.to, thread_id))
|
||||||
|
|
|
@ -35,14 +35,14 @@ class ConstantRI(IntEnum):
|
||||||
|
|
||||||
def test_avahi():
|
def test_avahi():
|
||||||
try:
|
try:
|
||||||
import dbus
|
import dbus # pylint: disable=unused-variable
|
||||||
except ImportError:
|
except ImportError:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def test_bonjour():
|
def test_bonjour():
|
||||||
try:
|
try:
|
||||||
import pybonjour
|
import pybonjour # pylint: disable=unused-variable
|
||||||
except ImportError:
|
except ImportError:
|
||||||
return False
|
return False
|
||||||
except WindowsError: # pylint: disable=undefined-variable
|
except WindowsError: # pylint: disable=undefined-variable
|
||||||
|
|
|
@ -176,7 +176,7 @@ class Zeroconf:
|
||||||
resolved_info = [(interface, protocol, host, aprotocol, address, int(port))]
|
resolved_info = [(interface, protocol, host, aprotocol, address, int(port))]
|
||||||
if name in self.contacts:
|
if name in self.contacts:
|
||||||
# Decide whether to try to merge with existing resolved info:
|
# Decide whether to try to merge with existing resolved info:
|
||||||
old_name, old_domain, old_resolved_info, old_bare_name, old_txt = self.contacts[name]
|
old_name, old_domain, old_resolved_info, old_bare_name, _old_txt = self.contacts[name]
|
||||||
if name == old_name and domain == old_domain and bare_name == old_bare_name:
|
if name == old_name and domain == old_domain and bare_name == old_bare_name:
|
||||||
# Seems similar enough, try to merge resolved info:
|
# Seems similar enough, try to merge resolved info:
|
||||||
for i in range(len(old_resolved_info)):
|
for i in range(len(old_resolved_info)):
|
||||||
|
@ -210,7 +210,7 @@ class Zeroconf:
|
||||||
domain, host, aprotocol, address, port, txt, flags):
|
domain, host, aprotocol, address, port, txt, flags):
|
||||||
if not self.connected:
|
if not self.connected:
|
||||||
return
|
return
|
||||||
bare_name = name
|
|
||||||
if name.find('@') == -1:
|
if name.find('@') == -1:
|
||||||
name = name + '@' + name
|
name = name + '@' + name
|
||||||
# update TXT data only, as intended according to resolve_all comment
|
# update TXT data only, as intended according to resolve_all comment
|
||||||
|
|
|
@ -144,7 +144,7 @@ class Zeroconf:
|
||||||
log.error('Error in query_record_callback: %s', str(errorCode))
|
log.error('Error in query_record_callback: %s', str(errorCode))
|
||||||
return
|
return
|
||||||
|
|
||||||
name, bare_name, protocol, domain = self._parse_name(hosttarget)
|
name = self._parse_name(hosttarget)[0]
|
||||||
|
|
||||||
if name != self.name:
|
if name != self.name:
|
||||||
# update TXT data only, as intended according to
|
# update TXT data only, as intended according to
|
||||||
|
|
|
@ -696,9 +696,6 @@ class ConversationTextview(GObject.GObject):
|
||||||
childs[6].hide() # join group chat
|
childs[6].hide() # join group chat
|
||||||
childs[7].hide() # add to roster
|
childs[7].hide() # add to roster
|
||||||
else: # It's a mail or a JID
|
else: # It's a mail or a JID
|
||||||
# load muc icon
|
|
||||||
join_group_chat_menuitem = xml.get_object('join_group_chat_menuitem')
|
|
||||||
|
|
||||||
text = text.lower()
|
text = text.lower()
|
||||||
if text.startswith('xmpp:'):
|
if text.startswith('xmpp:'):
|
||||||
text = text[5:]
|
text = text[5:]
|
||||||
|
|
|
@ -1514,7 +1514,7 @@ class Dialog(Gtk.Dialog):
|
||||||
self.set_resizable(False)
|
self.set_resizable(False)
|
||||||
|
|
||||||
for stock, response in buttons:
|
for stock, response in buttons:
|
||||||
b = self.add_button(stock, response)
|
self.add_button(stock, response)
|
||||||
|
|
||||||
if default is not None:
|
if default is not None:
|
||||||
self.set_default_response(default)
|
self.set_default_response(default)
|
||||||
|
@ -1661,7 +1661,6 @@ class VoIPCallReceivedDialog:
|
||||||
if response == Gtk.ResponseType.YES:
|
if response == Gtk.ResponseType.YES:
|
||||||
#TODO: Ensure that ctrl.contact.resource == resource
|
#TODO: Ensure that ctrl.contact.resource == resource
|
||||||
jid = app.get_jid_without_resource(self.fjid)
|
jid = app.get_jid_without_resource(self.fjid)
|
||||||
resource = app.get_resource_from_jid(self.fjid)
|
|
||||||
ctrl = (app.interface.msg_win_mgr.get_control(self.fjid, self.account)
|
ctrl = (app.interface.msg_win_mgr.get_control(self.fjid, self.account)
|
||||||
or app.interface.msg_win_mgr.get_control(jid, self.account)
|
or app.interface.msg_win_mgr.get_control(jid, self.account)
|
||||||
or app.interface.new_chat_from_jid(self.account, jid))
|
or app.interface.new_chat_from_jid(self.account, jid))
|
||||||
|
|
|
@ -852,9 +852,9 @@ class AgentBrowser:
|
||||||
name = ''
|
name = ''
|
||||||
if len(identities) > 1:
|
if len(identities) > 1:
|
||||||
# Check if an identity with server category is present
|
# Check if an identity with server category is present
|
||||||
for i, _identity in enumerate(identities):
|
for _index, identity in enumerate(identities):
|
||||||
if _identity['category'] == 'server' and 'name' in _identity:
|
if identity['category'] == 'server' and 'name' in identity:
|
||||||
name = _identity['name']
|
name = identity['name']
|
||||||
break
|
break
|
||||||
elif 'name' in identities[0]:
|
elif 'name' in identities[0]:
|
||||||
name = identities[0]['name']
|
name = identities[0]['name']
|
||||||
|
|
|
@ -1092,7 +1092,6 @@ class GroupchatControl(ChatControlBase):
|
||||||
|
|
||||||
self.authentication_button.set_tooltip_text(tooltip)
|
self.authentication_button.set_tooltip_text(tooltip)
|
||||||
self.widget_set_visible(self.authentication_button, not visible)
|
self.widget_set_visible(self.authentication_button, not visible)
|
||||||
context = self.msg_scrolledwindow.get_style_context()
|
|
||||||
self.lock_image.set_sensitive(visible)
|
self.lock_image.set_sensitive(visible)
|
||||||
|
|
||||||
def _on_authentication_button_clicked(self, widget):
|
def _on_authentication_button_clicked(self, widget):
|
||||||
|
@ -1360,7 +1359,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
|
|
||||||
if kind == 'incoming': # it's a message NOT from us
|
if kind == 'incoming': # it's a message NOT from us
|
||||||
# highlighting and sounds
|
# highlighting and sounds
|
||||||
(highlight, sound) = self.highlighting_for_message(text, tim)
|
highlight, _sound = self.highlighting_for_message(text, tim)
|
||||||
if contact in self.gc_custom_colors:
|
if contact in self.gc_custom_colors:
|
||||||
other_tags_for_name.append('gc_nickname_color_' + \
|
other_tags_for_name.append('gc_nickname_color_' + \
|
||||||
str(self.gc_custom_colors[contact]))
|
str(self.gc_custom_colors[contact]))
|
||||||
|
|
|
@ -329,7 +329,7 @@ class ManageBookmarksWindow:
|
||||||
room_jid = room + '@' + server.strip()
|
room_jid = room + '@' + server.strip()
|
||||||
try:
|
try:
|
||||||
room_jid = helpers.parse_jid(room_jid)
|
room_jid = helpers.parse_jid(room_jid)
|
||||||
except helpers.InvalidFormat as e:
|
except helpers.InvalidFormat:
|
||||||
ErrorDialog(
|
ErrorDialog(
|
||||||
_('Invalid server'),
|
_('Invalid server'),
|
||||||
_('Character not allowed'),
|
_('Character not allowed'),
|
||||||
|
|
|
@ -699,7 +699,7 @@ class ChangeNickDialog(InputDialogCheck):
|
||||||
change_nick must be set to True when we are already occupant of the room
|
change_nick must be set to True when we are already occupant of the room
|
||||||
and we are changing our nick
|
and we are changing our nick
|
||||||
"""
|
"""
|
||||||
InputDialogCheck.__init__(self, title, '', checktext=check_text,
|
InputDialogCheck.__init__(self, title, '',
|
||||||
input_str='', is_modal=True, ok_handler=None,
|
input_str='', is_modal=True, ok_handler=None,
|
||||||
cancel_handler=None,
|
cancel_handler=None,
|
||||||
transient_for=transient_for)
|
transient_for=transient_for)
|
||||||
|
@ -735,14 +735,7 @@ class ChangeNickDialog(InputDialogCheck):
|
||||||
self.account, self.room_jid, self.prompt, self.change_nick = \
|
self.account, self.room_jid, self.prompt, self.change_nick = \
|
||||||
self.room_queue.pop(0)
|
self.room_queue.pop(0)
|
||||||
self.setup_dialog()
|
self.setup_dialog()
|
||||||
|
self.dialog.show()
|
||||||
if app.new_room_nick is not None and not app.gc_connected[
|
|
||||||
self.account][self.room_jid] and self.gc_control.nick != \
|
|
||||||
app.new_room_nick:
|
|
||||||
self.dialog.hide()
|
|
||||||
self.on_ok(app.new_room_nick, True)
|
|
||||||
else:
|
|
||||||
self.dialog.show()
|
|
||||||
|
|
||||||
def on_okbutton_clicked(self, widget):
|
def on_okbutton_clicked(self, widget):
|
||||||
nick = self.get_text()
|
nick = self.get_text()
|
||||||
|
@ -759,8 +752,6 @@ class ChangeNickDialog(InputDialogCheck):
|
||||||
self.on_ok(nick, self.is_checked())
|
self.on_ok(nick, self.is_checked())
|
||||||
|
|
||||||
def on_ok(self, nick, is_checked):
|
def on_ok(self, nick, is_checked):
|
||||||
if is_checked:
|
|
||||||
app.new_room_nick = nick
|
|
||||||
app.connections[self.account].join_gc(nick, self.room_jid, None,
|
app.connections[self.account].join_gc(nick, self.room_jid, None,
|
||||||
change_nick=self.change_nick)
|
change_nick=self.change_nick)
|
||||||
if app.gc_connected[self.account][self.room_jid]:
|
if app.gc_connected[self.account][self.room_jid]:
|
||||||
|
|
|
@ -159,7 +159,7 @@ class FeaturesDialog(Gtk.Dialog):
|
||||||
return True
|
return True
|
||||||
try:
|
try:
|
||||||
gi.require_version('Secret', '1')
|
gi.require_version('Secret', '1')
|
||||||
from gi.repository import Secret
|
from gi.repository import Secret # pylint: disable=unused-variable
|
||||||
except (ValueError, ImportError):
|
except (ValueError, ImportError):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -299,7 +299,7 @@ class HistoryWindow:
|
||||||
"""
|
"""
|
||||||
if jid_or_name and jid_or_name in self.completion_dict:
|
if jid_or_name and jid_or_name in self.completion_dict:
|
||||||
# a full qualified jid or a contact name was entered
|
# a full qualified jid or a contact name was entered
|
||||||
info_jid, info_account, info_name, info_completion = self.completion_dict[jid_or_name]
|
info_jid, info_account, _info_name, info_completion = self.completion_dict[jid_or_name]
|
||||||
self.jids_to_search = [info_jid]
|
self.jids_to_search = [info_jid]
|
||||||
self.jid = info_jid
|
self.jid = info_jid
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ class HistoryWindow:
|
||||||
"""
|
"""
|
||||||
if not self.jid:
|
if not self.jid:
|
||||||
return
|
return
|
||||||
year, month, day = widget.get_date() # integers
|
year, month, _day = widget.get_date() # integers
|
||||||
if year < 1900:
|
if year < 1900:
|
||||||
widget.select_month(0, 1900)
|
widget.select_month(0, 1900)
|
||||||
widget.select_day(1)
|
widget.select_day(1)
|
||||||
|
@ -400,8 +400,8 @@ class HistoryWindow:
|
||||||
try:
|
try:
|
||||||
log_days = app.logger.get_days_with_logs(
|
log_days = app.logger.get_days_with_logs(
|
||||||
self.account, self.jid, year, month)
|
self.account, self.jid, year, month)
|
||||||
except exceptions.PysqliteOperationalError as e:
|
except exceptions.PysqliteOperationalError as error:
|
||||||
ErrorDialog(_('Disk Error'), str(e))
|
ErrorDialog(_('Disk Error'), str(error))
|
||||||
return
|
return
|
||||||
|
|
||||||
for date in log_days:
|
for date in log_days:
|
||||||
|
|
|
@ -65,7 +65,7 @@ def get_icon_pixmap(icon_name, size=16, color=None, quiet=False):
|
||||||
if not iconinfo:
|
if not iconinfo:
|
||||||
raise GLib.GError
|
raise GLib.GError
|
||||||
if color:
|
if color:
|
||||||
pixbuf, was_symbolic = iconinfo.load_symbolic(*color)
|
pixbuf, _was_symbolic = iconinfo.load_symbolic(*color)
|
||||||
return pixbuf
|
return pixbuf
|
||||||
return iconinfo.load_icon()
|
return iconinfo.load_icon()
|
||||||
except GLib.GError as error:
|
except GLib.GError as error:
|
||||||
|
|
|
@ -174,10 +174,9 @@ class Interface:
|
||||||
'<b>%s</b>\n'
|
'<b>%s</b>\n'
|
||||||
'is in use or registered by another occupant.\n'
|
'is in use or registered by another occupant.\n'
|
||||||
'Please specify another nickname below:') % room_jid
|
'Please specify another nickname below:') % room_jid
|
||||||
check_text = _('Always use this nickname when there is a conflict')
|
|
||||||
if 'change_nick_dialog' in self.instances:
|
if 'change_nick_dialog' in self.instances:
|
||||||
self.instances['change_nick_dialog'].add_room(account, room_jid,
|
self.instances['change_nick_dialog'].add_room(
|
||||||
prompt)
|
account, room_jid, prompt)
|
||||||
else:
|
else:
|
||||||
self.instances['change_nick_dialog'] = ChangeNickDialog(
|
self.instances['change_nick_dialog'] = ChangeNickDialog(
|
||||||
account, room_jid, title, prompt, transient_for=parent_win)
|
account, room_jid, title, prompt, transient_for=parent_win)
|
||||||
|
@ -198,7 +197,7 @@ class Interface:
|
||||||
sec_msg = _('Do you accept this request on account %s?') % account
|
sec_msg = _('Do you accept this request on account %s?') % account
|
||||||
if obj.msg:
|
if obj.msg:
|
||||||
sec_msg = obj.msg + '\n' + sec_msg
|
sec_msg = obj.msg + '\n' + sec_msg
|
||||||
dialog = YesNoDialog(_('HTTP (%(method)s) Authorization for '
|
YesNoDialog(_('HTTP (%(method)s) Authorization for '
|
||||||
'%(url)s (ID: %(id)s)') % {'method': obj.method, 'url': obj.url,
|
'%(url)s (ID: %(id)s)') % {'method': obj.method, 'url': obj.url,
|
||||||
'id': obj.iq_id}, sec_msg, on_response_yes=(on_yes, obj),
|
'id': obj.iq_id}, sec_msg, on_response_yes=(on_yes, obj),
|
||||||
on_response_no=(response, obj, 'no'))
|
on_response_no=(response, obj, 'no'))
|
||||||
|
@ -207,7 +206,6 @@ class Interface:
|
||||||
#('ERROR_ANSWER', account, (id_, fjid, errmsg, errcode))
|
#('ERROR_ANSWER', account, (id_, fjid, errmsg, errcode))
|
||||||
if str(obj.errcode) in ('400', '403', '406') and obj.id_:
|
if str(obj.errcode) in ('400', '403', '406') and obj.id_:
|
||||||
# show the error dialog
|
# show the error dialog
|
||||||
ft = self.instances['file_transfers']
|
|
||||||
sid = obj.id_
|
sid = obj.id_
|
||||||
if len(obj.id_) > 3 and obj.id_[2] == '_':
|
if len(obj.id_) > 3 and obj.id_[2] == '_':
|
||||||
sid = obj.id_[3:]
|
sid = obj.id_[3:]
|
||||||
|
@ -392,11 +390,6 @@ class Interface:
|
||||||
# Contact changed show
|
# Contact changed show
|
||||||
account = obj.conn.name
|
account = obj.conn.name
|
||||||
jid = obj.jid
|
jid = obj.jid
|
||||||
show = obj.show
|
|
||||||
status = obj.status
|
|
||||||
resource = obj.resource or ''
|
|
||||||
|
|
||||||
jid_list = app.contacts.get_jid_list(account)
|
|
||||||
|
|
||||||
# unset custom status
|
# unset custom status
|
||||||
if (obj.old_show == 0 and obj.new_show > 1) or \
|
if (obj.old_show == 0 and obj.new_show > 1) or \
|
||||||
|
@ -415,9 +408,6 @@ class Interface:
|
||||||
GLib.timeout_add_seconds(30, self.unblock_signed_in_notifications,
|
GLib.timeout_add_seconds(30, self.unblock_signed_in_notifications,
|
||||||
account_jid)
|
account_jid)
|
||||||
|
|
||||||
highest = app.contacts.get_contact_with_highest_priority(account, jid)
|
|
||||||
is_highest = (highest and highest.resource == resource)
|
|
||||||
|
|
||||||
ctrl = self.msg_win_mgr.get_control(jid, account)
|
ctrl = self.msg_win_mgr.get_control(jid, account)
|
||||||
if ctrl and ctrl.session and len(obj.contact_list) > 1:
|
if ctrl and ctrl.session and len(obj.contact_list) > 1:
|
||||||
ctrl.remove_session(ctrl.session)
|
ctrl.remove_session(ctrl.session)
|
||||||
|
@ -1188,7 +1178,7 @@ class Interface:
|
||||||
def on_cancel():
|
def on_cancel():
|
||||||
obj.conn.change_status('offline', '')
|
obj.conn.change_status('offline', '')
|
||||||
|
|
||||||
dlg = InputDialog(_('Username Conflict'),
|
InputDialog(_('Username Conflict'),
|
||||||
_('Please type a new username for your local account'),
|
_('Please type a new username for your local account'),
|
||||||
input_str=obj.alt_name, is_modal=True, ok_handler=on_ok,
|
input_str=obj.alt_name, is_modal=True, ok_handler=on_ok,
|
||||||
cancel_handler=on_cancel, transient_for=self.roster.window)
|
cancel_handler=on_cancel, transient_for=self.roster.window)
|
||||||
|
@ -1212,7 +1202,7 @@ class Interface:
|
||||||
return
|
return
|
||||||
|
|
||||||
proposed_resource += app.config.get('gc_proposed_nick_char')
|
proposed_resource += app.config.get('gc_proposed_nick_char')
|
||||||
dlg = dialogs.ResourceConflictDialog(_('Resource Conflict'),
|
dialogs.ResourceConflictDialog(_('Resource Conflict'),
|
||||||
_('You are already connected to this account with the same '
|
_('You are already connected to this account with the same '
|
||||||
'resource. Please type a new one'), resource=proposed_resource,
|
'resource. Please type a new one'), resource=proposed_resource,
|
||||||
ok_handler=on_ok)
|
ok_handler=on_ok)
|
||||||
|
@ -1618,7 +1608,7 @@ class Interface:
|
||||||
# events.
|
# events.
|
||||||
family = app.contacts.get_metacontacts_family(account, jid)
|
family = app.contacts.get_metacontacts_family(account, jid)
|
||||||
if family:
|
if family:
|
||||||
nearby_family, bb_jid, bb_account = \
|
_nearby_family, bb_jid, bb_account = \
|
||||||
app.contacts.get_nearby_family_and_big_brother(family,
|
app.contacts.get_nearby_family_and_big_brother(family,
|
||||||
account)
|
account)
|
||||||
else:
|
else:
|
||||||
|
@ -1628,7 +1618,6 @@ class Interface:
|
||||||
def handle_event(self, account, fjid, type_):
|
def handle_event(self, account, fjid, type_):
|
||||||
w = None
|
w = None
|
||||||
ctrl = None
|
ctrl = None
|
||||||
session = None
|
|
||||||
|
|
||||||
resource = app.get_resource_from_jid(fjid)
|
resource = app.get_resource_from_jid(fjid)
|
||||||
jid = app.get_jid_without_resource(fjid)
|
jid = app.get_jid_without_resource(fjid)
|
||||||
|
@ -2228,7 +2217,7 @@ class Interface:
|
||||||
self.roster.send_status(a, show, message)
|
self.roster.send_status(a, show, message)
|
||||||
self.roster.send_pep(a, pep_dict)
|
self.roster.send_pep(a, pep_dict)
|
||||||
for show in shows:
|
for show in shows:
|
||||||
message = self.roster.get_status_message(show, on_message)
|
self.roster.get_status_message(show, on_message)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def show_systray(self):
|
def show_systray(self):
|
||||||
|
@ -2379,7 +2368,7 @@ class Interface:
|
||||||
path, size, size, True)
|
path, size, size, True)
|
||||||
else:
|
else:
|
||||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file(path)
|
pixbuf = GdkPixbuf.Pixbuf.new_from_file(path)
|
||||||
except GLib.GError as error:
|
except GLib.GError:
|
||||||
app.log('avatar').info(
|
app.log('avatar').info(
|
||||||
'loading avatar %s failed. Try to convert '
|
'loading avatar %s failed. Try to convert '
|
||||||
'avatar image using pillow', filename)
|
'avatar image using pillow', filename)
|
||||||
|
@ -2735,8 +2724,8 @@ class Interface:
|
||||||
|
|
||||||
# Handle screensaver
|
# Handle screensaver
|
||||||
if sys.platform == 'linux':
|
if sys.platform == 'linux':
|
||||||
from gajim import logind_listener
|
from gajim import logind_listener # pylint: disable=unused-variable
|
||||||
from gajim import screensaver_listener
|
from gajim import screensaver_listener # pylint: disable=unused-variable
|
||||||
|
|
||||||
self.show_vcard_when_connect = []
|
self.show_vcard_when_connect = []
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,6 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# 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
|
|
||||||
|
|
||||||
from gi.repository import Gtk, Gio, GLib
|
from gi.repository import Gtk, Gio, GLib
|
||||||
from nbxmpp.protocol import NS_COMMANDS, NS_FILE, NS_MUC
|
from nbxmpp.protocol import NS_COMMANDS, NS_FILE, NS_MUC
|
||||||
from nbxmpp.protocol import NS_JINGLE_FILE_TRANSFER_5, NS_CONFERENCE
|
from nbxmpp.protocol import NS_JINGLE_FILE_TRANSFER_5, NS_CONFERENCE
|
||||||
|
@ -39,7 +37,6 @@ def build_resources_submenu(contacts, account, action, room_jid=None,
|
||||||
iconset = app.config.get('iconset')
|
iconset = app.config.get('iconset')
|
||||||
if not iconset:
|
if not iconset:
|
||||||
iconset = app.config.DEFAULT_ICONSET
|
iconset = app.config.DEFAULT_ICONSET
|
||||||
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
|
|
||||||
for c in contacts:
|
for c in contacts:
|
||||||
item = Gtk.MenuItem.new_with_label(
|
item = Gtk.MenuItem.new_with_label(
|
||||||
'%s (%s)' % (c.resource, str(c.priority)))
|
'%s (%s)' % (c.resource, str(c.priority)))
|
||||||
|
@ -171,7 +168,7 @@ show_bookmarked=False, force_resource=False):
|
||||||
for account in connected_accounts:
|
for account in connected_accounts:
|
||||||
con = app.connections[account]
|
con = app.connections[account]
|
||||||
boomarks = con.get_module('Bookmarks').bookmarks
|
boomarks = con.get_module('Bookmarks').bookmarks
|
||||||
for jid, bookmark in boomarks.items():
|
for jid in boomarks.keys():
|
||||||
if jid in r_jids:
|
if jid in r_jids:
|
||||||
continue
|
continue
|
||||||
if jid not in app.gc_connected[account] or not \
|
if jid not in app.gc_connected[account] or not \
|
||||||
|
@ -222,8 +219,6 @@ control=None, gc_contact=None, is_anonymous=True):
|
||||||
edit_groups_menuitem = xml.get_object('edit_groups_menuitem')
|
edit_groups_menuitem = xml.get_object('edit_groups_menuitem')
|
||||||
send_file_menuitem = xml.get_object('send_file_menuitem')
|
send_file_menuitem = xml.get_object('send_file_menuitem')
|
||||||
assign_openpgp_key_menuitem = xml.get_object('assign_openpgp_key_menuitem')
|
assign_openpgp_key_menuitem = xml.get_object('assign_openpgp_key_menuitem')
|
||||||
add_special_notification_menuitem = xml.get_object(
|
|
||||||
'add_special_notification_menuitem')
|
|
||||||
information_menuitem = xml.get_object('information_menuitem')
|
information_menuitem = xml.get_object('information_menuitem')
|
||||||
history_menuitem = xml.get_object('history_menuitem')
|
history_menuitem = xml.get_object('history_menuitem')
|
||||||
send_custom_status_menuitem = xml.get_object('send_custom_status_menuitem')
|
send_custom_status_menuitem = xml.get_object('send_custom_status_menuitem')
|
||||||
|
|
|
@ -530,7 +530,6 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
'''Process a img tag.
|
'''Process a img tag.
|
||||||
'''
|
'''
|
||||||
mem = ''
|
mem = ''
|
||||||
update = False
|
|
||||||
pixbuf = None
|
pixbuf = None
|
||||||
replace_mark = None
|
replace_mark = None
|
||||||
replace_tags = None
|
replace_tags = None
|
||||||
|
@ -544,7 +543,6 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
||||||
img).encode('utf-8'))
|
img).encode('utf-8'))
|
||||||
elif loaded is not None:
|
elif loaded is not None:
|
||||||
(mem, alt, replace_mark, replace_tags) = loaded
|
(mem, alt, replace_mark, replace_tags) = loaded
|
||||||
update = True
|
|
||||||
else:
|
else:
|
||||||
if self.conv_textview:
|
if self.conv_textview:
|
||||||
img_mark = self.textbuf.create_mark(None, self.iter, True)
|
img_mark = self.textbuf.create_mark(None, self.iter, True)
|
||||||
|
@ -929,9 +927,6 @@ class HtmlTextView(Gtk.TextView):
|
||||||
childs[6].hide() # join group chat
|
childs[6].hide() # join group chat
|
||||||
childs[7].hide() # add to roster
|
childs[7].hide() # add to roster
|
||||||
else: # It's a mail or a JID
|
else: # It's a mail or a JID
|
||||||
# load muc icon
|
|
||||||
join_group_chat_menuitem = ui.get_object('join_group_chat_menuitem')
|
|
||||||
|
|
||||||
text = text.lower()
|
text = text.lower()
|
||||||
if text.startswith('xmpp:'):
|
if text.startswith('xmpp:'):
|
||||||
text = text[5:]
|
text = text[5:]
|
||||||
|
@ -1125,14 +1120,11 @@ if __name__ == '__main__':
|
||||||
if change_cursor:
|
if change_cursor:
|
||||||
w.set_cursor(get_cursor('XTERM'))
|
w.set_cursor(get_cursor('XTERM'))
|
||||||
change_cursor = None
|
change_cursor = None
|
||||||
tag_table = htmlview.tv.get_buffer().get_tag_table()
|
|
||||||
for tag in tags:
|
for tag in tags:
|
||||||
try:
|
try:
|
||||||
if tag.is_anchor:
|
if tag.is_anchor:
|
||||||
w.set_cursor(get_cursor('HAND2'))
|
w.set_cursor(get_cursor('HAND2'))
|
||||||
change_cursor = tag
|
change_cursor = tag
|
||||||
elif tag == tag_table.lookup('focus-out-line'):
|
|
||||||
over_line = True
|
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -59,28 +59,28 @@ class MessageTextView(Gtk.TextView):
|
||||||
# needed to know if we undid something
|
# needed to know if we undid something
|
||||||
self.undo_pressed = False
|
self.undo_pressed = False
|
||||||
|
|
||||||
_buffer = self.get_buffer()
|
buffer_ = self.get_buffer()
|
||||||
self.begin_tags = {}
|
self.begin_tags = {}
|
||||||
self.end_tags = {}
|
self.end_tags = {}
|
||||||
self.color_tags = []
|
self.color_tags = []
|
||||||
self.fonts_tags = []
|
self.fonts_tags = []
|
||||||
self.other_tags = {}
|
self.other_tags = {}
|
||||||
self.placeholder_tag = _buffer.create_tag('placeholder')
|
self.placeholder_tag = buffer_.create_tag('placeholder')
|
||||||
self.placeholder_tag.set_property('foreground_rgba',
|
self.placeholder_tag.set_property('foreground_rgba',
|
||||||
gtkgui_helpers.Color.GREY)
|
gtkgui_helpers.Color.GREY)
|
||||||
self.other_tags['bold'] = _buffer.create_tag('bold')
|
self.other_tags['bold'] = buffer_.create_tag('bold')
|
||||||
self.other_tags['bold'].set_property('weight', Pango.Weight.BOLD)
|
self.other_tags['bold'].set_property('weight', Pango.Weight.BOLD)
|
||||||
self.begin_tags['bold'] = '<strong>'
|
self.begin_tags['bold'] = '<strong>'
|
||||||
self.end_tags['bold'] = '</strong>'
|
self.end_tags['bold'] = '</strong>'
|
||||||
self.other_tags['italic'] = _buffer.create_tag('italic')
|
self.other_tags['italic'] = buffer_.create_tag('italic')
|
||||||
self.other_tags['italic'].set_property('style', Pango.Style.ITALIC)
|
self.other_tags['italic'].set_property('style', Pango.Style.ITALIC)
|
||||||
self.begin_tags['italic'] = '<em>'
|
self.begin_tags['italic'] = '<em>'
|
||||||
self.end_tags['italic'] = '</em>'
|
self.end_tags['italic'] = '</em>'
|
||||||
self.other_tags['underline'] = _buffer.create_tag('underline')
|
self.other_tags['underline'] = buffer_.create_tag('underline')
|
||||||
self.other_tags['underline'].set_property('underline', Pango.Underline.SINGLE)
|
self.other_tags['underline'].set_property('underline', Pango.Underline.SINGLE)
|
||||||
self.begin_tags['underline'] = '<span style="text-decoration: underline;">'
|
self.begin_tags['underline'] = '<span style="text-decoration: underline;">'
|
||||||
self.end_tags['underline'] = '</span>'
|
self.end_tags['underline'] = '</span>'
|
||||||
self.other_tags['strike'] = _buffer.create_tag('strike')
|
self.other_tags['strike'] = buffer_.create_tag('strike')
|
||||||
self.other_tags['strike'].set_property('strikethrough', True)
|
self.other_tags['strike'].set_property('strikethrough', True)
|
||||||
self.begin_tags['strike'] = '<span style="text-decoration: line-through;">'
|
self.begin_tags['strike'] = '<span style="text-decoration: line-through;">'
|
||||||
self.end_tags['strike'] = '</span>'
|
self.end_tags['strike'] = '</span>'
|
||||||
|
@ -90,8 +90,8 @@ class MessageTextView(Gtk.TextView):
|
||||||
self.connect('focus-in-event', self._on_focus_in)
|
self.connect('focus-in-event', self._on_focus_in)
|
||||||
self.connect('focus-out-event', self._on_focus_out)
|
self.connect('focus-out-event', self._on_focus_out)
|
||||||
|
|
||||||
start, end = _buffer.get_bounds()
|
start = buffer_.get_bounds()[0]
|
||||||
_buffer.insert_with_tags(
|
buffer_.insert_with_tags(
|
||||||
start, self.PLACEHOLDER, self.placeholder_tag)
|
start, self.PLACEHOLDER, self.placeholder_tag)
|
||||||
|
|
||||||
def has_text(self):
|
def has_text(self):
|
||||||
|
@ -178,7 +178,7 @@ class MessageTextView(Gtk.TextView):
|
||||||
return new_text # the position after *last* special text
|
return new_text # the position after *last* special text
|
||||||
|
|
||||||
def get_active_tags(self):
|
def get_active_tags(self):
|
||||||
start, finish = self.get_active_iters()
|
start = self.get_active_iters()[0]
|
||||||
active_tags = []
|
active_tags = []
|
||||||
for tag in start.get_tags():
|
for tag in start.get_tags():
|
||||||
active_tags.append(tag.get_property('name'))
|
active_tags.append(tag.get_property('name'))
|
||||||
|
|
|
@ -253,7 +253,7 @@ class PluginsWindow:
|
||||||
return
|
return
|
||||||
model = self.installed_plugins_model
|
model = self.installed_plugins_model
|
||||||
|
|
||||||
for i, row in enumerate(model):
|
for _index, row in enumerate(model):
|
||||||
if plugin == row[Column.PLUGIN]:
|
if plugin == row[Column.PLUGIN]:
|
||||||
model.remove(row.iter)
|
model.remove(row.iter)
|
||||||
break
|
break
|
||||||
|
|
|
@ -314,7 +314,7 @@ class PluginManager(metaclass=Singleton):
|
||||||
gui_extpoint_name]:
|
gui_extpoint_name]:
|
||||||
try:
|
try:
|
||||||
handlers[0](*args)
|
handlers[0](*args)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
log.warning('Error executing %s',
|
log.warning('Error executing %s',
|
||||||
handlers[0], exc_info=True)
|
handlers[0], exc_info=True)
|
||||||
|
|
||||||
|
|
|
@ -511,15 +511,12 @@ class GajimRemote(Server):
|
||||||
if not keyID:
|
if not keyID:
|
||||||
keyID = ''
|
keyID = ''
|
||||||
|
|
||||||
connected_account, contact = self._get_account_and_contact(
|
connected_account = self._get_account_and_contact(account, jid)[0]
|
||||||
account, jid)
|
|
||||||
if connected_account:
|
if connected_account:
|
||||||
connection = app.connections[connected_account]
|
connection = app.connections[connected_account]
|
||||||
sessions = connection.get_sessions(jid)
|
sessions = connection.get_sessions(jid)
|
||||||
if sessions:
|
if not sessions:
|
||||||
session = sessions[0]
|
connection.make_new_session(jid)
|
||||||
else:
|
|
||||||
session = connection.make_new_session(jid)
|
|
||||||
ctrl = app.interface.msg_win_mgr.search_control(
|
ctrl = app.interface.msg_win_mgr.search_control(
|
||||||
jid, connected_account)
|
jid, connected_account)
|
||||||
if ctrl:
|
if ctrl:
|
||||||
|
@ -563,7 +560,6 @@ class GajimRemote(Server):
|
||||||
return False
|
return False
|
||||||
connected_account = self._get_account_for_groupchat(account, room_jid)
|
connected_account = self._get_account_for_groupchat(account, room_jid)
|
||||||
if connected_account:
|
if connected_account:
|
||||||
connection = app.connections[connected_account]
|
|
||||||
app.nec.push_outgoing_event(
|
app.nec.push_outgoing_event(
|
||||||
GcMessageOutgoingEvent(
|
GcMessageOutgoingEvent(
|
||||||
None,
|
None,
|
||||||
|
|
|
@ -2728,7 +2728,7 @@ class RosterWindow:
|
||||||
family = app.contacts.get_metacontacts_family(obj.conn.name,
|
family = app.contacts.get_metacontacts_family(obj.conn.name,
|
||||||
obj.jid)
|
obj.jid)
|
||||||
if family:
|
if family:
|
||||||
nearby_family, bb_jid, bb_account = \
|
_nearby_family, bb_jid, bb_account = \
|
||||||
app.contacts.get_nearby_family_and_big_brother(family,
|
app.contacts.get_nearby_family_and_big_brother(family,
|
||||||
obj.conn.name)
|
obj.conn.name)
|
||||||
else:
|
else:
|
||||||
|
@ -3453,7 +3453,7 @@ class RosterWindow:
|
||||||
# several contact to remove at the same time
|
# several contact to remove at the same time
|
||||||
pritext = _('Contacts will be removed from your roster')
|
pritext = _('Contacts will be removed from your roster')
|
||||||
jids = ''
|
jids = ''
|
||||||
for (contact, account) in list_:
|
for contact, _account in list_:
|
||||||
jids += '\n ' + contact.get_shown_name() + ' (%s)' % \
|
jids += '\n ' + contact.get_shown_name() + ' (%s)' % \
|
||||||
contact.jid + ','
|
contact.jid + ','
|
||||||
sectext = _('By removing these contacts:%s\nyou also remove '
|
sectext = _('By removing these contacts:%s\nyou also remove '
|
||||||
|
@ -4742,7 +4742,7 @@ class RosterWindow:
|
||||||
type_ = model[titer][Column.TYPE]
|
type_ = model[titer][Column.TYPE]
|
||||||
except TypeError:
|
except TypeError:
|
||||||
return
|
return
|
||||||
theme = app.config.get('roster_theme')
|
|
||||||
if type_ == 'account':
|
if type_ == 'account':
|
||||||
color = app.css_config.get_value('.gajim-account-row', StyleAttr.COLOR)
|
color = app.css_config.get_value('.gajim-account-row', StyleAttr.COLOR)
|
||||||
renderer.set_property('foreground', color)
|
renderer.set_property('foreground', color)
|
||||||
|
@ -4875,12 +4875,10 @@ class RosterWindow:
|
||||||
renderer.set_property('visible', False)
|
renderer.set_property('visible', False)
|
||||||
|
|
||||||
def _set_account_row_background_color(self, renderer):
|
def _set_account_row_background_color(self, renderer):
|
||||||
theme = app.config.get('roster_theme')
|
|
||||||
color = app.css_config.get_value('.gajim-account-row', StyleAttr.BACKGROUND)
|
color = app.css_config.get_value('.gajim-account-row', StyleAttr.BACKGROUND)
|
||||||
renderer.set_property('cell-background', color)
|
renderer.set_property('cell-background', color)
|
||||||
|
|
||||||
def _set_contact_row_background_color(self, renderer, jid, account):
|
def _set_contact_row_background_color(self, renderer, jid, account):
|
||||||
theme = app.config.get('roster_theme')
|
|
||||||
if jid in app.newly_added[account]:
|
if jid in app.newly_added[account]:
|
||||||
renderer.set_property('cell-background', app.css_config.get_value(
|
renderer.set_property('cell-background', app.css_config.get_value(
|
||||||
'.gajim-roster-connected', StyleAttr.BACKGROUND))
|
'.gajim-roster-connected', StyleAttr.BACKGROUND))
|
||||||
|
@ -4892,7 +4890,6 @@ class RosterWindow:
|
||||||
renderer.set_property('cell-background', color)
|
renderer.set_property('cell-background', color)
|
||||||
|
|
||||||
def _set_group_row_background_color(self, renderer):
|
def _set_group_row_background_color(self, renderer):
|
||||||
theme = app.config.get('roster_theme')
|
|
||||||
color = app.css_config.get_value('.gajim-group-row', 'background')
|
color = app.css_config.get_value('.gajim-group-row', 'background')
|
||||||
renderer.set_property('cell-background', color)
|
renderer.set_property('cell-background', color)
|
||||||
|
|
||||||
|
@ -4904,9 +4901,6 @@ class RosterWindow:
|
||||||
def build_account_menu(self, account):
|
def build_account_menu(self, account):
|
||||||
# we have to create our own set of icons for the menu
|
# we have to create our own set of icons for the menu
|
||||||
# using self.jabber_status_images is poopoo
|
# using self.jabber_status_images is poopoo
|
||||||
iconset = app.config.get('iconset')
|
|
||||||
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
|
|
||||||
|
|
||||||
if not app.config.get_per('accounts', account, 'is_zeroconf'):
|
if not app.config.get_per('accounts', account, 'is_zeroconf'):
|
||||||
xml = gtkgui_helpers.get_gtk_builder('account_context_menu.ui')
|
xml = gtkgui_helpers.get_gtk_builder('account_context_menu.ui')
|
||||||
account_context_menu = xml.get_object('account_context_menu')
|
account_context_menu = xml.get_object('account_context_menu')
|
||||||
|
@ -5063,8 +5057,6 @@ class RosterWindow:
|
||||||
menu = self.build_account_menu(account)
|
menu = self.build_account_menu(account)
|
||||||
else:
|
else:
|
||||||
menu = Gtk.Menu()
|
menu = Gtk.Menu()
|
||||||
iconset = app.config.get('iconset')
|
|
||||||
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
|
|
||||||
accounts = [] # Put accounts in a list to sort them
|
accounts = [] # Put accounts in a list to sort them
|
||||||
for account in app.connections:
|
for account in app.connections:
|
||||||
accounts.append(account)
|
accounts.append(account)
|
||||||
|
@ -5088,7 +5080,6 @@ class RosterWindow:
|
||||||
Make group's popup menu
|
Make group's popup menu
|
||||||
"""
|
"""
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
path = model.get_path(titer)
|
|
||||||
group = model[titer][Column.JID]
|
group = model[titer][Column.JID]
|
||||||
account = model[titer][Column.ACCOUNT]
|
account = model[titer][Column.ACCOUNT]
|
||||||
|
|
||||||
|
@ -5155,8 +5146,6 @@ class RosterWindow:
|
||||||
send_custom_status_menuitem.set_sensitive(False)
|
send_custom_status_menuitem.set_sensitive(False)
|
||||||
status_menuitems = Gtk.Menu()
|
status_menuitems = Gtk.Menu()
|
||||||
send_custom_status_menuitem.set_submenu(status_menuitems)
|
send_custom_status_menuitem.set_submenu(status_menuitems)
|
||||||
iconset = app.config.get('iconset')
|
|
||||||
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
|
|
||||||
for s in ('online', 'chat', 'away', 'xa', 'dnd', 'offline'):
|
for s in ('online', 'chat', 'away', 'xa', 'dnd', 'offline'):
|
||||||
status_menuitem = Gtk.MenuItem.new_with_label(
|
status_menuitem = Gtk.MenuItem.new_with_label(
|
||||||
helpers.get_uf_show(s))
|
helpers.get_uf_show(s))
|
||||||
|
@ -5343,7 +5332,6 @@ class RosterWindow:
|
||||||
"""
|
"""
|
||||||
model = self.modelfilter
|
model = self.modelfilter
|
||||||
jid = model[titer][Column.JID]
|
jid = model[titer][Column.JID]
|
||||||
path = model.get_path(titer)
|
|
||||||
account = model[titer][Column.ACCOUNT]
|
account = model[titer][Column.ACCOUNT]
|
||||||
contact = app.contacts.get_contact_with_highest_priority(account, jid)
|
contact = app.contacts.get_contact_with_highest_priority(account, jid)
|
||||||
menu = gui_menu_builder.get_transport_menu(contact, account)
|
menu = gui_menu_builder.get_transport_menu(contact, account)
|
||||||
|
|
|
@ -171,14 +171,6 @@ class ChatControlSession:
|
||||||
self.conn.name, obj.jid) and not pm:
|
self.conn.name, obj.jid) and not pm:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
highest_contact = app.contacts.get_contact_with_highest_priority(
|
|
||||||
self.conn.name, obj.jid)
|
|
||||||
|
|
||||||
# does this resource have the highest priority of any available?
|
|
||||||
is_highest = not highest_contact or not highest_contact.resource or \
|
|
||||||
obj.resource == highest_contact.resource or highest_contact.show ==\
|
|
||||||
'offline'
|
|
||||||
|
|
||||||
if not self.control:
|
if not self.control:
|
||||||
ctrl = app.interface.msg_win_mgr.search_control(obj.jid,
|
ctrl = app.interface.msg_win_mgr.search_control(obj.jid,
|
||||||
obj.conn.name, obj.resource)
|
obj.conn.name, obj.resource)
|
||||||
|
@ -414,7 +406,7 @@ class ChatControlSession:
|
||||||
# events.
|
# events.
|
||||||
family = app.contacts.get_metacontacts_family(self.conn.name, jid)
|
family = app.contacts.get_metacontacts_family(self.conn.name, jid)
|
||||||
if family:
|
if family:
|
||||||
nearby_family, bb_jid, bb_account = \
|
_nearby_family, bb_jid, bb_account = \
|
||||||
app.contacts.get_nearby_family_and_big_brother(family,
|
app.contacts.get_nearby_family_and_big_brother(family,
|
||||||
self.conn.name)
|
self.conn.name)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -195,10 +195,6 @@ class StatusIcon:
|
||||||
gc_sub_menu = Gtk.Menu() # gc is always a submenu
|
gc_sub_menu = Gtk.Menu() # gc is always a submenu
|
||||||
join_gc_menuitem.set_submenu(gc_sub_menu)
|
join_gc_menuitem.set_submenu(gc_sub_menu)
|
||||||
|
|
||||||
# We need our own set of status icons, let's make 'em!
|
|
||||||
iconset = app.config.get('iconset')
|
|
||||||
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
|
|
||||||
|
|
||||||
for show in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible'):
|
for show in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible'):
|
||||||
uf_show = helpers.get_uf_show(show, use_mnemonic=True)
|
uf_show = helpers.get_uf_show(show, use_mnemonic=True)
|
||||||
item = Gtk.MenuItem.new_with_mnemonic(uf_show)
|
item = Gtk.MenuItem.new_with_mnemonic(uf_show)
|
||||||
|
|
Loading…
Reference in New Issue