Merge branch 'xep-0461-fixes' into 'master'

XEP-0461: fixes

See merge request poezio/slixmpp!233
This commit is contained in:
Maxime Buquet 2023-02-23 23:42:19 +00:00
commit de7b2d33a3
3 changed files with 7 additions and 7 deletions

View file

@ -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"}
@ -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):

View file

@ -35,7 +35,7 @@ class TestReply(SlixTest):
"""
<message xmlns="jabber:client">
<body>12345\nrealbody</body>
<fallback xmlns='urn:xmpp:feature-fallback:0' for='NS'>
<fallback xmlns='urn:xmpp:fallback:0' for='NS'>
<body start="0" end="6" />
</fallback>
</message>
@ -54,8 +54,8 @@ class TestReply(SlixTest):
"""
<message xmlns="jabber:client" type="normal">
<body>> Anna wrote:\n> Hi, how are you?\nGreat</body>
<fallback xmlns="urn:xmpp:feature-fallback:0" for="urn:xmpp:reply:0">
<body start='0' end='32' />
<fallback xmlns="urn:xmpp:fallback:0" for="urn:xmpp:reply:0">
<body start='0' end='33' />
</fallback>
</message>
"""

View file

@ -28,7 +28,7 @@ class TestReply(SlixTest):
<message id="other-id" from="from@from.com/res">
<reply xmlns="urn:xmpp:reply:0" id="some-id" />
<body>&gt; quoted\nsome-body</body>
<fallback xmlns='urn:xmpp:feature-fallback:0' for='urn:xmpp:reply:0'>
<fallback xmlns='urn:xmpp:fallback:0' for='urn:xmpp:reply:0'>
<body start="0" end="8" />
</fallback>
</message>