diff browser_side/menu.py @ 242:a25aa882e09a

browser_side: add context menu for contact: - for now only when a blog exists on the current libervia's server - retrieve the server domain with the bridge method getNewAccountDomain - getNewAccountDomain is also used to display the current libervia domain in the dialogs (new contact default domain, messages for invalid contact or group)
author souliane <souliane@mailoo.org>
date Fri, 18 Oct 2013 11:14:55 +0200
parents dec76d4536ad
children 0e7f3944bd27
line wrap: on
line diff
--- a/browser_side/menu.py	Tue Oct 15 13:36:51 2013 +0200
+++ b/browser_side/menu.py	Fri Oct 18 11:14:55 2013 +0200
@@ -186,7 +186,7 @@
     def onDisconnect(self):
         def confirm_cb(answer):
             if answer:
-                print "déconnexion"
+                print "disconnection"
                 self.host.bridge.call('disconnect', None)
         _dialog = dialog.ConfirmDialog(confirm_cb, text="Do you really want to disconnect ?")
         _dialog.show()
@@ -218,14 +218,14 @@
         edit = TextBox()
 
         def addContactCb(sender):
-            if not re.match(r'^.+@.+\..+',edit.getText(), re.IGNORECASE):
-                Window.alert('You must enter a valid contact JID (like "contact@libervia.org")')
+            if not re.match(r'^.+@.+\..+', edit.getText(), re.IGNORECASE):
+                Window.alert('You must enter a valid contact JID (like "contact@%s")' % self.host._defaultDomain)
                 _dialog.show()
             else:
                 self.host.bridge.call('addContact', None, edit.getText(), '', _dialog.getSelectedGroups() )
 
         label = Label("new contact identifier (JID):")
-        edit.setText('@libervia.org')
+        edit.setText('@%s' % self.host._defaultDomain)
         edit.setWidth('100%')
         _dialog = dialog.GroupSelector([label, edit], self.host.contact_panel.getGroups(), [],
                                        "Add", addContactCb)
@@ -285,7 +285,7 @@
 
         def onOK(sender):
             if not _edit.getText():
-                Window.alert('You must enter a room jid in the form libervia@conference.libervia.org')
+                Window.alert('You must enter a room jid in the form room@chat.%s' % self.host._defaultDomain)
             if self.host.whoami:
                 nick = self.host.whoami.node
                 self.host.bridge.call('joinMUC', None, _edit.getText(), nick)
@@ -325,7 +325,7 @@
         #self.host.tab_panel.add(EmptyPanel(self.host), "Tarot")
         def onPlayersSelected(other_players):
             self.host.bridge.call('launchTarotGame', None, other_players)
-        dialog.ContactsChooser(self.host, onPlayersSelected, 3, text="Please select 3 other players").getContacts() 
+        dialog.ContactsChooser(self.host, onPlayersSelected, 3, text="Please select 3 other players").getContacts()
 
     def onXiangqiGame(self):
         Window.alert("A Xiangqi game is planed, but not available yet")