comparison src/browser/libervia_main.py @ 839:09ace5cbcb9b

browser (games, menu): rename showFailureRoomInvalid to onJoinMUCFailure and display a nice message when the room has already been joined (it is not a real error)
author souliane <souliane@mailoo.org>
date Wed, 13 Jan 2016 13:11:44 +0100
parents a964ff397484
children 83a40d786e7a
comparison
equal deleted inserted replaced
838:ab87da500820 839:09ace5cbcb9b
690 # FIXME: message is lost by JSON, we hardcode it for now... remove msg argument when possible 690 # FIXME: message is lost by JSON, we hardcode it for now... remove msg argument when possible
691 err_code, err_obj = err_data 691 err_code, err_obj = err_data
692 title = err_obj['message']['faultString'] if isinstance(err_obj['message'], dict) else err_obj['message'] 692 title = err_obj['message']['faultString'] if isinstance(err_obj['message'], dict) else err_obj['message']
693 self.showDialog(msg, title, 'error') 693 self.showDialog(msg, title, 'error')
694 694
695 def showFailureRoomInvalid(self, err_data): 695 def onJoinMUCFailure(self, err_data):
696 """Show a failure that has been returned when trying to join an invalid room. 696 """Show a failure that has been returned when trying to join a room.
697 697
698 @param failure (defer.Failure): Failure instance 698 @param failure (defer.Failure): Failure instance
699 """ 699 """
700 # FIXME: remove asap, see self.showFailure 700 # FIXME: remove asap, see self.showFailure
701 msg = _(u"Invalid room identifier. Please give a room short or full identifier like 'room' or '%s'.") % self.default_muc 701 err_code, err_obj = err_data
702 if err_obj["data"] == "AlreadyJoinedRoom":
703 msg = _(u"The room has already been joined.")
704 err_obj["message"] = _(u"Information")
705 else:
706 msg = _(u"Invalid room identifier. Please give a room short or full identifier like 'room' or '%s'.") % self.default_muc
707 err_obj["message"] = _(u"Error")
702 self.showFailure(err_data, msg) 708 self.showFailure(err_data, msg)
703 709
704 710
705 if __name__ == '__main__': 711 if __name__ == '__main__':
706 app = SatWebFrontend() 712 app = SatWebFrontend()