comparison src/browser/libervia_main.py @ 686:90a5a5af2550

browser_side: let the backend check for the validity of MUC JIDs that come from a user input
author souliane <souliane@mailoo.org>
date Fri, 27 Mar 2015 00:15:42 +0100
parents 9877607c719a
children 3845a086f0b3
comparison
equal deleted inserted replaced
685:9877607c719a 686:90a5a5af2550
1071 else: 1071 else:
1072 popup = dialog.InfoDialog(unicode(title), unicode(message), callback=answer_cb) 1072 popup = dialog.InfoDialog(unicode(title), unicode(message), callback=answer_cb)
1073 log.error(_('unmanaged dialog type: %s'), type_) 1073 log.error(_('unmanaged dialog type: %s'), type_)
1074 popup.show() 1074 popup.show()
1075 1075
1076 def showFailure(self, err_data, msg=''):
1077 """Show a failure that has been returned by an asynchronous bridge method.
1078
1079 @param failure (defer.Failure): Failure instance
1080 @param msg (unicode): message to display
1081 """
1082 # FIXME: message is lost by JSON, we hardcode it for now... remove msg argument when possible
1083 err_code, err_obj = err_data
1084 title = err_obj['message']['faultString'] if isinstance(err_obj['message'], dict) else err_obj['message']
1085 self.showDialog(msg, title, 'error')
1086
1087 def showFailureRoomInvalid(self, err_data):
1088 """Show a failure that has been returned when trying to join an invalid room.
1089
1090 @param failure (defer.Failure): Failure instance
1091 """
1092 # FIXME: remove asap, see self.showFailure
1093 msg = _(u"Invalid room identifier. Please give a room short or full identifier like 'room' or 'room@%s'.") % C.DEFAULT_MUC_SERVICE
1094 self.showFailure(err_data, msg)
1095
1076 1096
1077 if __name__ == '__main__': 1097 if __name__ == '__main__':
1078 app = SatWebFrontend() 1098 app = SatWebFrontend()
1079 app.onModuleLoad() 1099 app.onModuleLoad()
1080 host_listener.callListeners(app) 1100 host_listener.callListeners(app)