diff --git a/sat/plugins/plugin_xep_0334.py b/sat/plugins/plugin_xep_0334.py index 2081540e..081d961c 100644 --- a/sat/plugins/plugin_xep_0334.py +++ b/sat/plugins/plugin_xep_0334.py @@ -85,10 +85,18 @@ class XEP_0334(object): else: log.error(u"Unknown hint: {}".format(hint)) + def addHintElements(self, message_elt, hints): + """Add hints elements to message stanza + + @param message_elt(domish.Element): stanza where hints must be added + @param hints(iterable(unicode)): hints to add + """ + for hint in hints: + message_elt.addElement((NS_HINTS, hint)) + def _sendPostXmlTreatment(self, mess_data): if "hints" in mess_data: - for hint in mess_data["hints"]: - mess_data[u"xml"].addElement((NS_HINTS, hint)) + self.addHintElements(mess_data[u"xml"], mess_data[u"hints"]) return mess_data def sendMessageTrigger(