File: use-old-jid-check.patch

package info (click to toggle)
slidge 0.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 4,516 kB
  • sloc: python: 20,548; xml: 518; sh: 57; javascript: 27; makefile: 14
file content (37 lines) | stat: -rw-r--r-- 1,252 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Description: use old JID check, because new check depends on slixmpps jid.rs
Author: Nicolas Cedilnik <nicoco@nicoco.fr>
Origin: upstream
Bug-Debian: https://bugs.debian.org/1099131
Last-Update: 2025-03-08
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/slidge/group/participant.py
+++ b/slidge/group/participant.py
@@ -1,5 +1,6 @@
 import logging
 import string
+import stringprep
 import uuid
 import warnings
 from copy import copy
@@ -11,6 +12,8 @@
 from slixmpp import JID, InvalidJID, Message, Presence
 from slixmpp.plugins.xep_0045.stanza import MUCAdminItem
 from slixmpp.types import MessageTypes, OptJid
+from slixmpp.stringprep import StringprepError, resourceprep
+from slixmpp.util.stringprep_profiles import StringPrepError, prohibit_output
 from sqlalchemy.orm.exc import DetachedInstanceError
 
 from ..contact import LegacyContact
@@ -552,8 +555,10 @@
     jid = JID(muc_jid)
 
     try:
+        prohibit_output(nickname, [stringprep.in_table_a1])
+        resourceprep(nickname)
         jid.resource = nickname
-    except InvalidJID:
+    except (InvalidJID, StringPrepError, StringprepError):
         nickname = nickname.encode("punycode").decode()
         try:
             jid.resource = nickname