comparison libervia/backend/plugins/plugin_xep_0277.py @ 4172:0e48181d50ab

Plugin XEP-0277: Add metadata to prevent adding random suffixes to generated user-friendly IDs.
author Goffi <goffi@goffi.org>
date Tue, 05 Dec 2023 13:10:21 +0100
parents 4b842c1fb686
children 30f7513e5590
comparison
equal deleted inserted replaced
4171:da7d360a87be 4172:0e48181d50ab
990 or data.get('title_rich') 990 or data.get('title_rich')
991 or data.get('content') 991 or data.get('content')
992 or data.get('content_rich') 992 or data.get('content_rich')
993 or '' 993 or ''
994 ) 994 )
995 return f"{id_base}-{token_urlsafe(3)}" 995 if not data.get("user_friendly_id_suffix", True):
996 return id_base
997 else:
998 return f"{id_base}-{token_urlsafe(3)}"
996 999
997 def _mb_send(self, service, node, data, profile_key): 1000 def _mb_send(self, service, node, data, profile_key):
998 service = jid.JID(service) if service else None 1001 service = jid.JID(service) if service else None
999 node = node if node else NS_MICROBLOG 1002 node = node if node else NS_MICROBLOG
1000 client = self.host.get_client(profile_key) 1003 client = self.host.get_client(profile_key)