changeset 108:fad0e51cf565

on failure, Libervia now wait 5 s before trying again to call the serveur + only room name is now shown in tabs
author Goffi <goffi@goffi.org>
date Wed, 29 Jun 2011 02:37:45 +0200
parents c3fb3292f582
children 5c363b638127
files libervia.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libervia.py	Wed Jun 29 02:08:43 2011 +0200
+++ b/libervia.py	Wed Jun 29 02:37:45 2011 +0200
@@ -23,6 +23,7 @@
 from pyjamas.ui.RootPanel import RootPanel
 from pyjamas.ui.HTML import HTML
 from pyjamas.ui.KeyboardListener import KEY_ESCAPE
+from pyjamas.Timer import Timer
 from pyjamas import Window, DOM
 from pyjamas.JSONService import JSONProxy
 from browser_side.register import RegisterBox
@@ -89,8 +90,10 @@
         #we now try to reconnect
         if isinstance(errobj['message'],dict) and errobj['message']['faultCode']==0:
            Window.alert('You are not allowed to connect to server')
-        else: 
-            self.host.bridge_signals.call('getSignals', self.host._getSignalsCB)
+        else:
+            def _timerCb():
+                self.host.bridge_signals.call('getSignals', self.host._getSignalsCB)
+            Timer(notify=_timerCb).schedule(5000) #we wait 5 s and try again
 
 class MicroblogEntry():
     def __init__(self, data):
@@ -308,7 +311,7 @@
         if room_id.startswith('sat_tarot_'): #XXX: it's not really beautiful, but it works :)
             self.addTab(chat_panel, "Tarot")
         else:
-            self.addTab(chat_panel, str(_target))
+            self.addTab(chat_panel, _target.node)
         chat_panel.setPresents(room_nicks)
         chat_panel.historyPrint()