diff 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
line wrap: on
line diff
--- a/src/browser/libervia_main.py	Tue Jan 12 20:34:20 2016 +0100
+++ b/src/browser/libervia_main.py	Wed Jan 13 13:11:44 2016 +0100
@@ -692,13 +692,19 @@
         title = err_obj['message']['faultString'] if isinstance(err_obj['message'], dict) else err_obj['message']
         self.showDialog(msg, title, 'error')
 
-    def showFailureRoomInvalid(self, err_data):
-        """Show a failure that has been returned when trying to join an invalid room.
+    def onJoinMUCFailure(self, err_data):
+        """Show a failure that has been returned when trying to join a room.
 
         @param failure (defer.Failure): Failure instance
         """
         # FIXME: remove asap, see self.showFailure
-        msg = _(u"Invalid room identifier. Please give a room short or full identifier like 'room' or '%s'.") % self.default_muc
+        err_code, err_obj = err_data
+        if err_obj["data"] == "AlreadyJoinedRoom":
+            msg = _(u"The room has already been joined.")
+            err_obj["message"] = _(u"Information")
+        else:
+            msg = _(u"Invalid room identifier. Please give a room short or full identifier like 'room' or '%s'.") % self.default_muc
+            err_obj["message"] = _(u"Error")
         self.showFailure(err_data, msg)