diff --git a/slixmpp/plugins/xep_0461/stanza.py b/slixmpp/plugins/xep_0461/stanza.py index 09a25f97..f52d0964 100644 --- a/slixmpp/plugins/xep_0461/stanza.py +++ b/slixmpp/plugins/xep_0461/stanza.py @@ -23,8 +23,8 @@ class FeatureFallBack(ElementBase): start = self["fallback_body"]["start"] end = self["fallback_body"]["end"] body = self.parent()["body"] - if start < end < len(body): - return body[start:end] + if start <= end: + return body[start:end+1] else: return "" @@ -33,7 +33,7 @@ class FeatureFallBack(ElementBase): start = self["fallback_body"]["start"] end = self["fallback_body"]["end"] body = self.parent()["body"] - if start < end < len(body): + if start <= end < len(body): return body[:start] + body[end:] else: return body @@ -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) + msg["feature_fallback"]["fallback_body"]["end"] = len(quoted) - 1 class FallBackBody(ElementBase): diff --git a/tests/test_stanza_xep_0461.py b/tests/test_stanza_xep_0461.py index 76f07c80..e43b8138 100644 --- a/tests/test_stanza_xep_0461.py +++ b/tests/test_stanza_xep_0461.py @@ -33,7 +33,7 @@ class TestReply(SlixTest): self.check( message, """ - + M 12345\nrealbody @@ -55,7 +55,7 @@ class TestReply(SlixTest): > Anna wrote:\n> Hi, how are you?\nGreat - + """