when we add a contact, check if it's already in roster (case insensitive)

This commit is contained in:
Yann Leboulanger 2005-11-02 12:46:57 +00:00
parent c4eb2d62d7
commit 73a9a282ba
1 changed files with 14 additions and 2 deletions

View File

@ -355,9 +355,21 @@ _('Please fill in the data of the contact you want to add in account %s') %accou
if not jid:
return
if jid.find('@') < 0:
ErrorDialog(_("Invalid user name"),
_('Contact names must be of the form "user@servername".')).get_response()
ErrorDialog(_('Invalid user name'),
_('Contact names must be of the form "user@servername".')).get_response()
return
# check if contact is already in roster (user@server == UsEr@server)
already_in = False
for rjid in gajim.contacts[self.account]:
if jid.lowercase() == rjid.lowercase():
already_in = True
break
if already_in:
ErrorDialog(_('Contact already in roster'),
_('The contact is already registered in your roster.')).get_response()
return
message_buffer = self.xml.get_widget('message_textview').get_buffer()
start_iter = message_buffer.get_start_iter()
end_iter = message_buffer.get_end_iter()