comparison sat_pubsub/privilege.py @ 462:a017af61a32b

privilege: add server JID to `publisher` so `+notify` works with it: the server's PEP itself is now working as other PEP accounts, i.e. notification of last published message are sent on presence received when `+notify` is used.
author Goffi <goffi@goffi.org>
date Fri, 15 Oct 2021 09:32:07 +0200
parents 607616f9ef5b
children f520ac3164b0
comparison
equal deleted inserted replaced
461:c9238fca1fb3 462:a017af61a32b
290 290
291 # nodes are the nodes subscribed with +notify 291 # nodes are the nodes subscribed with +notify
292 nodes = tuple(self.hash_map[disco_tuple]['notify']) 292 nodes = tuple(self.hash_map[disco_tuple]['notify'])
293 if not nodes: 293 if not nodes:
294 return 294 return
295 # publishers are entities which have granted presence access to our user + user itself 295 # publishers are entities which have granted presence access to our user
296 publishers = tuple(self.presence_map.get(from_jid_bare, ())) + (from_jid_bare,) 296 # + user itself + server
297 publishers = (
298 tuple(self.presence_map.get(from_jid_bare, ()))
299 + (from_jid_bare, self.backend.server_jid)
300 )
297 301
298 # FIXME: add "presence" access_model (for node) for getLastItems 302 # FIXME: add "presence" access_model (for node) for getLastItems
299 last_items = yield self._backend.storage.getLastItems(publishers, nodes, ('open',), ('open',), True) 303 last_items = yield self._backend.storage.getLastItems(publishers, nodes, ('open',), ('open',), True)
300 # we send message with last item, as required by https://xmpp.org/extensions/xep-0163.html#notify-last 304 # we send message with last item, as required by https://xmpp.org/extensions/xep-0163.html#notify-last
301 for pep_jid, node, item, item_access_model in last_items: 305 for pep_jid, node, item, item_access_model in last_items: