comparison libervia/backend/plugins/plugin_xep_0338.py @ 4123:c8b19a32f5c0

plugin XEP-0338: always add `<group>` element as first <jingle> child: this is to work around a Movim bug (https://github.com/movim/movim/issues/1233). rel 424
author Goffi <goffi@goffi.org>
date Tue, 03 Oct 2023 16:00:21 +0200
parents 52a89ddf3087
children 0d7bb4df2343
comparison
equal deleted inserted replaced
4122:52a89ddf3087 4123:c8b19a32f5c0
107 def add_group_element( 107 def add_group_element(
108 self, jingle_elt: domish.Element, session: dict 108 self, jingle_elt: domish.Element, session: dict
109 ) -> None: 109 ) -> None:
110 """Build the <group> and <content> elements if possible""" 110 """Build the <group> and <content> elements if possible"""
111 for semantics, content_names in session["metadata"].get("group", {}).items(): 111 for semantics, content_names in session["metadata"].get("group", {}).items():
112 group_elt = jingle_elt.addElement((NS_JINGLE_GROUPING, "group")) 112 # always add the <group> element as first child of <jingle> element to work
113 # around https://github.com/movim/movim/issues/1233
114 group_elt = domish.Element((NS_JINGLE_GROUPING, "group"))
115 jingle_elt.children.insert(0, group_elt)
116
113 group_elt["semantics"] = semantics 117 group_elt["semantics"] = semantics
114 for content_name in content_names: 118 for content_name in content_names:
115 content_elt = group_elt.addElement((NS_JINGLE_GROUPING, "content")) 119 content_elt = group_elt.addElement((NS_JINGLE_GROUPING, "content"))
116 content_elt["name"] = content_name 120 content_elt["name"] = content_name
117 121