do a little less loops
This commit is contained in:
parent
06fdc8367b
commit
eb22930361
|
@ -1733,21 +1733,20 @@ class GroupchatControl(ChatControlBase):
|
||||||
'nick': self.nick
|
'nick': self.nick
|
||||||
}
|
}
|
||||||
|
|
||||||
|
place_found = False
|
||||||
|
index = 0
|
||||||
|
# check for duplicate entry and espect alpha order
|
||||||
for bookmark in gajim.connections[self.account].bookmarks:
|
for bookmark in gajim.connections[self.account].bookmarks:
|
||||||
if bookmark['jid'] == bm['jid']:
|
if bookmark['jid'] == bm['jid']:
|
||||||
dialogs.ErrorDialog(
|
dialogs.ErrorDialog(
|
||||||
_('Bookmark already set'),
|
_('Bookmark already set'),
|
||||||
_('Group Chat "%s" is already in your bookmarks.') % bm['jid'])
|
_('Group Chat "%s" is already in your bookmarks.') % bm['jid'])
|
||||||
return
|
return
|
||||||
|
|
||||||
place_found = False
|
|
||||||
index = 0
|
|
||||||
# Respect alpha order
|
|
||||||
for bookmark in gajim.connections[self.account].bookmarks:
|
|
||||||
if bookmark['name'] > bm['name']:
|
if bookmark['name'] > bm['name']:
|
||||||
place_found = True
|
place_found = True
|
||||||
break
|
break
|
||||||
index += 1
|
index += 1
|
||||||
|
|
||||||
if place_found:
|
if place_found:
|
||||||
gajim.connections[self.account].bookmarks.insert(index, bm)
|
gajim.connections[self.account].bookmarks.insert(index, bm)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue