Philipp Hörist pushed to branch master at gajim / python-nbxmpp


Commits:
5425f7ea by lovetox at 2020-03-14T08:15:46+01:00
Client: Expose more data via propertys

- - - - -
bfa40738 by lovetox at 2020-03-14T13:43:51+01:00
SASL: Treat unknown error conditions as not-authorized

Recommended by the RFC

- - - - -
546d83b8 by lovetox at 2020-03-14T13:52:21+01:00
Client: Silence errors after login-successful signal

- - - - -


2 changed files:

- nbxmpp/auth.py
- nbxmpp/client.py


Changes:

=====================================
nbxmpp/auth.py
=====================================
@@ -65,6 +65,10 @@ class SASL:
     def set_password(self, password):
         self._password = password
 
+    @property
+    def password(self):
+        return self._password
+
     def delegate(self, stanza):
         if stanza.getNamespace() != NS_SASL:
             return
@@ -183,7 +187,7 @@ class SASL:
 
     def _on_failure(self, stanza):
         text = stanza.getTagData('text')
-        reason = 'unknown-error'
+        reason = 'not-authorized'
         childs = stanza.getChildren()
         for child in childs:
             name = child.getName()


=====================================
nbxmpp/client.py
=====================================
@@ -179,6 +179,10 @@ class Client(Observable):
     def set_password(self, password):
         self._sasl.set_password(password)
 
+    @property
+    def password(self):
+        return self._sasl.password
+
     @property
     def peer_certificate(self):
         return self._peer_certificate, self._peer_certificate_errors
@@ -256,6 +260,10 @@ class Client(Observable):
         self._proxy = proxy
         self._dispatcher.get_module('Muclumbus').set_proxy(proxy)
 
+    @property
+    def proxy(self):
+        return self._proxy
+
     def get_bound_jid(self):
         return self._jid
 
@@ -407,6 +415,9 @@ class Client(Observable):
         self.disconnect()
 
     def _on_parsing_error(self, _dispatcher, _signal_name, error):
+        if self._state == StreamState.DISCONNECTING:
+            # Don't notify about parsing errors if we already ended the stream
+            return
         self._disconnect_with_error(StreamError.PARSING, 'parsing-error', 
error)
 
     def _on_stream_end(self, _dispatcher, _signal_name, error):
@@ -596,6 +607,9 @@ class Client(Observable):
             self._stream_authenticated = True
             if self._mode.is_login_test:
                 self.notify('login-successful')
+                # Reset parser because we will receive a new stream header
+                # which will otherwise lead to a parsing error
+                self._dispatcher.reset_parser()
                 self.disconnect()
                 return
 



View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/compare/024648852a6e772a8d4ac552ba48a8d5abae53c9...546d83b85b4c2f7fae378f0807d0fd7577c4ae65

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/python-nbxmpp/-/compare/024648852a6e772a8d4ac552ba48a8d5abae53c9...546d83b85b4c2f7fae378f0807d0fd7577c4ae65
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to