Philipp Hörist pushed to branch master at gajim / gajim
Commits:
9af13bd0 by lovetox at 2020-04-16T14:15:54+02:00
HtmlTextView: Add comment
- - - - -
1 changed file:
- gajim/gtk/htmltextview.py
Changes:
=====================================
gajim/gtk/htmltextview.py
=====================================
@@ -957,6 +957,8 @@ class HtmlTextView(Gtk.TextView):
parser = xml.sax.make_parser()
parser.setContentHandler(HtmlHandler(textview, conv_textview, eob))
parser.parse(StringIO(html))
+ # If the xhtml ends with a BLOCK element we have to remove
+ # the \n we add after BLOCK elements
self._delete_last_char(buffer_, eob)
@staticmethod
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/9af13bd0bddb94453de8e4030699c79f…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/9af13bd0bddb94453de8e4030699c79f…
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:
857ab2bb by Philipp Hörist at 2020-04-15T20:27:40+02:00
Revert "NodeBuilder: Don't add empty strings to cdata list"
This reverts commit 96961854ec58dff104eb67267424c6b7bc1ba2ba
- - - - -
1 changed file:
- nbxmpp/simplexml.py
Changes:
=====================================
nbxmpp/simplexml.py
=====================================
@@ -625,6 +625,8 @@ class NodeBuilder:
except ValueError as e:
self._document_attrs = None
raise ValueError(str(e))
+ if not self.last_is_data and self._ptr.parent:
+ self._ptr.parent.data.append('')
self.last_is_data = 0
def _check_stream_start(self, ns, tag):
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/857ab2bb5ee89d00e747ea89…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/857ab2bb5ee89d00e747ea89…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
bc72da81 by lovetox at 2020-04-13T20:04:00+02:00
Remove usage of stringprepare
It was removed from nbxmpp
- - - - -
1 changed file:
- gajim/common/helpers.py
Changes:
=====================================
gajim/common/helpers.py
=====================================
@@ -59,7 +59,6 @@ from encodings.punycode import punycode_encode
from functools import wraps
import nbxmpp
-from nbxmpp.stringprepare import nameprep
from nbxmpp.const import Role
from nbxmpp.const import ConnectionProtocol
from nbxmpp.const import ConnectionType
@@ -101,48 +100,11 @@ class InvalidFormat(Exception):
pass
-def decompose_jid(jidstring):
- user = None
- server = None
- resource = None
-
- # Search for delimiters
- user_sep = jidstring.find('@')
- res_sep = jidstring.find('/')
-
- if user_sep == -1:
- if res_sep == -1:
- # host
- server = jidstring
- else:
- # host/resource
- server = jidstring[0:res_sep]
- resource = jidstring[res_sep + 1:]
- else:
- if res_sep == -1:
- # user@host
- user = jidstring[0:user_sep]
- server = jidstring[user_sep + 1:]
- else:
- if user_sep < res_sep:
- # user@host/resource
- user = jidstring[0:user_sep]
- server = jidstring[user_sep + 1:user_sep + (res_sep - user_sep)]
- resource = jidstring[res_sep + 1:]
- else:
- # server/resource (with an @ in resource)
- server = jidstring[0:res_sep]
- resource = jidstring[res_sep + 1:]
- return user, server, resource
-
def parse_jid(jidstring):
- """
- Perform stringprep on all JID fragments from a string and return the full
- jid
- """
- # This function comes from http://svn.twistedmatrix.com/cvs/trunk/twisted/words/protocols/jabber/jid.py
-
- return prep(*decompose_jid(jidstring))
+ try:
+ return validate_jid(jidstring)
+ except Exception as error:
+ raise InvalidFormat(error)
def idn_to_ascii(host):
"""
@@ -193,71 +155,6 @@ def parse_resource(resource):
except UnicodeError:
raise InvalidFormat('Invalid character in resource.')
-def prep(user, server, resource):
- """
- Perform stringprep on all JID fragments and return the full jid
- """
- # This function comes from
- #http://svn.twistedmatrix.com/cvs/trunk/twisted/words/protocols/jabber/jid.py
-
- ip_address = False
-
- try:
- socket.inet_aton(server)
- ip_address = True
- except socket.error:
- pass
-
- if not ip_address and hasattr(socket, 'inet_pton'):
- try:
- socket.inet_pton(socket.AF_INET6, server.strip('[]'))
- server = '[%s]' % server.strip('[]')
- ip_address = True
- except (socket.error, ValueError):
- pass
-
- if not ip_address:
- if server is not None:
- if server.endswith('.'): # RFC7622, 3.2
- server = server[:-1]
- if not server or len(server.encode('utf-8')) > 1023:
- raise InvalidFormat(_('Server must be between 1 and 1023 bytes'))
- try:
- server = nameprep.prepare(server)
- except UnicodeError:
- raise InvalidFormat(_('Invalid character in hostname.'))
- else:
- raise InvalidFormat(_('Server address required.'))
-
- if user is not None:
- if not user or len(user.encode('utf-8')) > 1023:
- raise InvalidFormat(_('Username must be between 1 and 1023 bytes'))
- try:
- user = user.encode('UsernameCaseMapped').decode('utf-8')
- except UnicodeError:
- raise InvalidFormat(_('Invalid character in username.'))
- else:
- user = None
-
- if resource is not None:
- if not resource or len(resource.encode('utf-8')) > 1023:
- raise InvalidFormat(_('Resource must be between 1 and 1023 bytes'))
- try:
- resource = resource.encode('OpaqueString').decode('utf-8')
- except UnicodeError:
- raise InvalidFormat(_('Invalid character in resource.'))
- else:
- resource = None
-
- if user:
- if resource:
- return '%s@%s/%s' % (user, server, resource)
- return '%s@%s' % (user, server)
-
- if resource:
- return '%s/%s' % (server, resource)
- return server
-
def windowsify(s):
if os.name == 'nt':
return s.capitalize()
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/bc72da81fccf15add0bd14a619821733…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/bc72da81fccf15add0bd14a619821733…
You're receiving this email because of your account on dev.gajim.org.