Mercurial > libervia-backend
comparison sat/plugins/plugin_xep_0045.py @ 3002:6acaa8244220
plugin 0249: fixed invitation handling + some improvments:
- properly retrieve payload by namespace
- now use a trigger instead of observer, so the message workflow is stopped if an invitation is found
- namespace is registered
fix 241
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 14 Jul 2019 11:23:25 +0200 |
parents | 94708a7d3ecf |
children | c8c68a3b0a79 |
comparison
equal
deleted
inserted
replaced
3001:ce52ac2fe213 | 3002:6acaa8244220 |
---|---|
480 nick = client.jid.user | 480 nick = client.jid.user |
481 if options is None: | 481 if options is None: |
482 options = {} | 482 options = {} |
483 if room_jid in client._muc_client.joined_rooms: | 483 if room_jid in client._muc_client.joined_rooms: |
484 room = client._muc_client.joined_rooms[room_jid] | 484 room = client._muc_client.joined_rooms[room_jid] |
485 log.info(_(u'{profile} is already in room {room_jid}').format(profile=client.profile, room_jid = room_jid.userhost())) | 485 log.info(_(u'{profile} is already in room {room_jid}').format( |
486 profile=client.profile, room_jid = room_jid.userhost())) | |
486 return defer.fail(AlreadyJoined(room)) | 487 return defer.fail(AlreadyJoined(room)) |
487 log.info(_(u"[{profile}] is joining room {room} with nick {nick}").format(profile=client.profile, room=room_jid.userhost(), nick=nick)) | 488 log.info(_(u"[{profile}] is joining room {room} with nick {nick}").format( |
489 profile=client.profile, room=room_jid.userhost(), nick=nick)) | |
488 | 490 |
489 password = options.get("password") | 491 password = options.get("password") |
490 | 492 |
491 return client._muc_client.join(room_jid, nick, password).addCallbacks(self._joinCb, self._joinEb, (client, room_jid, nick), errbackArgs=(client, room_jid, nick, password)) | 493 d = client._muc_client.join(room_jid, nick, password) |
494 d.addCallbacks(self._joinCb, self._joinEb, | |
495 (client, room_jid, nick), | |
496 errbackArgs=(client, room_jid, nick, password)) | |
497 return d | |
492 | 498 |
493 def _nick(self, room_jid_s, nick, profile_key=C.PROF_KEY_NONE): | 499 def _nick(self, room_jid_s, nick, profile_key=C.PROF_KEY_NONE): |
494 client = self.host.getClient(profile_key) | 500 client = self.host.getClient(profile_key) |
495 return self.nick(client, jid.JID(room_jid_s), nick) | 501 return self.nick(client, jid.JID(room_jid_s), nick) |
496 | 502 |