Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
7373fe86 by lovetox at 2021-09-11T13:25:53+02:00
AdHoc: Make parsing actions more robust
- Ignore unknown actions instead of failing
- Don’t fail on duplicated actions
- - - - -
1 changed file:
- nbxmpp/modules/adhoc.py
Changes:
=====================================
nbxmpp/modules/adhoc.py
=====================================
@@ -151,27 +151,14 @@ def _parse_notes(command):
def _parse_actions(command):
if command.getAttr('status') != 'executing':
- return [], None
+ return set(), None
actions_node = command.getTag('actions')
if actions_node is None:
# If there is no <actions/> element,
# the user-agent can use a single-stage dialog or view.
# The action "execute" is equivalent to the action "complete".
- return [AdHocAction.CANCEL, AdHocAction.COMPLETE], AdHocAction.COMPLETE
-
- actions = []
- for action in actions_node.getChildren():
- name = action.getName()
- if name not in ('prev', 'next', 'complete'):
- raise ValueError('invalid action name: %s' % name)
- actions.append(AdHocAction(name))
-
- if not actions:
- raise ValueError('actions element without actions')
-
- # The action "cancel" is always allowed.
- actions.append(AdHocAction.CANCEL)
+ return {AdHocAction.CANCEL, AdHocAction.COMPLETE}, AdHocAction.COMPLETE
default = actions_node.getAttr('execute')
if default is None:
@@ -183,13 +170,31 @@ def _parse_actions(command):
default = AdHocAction(default)
+ # We use a set because it cannot contain duplicates
+ actions = set()
+ for action in actions_node.getChildren():
+ name = action.getName()
+ if name == 'execute':
+ actions.add(default)
+
+ if name in ('prev', 'next', 'complete'):
+ actions.add(AdHocAction(name))
+
+ if not actions:
+ raise ValueError('actions element without actions')
+
+ # The action "cancel" is always allowed.
+ actions.add(AdHocAction.CANCEL)
+
# A form which has an <actions/> element and an "execute" attribute
# which evaluates (taking the default into account if absent) to an
# action which is not allowed is therefore invalid.
if default not in actions:
# Some implementations don’t respect this rule.
# Take the first action so we don’t fail here.
- default = actions[0]
+ for act in actions:
+ default = act
+ break
return actions, default
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/7373fe86752471d8ed25b0d0…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/7373fe86752471d8ed25b0d0…
You're receiving this email because of your account on dev.gajim.org.
Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits:
397b68fc by wurstsalat at 2021-09-11T11:31:07+02:00
ServiceRegistration: Add line wrap for error text
- - - - -
1 changed file:
- gajim/gtk/service_registration.py
Changes:
=====================================
gajim/gtk/service_registration.py
=====================================
@@ -218,8 +218,9 @@ def __init__(self):
icon.get_style_context().add_class('error-color')
icon.set_valign(Gtk.Align.END)
self._label = Gtk.Label()
- self._label.get_style_context().add_class('bold16')
self._label.set_valign(Gtk.Align.START)
+ self._label.set_max_width_chars(50)
+ self._label.set_line_wrap(True)
self.add(icon)
self.add(self._label)
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/397b68fc7f978066a20f1b310b711f95…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/397b68fc7f978066a20f1b310b711f95…
You're receiving this email because of your account on dev.gajim.org.
Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits:
84b7486d by wurstsalat at 2021-09-11T02:18:54+02:00
AddContact: Consider subscription-required
- - - - -
1 changed file:
- gajim/gtk/add_contact.py
Changes:
=====================================
gajim/gtk/add_contact.py
=====================================
@@ -130,7 +130,11 @@ def _process_error(self, account, result):
log.debug('Error received: %s', result)
self._result = result
- if result.condition == 'service-unavailable':
+ contact_conditions = [
+ 'service-unavailable', # Prosody
+ 'subscription-required' # ejabberd
+ ]
+ if result.condition in contact_conditions:
# It seems to be a contact
self.get_page('contact').prepare(account, result)
self.show_page('contact', Gtk.StackTransitionType.SLIDE_LEFT)
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/84b7486d8699fb95bd34f9dfc1109335…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/84b7486d8699fb95bd34f9dfc1109335…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch nbxmpp_2.0 at gajim / python-nbxmpp
Commits:
ce819122 by lovetox at 2021-09-08T21:35:16+02:00
Correction: Ignore messages where message id == replace id
This can only happen when clients don’t use unique ids or are broken
- - - - -
1 changed file:
- nbxmpp/modules/correction.py
Changes:
=====================================
nbxmpp/modules/correction.py
=====================================
@@ -44,4 +44,9 @@ class Correction(BaseModule):
self._log.warning(stanza)
return
+ if stanza.getID() == id_:
+ self._log.warning('correcton id == message id')
+ self._log.warning(stanza)
+ return
+
properties.correction = CorrectionData(id_)
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/ce8191222c6602c65b414ec8…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/ce8191222c6602c65b414ec8…
You're receiving this email because of your account on dev.gajim.org.