From 79ffa1668f5a727d384543aa111010b801cffb85 Mon Sep 17 00:00:00 2001 From: nicoco Date: Fri, 24 Feb 2023 00:10:31 +0100 Subject: [PATCH 1/2] XEP-0461: fix fallback namespace the XEP should be updated soon, confirmed by author, other implementations use this namespace --- slixmpp/plugins/xep_0461/stanza.py | 2 +- tests/test_stanza_xep_0461.py | 2 +- tests/test_stream_xep_0461.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/slixmpp/plugins/xep_0461/stanza.py b/slixmpp/plugins/xep_0461/stanza.py index f52d0964..b4a36b60 100644 --- a/slixmpp/plugins/xep_0461/stanza.py +++ b/slixmpp/plugins/xep_0461/stanza.py @@ -13,7 +13,7 @@ class Reply(ElementBase): class FeatureFallBack(ElementBase): # should also be a multi attrib - namespace = "urn:xmpp:feature-fallback:0" + namespace = "urn:xmpp:fallback:0" name = "fallback" plugin_attrib = "feature_fallback" interfaces = {"for"} diff --git a/tests/test_stanza_xep_0461.py b/tests/test_stanza_xep_0461.py index f6f21210..202e2083 100644 --- a/tests/test_stanza_xep_0461.py +++ b/tests/test_stanza_xep_0461.py @@ -35,7 +35,7 @@ class TestReply(SlixTest): """ 12345\nrealbody - + diff --git a/tests/test_stream_xep_0461.py b/tests/test_stream_xep_0461.py index b73a9964..9062a056 100644 --- a/tests/test_stream_xep_0461.py +++ b/tests/test_stream_xep_0461.py @@ -28,7 +28,7 @@ class TestReply(SlixTest): > quoted\nsome-body - + From 40a857de65871a61d9c3e91e5a62d52faee95af9 Mon Sep 17 00:00:00 2001 From: nicoco Date: Fri, 24 Feb 2023 00:11:06 +0100 Subject: [PATCH 2/2] XEP-0461: fix char counting I think this time I got it right, confirmed against client implementations (dino and movim) --- slixmpp/plugins/xep_0461/stanza.py | 4 ++-- tests/test_stanza_xep_0461.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/slixmpp/plugins/xep_0461/stanza.py b/slixmpp/plugins/xep_0461/stanza.py index b4a36b60..e6297f75 100644 --- a/slixmpp/plugins/xep_0461/stanza.py +++ b/slixmpp/plugins/xep_0461/stanza.py @@ -24,7 +24,7 @@ class FeatureFallBack(ElementBase): end = self["fallback_body"]["end"] body = self.parent()["body"] if start <= end: - return body[start:end+1] + return body[start:end] else: return "" @@ -44,7 +44,7 @@ class FeatureFallBack(ElementBase): msg["body"] = quoted + msg["body"] msg["feature_fallback"]["for"] = NS msg["feature_fallback"]["fallback_body"]["start"] = 0 - msg["feature_fallback"]["fallback_body"]["end"] = len(quoted) - 1 + msg["feature_fallback"]["fallback_body"]["end"] = len(quoted) class FallBackBody(ElementBase): diff --git a/tests/test_stanza_xep_0461.py b/tests/test_stanza_xep_0461.py index 202e2083..12c92bd4 100644 --- a/tests/test_stanza_xep_0461.py +++ b/tests/test_stanza_xep_0461.py @@ -54,8 +54,8 @@ class TestReply(SlixTest): """ > Anna wrote:\n> Hi, how are you?\nGreat - - + + """