changeset 3923:13a2403774d4

plugin XEP-0334: avoid adding twice the same hint: rel 379
author Goffi <goffi@goffi.org>
date Thu, 06 Oct 2022 16:02:05 +0200
parents 0ff265725489
children e4631d073c8b
files sat/plugins/plugin_xep_0334.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0334.py	Thu Oct 06 16:02:05 2022 +0200
+++ b/sat/plugins/plugin_xep_0334.py	Thu Oct 06 16:02:05 2022 +0200
@@ -92,7 +92,10 @@
         @param hints: hints to add
         """
         for hint in hints:
-            message_elt.addElement((NS_HINTS, hint))
+            if not list(message_elt.elements(NS_HINTS, hint)):
+                message_elt.addElement((NS_HINTS, hint))
+            else:
+                log.debug('Not adding {hint!r} hint: it is already present in <message>')
 
     def _sendPostXmlTreatment(self, mess_data):
         if "hints" in mess_data: