comparison 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
comparison
equal deleted inserted replaced
53:dc7861390f10 54:f25c4077f6b9
53 from jid import JID 53 from jid import JID
54 from tools import html_sanitize 54 from tools import html_sanitize
55 from datetime import datetime 55 from datetime import datetime
56 from time import time 56 from time import time
57 import dialog 57 import dialog
58 import re
58 59
59 class MenuCmd: 60 class MenuCmd:
60 61
61 def __init__(self, object, handler): 62 def __init__(self, object, handler):
62 self._object = object 63 self._object = object
118 """Q&D contact addition""" 119 """Q&D contact addition"""
119 _dialog = None 120 _dialog = None
120 edit = TextBox() 121 edit = TextBox()
121 122
122 def addContactCb(sender): 123 def addContactCb(sender):
123 if not edit.getText(): 124 if not re.match(r'^.+@.+\..+',edit.getText(), re.IGNORECASE):
124 Window.alert('You must enter a contact JID') 125 Window.alert('You must enter a valid contact JID (like "contact@libervia.org")')
125 _dialog.show() 126 _dialog.show()
127 else:
128 self.host.bridge.call('addContact', None, edit.getText(), '', _dialog.getSelectedGroups() )
126 129
127 label = Label("new contact identifier (JID):") 130 label = Label("new contact identifier (JID):")
128 edit.setText('@libervia.org') 131 edit.setText('@libervia.org')
129 edit.setWidth('100%') 132 edit.setWidth('100%')
130 _dialog = dialog.GroupSelector([label, edit], self.host.contact_panel.getGroups(), [], addContactCb) 133 _dialog = dialog.GroupSelector([label, edit], self.host.contact_panel.getGroups(), [], addContactCb)
627 @param msg: message to print 630 @param msg: message to print
628 @type: one of: 631 @type: one of:
629 normal: general info like "toto has joined the room" 632 normal: general info like "toto has joined the room"
630 me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist" 633 me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist"
631 """ 634 """
632 _wid = Label(html_sanitize(msg)) 635 _wid = Label(msg)
633 if type == 'normal': 636 if type == 'normal':
634 _wid.setStyleName('chatTextInfo') 637 _wid.setStyleName('chatTextInfo')
635 elif type == 'me': 638 elif type == 'me':
636 _wid.setStyleName('chatTextMe') 639 _wid.setStyleName('chatTextMe')
637 else: 640 else: