Mercurial > libervia-web
comparison src/browser/sat_browser/game_radiocol.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 | 7a9c7b9f6a28 |
comparison
equal
deleted
inserted
replaced
685:9877607c719a | 686:90a5a5af2550 |
---|---|
20 import pyjd # this is dummy in pyjs | 20 import pyjd # this is dummy in pyjs |
21 from sat.core.log import getLogger | 21 from sat.core.log import getLogger |
22 log = getLogger(__name__) | 22 log = getLogger(__name__) |
23 | 23 |
24 from sat.core.i18n import _, D_ | 24 from sat.core.i18n import _, D_ |
25 from sat_frontends.tools.misc import DEFAULT_MUC | |
26 from sat_frontends.tools import host_listener | 25 from sat_frontends.tools import host_listener |
27 from constants import Const as C | 26 from constants import Const as C |
28 | 27 |
29 from pyjamas.ui.VerticalPanel import VerticalPanel | 28 from pyjamas.ui.VerticalPanel import VerticalPanel |
30 from pyjamas.ui.HorizontalPanel import HorizontalPanel | 29 from pyjamas.ui.HorizontalPanel import HorizontalPanel |
256 self.addClickListener(self) | 255 self.addClickListener(self) |
257 | 256 |
258 help_msg = """Accepted file formats: Ogg Vorbis (recommended), MP3.<br /> | 257 help_msg = """Accepted file formats: Ogg Vorbis (recommended), MP3.<br /> |
259 Please do not submit files that are protected by copyright.<br /> | 258 Please do not submit files that are protected by copyright.<br /> |
260 Click <a style="color: red;">here</a> if you need some support :)""" | 259 Click <a style="color: red;">here</a> if you need some support :)""" |
261 link_cb = lambda: self._parent.host.bridge.call('joinMUC', None, DEFAULT_MUC, self._parent.nick) | 260 link_cb = lambda: self._parent.host.bridge.joinMUC(C.DEFAULT_MUC, self._parent.nick, profile=C.PROF_KEY_NONE, callback=lambda dummy: None, errback=self.host.showFailureRoomInvalid) |
262 self._parent.printInfo(help_msg, type_='link', link_cb=link_cb) | 261 self._parent.printInfo(help_msg, type_='link', link_cb=link_cb) |
263 | 262 |
264 def pushNextSong(self, title): | 263 def pushNextSong(self, title): |
265 """Add a song to the left panel's next songs queue""" | 264 """Add a song to the left panel's next songs queue""" |
266 next_song = Label(title) | 265 next_song = Label(title) |
332 def hostReady(host): | 331 def hostReady(host): |
333 def onCollectiveRadio(self): | 332 def onCollectiveRadio(self): |
334 def callback(room_jid, contacts): | 333 def callback(room_jid, contacts): |
335 contacts = [unicode(contact) for contact in contacts] | 334 contacts = [unicode(contact) for contact in contacts] |
336 room_jid_s = unicode(room_jid) if room_jid else '' | 335 room_jid_s = unicode(room_jid) if room_jid else '' |
337 host.bridge.launchRadioCollective(contacts, room_jid_s, profile=C.PROF_KEY_NONE) | 336 host.bridge.launchRadioCollective(contacts, room_jid_s, profile=C.PROF_KEY_NONE, callback=lambda dummy: None, errback=host.showFailureRoomInvalid) |
338 dialog.RoomAndContactsChooser(host, callback, ok_button="Choose", title="Collective Radio", visible=(False, True)) | 337 dialog.RoomAndContactsChooser(host, callback, ok_button="Choose", title="Collective Radio", visible=(False, True)) |
339 | 338 |
340 | 339 |
341 def gotMenus(): | 340 def gotMenus(): |
342 host.menus.addMenu(C.MENU_GLOBAL, (D_(u"Groups"), D_(u"Collective radio")), callback=onCollectiveRadio) | 341 host.menus.addMenu(C.MENU_GLOBAL, (D_(u"Groups"), D_(u"Collective radio")), callback=onCollectiveRadio) |