Philipp Hörist pushed to branch master at gajim / gajim
Commits:
172725d1 by Philipp Hörist at 2019-10-19T13:51:20Z
Passwords: Improve log message in case of deletion error
Fixes #9865
- - - - -
1 changed file:
- gajim/common/passwords.py
Changes:
=====================================
gajim/common/passwords.py
=====================================
@@ -81,9 +81,11 @@ class SecretPasswordStorage(PasswordStorage):
log.info('Remove password from keyring')
try:
return self.keyring.delete_password('gajim', account_name)
+ except keyring.errors.PasswordDeleteError as error:
+ log.warning('Removing password failed: %s', error)
except Exception:
- log.exception('Remove password failed')
- return
+ log.exception('Removing password failed')
+
class PasswordStorageManager(PasswordStorage):
"""Access all the implemented password storage backends, knowing which ones
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/172725d18c5e0bea540605c7b1a8da047e…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/172725d18c5e0bea540605c7b1a8da047e…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
0d7316be by Philipp Hörist at 2019-10-18T21:34:09Z
AccountCreation: Register plugin modules after successful registration
Fixes #9856
- - - - -
1 changed file:
- gajim/gtk/account_wizard.py
Changes:
=====================================
gajim/gtk/account_wizard.py
=====================================
@@ -293,7 +293,6 @@ class AccountCreationWizard:
100, self.update_progressbar)
# Get form from serveur
con = connection.Connection(self.account)
- app.plugin_manager.register_modules_for_account(con)
app.connections[self.account] = con
con.new_account(self.account, config)
elif cur_page == 3:
@@ -458,6 +457,10 @@ class AccountCreationWizard:
self.create_vars(obj.account_info)
self.show_finish_page()
+ # Register plugin modules after successful registration
+ # Some plugins need the registered JID to function properly
+ app.plugin_manager.register_modules_for_account(obj.conn)
+
if self.update_progressbar_timeout_id is not None:
GLib.source_remove(self.update_progressbar_timeout_id)
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0d7316be2dfb447240af96df1f20df9e2c…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0d7316be2dfb447240af96df1f20df9e2c…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
0acfc4c8 by Philipp Hörist at 2019-10-18T21:01:28Z
MAM: Correctly detect if we sent a message
properties.jid always yields the remote JID now after nbxmpp changes
- - - - -
1 changed file:
- gajim/common/modules/mam.py
Changes:
=====================================
gajim/common/modules/mam.py
=====================================
@@ -96,7 +96,7 @@ class MAM(BaseModule):
if properties.is_muc_pm:
return properties.mam.id, properties.id
- if self._con.get_own_jid().bareMatch(properties.jid):
+ if self._con.get_own_jid().bareMatch(properties.from_):
# message we sent
return properties.mam.id, properties.id
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0acfc4c8087c731296a49e3cd4c489ee09…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/0acfc4c8087c731296a49e3cd4c489ee09…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
8fb372a5 by Philipp Hörist at 2019-10-16T17:42:10Z
Use monotonic time for timeouts
Fixes #87
- - - - -
1 changed file:
- nbxmpp/idlequeue.py
Changes:
=====================================
nbxmpp/idlequeue.py
=====================================
@@ -22,6 +22,7 @@ import os
import errno
import select
import logging
+import time
log = logging.getLogger('nbxmpp.idlequeue')
# needed for get_idleqeue
@@ -174,8 +175,7 @@ class IdleCommand(IdleObject):
self.pipe = Popen(self._compose_command_args(), stdout=PIPE,
bufsize=1024, shell=True, stderr=STDOUT, stdin=PIPE)
if self.commandtimeout >= 0:
- self.endtime = self.idlequeue.current_time() + \
- (self.commandtimeout * 1e6)
+ self.endtime = self.idlequeue.current_time() + self.commandtimeout
self.idlequeue.set_alarm(self.wait_child, 0.1)
def _start_posix(self):
@@ -253,7 +253,7 @@ class IdleQueue:
"""
Set up a new alarm. alarm_cb will be called after specified seconds.
"""
- alarm_time = self.current_time() + (seconds * 1e6)
+ alarm_time = self.current_time() + seconds
# almost impossible, but in case we have another alarm_cb at this time
if alarm_time in self.alarms:
self.alarms[alarm_time].append(alarm_cb)
@@ -306,7 +306,7 @@ class IdleQueue:
if func:
log_txt += ' with function ' + str(func)
log.info(log_txt)
- timeout = self.current_time() + (seconds * 1e6)
+ timeout = self.current_time() + seconds
if fd in self.read_timeouts:
self.read_timeouts[fd][timeout] = func
else:
@@ -385,8 +385,7 @@ class IdleQueue:
self._remove_idle(fd)
def current_time(self):
- from time import time
- return time() * 1e6
+ return time.monotonic()
def _remove_idle(self, fd):
"""
@@ -571,5 +570,3 @@ class GlibIdleQueue(IdleQueue):
def process(self):
self._check_time_events()
-
- current_time = GLib.get_real_time
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/8fb372a55962a47e4ddf8bb35a…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/8fb372a55962a47e4ddf8bb35a…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
bf53ae00 by Philipp Hörist at 2019-10-16T11:14:46Z
Don't import version from package
__init__.py has too many other imports, this leads to all dependencys beeing imported in the install process before they are downloaded
- - - - -
1 changed file:
- setup.cfg
Changes:
=====================================
setup.cfg
=====================================
@@ -1,6 +1,6 @@
[metadata]
name = nbxmpp
-version = attr: nbxmpp.__version__
+version = 0.9.92
description = Non blocking Jabber/XMPP module
author = Yann Leboulanger, Philipp Hoerist
author_email = gajim-devel(a)gajim.org
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/bf53ae006052d0a3265a1969d9…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/bf53ae006052d0a3265a1969d9…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
8cc2f1d3 by Philipp Hörist at 2019-10-14T15:06:06Z
Add xhtml message attribute
- - - - -
bae3cfd1 by Philipp Hörist at 2019-10-14T16:20:19Z
Add Security Labels (XEP-0258) support
- - - - -
16305759 by Philipp Hörist at 2019-10-14T18:53:27Z
Add Chat State Notifications (XEP-0085) support
- - - - -
6705a89b by Philipp Hörist at 2019-10-14T18:53:31Z
Attention: Don't parse legacy delay tags
- - - - -
8 changed files:
- nbxmpp/const.py
- nbxmpp/dispatcher.py
- nbxmpp/modules/attention.py
- + nbxmpp/modules/chatstates.py
- nbxmpp/modules/message.py
- + nbxmpp/modules/security_labels.py
- nbxmpp/protocol.py
- nbxmpp/structs.py
Changes:
=====================================
nbxmpp/const.py
=====================================
@@ -545,3 +545,12 @@ TUNE_DATA = [
'title',
'track',
'uri']
+
+
+CHATSTATES = [
+ 'active',
+ 'inactive',
+ 'gone',
+ 'composing',
+ 'paused'
+]
\ No newline at end of file
=====================================
nbxmpp/dispatcher.py
=====================================
@@ -76,6 +76,8 @@ from nbxmpp.modules.receipts import Receipts
from nbxmpp.modules.oob import OOB
from nbxmpp.modules.correction import Correction
from nbxmpp.modules.attention import Attention
+from nbxmpp.modules.security_labels import SecurityLabels
+from nbxmpp.modules.chatstates import Chatstates
from nbxmpp.modules.misc import unwrap_carbon
from nbxmpp.modules.misc import unwrap_mam
from nbxmpp.util import get_properties_struct
@@ -219,6 +221,8 @@ class XMPPDispatcher(PlugIn):
self._modules['OOB'] = OOB(self._owner)
self._modules['Correction'] = Correction(self._owner)
self._modules['Attention'] = Attention(self._owner)
+ self._modules['SecurityLabels'] = SecurityLabels(self._owner)
+ self._modules['Chatstates'] = Chatstates(self._owner)
for instance in self._modules.values():
for handler in instance.handlers:
=====================================
nbxmpp/modules/attention.py
=====================================
@@ -45,7 +45,7 @@ class Attention:
if properties.is_carbon_message and properties.carbon.is_sent:
return
- if stanza.getTag('x', namespace=NS_DELAY2) is not None:
+ if stanza.getTag('delay', namespace=NS_DELAY2) is not None:
return
properties.attention = True
=====================================
nbxmpp/modules/chatstates.py
=====================================
@@ -0,0 +1,62 @@
+# Copyright (C) 2018 Philipp Hörist <philipp AT hoerist.com>
+#
+# This file is part of nbxmpp.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; If not, see <http://www.gnu.org/licenses/>.
+
+import logging
+
+from nbxmpp.protocol import NS_CHATSTATES
+from nbxmpp.protocol import NS_DELAY2
+from nbxmpp.structs import StanzaHandler
+from nbxmpp.const import CHATSTATES
+
+log = logging.getLogger('nbxmpp.m.chatstates')
+
+
+class Chatstates:
+ def __init__(self, client):
+ self._client = client
+ self.handlers = [
+ StanzaHandler(name='message',
+ callback=self._process_message_chatstate,
+ ns=NS_CHATSTATES,
+ priority=15),
+ ]
+
+ def _process_message_chatstate(self, _con, stanza, properties):
+ chatstate = parse_chatstate(stanza)
+ if chatstate is None:
+ return
+
+ if properties.is_mam_message:
+ return
+
+ if stanza.getTag('delay', namespace=NS_DELAY2) is not None:
+ return
+
+ if chatstate not in CHATSTATES:
+ log.warning('Invalid chatstate: %s', chatstate)
+ log.warning(stanza)
+ return
+
+ properties.chatstate = chatstate
+
+
+def parse_chatstate(stanza):
+ children = stanza.getChildren()
+ for child in children:
+ if child.getNamespace() == NS_CHATSTATES:
+ return child.getName()
+ return None
=====================================
nbxmpp/modules/message.py
=====================================
@@ -79,6 +79,7 @@ class BaseMessage:
forms = stanza.getTags('x', namespace=NS_DATA)
if forms:
properties.forms = forms
+ properties.xhtml = stanza.getXHTML()
@staticmethod
def _parse_type(stanza):
=====================================
nbxmpp/modules/security_labels.py
=====================================
@@ -0,0 +1,57 @@
+# Copyright (C) 2018 Philipp Hörist <philipp AT hoerist.com>
+#
+# This file is part of nbxmpp.
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 3
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; If not, see <http://www.gnu.org/licenses/>.
+
+import logging
+
+from nbxmpp.protocol import NS_SECLABEL
+from nbxmpp.structs import StanzaHandler
+from nbxmpp.structs import SecurityLabel
+from nbxmpp.structs import DisplayMarking
+
+log = logging.getLogger('nbxmpp.m.security_labels')
+
+
+class SecurityLabels:
+ def __init__(self, client):
+ self._client = client
+ self.handlers = [
+ StanzaHandler(name='message',
+ callback=self._process_message_security_label,
+ ns=NS_SECLABEL,
+ priority=15),
+ ]
+
+ def _process_message_security_label(self, _con, stanza, properties):
+ security = stanza.getTag('securitylabel', namespace=NS_SECLABEL)
+ if security is None:
+ return
+
+ displaymarking = security.getTag('displaymarking')
+ if displaymarking is None:
+ return
+
+ label = displaymarking.getData()
+ if not label:
+ log.warning('No label found')
+ log.warning(stanza)
+ return
+
+ fgcolor = displaymarking.getAttr('fgcolor')
+ bgcolor = displaymarking.getAttr('bgcolor')
+
+ properties.security_label = SecurityLabel(
+ DisplayMarking(label, fgcolor, bgcolor))
=====================================
nbxmpp/protocol.py
=====================================
@@ -1243,12 +1243,14 @@ class Message(Protocol):
TODO: Returning a DOM could make rendering faster.
"""
- xhtml = self.getTag('html')
+ xhtml = self.getTag('html', namespace=NS_XHTML_IM)
if xhtml:
if xmllang:
- body = xhtml.getTag('body', attrs={'xml:lang': xmllang})
+ body = xhtml.getTag('body',
+ namespace=NS_XHTML,
+ attrs={'xml:lang': xmllang})
else:
- body = xhtml.getTag('body')
+ body = xhtml.getTag('body', namespace=NS_XHTML)
return str(body)
return None
=====================================
nbxmpp/structs.py
=====================================
@@ -125,6 +125,9 @@ OOBData = namedtuple('OOBData', 'url desc')
CorrectionData = namedtuple('CorrectionData', 'id')
+DisplayMarking = namedtuple('DisplayMarking', 'label fgcolor bgcolor')
+SecurityLabel = namedtuple('SecurityLabel', 'displaymarking')
+
class DiscoInfo(namedtuple('DiscoInfo', 'stanza identities features dataforms timestamp')):
@@ -553,6 +556,9 @@ class MessageProperties:
self.correction = None
self.attention = False
self.forms = None
+ self.xhtml = None
+ self.security_label = None
+ self.chatstate = None
@property
def has_user_delay(self):
@@ -649,6 +655,18 @@ class MessageProperties:
def has_forms(self):
return self.forms is not None
+ @property
+ def has_xhtml(self):
+ return self.xhtml is not None
+
+ @property
+ def has_security_label(self):
+ return self.security_label is not None
+
+ @property
+ def has_chatstate(self):
+ return self.chatstate is not None
+
class IqProperties:
def __init__(self):
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/compare/22ddb4b89a8bdd94d96c7b4b0…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/compare/22ddb4b89a8bdd94d96c7b4b0…
You're receiving this email because of your account on dev.gajim.org.