diff browser_side/panels.py @ 54:f25c4077f6b9

addind contact + subscription management + misc - removed bad html_sanitize (not needed in Label !) - added isContactInRoster method in ContactPanel
author Goffi <goffi@goffi.org>
date Sat, 28 May 2011 20:18:14 +0200
parents 4419ef07bb2b
children d5266c41ca24
line wrap: on
line diff
--- a/browser_side/panels.py	Sat May 28 20:14:38 2011 +0200
+++ b/browser_side/panels.py	Sat May 28 20:18:14 2011 +0200
@@ -55,6 +55,7 @@
 from datetime import datetime
 from time import time
 import dialog
+import re
 
 class MenuCmd:
 
@@ -120,9 +121,11 @@
         edit = TextBox()
 
         def addContactCb(sender):
-            if not edit.getText():
-                Window.alert('You must enter a contact JID')
+            if not re.match(r'^.+@.+\..+',edit.getText(), re.IGNORECASE):
+                Window.alert('You must enter a valid contact JID (like "contact@libervia.org")')
                 _dialog.show()
+            else:
+                self.host.bridge.call('addContact', None, edit.getText(), '', _dialog.getSelectedGroups() )
 
         label = Label("new contact identifier (JID):")
         edit.setText('@libervia.org')
@@ -629,7 +632,7 @@
             normal: general info like "toto has joined the room"
             me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist"
         """
-        _wid = Label(html_sanitize(msg))
+        _wid = Label(msg)
         if type == 'normal':
             _wid.setStyleName('chatTextInfo')
         elif type == 'me':