Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0045.py @ 1789:8e2c831073a6
plugin XEP-0045: raise a special error when the room has already been joined
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 13 Jan 2016 13:07:36 +0100 |
parents | d17772b0fe22 |
children | 0a45bc8e7cf4 |
comparison
equal
deleted
inserted
replaced
1788:526e4145253c | 1789:8e2c831073a6 |
---|---|
57 | 57 |
58 | 58 |
59 class UnknownRoom(Exception): | 59 class UnknownRoom(Exception): |
60 pass | 60 pass |
61 | 61 |
62 | |
63 class AlreadyJoinedRoom(Exception): | |
64 pass | |
62 | 65 |
63 class NotReadyYet(Exception): | 66 class NotReadyYet(Exception): |
64 pass | 67 pass |
65 | 68 |
66 | 69 |
361 profile = self.host.memory.getProfileName(profile_key) | 364 profile = self.host.memory.getProfileName(profile_key) |
362 if not self.checkClient(profile): | 365 if not self.checkClient(profile): |
363 return _errDeferred() | 366 return _errDeferred() |
364 if room_jid in self.clients[profile].joined_rooms: | 367 if room_jid in self.clients[profile].joined_rooms: |
365 log.warning(_(u'%(profile)s is already in room %(room_jid)s') % {'profile': profile, 'room_jid': room_jid.userhost()}) | 368 log.warning(_(u'%(profile)s is already in room %(room_jid)s') % {'profile': profile, 'room_jid': room_jid.userhost()}) |
366 return _errDeferred() | 369 return _errDeferred(AlreadyJoinedRoom, D_(u"The room has already been joined")) |
367 log.info(_(u"[%(profile)s] is joining room %(room)s with nick %(nick)s") % {'profile': profile, 'room': room_jid.userhost(), 'nick': nick}) | 370 log.info(_(u"[%(profile)s] is joining room %(room)s with nick %(nick)s") % {'profile': profile, 'room': room_jid.userhost(), 'nick': nick}) |
368 | 371 |
369 if "history" in options: | 372 if "history" in options: |
370 history_limit = int(options["history"]) | 373 history_limit = int(options["history"]) |
371 else: | 374 else: |